Exemplo n.º 1
0
 function _parse_url_attach($data, $attach_url)
 {
     $__is_attach = false;
     $uid = $data['uid'];
     $username = $data['username'];
     $attach_id = jlogic('attach')->add($uid, $username);
     $p = array('id' => $attach_id, 'tid' => $data['tid'], 'file_url' => $attach_url);
     jlogic('attach')->modify($p);
     $attach_path = RELATIVE_ROOT_PATH . 'data/attachs/topic/' . face_path($attach_id) . '/';
     $attach_type = strtolower(end(explode('.', $attach_url)));
     $attach_name = $attach_id . '.' . $attach_type;
     $attach_file = $attach_path . $attach_name;
     if (!is_file($attach_file)) {
         if (!is_dir($attach_path)) {
             jio()->MakeDir($attach_path);
         }
         if (($temp_attach = dfopen($attach_url)) && jio()->WriteFile($attach_file, $temp_attach) && is_attach($attach_file)) {
             $attach_size = filesize($attach_file);
             $site_url = '';
             if ($GLOBALS['_J']['config']['ftp_on']) {
                 $ftp_key = randgetftp();
                 $get_ftps = jconf::get('ftp');
                 $site_url = $get_ftps[$ftp_key]['attachurl'];
                 $ftp_result = ftpcmd('upload', $attach_file, '', $ftp_key);
             }
             $p = array('id' => $attach_id, 'vtid' => $data['id'], 'site_url' => $site_url, 'file' => $attach_file, 'name' => basename($attach_url), 'filesize' => $attach_size, 'filetype' => $attach_type);
             jlogic('attach')->modify($p);
             $__is_attach = true;
         }
     }
     if (false === $__is_attach && $attach_id > 0) {
         jlogic('attach')->delete($attach_id);
         $attach_id = 0;
     }
     return $attach_id;
 }
