/**
  * Adds the order processing count to the menu.
  */
 public function menu_order_count()
 {
     global $submenu;
     if (isset($submenu['youpzt_store'])) {
         // Remove 'WooCommerce' sub menu item
         unset($submenu['youpzt_store'][0]);
         // Add count if user has access
         if (apply_filters('woocommerce_include_processing_order_count_in_menu', true) && current_user_can('manage_youpztstore') && ($order_count = wc_processing_order_count())) {
             foreach ($submenu['youpzt_store'] as $key => $menu_item) {
                 if (0 === strpos($menu_item[0], _x('Orders', 'Admin menu name', 'woocommerce'))) {
                     $submenu['youpzt_store'][$key][0] .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n($order_count) . '</span></span>';
                     break;
                 }
             }
         }
     }
 }
 /**
  * Register core post types
  */
 public static function register_post_types()
 {
     if (post_type_exists('product')) {
         return;
     }
     do_action('woocommerce_register_post_type');
     $permalinks = get_option('woocommerce_permalinks');
     $product_permalink = empty($permalinks['product_base']) ? _x('product', 'slug', 'woocommerce') : $permalinks['product_base'];
     register_post_type("product", apply_filters('woocommerce_register_post_type_product', array('labels' => array('name' => __('Products', 'woocommerce'), 'singular_name' => __('Product', 'woocommerce'), 'menu_name' => _x('Products', 'Admin menu name', 'woocommerce'), 'add_new' => __('Add Product', 'woocommerce'), 'add_new_item' => __('Add New Product', 'woocommerce'), 'edit' => __('Edit', 'woocommerce'), 'edit_item' => __('Edit Product', 'woocommerce'), 'new_item' => __('New Product', 'woocommerce'), 'view' => __('View Product', 'woocommerce'), 'view_item' => __('View Product', 'woocommerce'), 'search_items' => __('Search Products', 'woocommerce'), 'not_found' => __('No Products found', 'woocommerce'), 'not_found_in_trash' => __('No Products found in trash', 'woocommerce'), 'parent' => __('Parent Product', 'woocommerce')), 'description' => __('This is where you can add new products to your store.', 'woocommerce'), 'public' => true, 'show_ui' => true, 'capability_type' => 'product', 'map_meta_cap' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => $product_permalink ? array('slug' => untrailingslashit($product_permalink), 'with_front' => false, 'feeds' => true) : false, 'query_var' => true, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes'), 'has_archive' => ($shop_page_id = wc_get_page_id('shop')) && get_page($shop_page_id) ? get_page_uri($shop_page_id) : 'shop', 'show_in_nav_menus' => true)));
     register_post_type("product_variation", apply_filters('woocommerce_register_post_type_product_variation', array('label' => __('Variations', 'woocommerce'), 'public' => false, 'hierarchical' => false, 'supports' => false)));
     $menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
     if ($order_count = wc_processing_order_count()) {
         $menu_name .= " <span class='awaiting-mod update-plugins count-{$order_count}'><span class='processing-count'>" . number_format_i18n($order_count) . "</span></span>";
     }
     register_post_type("shop_order", apply_filters('woocommerce_register_post_type_shop_order', array('labels' => array('name' => __('Orders', 'woocommerce'), 'singular_name' => __('Order', 'woocommerce'), 'add_new' => __('Add Order', 'woocommerce'), 'add_new_item' => __('Add New Order', 'woocommerce'), 'edit' => __('Edit', 'woocommerce'), 'edit_item' => __('Edit Order', 'woocommerce'), 'new_item' => __('New Order', 'woocommerce'), 'view' => __('View Order', 'woocommerce'), 'view_item' => __('View Order', 'woocommerce'), 'search_items' => __('Search Orders', 'woocommerce'), 'not_found' => __('No Orders found', 'woocommerce'), 'not_found_in_trash' => __('No Orders found in trash', 'woocommerce'), 'parent' => __('Parent Orders', 'woocommerce'), 'menu_name' => $menu_name), 'description' => __('This is where store orders are stored.', 'woocommerce'), 'public' => false, 'show_ui' => true, 'capability_type' => 'shop_order', 'map_meta_cap' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_in_menu' => current_user_can('manage_woocommerce') ? 'woocommerce' : true, 'hierarchical' => false, 'show_in_nav_menus' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'comments', 'custom-fields'), 'has_archive' => false)));
     if (get_option('woocommerce_enable_coupons') == 'yes') {
         register_post_type("shop_coupon", apply_filters('woocommerce_register_post_type_shop_coupon', array('labels' => array('name' => __('Coupons', 'woocommerce'), 'singular_name' => __('Coupon', 'woocommerce'), 'menu_name' => _x('Coupons', 'Admin menu name', 'woocommerce'), 'add_new' => __('Add Coupon', 'woocommerce'), 'add_new_item' => __('Add New Coupon', 'woocommerce'), 'edit' => __('Edit', 'woocommerce'), 'edit_item' => __('Edit Coupon', 'woocommerce'), 'new_item' => __('New Coupon', 'woocommerce'), 'view' => __('View Coupons', 'woocommerce'), 'view_item' => __('View Coupon', 'woocommerce'), 'search_items' => __('Search Coupons', 'woocommerce'), 'not_found' => __('No Coupons found', 'woocommerce'), 'not_found_in_trash' => __('No Coupons found in trash', 'woocommerce'), 'parent' => __('Parent Coupon', 'woocommerce')), 'description' => __('This is where you can add new coupons that customers can use in your store.', 'woocommerce'), 'public' => false, 'show_ui' => true, 'capability_type' => 'shop_coupon', 'map_meta_cap' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_in_menu' => current_user_can('manage_woocommerce') ? 'woocommerce' : true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_nav_menus' => false, 'show_in_admin_bar' => true)));
     }
 }
/**
 * @deprecated
 */
function woocommerce_processing_order_count()
{
    return wc_processing_order_count();
}
 /**
  * Highlights the correct top level admin menu item for post type add screens.
  *
  * @access public
  * @return void
  */
 public function menu_highlight()
 {
     global $menu, $submenu, $parent_file, $submenu_file, $self, $post_type, $taxonomy;
     $to_highlight_types = array('shop_order', 'shop_coupon');
     if (isset($post_type)) {
         if (in_array($post_type, $to_highlight_types)) {
             $submenu_file = 'edit.php?post_type=' . esc_attr($post_type);
             $parent_file = 'woocommerce';
         }
         if ('product' == $post_type) {
             $screen = get_current_screen();
             if ($screen->base == 'edit-tags' && taxonomy_is_product_attribute($taxonomy)) {
                 $submenu_file = 'product_attributes';
                 $parent_file = 'edit.php?post_type=' . esc_attr($post_type);
             }
         }
     }
     if (isset($submenu['woocommerce']) && isset($submenu['woocommerce'][1])) {
         $submenu['woocommerce'][0] = $submenu['woocommerce'][1];
         unset($submenu['woocommerce'][1]);
     }
     // Sort out Orders menu when on the top level
     if (!current_user_can('manage_woocommerce')) {
         foreach ($menu as $key => $menu_item) {
             if (strpos($menu_item[0], _x('Orders', 'Admin menu name', 'woocommerce')) === 0) {
                 $menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
                 $menu_name_count = '';
                 if ($order_count = wc_processing_order_count()) {
                     $menu_name_count = " <span class='awaiting-mod update-plugins count-{$order_count}'><span class='processing-count'>" . number_format_i18n($order_count) . "</span></span>";
                 }
                 $menu[$key][0] = $menu_name . $menu_name_count;
                 $submenu['edit.php?post_type=shop_order'][5][0] = $menu_name;
                 break;
             }
         }
     }
 }
 /**
  * Highlights the correct top level admin menu item for post type add screens.
  *
  * @return void
  */
 public function menu_highlight()
 {
     global $menu, $submenu, $parent_file, $submenu_file, $self, $post_type, $taxonomy;
     $to_highlight_types = array('shop_order', 'shop_coupon');
     if (isset($post_type)) {
         if (in_array($post_type, $to_highlight_types)) {
             $submenu_file = 'edit.php?post_type=' . esc_attr($post_type);
             $parent_file = 'woocommerce';
         }
         if ('product' == $post_type) {
             $screen = get_current_screen();
             if ($screen->base == 'edit-tags' && taxonomy_is_product_attribute($taxonomy)) {
                 $submenu_file = 'product_attributes';
                 $parent_file = 'edit.php?post_type=' . esc_attr($post_type);
             }
         }
     }
     if (isset($submenu['woocommerce']) && isset($submenu['woocommerce'][1])) {
         $submenu['woocommerce'][0] = $submenu['woocommerce'][1];
         unset($submenu['woocommerce'][1]);
     }
     if (isset($submenu['woocommerce']) && current_user_can('manage_woocommerce')) {
         foreach ($submenu['woocommerce'] as $key => $menu_item) {
             if (0 === strpos($menu_item[0], _x('Orders', 'Admin menu name', 'woocommerce'))) {
                 $menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
                 if ($order_count = wc_processing_order_count()) {
                     $menu_name .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n($order_count) . '</span></span>';
                 }
                 $submenu['woocommerce'][$key][0] = $menu_name;
                 break;
             }
         }
     }
 }
 function val_replace($str)
 {
     if (!empty($str)) {
         $update_data = wp_get_update_data();
         $awaiting_mod = wp_count_comments();
         $awaiting_mod = $awaiting_mod->moderated;
         $current_user = wp_get_current_user();
         if (is_multisite()) {
             $current_site = get_current_site();
         }
         if (strstr($str, '[blog_url]')) {
             $str = str_replace('[blog_url]', get_bloginfo('url'), $str);
         }
         if (strstr($str, '[template_directory_uri]')) {
             $str = str_replace('[template_directory_uri]', get_bloginfo('template_directory'), $str);
         }
         if (strstr($str, '[stylesheet_directory_uri]')) {
             $str = str_replace('[stylesheet_directory_uri]', get_stylesheet_directory_uri(), $str);
         }
         if (strstr($str, '[blog_name]')) {
             $str = str_replace('[blog_name]', get_bloginfo('name'), $str);
         }
         if (strstr($str, '[update_total]')) {
             $str = str_replace('[update_total]', $update_data["counts"]["total"], $str);
         }
         if (strstr($str, '[update_total_format]')) {
             $str = str_replace('[update_total_format]', number_format_i18n($update_data["counts"]["total"]), $str);
         }
         if (strstr($str, '[update_plugins]')) {
             $str = str_replace('[update_plugins]', $update_data["counts"]["plugins"], $str);
         }
         if (strstr($str, '[update_plugins_format]')) {
             $str = str_replace('[update_plugins_format]', number_format_i18n($update_data["counts"]["plugins"]), $str);
         }
         if (strstr($str, '[update_themes]')) {
             $str = str_replace('[update_themes]', $update_data["counts"]["themes"], $str);
         }
         if (strstr($str, '[update_themes_format]')) {
             $str = str_replace('[update_themes_format]', number_format_i18n($update_data["counts"]["themes"]), $str);
         }
         if (strstr($str, '[comment_count]')) {
             $str = str_replace('[comment_count]', $awaiting_mod, $str);
         }
         if (strstr($str, '[comment_count_format]')) {
             $str = str_replace('[comment_count_format]', number_format_i18n($awaiting_mod), $str);
         }
         if (strstr($str, '[user_name]')) {
             $str = str_replace('[user_name]', $current_user->display_name, $str);
         }
         if (strstr($str, '[user_login_name]')) {
             $str = str_replace('[user_login_name]', $current_user->user_login, $str);
         }
         if (strstr($str, '[user_avatar]')) {
             $str = str_replace('[user_avatar]', get_avatar($current_user->ID, 16), $str);
         }
         if (strstr($str, '[user_avatar_64]')) {
             $str = str_replace('[user_avatar_64]', get_avatar($current_user->ID, 64), $str);
         }
         if (strstr($str, '[post_type]')) {
             $post_name = '';
             if (is_admin()) {
                 global $current_screen;
                 global $typenow;
                 global $tax;
                 if ($current_screen->base == 'edit' or $current_screen->base == 'post' && !empty($typenow)) {
                     $post_type_object = get_post_type_object($typenow);
                     if (!empty($post_type_object->public)) {
                         $post_name = $post_type_object->labels->singular_name;
                     }
                 } elseif ($current_screen->base == 'edit-tags' && !empty($tax)) {
                     if (!empty($tax->public)) {
                         $post_name = $tax->labels->singular_name;
                     }
                 }
             } else {
                 $queried_object = get_queried_object();
                 if (!empty($queried_object->post_type)) {
                     $post_type_object = get_post_type_object($queried_object->post_type);
                     if (!empty($post_type_object->public)) {
                         $post_name = $post_type_object->labels->singular_name;
                     }
                 } elseif (!empty($queried_object->taxonomy)) {
                     $tax = get_taxonomy($queried_object->taxonomy);
                     if (!empty($tax->public)) {
                         $post_name = $tax->labels->singular_name;
                     }
                 }
             }
             $str = str_replace('[post_type]', $post_name, $str);
         }
         if (is_multisite()) {
             if (strstr($str, '[site_name]')) {
                 $str = str_replace('[site_name]', esc_attr($current_site->site_name), $str);
             }
             if (strstr($str, '[site_url]')) {
                 $str = str_replace('[site_url]', $this->Schema . esc_attr($current_site->domain . $current_site->path), $str);
             }
         }
         if (!empty($this->ActivatedPlugin)) {
             $activated_plugins = $this->ActivatedPlugin;
             if (!empty($activated_plugins['woocommerce'])) {
                 if (strstr($str, '[woocommerce_order_process_count]')) {
                     $woocommerce_order_process_count = '';
                     if (function_exists('wc_processing_order_count')) {
                         $order_count = intval(wc_processing_order_count());
                         if (!empty($order_count)) {
                             $woocommerce_order_process_count = ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n($order_count) . '</span></span>';
                         }
                     }
                     $str = str_replace('[woocommerce_order_process_count]', $woocommerce_order_process_count, $str);
                 }
             }
         }
     }
     return $str;
 }
Exemplo n.º 7
0
 /**
  * Test wc_processing_order_count().
  * @since 2.4
  */
 public function test_wc_processing_order_count()
 {
     $this->assertEquals(0, wc_processing_order_count());
 }
Exemplo n.º 8
0
if (!empty($this->ActivatedPlugin)) {
    ?>
				
					<?php 
    $activated_plugins = $this->ActivatedPlugin;
    ?>
					
					<?php 
    if (!empty($activated_plugins['woocommerce'])) {
        ?>
					
						<?php 
        if (function_exists('wc_processing_order_count')) {
            ?>
							<?php 
            $order_count = intval(wc_processing_order_count());
            ?>
							<?php 
            if (!empty($order_count)) {
                ?>
							<tr>
								<th><strong>[woocommerce_order_process_count]</strong></th>
								<td>
									<code>&lt;span class=&quot;awaiting-mod update-plugins count-<?php 
                echo $order_count;
                ?>
&quot;&gt;&lt;span class=&quot;processing-count&quot;><?php 
                echo number_format_i18n($order_count);
                ?>
&lt;/span&gt;&lt;/span&gt;</code>
								</td>
 /**
  * Get the count of all processing orders
  *
  * @since 1.1.1
  * @return type
  */
 public static function get_processing_order_count()
 {
     if (self::is_wc_2_2()) {
         return wc_processing_order_count();
     } else {
         return get_term_by('slug', 'processing', 'shop_order_status')->count;
     }
 }