/home/vianto5/cititower.mx/wp-content/plugins/siteorigin-panels/inc/widgets
NameSizeModeActions
layout.php51410644editdlrm
post-content.php28120644editdlrm
post-loop-helper.php30950644editdlrm
post-loop.php209620644editdlrm
Edit: /home/vianto5/cititower.mx/wp-content/plugins/siteorigin-panels/inc/widgets/post-loop.php (20962B)
__( 'Displays a post loop.', 'siteorigin-panels' ), ), array( 'width' => 800, ) ); } /** * Are we currently rendering a post loop * * @return bool */ public static function is_rendering_loop() { return self::$rendering_loop; } /** * Which post loop is currently being rendered * * @return array */ public static function get_current_loop_template() { return self::$current_loop_template; } /** * Which post loop is currently being rendered * * @return array */ public static function get_current_loop_instance() { return self::$current_loop_instance; } /** * The pagination id used in custom format pagination links * * @return array */ public static function get_current_pagination_id() { return self::$current_pagination_id; } /** * Update the widget * * @param array $new * @param array $old * * @return array */ public function update( $new, $old ) { $new['pagination_id'] = rand(); if ( class_exists( 'SiteOrigin_Widget' ) && class_exists( 'SiteOrigin_Widget_Field_Posts' ) ) { $helper = $this->get_helper_widget( $this->get_loop_templates() ); return $helper->update( $new, $old ); } else { $new['more'] = ! empty( $new['more'] ); return $new; } } private static function is_legacy_widget_block_preview() { if ( empty( $_GET['legacy-widget-preview'] ) ) { return false; } $id_base = isset( $_GET['legacy-widget-preview']['idBase'] ) ? sanitize_key( wp_unslash( $_GET['legacy-widget-preview']['idBase'] ) ) : ''; return 'siteorigin-panels-postloop' === $id_base || 'siteorigin-panels-builder' === $id_base; } private static function is_layout_block_preview() { return isset( $_POST['action'] ) && $_POST['action'] == 'so_panels_layout_block_preview'; } /** * @param array $args * @param array $instance */ public function widget( $args, $instance ) { if ( empty( $instance['template'] ) ) { return; } // The Post Loop widget should only preview in WP Admin if it's a Layout Block preview, or a legacy Widget Block preview. if ( is_admin() && ! self::is_legacy_widget_block_preview() && ! self::is_layout_block_preview() ) { return; } static $depth = 0; $depth++; if ( $depth > 1 ) { // Because of infinite loops, don't render this post loop if its inside another $depth--; echo $args['before_widget'] . $args['after_widget']; return; } $query_args = $instance; //If Widgets Bundle post selector is available and a posts query has been saved using it. if ( function_exists( 'siteorigin_widget_post_selector_process_query' ) && ! empty( $instance['posts'] ) ) { $query_args = siteorigin_widget_post_selector_process_query( $instance['posts'] ); $query_args['additional'] = empty( $instance['additional'] ) ? array() : $instance['additional']; } else { if ( ! empty( $instance['posts'] ) ) { // This is using the new WB 1.9 posts field $query_args = wp_parse_args( $instance['posts'], $query_args ); } if ( ! empty( $query_args['sticky'] ) ) { switch( $query_args['sticky'] ) { case 'ignore': $query_args['ignore_sticky_posts'] = 1; break; case 'only': $query_args['post__in'] = get_option( 'sticky_posts' ); break; case 'exclude': $query_args['post__not_in'] = get_option( 'sticky_posts' ); break; } } unset( $query_args['template'] ); unset( $query_args['title'] ); unset( $query_args['sticky'] ); if ( empty( $query_args['additional'] ) ) { $query_args['additional'] = array(); } } $query_args = wp_parse_args( $query_args['additional'], $query_args ); unset( $query_args['additional'] ); global $wp_rewrite; if ( $wp_rewrite->using_permalinks() ) { if ( apply_filters( 'siteorigin_panels_post_loop_custom_pagination', false ) ) { if ( isset( $instance['pagination_id'] ) ) { self::$current_pagination_id = $instance['pagination_id']; if ( isset( $_GET[ 'page-' . self::$current_pagination_id ] ) && is_numeric( $_GET[ 'page-' . self::$current_pagination_id ] ) ) { $query_args['paged'] = (int) $_GET[ 'page-' . self::$current_pagination_id ]; } } } else { if ( get_query_var( 'paged' ) ) { // When the widget appears on a sub page. $query_args['paged'] = get_query_var( 'paged' ); } elseif ( strpos( $_SERVER['REQUEST_URI'], '/page/' ) !== false ) { // When the widget appears on the home page. preg_match( '/\/page\/([0-9]+)\//', $_SERVER['REQUEST_URI'], $matches ); if ( ! empty( $matches[1] ) ) { $query_args['paged'] = (int) $matches[1]; } else { $query_args['paged'] = 1; } } } if ( ! isset( $query_args['paged'] ) ) { $query_args['paged'] = 1; } } else { // Get current page number when we're not using permalinks $query_args['paged'] = isset( $_GET['paged'] ) ? (int) $_GET['paged'] : 1; } // Exclude the current post to prevent possible infinite loop global $siteorigin_panels_current_post; if ( apply_filters( 'siteorigin_panels_postloop_exclude_current_post', true ) && ! empty( $siteorigin_panels_current_post ) ) { if ( ! empty( $query_args['post__not_in'] ) ) { if ( ! is_array( $query_args['post__not_in'] ) ) { $query_args['post__not_in'] = explode( ',', $query_args['post__not_in'] ); $query_args['post__not_in'] = array_map( 'intval', $query_args['post__not_in'] ); } $query_args['post__not_in'][] = $siteorigin_panels_current_post; } else { $query_args['post__not_in'] = array( $siteorigin_panels_current_post ); } } if ( ! empty( $query_args['post__in'] ) && ! is_array( $query_args['post__in'] ) ) { $query_args['post__in'] = explode( ',', $query_args['post__in'] ); $query_args['post__in'] = array_map( 'intval', $query_args['post__in'] ); } // Create the query query_posts( apply_filters( 'siteorigin_panels_postloop_query_args', $query_args ) ); echo $args['before_widget']; // Filter the title $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . wp_kses_post( $instance['title'] ) . $args['after_title']; } global $more; $old_more = $more; $more = empty( $instance['more'] ); self::$rendering_loop = true; self::$current_loop_instance = $instance; self::$current_loop_template = $instance['template']; if ( preg_match( '/\/content*/', '/' . $instance['template'] ) ) { while ( have_posts() ) { the_post(); self::locate_template( $instance['template'], true, false ); } } else { self::locate_template( $instance['template'], true, false ); } self::$rendering_loop = false; self::$current_loop_instance = null; self::$current_loop_template = null; self::$current_pagination_id = null; echo $args['after_widget']; // Reset everything wp_reset_query(); $depth--; } /** * Display the form for the post loop. * * @param array $instance * * @return string|void */ public function form( $instance ) { $templates = $this->get_loop_templates(); if ( empty( $templates ) ) { ?>

get_helper_widget( $templates ); $helper->form( $instance ); } else { $instance = wp_parse_args( $instance, array( 'title' => '', 'template' => 'loop.php', // Query args 'post_type' => 'post', 'posts_per_page' => '', 'order' => 'DESC', 'orderby' => 'date', 'sticky' => '', 'additional' => '', 'more' => false, ) ); ?>

/>

true ) ); $post_types = array_values( $post_types ); $post_types = array_diff( $post_types, array( 'attachment', 'revision', 'nav_menu_item' ) ); ?>

$1', esc_html__( 'Additional query arguments. See 1{query_posts}.', 'siteorigin-panels' ) ); ?>

helper ) && class_exists( 'SiteOrigin_Widget' ) && class_exists( 'SiteOrigin_Widget_Field_Posts' ) ) { $this->helper = new SiteOrigin_Panels_Widgets_PostLoop_Helper( $templates ); } // These ensure the form fields name attributes are correct. $this->helper->id_base = $this->id_base; $this->helper->id = $this->id; $this->helper->number = $this->number; return $this->helper; } }