| 1 |
<?php |
| 2 |
/** |
| 3 |
* Merchant_Loader Class. |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
if ( ! class_exists( 'Merchant_Loader' ) ) { |
| 11 |
class Merchant_Loader { |
| 12 |
|
| 13 |
/** |
| 14 |
* The single class instance. |
| 15 |
*/ |
| 16 |
private static $instance = null; |
| 17 |
|
| 18 |
/** |
| 19 |
* Instance. |
| 20 |
*/ |
| 21 |
public static function instance() { |
| 22 |
if ( is_null( self::$instance ) ) { |
| 23 |
self::$instance = new self(); |
| 24 |
} |
| 25 |
|
| 26 |
return self::$instance; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Constructor. |
| 31 |
*/ |
| 32 |
public function __construct() { |
| 33 |
// Includes. |
| 34 |
$this->includes(); |
| 35 |
|
| 36 |
add_action( 'plugins_loaded', array( $this, 'maybe_define_awl_constant' ), 5 ); |
| 37 |
|
| 38 |
// Register scripts. |
| 39 |
add_action( 'wp_enqueue_scripts', array( $this, 'register_global_js_and_css' ) ); |
| 40 |
|
| 41 |
// Enqueue scripts. |
| 42 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) ); |
| 43 |
|
| 44 |
// Add identifier to body class. |
| 45 |
add_filter( 'body_class', array( $this, 'add_body_class' ) ); |
| 46 |
|
| 47 |
// Add row meta to the plugin screen. |
| 48 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); |
| 49 |
|
| 50 |
// Add settings link to the plugin screen. |
| 51 |
add_filter( 'plugin_action_links_' . plugin_basename( MERCHANT_DIR . 'merchant.php' ), array( $this, 'settings_link' ) ); |
| 52 |
|
| 53 |
// WP Abilities API integration. |
| 54 |
add_action( 'plugins_loaded', array( $this, 'load_abilities_bootstrap' ), 20 ); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Include required classes. |
| 59 |
*/ |
| 60 |
public function includes() { |
| 61 |
|
| 62 |
// Essential functions. |
| 63 |
require_once MERCHANT_DIR . 'inc/functions.php'; |
| 64 |
|
| 65 |
// Helpers. |
| 66 |
require_once MERCHANT_DIR . 'inc/helpers.php'; |
| 67 |
|
| 68 |
// Multi Language. |
| 69 |
require_once MERCHANT_DIR . 'inc/MultiLang/interface-language-strategy.php'; |
| 70 |
require_once MERCHANT_DIR . 'inc/MultiLang/class-merchant-no-plugin-support.php'; |
| 71 |
require_once MERCHANT_DIR . 'inc/MultiLang/class-merchant-polylang-support.php'; |
| 72 |
require_once MERCHANT_DIR . 'inc/MultiLang/class-merchant-wpml-support.php'; |
| 73 |
require_once MERCHANT_DIR . 'inc/MultiLang/class-merchant-translator.php'; |
| 74 |
|
| 75 |
// Ajax callbacks. |
| 76 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-ajax-callbacks.php'; |
| 77 |
|
| 78 |
// Core classes. |
| 79 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-option.php'; |
| 80 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-modules.php'; |
| 81 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-custom-css.php'; |
| 82 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-svg-icons.php'; |
| 83 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-db-tables.php'; |
| 84 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-general-hooks.php'; |
| 85 |
|
| 86 |
// Metabox |
| 87 |
require_once MERCHANT_DIR . 'inc/classes/class-merchant-metabox.php'; |
| 88 |
|
| 89 |
// The main class for adding modules. |
| 90 |
require_once MERCHANT_DIR . 'inc/modules/class-add-module.php'; |
| 91 |
|
| 92 |
// Modules global settings. |
| 93 |
require_once MERCHANT_DIR . 'inc/modules/global-settings/global-settings.php'; |
| 94 |
|
| 95 |
// Modules analytics |
| 96 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-db-orm.php'; |
| 97 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-logger.php'; |
| 98 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-data-provider.php'; |
| 99 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-data-reports.php'; |
| 100 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-data-ajax.php'; |
| 101 |
require_once MERCHANT_DIR . 'inc/analytics/class-merchant-analytics-data-hooks.php'; |
| 102 |
|
| 103 |
// Usage Tracking. |
| 104 |
require_once MERCHANT_DIR . 'inc/usage-tracking/class-merchant-usage-tracking.php'; |
| 105 |
require_once MERCHANT_DIR . 'inc/usage-tracking/class-merchant-send-usage-task.php'; |
| 106 |
|
| 107 |
/* |
| 108 |
* Action Scheduler requires a special loading procedure. |
| 109 |
* Load on plugins_loaded to ensure it's available before init. |
| 110 |
* |
| 111 |
* @since {VERSION} |
| 112 |
*/ |
| 113 |
add_action( |
| 114 |
'plugins_loaded', |
| 115 |
static function() { |
| 116 |
|
| 117 |
//Check if Action Scheduler is already loaded. |
| 118 |
if ( function_exists( 'as_schedule_recurring_action' ) ) { |
| 119 |
return; |
| 120 |
} |
| 121 |
|
| 122 |
require_once MERCHANT_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php'; |
| 123 |
}, |
| 124 |
); |
| 125 |
|
| 126 |
// Modules (free and pro). |
| 127 |
foreach ( Merchant_Admin_Modules::$modules_data as $module_id => $module_data ) { |
| 128 |
if ( |
| 129 |
defined( 'MERCHANT_PRO_VERSION' ) |
| 130 |
&& version_compare( MERCHANT_PRO_VERSION, '1.3', '<' ) |
| 131 |
&& isset( $module_data['pro'] ) && $module_data['pro'] |
| 132 |
) { |
| 133 |
continue; |
| 134 |
} |
| 135 |
|
| 136 |
require_once MERCHANT_DIR . 'inc/modules/' . $module_id . '/class-' . $module_id . '.php'; |
| 137 |
} |
| 138 |
|
| 139 |
// Compatibility Layer |
| 140 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-botiga-theme.php'; |
| 141 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-divi-theme.php'; |
| 142 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-avada-theme.php'; |
| 143 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-astra-theme.php'; |
| 144 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-kadence-theme.php'; |
| 145 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-oceanwp-theme.php'; |
| 146 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-twenty-twenty-four-theme.php'; |
| 147 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-blocksy-theme.php'; |
| 148 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-flatsome-theme.php'; |
| 149 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-breakdance-builder.php'; |
| 150 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-elementor-builder.php'; |
| 151 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-bricks-builder.php'; |
| 152 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-woo-payments-plugin.php'; |
| 153 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-ohio-theme.php'; |
| 154 |
require_once MERCHANT_DIR . 'inc/compatibility/class-merchant-woo-multi-currency.php'; |
| 155 |
|
| 156 |
/** |
| 157 |
* Hook 'merchant_admin_after_include_modules_classes'. |
| 158 |
* |
| 159 |
* @since 1.0 |
| 160 |
*/ |
| 161 |
do_action( 'merchant_admin_after_include_modules_classes' ); |
| 162 |
} |
| 163 |
|
| 164 |
/** |
| 165 |
* Define MERCHANT_AWL_ACTIVE when White Label is applied. |
| 166 |
* |
| 167 |
* @return void |
| 168 |
*/ |
| 169 |
public function maybe_define_awl_constant() { |
| 170 |
if ( defined( 'MERCHANT_AWL_ACTIVE' ) ) { |
| 171 |
return; |
| 172 |
} |
| 173 |
|
| 174 |
if ( merchant_white_label_is_applied() ) { |
| 175 |
define( 'MERCHANT_AWL_ACTIVE', true ); |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Add to body class. |
| 181 |
*/ |
| 182 |
public function add_body_class( $classes ) { |
| 183 |
$theme = wp_get_theme(); |
| 184 |
$theme = ( get_template_directory() !== get_stylesheet_directory() && $theme->parent() ) ? $theme->parent() : $theme; |
| 185 |
$theme_name = str_replace( ' ', '-', $theme->name ); |
| 186 |
|
| 187 |
$classes[] = 'merchant-theme-' . strtolower( esc_attr( $theme_name ) ); |
| 188 |
|
| 189 |
return $classes; |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Bootstrap the WP Abilities API integration. |
| 194 |
* |
| 195 |
* Only loads on WordPress 6.9+ where the Abilities API exists. |
| 196 |
* Zero overhead on older WordPress versions. |
| 197 |
* |
| 198 |
* @since 2.3.0 |
| 199 |
*/ |
| 200 |
public function load_abilities_bootstrap() { |
| 201 |
if ( ! function_exists( 'wp_register_ability' ) ) { |
| 202 |
return; |
| 203 |
} |
| 204 |
|
| 205 |
require_once MERCHANT_DIR . 'inc/abilities/class-merchant-abilities-bootstrap.php'; |
| 206 |
Merchant_Abilities_Bootstrap::init(); |
| 207 |
} |
| 208 |
|
| 209 |
/** |
| 210 |
* Show row meta on the plugin screen. |
| 211 |
* |
| 212 |
* @param mixed $links Plugin Row Meta. |
| 213 |
* @param mixed $file Plugin Base file. |
| 214 |
* |
| 215 |
* @since 2.1.2 |
| 216 |
* |
| 217 |
* @return array |
| 218 |
*/ |
| 219 |
public function plugin_row_meta($links, $file) { |
| 220 |
if ( plugin_basename( MERCHANT_FILE ) !== $file ) { |
| 221 |
return $links; |
| 222 |
} |
| 223 |
|
| 224 |
/** |
| 225 |
* The Merchant documentation URL. |
| 226 |
* |
| 227 |
* @since 2.1.2 |
| 228 |
*/ |
| 229 |
$docs_url = apply_filters( 'merchant_docs_url', 'https://docs.athemes.com/documentation/merchant/' ); |
| 230 |
|
| 231 |
/** |
| 232 |
* The Merchant landing page URL. |
| 233 |
* |
| 234 |
* @since 2.1.2 |
| 235 |
*/ |
| 236 |
$plugin_site = apply_filters( 'merchant_plugin_site_url', 'https://athemes.com/merchant/' ); |
| 237 |
|
| 238 |
/** |
| 239 |
* The Merchant changelog URL. |
| 240 |
* |
| 241 |
* @since 2.1.2 |
| 242 |
*/ |
| 243 |
$changelog = apply_filters( 'merchant_changelog_url', 'https://athemes.com/changelog/merchant/' ); |
| 244 |
|
| 245 |
$row_meta = array( |
| 246 |
'docs' => '<a href="' . esc_url( $docs_url ) . '" aria-label="' . esc_attr__( 'View Merchant documentation', 'merchant' ) . '" target="_blank">' . esc_html__( |
| 247 |
'Docs', |
| 248 |
'merchant' |
| 249 |
) . '</a>', |
| 250 |
'apidocs' => '<a href="' . esc_url( $plugin_site ) . '" aria-label="' . esc_attr__( 'View Merchant plugin site', 'merchant' ) . '" target="_blank">' . esc_html__( |
| 251 |
'Visit plugin site', |
| 252 |
'merchant' ) . '</a>', |
| 253 |
'support' => '<a href="' . esc_url( $changelog ) . '" aria-label="' . esc_attr__( 'View Merchant changelog', 'merchant' ) . '" target="_blank">' . esc_html__( 'Changelog', |
| 254 |
'merchant' ) . '</a>', |
| 255 |
); |
| 256 |
|
| 257 |
/** |
| 258 |
* Filter the plugin row meta links. |
| 259 |
* |
| 260 |
* @since 2.1.2 |
| 261 |
* |
| 262 |
* @param array $row_meta The plugin row meta links. |
| 263 |
* @param string $file The plugin file. |
| 264 |
*/ |
| 265 |
$row_meta = apply_filters( 'merchant_plugin_row_meta', $row_meta, $file ); |
| 266 |
|
| 267 |
return array_merge( $links, $row_meta ); |
| 268 |
} |
| 269 |
|
| 270 |
/** |
| 271 |
* Add settings link to the Plugins page. |
| 272 |
* |
| 273 |
* @since 2.1.2 |
| 274 |
* |
| 275 |
* @param array $links Plugin row links. |
| 276 |
* |
| 277 |
* @return array $links |
| 278 |
*/ |
| 279 |
public function settings_link( $links ) { |
| 280 |
if ( ! merchant_pro_is_active() ) { |
| 281 |
$url = merchant_admin_upgrade_link( |
| 282 |
'https://athemes.com/merchant/#pricing', |
| 283 |
array(), |
| 284 |
'plugins-page-upgrade-link' |
| 285 |
); |
| 286 |
$links['merchant-pro'] = sprintf( |
| 287 |
'<a href="%1$s" aria-label="%2$s" target="_blank" rel="noopener noreferrer" |
| 288 |
style="color: #00a32a; font-weight: 700;" |
| 289 |
onmouseover="this.style.color=\'#008a20\';" |
| 290 |
onmouseout="this.style.color=\'#00a32a\';" |
| 291 |
>%3$s</a>', |
| 292 |
esc_url( $url ), |
| 293 |
esc_attr__( 'Upgrade to Merchant Pro', 'merchant' ), |
| 294 |
esc_html__( 'Get Merchant Pro', 'merchant' ) |
| 295 |
); |
| 296 |
} |
| 297 |
|
| 298 |
$custom['merchant-settings'] = sprintf( |
| 299 |
'<a href="%s" aria-label="%s">%s</a>', |
| 300 |
esc_url( |
| 301 |
add_query_arg( |
| 302 |
array( |
| 303 |
'page' => 'merchant', |
| 304 |
'section' => 'settings', |
| 305 |
), |
| 306 |
admin_url( 'admin.php' ) |
| 307 |
) |
| 308 |
), |
| 309 |
esc_attr__( 'Go to Merchant Settings page', 'merchant' ), |
| 310 |
esc_html__( 'Settings', 'merchant' ) |
| 311 |
); |
| 312 |
|
| 313 |
return array_merge( $custom, (array) $links ); |
| 314 |
} |
| 315 |
|
| 316 |
/** |
| 317 |
* Register scripts. |
| 318 |
* Scripts that might be used by multiple modules should be registered here. |
| 319 |
* |
| 320 |
*/ |
| 321 |
public function register_global_js_and_css() { |
| 322 |
// Register styles. |
| 323 |
$styles = array( |
| 324 |
|
| 325 |
// Grid. |
| 326 |
array( |
| 327 |
'handle' => 'merchant-grid', |
| 328 |
'src' => 'assets/css/grid.min.css', |
| 329 |
'dep' => array(), |
| 330 |
'ver' => MERCHANT_VERSION, |
| 331 |
'media' => 'all', |
| 332 |
), |
| 333 |
|
| 334 |
// Utilities. |
| 335 |
array( |
| 336 |
'handle' => 'merchant-utilities', |
| 337 |
'src' => 'assets/css/utilities.min.css', |
| 338 |
'dep' => array(), |
| 339 |
'ver' => MERCHANT_VERSION, |
| 340 |
'media' => 'all', |
| 341 |
), |
| 342 |
|
| 343 |
// Carousel. |
| 344 |
array( |
| 345 |
'handle' => 'merchant-carousel', |
| 346 |
'src' => 'assets/css/carousel.min.css', |
| 347 |
'dep' => array(), |
| 348 |
'ver' => MERCHANT_VERSION, |
| 349 |
'media' => 'all', |
| 350 |
), |
| 351 |
|
| 352 |
// Modal. |
| 353 |
array( |
| 354 |
'handle' => 'merchant-modal', |
| 355 |
'src' => 'assets/css/modal.min.css', |
| 356 |
'dep' => array(), |
| 357 |
'ver' => MERCHANT_VERSION, |
| 358 |
'media' => 'all', |
| 359 |
), |
| 360 |
|
| 361 |
// Tooltip. |
| 362 |
array( |
| 363 |
'handle' => 'merchant-tooltip', |
| 364 |
'src' => 'assets/css/tooltip.min.css', |
| 365 |
'dep' => array(), |
| 366 |
'ver' => MERCHANT_VERSION, |
| 367 |
'media' => 'all', |
| 368 |
), |
| 369 |
|
| 370 |
// Pagination. |
| 371 |
array( |
| 372 |
'handle' => 'merchant-pagination', |
| 373 |
'src' => 'assets/css/pagination.min.css', |
| 374 |
'dep' => array(), |
| 375 |
'ver' => MERCHANT_VERSION, |
| 376 |
'media' => 'all', |
| 377 |
), |
| 378 |
|
| 379 |
); |
| 380 |
|
| 381 |
foreach ( $styles as $style ) { |
| 382 |
wp_register_style( $style['handle'], MERCHANT_URI . $style['src'], $style['dep'], $style['ver'], $style['media'] ); |
| 383 |
} |
| 384 |
|
| 385 |
// Register scripts. |
| 386 |
$scripts = array( |
| 387 |
|
| 388 |
// Scroll Direction |
| 389 |
array( |
| 390 |
'handle' => 'merchant-scroll-direction', |
| 391 |
'src' => 'assets/js/scroll-direction.min.js', |
| 392 |
'dep' => array(), |
| 393 |
'in_footer' => true, |
| 394 |
), |
| 395 |
|
| 396 |
// Toggle Class |
| 397 |
array( |
| 398 |
'handle' => 'merchant-toggle-class', |
| 399 |
'src' => 'assets/js/toggle-class.min.js', |
| 400 |
'dep' => array(), |
| 401 |
'in_footer' => true, |
| 402 |
), |
| 403 |
|
| 404 |
// Scroll To |
| 405 |
array( |
| 406 |
'handle' => 'merchant-scroll-to', |
| 407 |
'src' => 'assets/js/scroll-to.min.js', |
| 408 |
'dep' => array(), |
| 409 |
'in_footer' => true, |
| 410 |
), |
| 411 |
|
| 412 |
// Custom Add To Cart Button |
| 413 |
array( |
| 414 |
'handle' => 'merchant-custom-addtocart-button', |
| 415 |
'src' => 'assets/js/custom-addtocart-button.min.js', |
| 416 |
'dep' => array(), |
| 417 |
'in_footer' => true, |
| 418 |
), |
| 419 |
|
| 420 |
// Carousel |
| 421 |
array( |
| 422 |
'handle' => 'merchant-carousel', |
| 423 |
'src' => 'assets/js/carousel.min.js', |
| 424 |
'dep' => array(), |
| 425 |
'in_footer' => true, |
| 426 |
), |
| 427 |
|
| 428 |
// Modal |
| 429 |
array( |
| 430 |
'handle' => 'merchant-modal', |
| 431 |
'src' => 'assets/js/modal.min.js', |
| 432 |
'dep' => array(), |
| 433 |
'in_footer' => true, |
| 434 |
), |
| 435 |
|
| 436 |
// Copy To Clipboard |
| 437 |
array( |
| 438 |
'handle' => 'merchant-copy-to-clipboard', |
| 439 |
'src' => 'assets/js/copy-to-clipboard.min.js', |
| 440 |
'dep' => array(), |
| 441 |
'in_footer' => true, |
| 442 |
'localize_script' => array( |
| 443 |
'object' => 'merchantCopyToClipboard', |
| 444 |
'data' => array( |
| 445 |
'i18n' => array( |
| 446 |
'copied' => esc_html__( 'Copied!', 'merchant' ), |
| 447 |
), |
| 448 |
), |
| 449 |
), |
| 450 |
), |
| 451 |
|
| 452 |
// Pagination |
| 453 |
array( |
| 454 |
'handle' => 'merchant-pagination', |
| 455 |
'src' => 'assets/js/pagination.min.js', |
| 456 |
'dep' => array(), |
| 457 |
'in_footer' => true, |
| 458 |
), |
| 459 |
); |
| 460 |
|
| 461 |
foreach ( $scripts as $script ) { |
| 462 |
wp_register_script( $script['handle'], MERCHANT_URI . $script['src'], $script['dep'], MERCHANT_VERSION, $script['in_footer'] ); |
| 463 |
|
| 464 |
if ( isset( $script['localize_script'] ) ) { |
| 465 |
wp_localize_script( $script['handle'], $script['localize_script']['object'], $script['localize_script']['data'] ); |
| 466 |
} |
| 467 |
} |
| 468 |
} |
| 469 |
|
| 470 |
/** |
| 471 |
* Enqueue styles and scripts. |
| 472 |
*/ |
| 473 |
public function enqueue_styles_scripts() { |
| 474 |
|
| 475 |
/** |
| 476 |
* Hook 'merchant_enqueue_before_main_css_js' |
| 477 |
* |
| 478 |
* @since 1.0 |
| 479 |
*/ |
| 480 |
do_action( 'merchant_enqueue_before_main_css_js' ); |
| 481 |
|
| 482 |
wp_enqueue_style( 'merchant', MERCHANT_URI . 'assets/css/merchant.min.css', array(), MERCHANT_VERSION ); |
| 483 |
wp_enqueue_script( 'merchant', MERCHANT_URI . 'assets/js/merchant.min.js', array( 'jquery' ), MERCHANT_VERSION, true ); |
| 484 |
|
| 485 |
$setting = array( |
| 486 |
'nonce' => wp_create_nonce( 'merchant-nonce' ), |
| 487 |
'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 488 |
); |
| 489 |
|
| 490 |
// Scroll to Top Button |
| 491 |
// TODO: Move this to the respective module class. |
| 492 |
if ( Merchant_Modules::is_module_active( 'scroll-to-top-button' ) ) { |
| 493 |
$setting['scroll_to_top'] = true; |
| 494 |
} |
| 495 |
|
| 496 |
// Auto External Links |
| 497 |
// TODO: Move this to the respective module class. |
| 498 |
if ( Merchant_Modules::is_module_active( 'auto-external-links' ) ) { |
| 499 |
$setting['auto_external_links'] = true; |
| 500 |
} |
| 501 |
|
| 502 |
// Cookie Banner |
| 503 |
if ( Merchant_Modules::is_module_active( 'cookie-banner' ) ) { |
| 504 |
$setting['cookie_banner'] = true; |
| 505 |
$setting['cookie_banner_duration'] = Merchant_Admin_Options::get( 'cookie-banner', 'cookie_duration', 365 ); |
| 506 |
} |
| 507 |
|
| 508 |
/** |
| 509 |
* Hook 'merchant_enqueue_after_main_css_js' |
| 510 |
* |
| 511 |
* @since 1.0 |
| 512 |
*/ |
| 513 |
do_action( 'merchant_enqueue_after_main_css_js' ); |
| 514 |
|
| 515 |
/** |
| 516 |
* Hook 'merchant_localize_script' |
| 517 |
* |
| 518 |
* @since 1.0 |
| 519 |
*/ |
| 520 |
$setting = apply_filters( 'merchant_localize_script', $setting ); |
| 521 |
|
| 522 |
wp_localize_script( 'merchant', 'merchant', array( |
| 523 |
'general' => array( |
| 524 |
'wooCurrencySymbol' => class_exists( 'Woocommerce' ) ? html_entity_decode( get_woocommerce_currency_symbol() ) : '', |
| 525 |
'wooCurrencyPosition' => class_exists( 'Woocommerce' ) ? get_option( 'woocommerce_currency_pos' ) : 'left', |
| 526 |
'wooThousandsSeparator' => class_exists( 'Woocommerce' ) ? wc_get_price_thousand_separator() : ',', |
| 527 |
'wooDecimalSeparator' => class_exists( 'Woocommerce' ) ? wc_get_price_decimal_separator() : '.', |
| 528 |
'wooNumberOfDecimals' => class_exists( 'Woocommerce' ) ? wc_get_price_decimals() : 2, |
| 529 |
|
| 530 |
), |
| 531 |
'setting' => $setting, |
| 532 |
) ); |
| 533 |
} |
| 534 |
} |
| 535 |
|
| 536 |
Merchant_Loader::instance(); |
| 537 |
} |
| 538 |
|