Exemplo n.º 2
0
function woo_sbm_sidebar($current_sidebar_id)
{
    //Load Settings
    $woo_sbm_options = get_option('sbm_woo_sbm_options');
    if (!empty($woo_sbm_options['sidebars'])) {
        foreach ($woo_sbm_options['sidebars'] as $sidebar) {
            $id = $sidebar['conditionals']['id'];
            $type = $sidebar['conditionals']['conditional'];
            $sidebar_id = $sidebar['conditionals']['sidebar_id'];
            $sidebar_to_replace = $sidebar['conditionals']['sidebar_to_replace'];
            $sidebar_piggy = $sidebar['conditionals']['piggy'];
            if (!empty($sidebar_piggy)) {
                $sidebar_id = $sidebar_piggy;
                $sidebar_to_replace = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['sidebar_to_replace'];
            }
            //For query posts in the wild
            wp_reset_query();
            //Find conditionals return required sidebar
            if ($type == 'page') {
                if (is_page($id)) {
                    if ($sidebar_to_replace == $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                    }
                }
            }
            if ($type == 'category') {
                if (is_category($id)) {
                    if ($sidebar_to_replace == $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                    }
                }
            }
            if ($type == 'post_tag') {
                $tag_data = get_tag($id);
                if (is_tag($tag_data->slug)) {
                    if ($sidebar_to_replace == $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                    }
                }
            }
            if ($type == 'page_template') {
                if (is_page_template($id)) {
                    if ($sidebar_to_replace == $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                    }
                }
            }
            if ($type == 'hierarchy') {
                if ($id == 'front_page') {
                    if (is_front_page()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'home') {
                    if (is_home()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'single') {
                    if (is_single()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'page') {
                    if (is_page()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'singular') {
                    if (is_singular()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'archive') {
                    if (is_archive()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'category') {
                    if (is_category()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'tag') {
                    if (is_tag()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'tax') {
                    if (is_tax()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'author') {
                    if (is_author()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'search') {
                    if (is_search()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'paged') {
                    if (is_paged()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == 'attach') {
                    if (is_attach()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
                if ($id == '404') {
                    if (is_404()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                }
            }
        }
    }
    return $current_sidebar_id;
}
Exemplo n.º 3
0
function woo_sbm_sidebar($current_sidebar_id){

	//Load Settings
	$woo_sbm_options = get_option( 'sbm_woo_sbm_options' );

	$_is_replaced = false;

	if(is_int($current_sidebar_id)){ $current_sidebar_id = "sidebar-" . $current_sidebar_id; }

	if(!empty($woo_sbm_options['sidebars'])){

		/*------------------------------------------------------------*/
		/* Re-order sidebars such that they are replaced appropriately.
		/* Ordering as follows:
		/*
		/* 1. Specific Pages.
		/* 2. Page Templates.
		/* 3. Categories.
		/* 4. Tags.
		/* 5. Custom Taxonomies.
		/* 6. Template Hierarchy.
		/*------------------------------------------------------------*/

		$sidebars_by_type = array();
		$reordered_sidebars = array();
		$custom_taxonomies = array();
		$hierarchy_sidebars = array();
		$priority = array( 'page', 'page_template', 'custom_post_type', 'category', 'post_tag', 'taxonomy', 'post_type_archive', 'hierarchy' );

		// Make sure a conditional is always set for each sidebar. If not, use the "type" instead.
		foreach ( $woo_sbm_options['sidebars'] as $k => $s ) {
			
			if ( $s['conditionals']['conditional'] == '' ) {
				$woo_sbm_options['sidebars'][$k]['conditionals']['conditional'] = $s['conditionals']['type'];
			}
		
		}
		
		// Separate the sidebars by "conditional".
		foreach ( $woo_sbm_options['sidebars'] as $k => $s ) {
			
			$sidebars_by_type[$s['conditionals']['conditional']][$k] = $s;
		}

		if ( ! empty( $sidebars_by_type ) ) {
			foreach( $priority as $key ) {

		        if( array_key_exists( $key, $sidebars_by_type ) ) {
	                foreach ( $sidebars_by_type[$key] as $k => $s ) {

						$reordered_sidebars[$k] = $s;

	                }
	                unset( $sidebars_by_type[$key] );
		        } else {
		        	// Place the taxonomies in their own array (there could be any number of custom ones)
		        	$custom_taxonomies[$k] = $s;
		        }
		    }
		}

		// Add the remaining sidebars at the end.
		if ( count( $sidebars_by_type ) ) {
			foreach ( $sidebars_by_type as $k => $v ) {
				if ( count( $v ) > 0 ) {
					foreach ( $v as $i => $j ) {
						$reordered_sidebars[$i] = $j;
					}
				}
			}
		}

		$woo_sbm_options['sidebars'] = $reordered_sidebars;

		// Get array of all custom taxonomy keys.
		$wp_custom_taxonomy_args = array( '_builtin' => false );
		$woo_wp_custom_taxonomies = get_taxonomies( $wp_custom_taxonomy_args, 'objects' );
		$tax_keys = array();
		if ( count( $woo_wp_custom_taxonomies ) > 0 ) { $tax_keys = array_keys( $woo_wp_custom_taxonomies ); }

		foreach($woo_sbm_options['sidebars'] as $sidebar){

			$id = $sidebar['conditionals']['id'];
			$type = $sidebar['conditionals']['conditional'];
			$sidebar_id = $sidebar['conditionals']['sidebar_id'];
			$sidebar_to_replace = $sidebar['conditionals']['sidebar_to_replace'];
			$sidebar_piggy = $sidebar['conditionals']['piggy'];

			if(!empty($sidebar_piggy)) {
				$sidebar_id = $sidebar_piggy;
				$sidebar_to_replace = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['sidebar_to_replace'];
				// $type = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['type']; // Resolves dependencies issue from V4.3.7 when commented out.
			} // End IF Statement

			//For query posts in the wild
			wp_reset_query();

			/*------------------------------------------------------------*/
			/* Support for custom post types, if using WordPress 3.0+.
			/*------------------------------------------------------------*/

			global $wp_version, $post;

			$_post_types = array();

			if ( $wp_version >= '3.0' ) {

				$_args = array(
							'show_ui' => true,
							'public' => true,
							'publicly_queryable' => true,
							'_builtin' => false
							);

				$_post_types = get_post_types( $_args, 'object' );

				// Set certain post types that aren't allowed to have custom sidebars.

				$_disallowed_types = array( 'slide' );

				// Make the array pluggable.

				$_disallowed_types = apply_filters( 'wooframework_sbm_disallowed_posttypes', $_disallowed_types );

				if ( count( $_post_types ) ) {

					foreach ( $_post_types as $k => $v ) {

						if ( in_array( $k, $_disallowed_types ) ) {

							unset( $_post_types[$k] );

						} // End IF Statement

					} // End FOREACH Loop

				} // End IF Statement
				
				if ( $wp_version >= '3.1' ) {
					$_args = array(
							'show_ui' => true,
							'public' => true,
							'publicly_queryable' => true,
							'_builtin' => false, 
							'has_archive' => true
							);
	
					$_post_types = get_post_types( $_args, 'object' );
				}
				
				if ( count( $_post_types ) ) {

					foreach ( $_post_types as $k => $v ) {

						if ( in_array( $k, $_disallowed_types ) ) {

							unset( $_post_types[$k] );

						} // End IF Statement

					} // End FOREACH Loop

				} // End IF Statement

			} // End IF Statement

			/*
			if ( ( $type == 'custom_post_type' && is_single() ) && in_array( $post->post_type, array_keys( $_post_types ) ) ) {

				if( $post->post_type == $id && $sidebar_id == 'woo_sbm_custom_post_type_' . $id . '_' . $current_sidebar_id ) {

					if($sidebar_to_replace == $current_sidebar_id) {

						$current_sidebar_id = $sidebar_id;

						// Set this to prevent the system from conflicting with the template hierarchy.
						$_is_replaced = true;

					} // End IF Statement

				} else {

					if ( is_singular() && $sidebar_id == 'woo_sbm_hierarchy_singular_' . $current_sidebar_id ) {

						$current_sidebar_id = $sidebar_id;

						// Set this to prevent the system from conflicting with the template hierarchy.
						$_is_replaced = true;

					} // End IF Statement

				} // End IF Statement

			} else {
			*/
	
					// Find conditionals return required sidebar.
					if( $type == 'page' && ! $_is_replaced ) {

						if( is_page() && ( $id == $post->ID ) && ! is_archive() && ! is_home() )
							if($sidebar_to_replace == $current_sidebar_id) {
								$current_sidebar_id = $sidebar_id;

								// Set this to prevent the system from conflicting with the template hierarchy.
								$_is_replaced = true;
							}

					} // End IF Statement

					if( $type == 'category'/* && ! is_home() && ! $_is_replaced && ! is_singular()*/ ) {

						if( is_category($id) || ( is_single() && in_category( $id ) ) ) {
							if($sidebar_to_replace == $current_sidebar_id) {
								$current_sidebar_id = $sidebar_id;

								// Set this to prevent the system from conflicting with the template hierarchy.
								$_is_replaced = true;
							}
						}

					} // End IF Statement

					if( $type == 'post_tag'/* && ! is_home() && ! $_is_replaced*/ ) {
						$tag_data = get_tag($id);
						if(is_tag($tag_data->slug))
							if($sidebar_to_replace == $current_sidebar_id) {
								$current_sidebar_id = $sidebar_id;

								// Set this to prevent the system from conflicting with the template hierarchy.
								$_is_replaced = true;
							}
					} // End IF Statement

					if( $type == 'page_template'/* && ! is_home() && ! $_is_replaced*/ ) {
						if(is_page_template($id))
							if($sidebar_to_replace == $current_sidebar_id) {
								$current_sidebar_id = $sidebar_id;

								// Set this to prevent the system from conflicting with the template hierarchy.
								$_is_replaced = true;
							}
					} // End IF Statement

					if( $type == 'hierarchy' && ! $_is_replaced ) {

						if($id == 'front_page')
							if(is_front_page())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'home')
							if(is_home())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'single')
							if(is_single())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'page')
							if(is_page())
								if ( ! in_array( 'woo_sbm_page_' . $post->ID . '_' . $sidebar_to_replace, array_keys( $woo_sbm_options['sidebars'] ) ) )
									if($sidebar_to_replace == $current_sidebar_id)
										$current_sidebar_id = $sidebar_id;

						if($id == 'singular')
							if(is_singular())
								if($sidebar_to_replace == $current_sidebar_id)
								$current_sidebar_id = $sidebar_id;
						if($id == 'date')
							if(is_date())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'archive')
							if(is_archive())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'category')
							if(is_category())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'tag')
							if(is_tag())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'tax')
							if(is_tax())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'author')
							if(is_author())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'search')
							if(is_search())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'paged')
							if(is_paged())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == 'attach')
							if(is_attach())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;
						if($id == '404')
							if(is_404())
								if($sidebar_to_replace == $current_sidebar_id)
									$current_sidebar_id = $sidebar_id;

					} // End IF Statement

					if ( ( $type == '' || in_array( $type, $tax_keys ) ) ) {
						$type_tax = $sidebar['conditionals']['type'];
						if ($type_tax != '') {

							// Get taxonomy query object
							global $wp_query;

							$taxonomy_archive_query_obj = $wp_query->get_queried_object();

							if ( ( is_tax( $taxonomy_archive_query_obj->name, $taxonomy_archive_query_obj->slug ) ) && ( $id == $taxonomy_archive_query_obj->term_id ) ) { $sentinel = true; } // End IF Statement

							if ( ! $sentinel ) {

								// CUSTOM TAXONOMIES
								$wp_custom_taxonomy_args = array( '_builtin' => false );
								$woo_wp_custom_taxonomies = array();
								$woo_wp_custom_taxonomies = get_taxonomies($wp_custom_taxonomy_args,'objects' );
								$sentinel = false;
								foreach ($woo_wp_custom_taxonomies as $woo_wp_custom_taxonomy) {
									// checks for match to taxonomy
									if ($type_tax == $woo_wp_custom_taxonomy->name) {
										$term_list = get_the_terms( 0, $woo_wp_custom_taxonomy->name  );
										$term_results = '';
										if ($term_list) {
											foreach ($term_list as $term_item) {
												if ( (is_tax($woo_wp_custom_taxonomy->name, $term_item->slug)) && ($id == $term_item->term_id) ) { $sentinel = true; } // End IF Statement
											} // End FOREACH Loop
										} // End IF Statement
									} // End IF Statement
								} // End FOREACH Loop

							} // End IF Statement

							if ( $sentinel ) {
								if( $sidebar_to_replace == $current_sidebar_id ) {
									$current_sidebar_id = $sidebar_id;
									$_is_replaced = true;
								} // End IF Statement
							} // End IF Statement
						} // End IF Statement
					} // End IF Statement
					
					if( $type == 'post_type_archive' && is_post_type_archive( $id ) ) {
		
						if( $sidebar_to_replace == $current_sidebar_id && is_post_type_archive( $id ) ) {
							$current_sidebar_id = $sidebar_id;
		
							// Set this to prevent the system from conflicting with the template hierarchy.
							$_is_replaced = true;
						}
		
					} // End IF Statement
		
					if( $type == 'custom_post_type' && get_post_type() == $id && is_single() ) {
		
							if($sidebar_to_replace == $current_sidebar_id) {
								$current_sidebar_id = $sidebar_id;
		
								// Set this to prevent the system from conflicting with the template hierarchy.
								$_is_replaced = true;
							}
		
					} // End IF Statement

			// } // End Custom Post Type IF Statement

		} // End FOREACH Loop
	} // End IF Statement

	return $current_sidebar_id;

} // End woo_sbm_sidebar()
Exemplo n.º 4
0
function woo_sbm_sidebar($current_sidebar_id)
{
    //Load Settings
    $woo_sbm_options = get_option('sbm_woo_sbm_options');
    $_is_replaced = false;
    if (is_int($current_sidebar_id)) {
        $current_sidebar_id = "sidebar-" . $current_sidebar_id;
    }
    if (!empty($woo_sbm_options['sidebars'])) {
        foreach ($woo_sbm_options['sidebars'] as $sidebar) {
            $id = $sidebar['conditionals']['id'];
            $type = $sidebar['conditionals']['conditional'];
            $sidebar_id = $sidebar['conditionals']['sidebar_id'];
            $sidebar_to_replace = $sidebar['conditionals']['sidebar_to_replace'];
            $sidebar_piggy = $sidebar['conditionals']['piggy'];
            if (!empty($sidebar_piggy)) {
                $sidebar_id = $sidebar_piggy;
                $sidebar_to_replace = $woo_sbm_options['sidebars'][$sidebar_id]['conditionals']['sidebar_to_replace'];
            }
            // End IF Statement
            //For query posts in the wild
            wp_reset_query();
            /*------------------------------------------------------------*/
            /* Support for custom post types, if using WordPress 3.0+.
            			/*------------------------------------------------------------*/
            global $wp_version, $post;
            $_post_types = array();
            if ($wp_version >= '3.0') {
                $_args = array('show_ui' => true, 'public' => true, 'publicly_queryable' => true, '_builtin' => false);
                $_post_types = get_post_types($_args, 'object');
                // Set certain post types that aren't allowed to have custom sidebars.
                $_disallowed_types = array('slide');
                // Make the array pluggable.
                $_disallowed_types = apply_filters('wooframework_sbm_disallowed_posttypes', $_disallowed_types);
                if (count($_post_types)) {
                    foreach ($_post_types as $k => $v) {
                        if (in_array($k, $_disallowed_types)) {
                            unset($_post_types[$k]);
                        }
                        // End IF Statement
                    }
                    // End FOREACH Loop
                }
                // End IF Statement
            }
            // End IF Statement
            if (($type == 'custom_post_type' || $id == 'singular') && in_array($post->post_type, array_keys($_post_types))) {
                if ($post->post_type == $id && $sidebar_id == 'woo_sbm_custom_post_type_' . $id . '_' . $current_sidebar_id) {
                    if ($sidebar_to_replace == $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                        // Set this to prevent the system from conflicting with the template hierarchy.
                        $_is_replaced = true;
                    }
                    // End IF Statement
                } else {
                    if (is_singular() && $sidebar_id == 'woo_sbm_hierarchy_singular_' . $current_sidebar_id) {
                        $current_sidebar_id = $sidebar_id;
                        // Set this to prevent the system from conflicting with the template hierarchy.
                        $_is_replaced = true;
                    }
                    // End IF Statement
                }
                // End IF Statement
            } else {
                //Find conditionals return required sidebar
                if ($type == 'page' && $id == $post->ID) {
                    if (is_page($post->ID) && !is_archive() && !is_home()) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                    // Set this to prevent the system from conflicting with the template hierarchy.
                    $_is_replaced = true;
                }
                // End IF Statement
                if ($type == 'category') {
                    if (is_category($id) || is_single() && in_category($id)) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                    // Set this to prevent the system from conflicting with the template hierarchy.
                    $_is_replaced = true;
                }
                // End IF Statement
                if ($type == 'post_tag') {
                    $tag_data = get_tag($id);
                    if (is_tag($tag_data->slug)) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                    // Set this to prevent the system from conflicting with the template hierarchy.
                    $_is_replaced = true;
                }
                // End IF Statement
                if ($type == 'page_template') {
                    if (is_page_template($id)) {
                        if ($sidebar_to_replace == $current_sidebar_id) {
                            $current_sidebar_id = $sidebar_id;
                        }
                    }
                    // Set this to prevent the system from conflicting with the template hierarchy.
                    $_is_replaced = true;
                }
                // End IF Statement
                if ($type == 'hierarchy') {
                    if ($id == 'front_page') {
                        if (is_front_page()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'home') {
                        if (is_home()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'single') {
                        if (is_single()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'page') {
                        if (is_page()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'singular') {
                        if (is_singular()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'date') {
                        if (is_date()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'archive') {
                        if (is_archive()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'category') {
                        if (is_category()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'tag') {
                        if (is_tag()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'tax') {
                        if (is_tax()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'author') {
                        if (is_author()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'search') {
                        if (is_search()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'paged') {
                        if (is_paged()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == 'attach') {
                        if (is_attach()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                    if ($id == '404') {
                        if (is_404()) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                        }
                    }
                }
                // End IF Statement
                if ($type == '') {
                    $type_tax = $sidebar['conditionals']['type'];
                    if ($type_tax != '') {
                        // Get taxonomy query object
                        global $wp_query;
                        $taxonomy_archive_query_obj = $wp_query->get_queried_object();
                        if (is_tax($taxonomy_archive_query_obj->name, $taxonomy_archive_query_obj->slug) && $id == $taxonomy_archive_query_obj->term_id) {
                            $sentinel = true;
                        }
                        // End IF Statement
                        if (!$sentinel) {
                            // CUSTOM TAXONOMIES
                            $wp_custom_taxonomy_args = array('_builtin' => false);
                            $woo_wp_custom_taxonomies = array();
                            $woo_wp_custom_taxonomies = get_taxonomies($wp_custom_taxonomy_args, 'objects');
                            $sentinel = false;
                            foreach ($woo_wp_custom_taxonomies as $woo_wp_custom_taxonomy) {
                                // checks for match to taxonomy
                                if ($type_tax == $woo_wp_custom_taxonomy->name) {
                                    $term_list = get_the_terms(0, $woo_wp_custom_taxonomy->name);
                                    $term_results = '';
                                    if ($term_list) {
                                        foreach ($term_list as $term_item) {
                                            if (is_tax($woo_wp_custom_taxonomy->name, $term_item->slug) && $id == $term_item->term_id) {
                                                $sentinel = true;
                                            }
                                            // End IF Statement
                                        }
                                        // End FOREACH Loop
                                    }
                                    // End IF Statement
                                }
                                // End IF Statement
                            }
                            // End FOREACH Loop
                        }
                        // End IF Statement
                        if ($sentinel) {
                            if ($sidebar_to_replace == $current_sidebar_id) {
                                $current_sidebar_id = $sidebar_id;
                            }
                            // End IF Statement
                        }
                        // End IF Statement
                    }
                    // End IF Statement
                }
                // End IF Statement
            }
            // End Custom Post Type IF Statement
        }
        // End FOREACH Loop
    }
    // End IF Statement
    return $current_sidebar_id;
}