WooCommerce Product Feed PRO plugin please leave us a ★★★★★ rating. Thanks in advance!','woo-product-feed-pro'); } add_filter('admin_footer_text', 'my_footer_text'); delete_option( 'woosea_cat_mapping' ); $license_information = get_option( 'license_information' ); $host = sanitize_text_field($_SERVER['HTTP_HOST']); /** * Create notification object */ $notifications_obj = new WooSEA_Get_Admin_Notifications; $notifications_box = $notifications_obj->get_admin_notifications ( '1', 'false' ); /** * Update or get project configuration */ $nonce = wp_create_nonce( 'woosea_ajax_nonce' ); /** * Update project configuration */ if (array_key_exists('project_hash', $_GET)){ $project = WooSEA_Update_Project::get_project_data(sanitize_text_field($_GET['project_hash'])); $channel_data = WooSEA_Update_Project::get_channel_data(sanitize_text_field($_GET['channel_hash'])); $manage_project = "yes"; if(isset($project['WPML'])){ if ( ( is_plugin_active('sitepress-multilingual-cms') ) OR ( function_exists('icl_object_id') ) ){ if( !class_exists( 'Polylang' ) ) { // Get WPML language global $sitepress; $lang = $project['WPML']; $sitepress->switch_lang($lang); } } } } else { // Sanitize values in multi-dimensional POST array if(is_array($_POST)){ foreach($_POST as $p_key => $p_value){ if(is_array($p_value)){ foreach($p_value as $pp_key => $pp_value){ if(is_array($pp_value)){ foreach($pp_value as $ppp_key => $ppp_value){ $_POST[$p_key][$pp_key][$ppp_key] = sanitize_text_field($ppp_value); } } } } else { $_POST[$p_key] = sanitize_text_field($p_value); } } } else { $_POST = array(); } $project = WooSEA_Update_Project::update_project($_POST); $channel_data = WooSEA_Update_Project::get_channel_data(sanitize_text_field($_POST['channel_hash'])); if(isset($project['WPML'])){ if ( function_exists('icl_object_id') ) { if( !class_exists( 'Polylang' ) ) { // Get WPML language global $sitepress; $lang = $project['WPML']; $sitepress->switch_lang($lang); } } } } function woosea_hierarchical_term_tree($category, $prev_mapped){ $r = ''; $args = array( 'parent' => $category, 'hide_empty' => false, 'no_found_rows' => true, ); $next = get_terms('product_cat', $args); $nr_categories = count($next); $yo = 0; if ($next) { foreach ($next as $sub_category) { $yo++; $x = $sub_category->term_id; $woo_category = $sub_category->name; $woo_category_id = $sub_category->term_id; $mapped_category = ""; $mapped_active_class = "input-field-large"; $woo_category = preg_replace('/&/','&',$woo_category); $woo_category = preg_replace('/"/','"',$woo_category); // Check if mapping is in place if ((array_key_exists($x, $prev_mapped)) OR (array_key_exists($woo_category, $prev_mapped))){ if(array_key_exists($x, $prev_mapped)){ $mapped_category = $prev_mapped[$x]; } elseif (array_key_exists($woo_category, $prev_mapped)){ $mapped_category = $prev_mapped[$x]; } else { $mapped_category = $woo_category; } $mapped_active_class = "input-field-large-active"; } // These are main categories if($sub_category->parent == 0){ $args = array( 'parent' => $sub_category->term_id, 'hide_empty' => false, 'no_found_rows' => true, ); $subcat = get_terms('product_cat', $args); $nr_subcats = count($subcat); $r .= ""; $r .= "$woo_category ($sub_category->count)"; $r .= "
"; if(($yo == $nr_categories) AND ($nr_subcats == 0)){ $r .= ""; } else { if($nr_subcats > 0){ $r .= ""; } else { $r .= ""; } } $r .= ""; } else { $r .= ""; $r .= "-- $woo_category ($sub_category->count)"; $r .= "
parent\" value=\"$mapped_category\">
"; $r .= ""; $r .= ""; } $r .= $sub_category->term_id !== 0 ? woosea_hierarchical_term_tree($sub_category->term_id, $prev_mapped) : null; } } $allowed_tags = array( 'tr' => array( 'class' => array(), ), 'td' => array(), 'input' => array( 'type' => array(), 'name' => array(), 'value' => array(), 'class' => array(), 'id' => array(), ), 'span' => array( 'class' => array(), 'style' => array(), 'title' => array(), ), 'div' => array( 'id' => array(), ), '>' => array(), '&' => array(), ); return wp_kses_normalize_entities($r, $allowed_tags); } ?>