first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
{
"name": "wpdesk\/wp-coupons-interfaces",
"description": "Coupon shared interfaces",
"license": "MIT",
"keywords": [
"interfaces",
"wp-canva-editor",
"coupons"
],
"homepage": "https:\/\/gitlab.com\/wpdesk\/wp-coupons-interfaces",
"minimum-stability": "stable",
"authors": [
{
"name": "piotr.potrebka",
"email": "piotr.potrebka@wpdesk.net"
}
],
"config": {
"sort-packages": true,
"platform": {
"php": "5.6"
}
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"10up\/wp_mock": "*",
"mockery\/mockery": "*",
"phpunit\/phpunit": "<7",
"wp-coding-standards\/wpcs": "^0.14.1",
"squizlabs\/php_codesniffer": "^3.0.2",
"wimg\/php-compatibility": "^8"
},
"autoload": {
"psr-4": {
"FlexibleCouponsProVendor\\WPDesk\\Library\\CouponInterfaces\\": "src\/Interfaces"
}
},
"scripts": {
"phpcs": "phpcs",
"phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
"phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
"phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
"phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Editor area properties interface.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface EditorAreaProperties
{
/**
* @return int
*/
public function get_width();
/**
* @return int
*/
public function get_height();
/**
* Get page format.
*
* Return A4, A5 or A6.
*
* @return string
*/
public function get_format();
/**
* Get page orientation.
*
* Return L or P.
*
* @return string
*/
public function get_orientation();
/**
* Get page format.
*
* Return rgba or hex value. Example: rgba(255,255,255,1) or hex: #FFFFFF.
*
* @return string
*/
public function get_background_color();
}

View File

@@ -0,0 +1,24 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Editor interface. The interface is used to integrate with plugin and coupons library.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface EditorIntegration
{
/**
* @return string
*/
public function get_post_type();
/**
* @return array
*/
public function get_post_meta($post_id);
/**
* @return EditorAreaProperties
*/
public function get_area_properties($post_id);
}

View File

@@ -0,0 +1,17 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Interface for custom email message
*
* @package WPDesk\Library\CouponInterfaces
*/
interface Email
{
/**
* @param int $order_id Order ID.
* @param array $meta Meta.
*/
public function send_mail($order_id, $meta);
}

View File

@@ -0,0 +1,20 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Fonts interface.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface Fonts
{
/**
* Returns a font list for the MPDF library
*
* Format: [ 'lato' => [ 'R' => 'Lato-Regular.ttf', 'I' => 'Lato-Regular.ttf', 'B' => 'Lato-Bold.ttf', 'BI' => 'Lato-Bold.ttf', ] ... ],
*
* @return array
*/
public function get();
}

View File

@@ -0,0 +1,19 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* PDF Interface.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface PDF
{
/**
* @param int $order_id Order ID.
* @param int $item_id Order item ID.
*
* @return string
*/
public function get_pdf($order_id, $item_id);
}

View File

@@ -0,0 +1,18 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* PDF library interface.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface PDFLibrary
{
/**
* @param string $html_content
*
* @return string
*/
public function get_content_pdf($html_content);
}

View File

@@ -0,0 +1,25 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Product field definition interface.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface ProductFields
{
/**
* This method should return an array like: [ 'field_key' => [ 'id' => '', 'type' => '', title => '' ... ] ].
*
* @return array
*/
public function get();
/**
* Only if return true fields will be displayed on product page and can be saved into post meta.
* However, these fields will be displayed on the product edit page, but they will be inactive.
*
* @return bool
*/
public function is_premium();
}

View File

@@ -0,0 +1,30 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* Shortcode interface for declaration single shortcode.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface Shortcode
{
/**
* @return string
*/
public function get_id();
/**
* Shortcode definition for canva editor.
*
* Example: [ 'text' => '[shortcode_name]', 'top' => 20, 'left' => 20, 'width' => 200, 'height' => 30 ];
*
* @return array
*/
public function definition();
/**
* @param ShortcodeData $shortcode_data
*
* @return string
*/
public function get_value(\FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces\ShortcodeData $shortcode_data);
}

View File

@@ -0,0 +1,36 @@
<?php
namespace FlexibleCouponsProVendor\WPDesk\Library\CouponInterfaces;
/**
* An interface that groups data from different sources and is passing to the single shortcode implementation.
*
* @package WPDesk\Library\CouponInterfaces
*/
interface ShortcodeData
{
/**
* @return \WC_Order
*/
public function get_order();
/**
* @return \WC_Product
*/
public function get_product();
/**
* Get array of custom product field values saved in post meta for order item.
*
* Return [ 'field_key' => 'value ' ... ].
*
* @return array
*/
public function get_product_fields_values();
/**
* @return \WC_Coupon
*/
public function get_coupon();
/**
* @return string
*/
public function get_coupon_code();
}