'product_cat', 'orderby' => 'name', 'order' => 'ASC', 'search' => $keyword, 'number' => 100 ) ); $items = array(); if ( count( $categories ) ) { foreach ( $categories as $category ) { $item = array( 'id' => $category->term_id, 'text' => $category->name ); $items[] = $item; } } wp_send_json( $items ); die; } /*Ajax Product Search*/ public function search_product( $x = '', $post_types = array( 'product' ) ) { if ( ! current_user_can( 'manage_options' ) ) { return; } ob_start(); $keyword = filter_input( INPUT_GET, 'keyword', FILTER_SANITIZE_STRING ); if ( empty( $keyword ) ) { die(); } $arg = array( 'post_status' => 'publish', 'post_type' => $post_types, 'posts_per_page' => 50, 's' => $keyword ); $the_query = new WP_Query( $arg ); $found_products = array(); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); $prd = wc_get_product( get_the_ID() ); if ( $prd->has_child() && $prd->is_type( 'variable' ) ) { $product_children = $prd->get_children(); if ( count( $product_children ) ) { foreach ( $product_children as $product_child ) { if ( woocommerce_version_check() ) { $product = array( 'id' => $product_child, 'text' => get_the_title( $product_child ) ); } else { $child_wc = wc_get_product( $product_child ); $get_atts = $child_wc->get_variation_attributes(); $attr_name = array_values( $get_atts )[0]; $product = array( 'id' => $product_child, 'text' => get_the_title() . ' - ' . $attr_name ); } $found_products[] = $product; } } } else { $product_id = get_the_ID(); $product_title = get_the_title(); $the_product = new WC_Product( $product_id ); if ( ! $the_product->is_in_stock() ) { $product_title .= ' (out-of-stock)'; } $product = array( 'id' => $product_id, 'text' => $product_title ); $found_products[] = $product; } } } wp_send_json( $found_products ); die; } /** * Get files in directory * * @param $dir * * @return array|bool */ static private function scan_dir( $dir ) { $ignored = array( '.', '..', '.svn', '.htaccess', 'test-log.log' ); $files = array(); foreach ( scandir( $dir ) as $file ) { if ( in_array( $file, $ignored ) ) { continue; } $files[ $file ] = filemtime( $dir . '/' . $file ); } arsort( $files ); $files = array_keys( $files ); return ( $files ) ? $files : false; } private function stripslashes_deep( $value ) { $value = is_array( $value ) ? array_map( 'stripslashes_deep', $value ) : stripslashes( $value ); return $value; } /** * Save post meta * * @param $post * * @return bool */ public function save_meta_boxes() { global $woocommerce_notification_settings; if ( ! isset( $_POST['_wnotification_nonce'] ) || ! isset( $_POST['wnotification_params'] ) ) { return false; } if ( ! wp_verify_nonce( wp_unslash( sanitize_text_field( $_POST['_wnotification_nonce'] ) ), 'wnotification_save_email_settings' ) ) { return false; } if ( ! current_user_can( 'manage_options' ) ) { return false; } if ( isset( $_POST['wnotification_params']['archive_products'] ) && is_array( $_POST['wnotification_params']['archive_products'] ) && ( count( $_POST['wnotification_params']['archive_products'] ) > 2 ) ) { $_POST['wnotification_params']['archive_products'] = array_splice( $_POST['wnotification_params']['archive_products'], 0, 2 ); } if ( isset( $_POST['wnotification_params']['select_categories'] ) && is_array( $_POST['wnotification_params']['select_categories'] ) && ( count( $_POST['wnotification_params']['select_categories'] ) > 2 ) ) { $_POST['wnotification_params']['select_categories'] = array_splice( $_POST['wnotification_params']['select_categories'], 0, 2 ); } update_option( '_woocommerce_notification_prefix', substr( md5( date( "YmdHis" ) ), 0, 10 ) ); $data = $_POST['wnotification_params']; $args = array( 'virtual_name', 'conditional_tags', 'virtual_city', 'custom_css', 'virtual_country', ); if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) { $languages = $langs = icl_get_languages( 'skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str' ); if ( count( $languages ) ) { foreach ( $languages as $key => $language ) { if ( $language['active'] ) { continue; } $args[] = 'virtual_name_' . $key; $args[] = 'virtual_city_' . $key; $args[] = 'virtual_country_' . $key; } } } /*Polylang*/ elseif ( class_exists( 'Polylang' ) ) { $languages = pll_languages_list(); foreach ( $languages as $language ) { $default_lang = pll_default_language( 'slug' ); if ( $language == $default_lang ) { continue; } $args[] = 'virtual_name_' . $language; $args[] = 'virtual_city_' . $language; $args[] = 'virtual_country_' . $language; } } foreach ( $data as $key => $value ) { if ( in_array( $key, $args ) ) { $data[ $key ] = $this->stripslashes_deep( $value ); } else { $data[ $key ] = wc_clean( $value ); } } update_option( 'wnotification_params', $data ); if ( is_plugin_active( 'wp-fastest-cache/wpFastestCache.php' ) ) { $cache = new WpFastestCache(); $cache->deleteCache( true ); } $woocommerce_notification_settings = $data; } /** * Set Nonce * @return string */ protected static function set_nonce() { return wp_nonce_field( 'wnotification_save_email_settings', '_wnotification_nonce' ); } /** * Set field in meta box * * @param $field * @param bool $multi * * @return string */ protected static function set_field( $field, $multi = false ) { if ( $field ) { if ( $multi ) { return 'wnotification_params[' . $field . '][]'; } else { return 'wnotification_params[' . $field . ']'; } } else { return ''; } } /** * Get Post Meta * * @param $field * * @return bool */ public static function get_field( $field, $default = '' ) { $params = get_option( 'wnotification_params', array() ); if ( self::$params ) { $params = self::$params; } else { self::$params = $params; } if ( isset( $params[ $field ] ) && $field ) { return $params[ $field ]; } else { return $default; } } /** * Get list shortcode * @return array */ public static function page_callback() { self::$params = get_option( 'wnotification_params', array() ); ?>

tabindex="0" class="hidden" value="1" name=""/>
tabindex="0" class="hidden" value="1" name=""/>

tabindex="0" class="hidden" value="1" name=""/>

tabindex="0" class="hidden" value="1" name=""/>

tabindex="0" class="hidden" value="1" name=""/>

tabindex="0" class="hidden" value="0" name=""/>
$b_image ) { ?>
tabindex="0" class="hidden" value="" name=""/>
tabindex="0" class="hidden" value="0" name=""/>
tabindex="0" class="hidden" value="1" name=""/>
tabindex="0" class="hidden" value="2" name=""/>
tabindex="0" class="hidden" value="3" name=""/>
tabindex="0" class="vi_hidden" value="1" name=""/>

tabindex="0" class="hidden" value="1" name=""/>
tabindex="0" class="hidden" value="1" name=""/>

tabindex="0" class="hidden" value="1" name=""/>

Joe Doe in London, England purchased a Ninja Silhouette About 9 hours ago

$message ) { ?>
$language ) { if ( $language['active'] ) { continue; } $wpml_messages = self::get_field( 'message_purchased_' . $key ); if ( ! $wpml_messages ) { $wpml_messages = array( 'Someone in {city}, {country} purchased a {product_with_link} {time_ago}' ); } elseif ( ! is_array( $wpml_messages ) && $wpml_messages ) { $wpml_messages = array( $wpml_messages ); } ?>

  • {first_name} -
  • {city} -
  • {state} -
  • {country} -
  • {product} -
  • {product_with_link} -
  • {time_ago} -
  • {custom} -

$language ) { if ( $language['active'] ) { continue; } $wpml_custom_shortcode = self::get_field( 'custom_shortcode_' . $key ); if ( ! $wpml_custom_shortcode ) { $wpml_custom_shortcode = $custom_shortcode; } ?>