[ 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'ajaxNonce' => wp_create_nonce( 'ddfw-nonce' ), ], 'i18n' => [ 'subscribing' => esc_html__( 'Subscribing...', 'affiliates-for-woocommerce' ), 'subscribe' => esc_html__( 'Subscribe', 'affiliates-for-woocommerce' ), 'subscriptionSuccess' => esc_html__( 'Thank you for subscribing!', 'affiliates-for-woocommerce' ), 'subscriptionError' => esc_html__( 'An error occurred. Please try again.', 'affiliates-for-woocommerce' ), ], ] ); } // Get current DevDiggers plugin dynamically $devdiggers_plugin = $this->get_current_devdiggers_plugin(); wp_localize_script( self::$framework_js_handle, 'ddfwFrameworkObject', [ 'ajax' => [ 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'ajaxNonce' => wp_create_nonce( 'ddfw-nonce' ), ], 'i18n' => [ 'selectImage' => esc_html__( 'Select Image', 'affiliates-for-woocommerce' ), 'useImage' => esc_html__( 'Use Image', 'affiliates-for-woocommerce' ), 'pleaseEnter' => esc_html__( 'Please enter', 'affiliates-for-woocommerce' ), 'moreCharacter' => esc_html__( 'or more character', 'affiliates-for-woocommerce' ), 'noResult' => esc_html__( 'No result Found', 'affiliates-for-woocommerce' ), 'deleteConfirm' => esc_html__( 'Are you sure you want to delete?', 'affiliates-for-woocommerce' ), 'dismiss' => esc_html__( 'Dismiss', 'affiliates-for-woocommerce' ), 'selectDate' => esc_html__( 'Select date', 'affiliates-for-woocommerce' ), 'selectDateTime' => esc_html__( 'Select date and time', 'affiliates-for-woocommerce' ), 'now' => esc_html__( 'Now', 'affiliates-for-woocommerce' ), 'done' => esc_html__( 'Done', 'affiliates-for-woocommerce' ), 'time' => esc_html__( 'Time', 'affiliates-for-woocommerce' ), 'hour' => esc_html__( 'Hour', 'affiliates-for-woocommerce' ), 'minute' => esc_html__( 'Minute', 'affiliates-for-woocommerce' ), 'today' => esc_html__( 'Today', 'affiliates-for-woocommerce' ), 'clear' => esc_html__( 'Clear', 'affiliates-for-woocommerce' ), 'previousMonth' => esc_html__( 'Previous month', 'affiliates-for-woocommerce' ), 'nextMonth' => esc_html__( 'Next month', 'affiliates-for-woocommerce' ), 'replaceImage' => esc_html__( 'Replace', 'affiliates-for-woocommerce' ), 'uploadImage' => esc_html__( 'Upload image', 'affiliates-for-woocommerce' ), ], 'startOfWeek' => (int) get_option( 'start_of_week', 1 ), 'site_url' => site_url(), 'devdiggers_plugin' => $devdiggers_plugin, ] ); } /** * Resolve an asset version, falling back to the framework version if the file is absent. * * @param string $relative_path Path relative to the framework root. * @return string|int Version string. */ private static function asset_version( $relative_path ) { $path = DDFW_FILE . $relative_path; return file_exists( $path ) ? filemtime( $path ) : DDFW_VERSION; } /** * Get current DevDiggers plugin dynamically * * @return array */ private function get_current_devdiggers_plugin() { $plugin = []; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin page routing parameter. $current_page = ! empty( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; if ( strpos( $current_page, 'dd' ) !== false ) { $prefix = str_replace( '-dashboard', '', $current_page ); $plugin = [ 'page_slug' => $current_page, 'configuration_menu' => 'configuration', 'plugin_prefix' => $prefix, ]; } return $plugin; } } } DDFW_Assets::instance();