| 1 |
<?php |
| 2 |
/** |
| 3 |
* FluentCart Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\FluentCart; |
| 9 |
|
| 10 |
use NotificationX\Core\PostType; |
| 11 |
use NotificationX\Core\Rules; |
| 12 |
use NotificationX\GetInstance; |
| 13 |
use NotificationX\Extensions\Extension; |
| 14 |
use NotificationX\Extensions\FluentCart\FluentCart; |
| 15 |
use NotificationX\Extensions\GlobalFields; |
| 16 |
|
| 17 |
/** |
| 18 |
* FluentCart Extension Class |
| 19 |
*/ |
| 20 |
class FluentCartInline extends FluentCart { |
| 21 |
/** |
| 22 |
* Instance of FluentCartInline |
| 23 |
* |
| 24 |
* @var FluentCartInline |
| 25 |
*/ |
| 26 |
protected static $instance = null; |
| 27 |
public $priority = 6; |
| 28 |
public $id = 'fluentcart_inline'; |
| 29 |
public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/fluentcart.png'; |
| 30 |
public $doc_link = 'https://notificationx.com/docs/fluentcart-sales-notifications/'; |
| 31 |
public $types = 'inline'; |
| 32 |
public $module = 'modules_fluentcart'; |
| 33 |
public $module_priority = 3; |
| 34 |
|
| 35 |
/** |
| 36 |
* Get the instance of called class. |
| 37 |
* |
| 38 |
* @return FluentCartInline |
| 39 |
*/ |
| 40 |
public static function get_instance($args = null){ |
| 41 |
if ( is_null( static::$instance ) || ! static::$instance instanceof self ) { |
| 42 |
$class = __CLASS__; |
| 43 |
if(strpos($class, "NotificationX\\") === 0){ |
| 44 |
$pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class); |
| 45 |
if(class_exists($pro_class)){ |
| 46 |
$class = $pro_class; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
if(!empty($args)){ |
| 51 |
static::$instance = new $class($args); |
| 52 |
} |
| 53 |
else{ |
| 54 |
static::$instance = new $class; |
| 55 |
} |
| 56 |
} |
| 57 |
return static::$instance; |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Initially Invoked when initialized. |
| 62 |
*/ |
| 63 |
public function __construct(){ |
| 64 |
parent::__construct(); |
| 65 |
} |
| 66 |
|
| 67 |
public function init_extension() |
| 68 |
{ |
| 69 |
$this->title = __('FluentCart', 'notificationx'); |
| 70 |
$this->module_title = __('FluentCart', 'notificationx'); |
| 71 |
$this->themes = [ |
| 72 |
'conv-theme-seven' => array( |
| 73 |
'is_pro' => true, |
| 74 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline.jpg', |
| 75 |
'image_shape' => 'rounded', |
| 76 |
'inline_location' => [ 'fluentcart_single' ], |
| 77 |
'template' => [ |
| 78 |
'first_param' => 'tag_sales_count', |
| 79 |
'custom_first_param' => __( '99', 'notificationx' ), |
| 80 |
'second_param' => __( 'people purchased', 'notificationx' ), |
| 81 |
'third_param' => 'tag_product_title', |
| 82 |
'custom_third_param' => ' ', |
| 83 |
'fourth_param' => 'tag_7days', |
| 84 |
'custom_fourth_param' => __( 'in last {{day:7}}', 'notificationx' ), |
| 85 |
], |
| 86 |
), |
| 87 |
'stock-theme-one' => array( |
| 88 |
'is_pro' => true, |
| 89 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline-2.jpg', |
| 90 |
'image_shape' => 'rounded', |
| 91 |
'inline_location' => [ 'fluentcart_single' ], |
| 92 |
'template' => [ |
| 93 |
// 'first_param' => 'tag_sales_count', |
| 94 |
// 'custom_first_param' => __( 'Someone', 'notificationx' ), |
| 95 |
'second_param' => __( 'Only', 'notificationx' ), |
| 96 |
'third_param' => 'tag_stock_count', |
| 97 |
'custom_third_param' => 10, |
| 98 |
'fourth_param' => 'tag_left_in_stock', |
| 99 |
'custom_fourth_param' => __( 'left in stock', 'notificationx' ), |
| 100 |
'fifth_param' => 'tag_order_soon', |
| 101 |
'custom_fifth_param' => __( '- order soon.', 'notificationx' ), |
| 102 |
], |
| 103 |
), |
| 104 |
'stock-theme-two' => array( |
| 105 |
'is_pro' => true, |
| 106 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline-3.jpg', |
| 107 |
'image_shape' => 'rounded', |
| 108 |
'inline_location' => [ 'fluentcart_after_cart_item_name' ], |
| 109 |
'template' => [ |
| 110 |
// 'first_param' => 'tag_sales_count', |
| 111 |
// 'custom_first_param' => __( 'Someone', 'notificationx' ), |
| 112 |
'second_param' => __( 'In high demand - only', 'notificationx' ), |
| 113 |
'third_param' => 'tag_stock_count', |
| 114 |
'custom_third_param' => 10, |
| 115 |
'fourth_param' => 'tag_left', |
| 116 |
'custom_fourth_param' => __( 'left', 'notificationx' ), |
| 117 |
'fifth_param' => 'tag_on_our_site', |
| 118 |
'custom_fifth_param' => __( 'on our site!', 'notificationx' ), |
| 119 |
], |
| 120 |
), |
| 121 |
]; |
| 122 |
$this->templates = [ |
| 123 |
'woo_template_sales_count' => [ |
| 124 |
'first_param' => [ |
| 125 |
'tag_sales_count' => __( 'Sales Count', 'notificationx' ), |
| 126 |
], |
| 127 |
'third_param' => [ |
| 128 |
'tag_product_title' => __( 'Product Title', 'notificationx' ), |
| 129 |
], |
| 130 |
'fourth_param' => [ |
| 131 |
'tag_1day' => __( 'In last 1 day', 'notificationx' ), |
| 132 |
'tag_7days' => __( 'In last 7 days', 'notificationx' ), |
| 133 |
'tag_30days' => __( 'In last 30 days', 'notificationx' ), |
| 134 |
], |
| 135 |
'_themes' => [ |
| 136 |
"{$this->id}_conv-theme-seven", |
| 137 |
], |
| 138 |
], |
| 139 |
'inline_stock_template' => [ |
| 140 |
'third_param' => [ |
| 141 |
'tag_stock_count' => __( 'Stock Count', 'notificationx' ), |
| 142 |
], |
| 143 |
'fourth_param' => [ |
| 144 |
'tag_left_in_stock' => __( 'left in stock', 'notificationx' ), |
| 145 |
'tag_left' => __( 'left', 'notificationx' ), |
| 146 |
], |
| 147 |
'fifth_param' => [ |
| 148 |
'tag_order_soon' => __( 'order soon.', 'notificationx' ), |
| 149 |
'tag_on_our_site' => __( 'on our site!', 'notificationx' ), |
| 150 |
], |
| 151 |
'_themes' => [ |
| 152 |
'fluentcart_inline_conv-theme-seven', |
| 153 |
], |
| 154 |
], |
| 155 |
]; |
| 156 |
} |
| 157 |
|
| 158 |
public function doc(){ |
| 159 |
/* translators: %1$s: FluentCart WordPress plugin installed & configured link URL, %2$s: documentation link URL, %3$s: 👉 NotificationX Integration with FluentCart link URL */ |
| 160 |
return sprintf(__('<p>Make sure that you have the <a target="_blank" href="%1$s">FluentCart WordPress plugin installed & configured</a> to use its campaign and selling data. For detailed guidelines, check out the step-by-step <a target="_blank" href="%2$s">documentation</a>.</p> |
| 161 |
<a target="_blank" href="%3$s">👉 NotificationX Integration with FluentCart</a>', 'notificationx'), |
| 162 |
'https://wordpress.org/plugins/fluent-cart/', |
| 163 |
'https://notificationx.com/docs/fluentcart-growth-alert/', |
| 164 |
'https://notificationx.com/docs/fluentcart-growth-alert/' |
| 165 |
); |
| 166 |
} |
| 167 |
|
| 168 |
} |
| 169 |
|