| 1 |
<?php |
| 2 |
/** |
| 3 |
* WooCommerce Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\WooCommerce; |
| 9 |
|
| 10 |
/** |
| 11 |
* WooCommerce Extension Class |
| 12 |
* @method static WooCommerce get_instance($args = null) |
| 13 |
*/ |
| 14 |
class WooCommerceSalesReviews extends WooReviews { |
| 15 |
/** |
| 16 |
* Instance of WooInline |
| 17 |
* |
| 18 |
* @var WooCommerceSalesReviews |
| 19 |
*/ |
| 20 |
protected static $instance = null; |
| 21 |
public $priority = 10; |
| 22 |
public $id = 'woocommerce_sales_reviews'; |
| 23 |
public $img = ''; |
| 24 |
public $doc_link = 'https://notificationx.com/docs/woocommerce-reviews-notificationx/'; |
| 25 |
public $types = 'woocommerce_sales'; |
| 26 |
public $module = 'modules_woocommerce'; |
| 27 |
public $module_priority = 3; |
| 28 |
public $class = '\WooCommerce'; |
| 29 |
public $default_theme = 'woocommerce_sales_reviews_total-rated'; |
| 30 |
public $exclude_custom_themes = true; |
| 31 |
|
| 32 |
/** |
| 33 |
* Get the instance of called class. |
| 34 |
* |
| 35 |
* @return WooCommerce |
| 36 |
*/ |
| 37 |
public static function get_instance($args = null){ |
| 38 |
if ( is_null( static::$instance ) || ! static::$instance instanceof self ) { |
| 39 |
$class = __CLASS__; |
| 40 |
if(strpos($class, "NotificationX\\") === 0){ |
| 41 |
$pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class); |
| 42 |
if(class_exists($pro_class)){ |
| 43 |
$class = $pro_class; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if(!empty($args)){ |
| 48 |
static::$instance = new $class($args); |
| 49 |
} |
| 50 |
else{ |
| 51 |
static::$instance = new $class; |
| 52 |
} |
| 53 |
} |
| 54 |
return static::$instance; |
| 55 |
} |
| 56 |
/** |
| 57 |
* Initially Invoked when initialized. |
| 58 |
*/ |
| 59 |
public function __construct(){ |
| 60 |
parent::__construct(); |
| 61 |
} |
| 62 |
|
| 63 |
public function init_extension() |
| 64 |
{ |
| 65 |
$this->title = __('Reviews', 'notificationx'); |
| 66 |
$this->module_title = __('Reviews', 'notificationx'); |
| 67 |
$this->themes = [ |
| 68 |
'total-rated' => [ |
| 69 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/total-rated.png', |
| 70 |
'image_shape' => 'square', |
| 71 |
'template' => [ |
| 72 |
'first_param' => 'tag_rated', |
| 73 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 74 |
'second_param' => __('people rated', 'notificationx'), |
| 75 |
'third_param' => 'tag_product_title', |
| 76 |
'fourth_param' => 'tag_rating', |
| 77 |
'custom_fourth_param' => __('Some time ago', 'notificationx'), |
| 78 |
] |
| 79 |
], |
| 80 |
'reviewed' => [ |
| 81 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/reviewed.png', |
| 82 |
'image_shape' => 'circle', |
| 83 |
'template' => [ |
| 84 |
'first_param' => 'tag_username', |
| 85 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 86 |
'second_param' => __('just reviewed', 'notificationx'), |
| 87 |
'third_param' => 'tag_product_title', |
| 88 |
'fourth_param' => 'tag_rating', |
| 89 |
'custom_fourth_param' => __('Some time ago', 'notificationx'), |
| 90 |
] |
| 91 |
], |
| 92 |
'review_saying' => [ |
| 93 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/saying-review.png', |
| 94 |
'image_shape' => 'circle', |
| 95 |
'template' => [ |
| 96 |
'first_param' => 'tag_username', |
| 97 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 98 |
'second_param' => __('saying', 'notificationx'), |
| 99 |
'third_param' => 'tag_title', |
| 100 |
'custom_third_param' => __('Excellent', 'notificationx'), |
| 101 |
'review_fourth_param' => __('about', 'notificationx'), |
| 102 |
'fifth_param' => 'tag_plugin_name', |
| 103 |
'sixth_param' => 'tag_custom', |
| 104 |
'custom_sixth_param' => __('Try it now', 'notificationx'), |
| 105 |
] |
| 106 |
], |
| 107 |
'review-comment' => [ |
| 108 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment.jpg', |
| 109 |
'image_shape' => 'rounded', |
| 110 |
'template' => [ |
| 111 |
'first_param' => 'tag_username', |
| 112 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 113 |
'second_param' => __('just reviewed', 'notificationx'), |
| 114 |
'third_param' => 'tag_plugin_review', |
| 115 |
'fourth_param' => 'tag_rating', |
| 116 |
'custom_fourth_param' => __('Some time ago', 'notificationx'), |
| 117 |
] |
| 118 |
], |
| 119 |
'review-comment-2' => [ |
| 120 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment-2.jpg', |
| 121 |
'template' => [ |
| 122 |
'first_param' => 'tag_username', |
| 123 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 124 |
'second_param' => __('just reviewed', 'notificationx'), |
| 125 |
'third_param' => 'tag_plugin_review', |
| 126 |
'fourth_param' => 'tag_rating', |
| 127 |
'custom_fourth_param' => __('Some time ago', 'notificationx'), |
| 128 |
] |
| 129 |
], |
| 130 |
'review-comment-3' => [ |
| 131 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment-3.jpg', |
| 132 |
'image_shape' => 'circle', |
| 133 |
'template' => [ |
| 134 |
'first_param' => 'tag_username', |
| 135 |
'custom_first_param' => __('Someone', 'notificationx'), |
| 136 |
'second_param' => __('just reviewed', 'notificationx'), |
| 137 |
'third_param' => 'tag_plugin_review', |
| 138 |
'fourth_param' => 'tag_time', |
| 139 |
'custom_fourth_param' => __('Some time ago', 'notificationx'), |
| 140 |
] |
| 141 |
], |
| 142 |
]; |
| 143 |
|
| 144 |
$this->templates = [ |
| 145 |
'wp_reviews_template_new' => [ |
| 146 |
'first_param' => [ |
| 147 |
'tag_username' => __('Username', 'notificationx'), |
| 148 |
'tag_rated' => __('Rated', 'notificationx'), |
| 149 |
], |
| 150 |
'third_param' => [ |
| 151 |
'tag_product_title' => __('Product Title', 'notificationx'), |
| 152 |
'tag_plugin_review' => __('Review', 'notificationx'), |
| 153 |
'tag_anonymous_title' => __('Anonymous Title', 'notificationx'), |
| 154 |
], |
| 155 |
'fourth_param' => [ |
| 156 |
'tag_rating' => __('Rating', 'notificationx'), |
| 157 |
'tag_time' => __('Definite Time', 'notificationx'), |
| 158 |
], |
| 159 |
'_themes' => [ |
| 160 |
'woocommerce_sales_reviews_total-rated', |
| 161 |
'woocommerce_sales_reviews_reviewed', |
| 162 |
'woocommerce_sales_reviews_review-comment', |
| 163 |
'woocommerce_sales_reviews_review-comment-2', |
| 164 |
'woocommerce_sales_reviews_review-comment-3', |
| 165 |
], |
| 166 |
], |
| 167 |
'review_saying_template_new' => [ |
| 168 |
'first_param' => [ |
| 169 |
'tag_username' => __('Username', 'notificationx'), |
| 170 |
], |
| 171 |
'third_param' => [ |
| 172 |
'tag_title' => __('Review Title', 'notificationx'), |
| 173 |
'tag_anonymous_title' => __('Anonymous Title', 'notificationx'), |
| 174 |
], |
| 175 |
'fifth_param' => [ |
| 176 |
'tag_plugin_name' => __('Plugin Name', 'notificationx'), |
| 177 |
], |
| 178 |
'sixth_param' => [ |
| 179 |
// @todo maybe add some predefined texts. |
| 180 |
], |
| 181 |
'_themes' => [ |
| 182 |
'woocommerce_sales_reviews_review_saying', |
| 183 |
], |
| 184 |
], |
| 185 |
]; |
| 186 |
$this->res_themes = [ |
| 187 |
'res-theme-one' => [ |
| 188 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-1.png', |
| 189 |
'image_shape' => 'square', |
| 190 |
'template' => [ |
| 191 |
'res_first_param' => 'tag_rated', |
| 192 |
'res_second_param' => __('people rated', 'notificationx'), |
| 193 |
'res_third_param' => 'tag_plugin_name', |
| 194 |
], |
| 195 |
'is_pro' => true, |
| 196 |
], |
| 197 |
'res-theme-two' => [ |
| 198 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-2.png', |
| 199 |
'image_shape' => 'square', |
| 200 |
'template' => [ |
| 201 |
'res_first_param' => 'tag_username', |
| 202 |
'res_second_param' => __('just reviewed', 'notificationx'), |
| 203 |
'res_third_param' => 'tag_plugin_name', |
| 204 |
], |
| 205 |
'is_pro' => true, |
| 206 |
], |
| 207 |
'res-theme-three' => [ |
| 208 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-3.png', |
| 209 |
'image_shape' => 'square', |
| 210 |
'template' => [ |
| 211 |
'res_first_param' => 'tag_username', |
| 212 |
'res_second_param' => __('just reviewed', 'notificationx'), |
| 213 |
'res_third_param' => 'tag_plugin_name', |
| 214 |
], |
| 215 |
'is_pro' => true, |
| 216 |
], |
| 217 |
'rating-res-theme-four' => [ |
| 218 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-4.png', |
| 219 |
'image_shape' => 'square', |
| 220 |
'template' => [ |
| 221 |
'res_first_param' => 'tag_username', |
| 222 |
'res_second_param' => __('just reviewed', 'notificationx'), |
| 223 |
'res_third_param' => 'tag_rating', |
| 224 |
], |
| 225 |
'is_pro' => true, |
| 226 |
], |
| 227 |
'rating-res-theme-five' => [ |
| 228 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-5.png', |
| 229 |
'image_shape' => 'square', |
| 230 |
'template' => [ |
| 231 |
'res_first_param' => 'tag_username', |
| 232 |
'res_second_param' => __('just reviewed', 'notificationx'), |
| 233 |
'res_third_param' => 'tag_rating', |
| 234 |
], |
| 235 |
'is_pro' => true, |
| 236 |
], |
| 237 |
'rating-res-theme-six' => [ |
| 238 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_reviews/nx-review-res-theme-6.png', |
| 239 |
'image_shape' => 'square', |
| 240 |
'template' => [ |
| 241 |
'res_first_param' => 'tag_username', |
| 242 |
'res_second_param' => __('just reviewed', 'notificationx'), |
| 243 |
'res_third_param' => 'tag_rating', |
| 244 |
], |
| 245 |
'is_pro' => true, |
| 246 |
], |
| 247 |
]; |
| 248 |
} |
| 249 |
|
| 250 |
public function doc() { |
| 251 |
return sprintf(__('<p>Make sure that you have <a target="_blank" href="%1$s">WooCommerce installed & activated</a> to use this campaign. For further assistance, check out our step by step <a target="_blank" href="%2$s">documentation</a>.</p> |
| 252 |
<p>🎦 Watch <a target="_blank" href="%3$s">video tutorial</a> to learn quickly</p> |
| 253 |
<p><strong>Recommended Blog:</strong></p> |
| 254 |
<p>🚀 How to <a target="_blank" href="%4$s">boost WooCommerce Sales</a> Using NotificationX</p>', 'notificationx'), |
| 255 |
'https://wordpress.org/plugins/woocommerce/', |
| 256 |
'https://notificationx.com/docs/woocommerce-reviews-notificationx/', |
| 257 |
'https://www.youtube.com/watch?v=bHuaOs9JWvI', |
| 258 |
'https://wpdeveloper.com/ecommerce-sales-social-proof/' |
| 259 |
); |
| 260 |
} |
| 261 |
|
| 262 |
} |
| 263 |
|