Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter Cheon, YoungMin

    (@082net)

    This issue still not fixed after 5 months ??

    The code below is having a huge impact on the site’s performance!

    It filters all content of all post types and do all shortcodes to that contents (easydocs/shortcodes/reference.php)

    add_filter( 'the_content', function ( $ezd_content ) {
    	$ezd_options      = get_option( 'eazydocs_settings' );
    	$is_notes_title   = $ezd_options['is_footnotes_heading'] ?? '1';
    	$notes_title_text = $ezd_options['footnotes_heading_text'] ?? __( 'Footnotes', 'eazydocs' );
    	$footnotes_column = $ezd_options['footnotes_column'] ?? '1';
    
    	$all_shortcodes = ezd_all_shortcodes( $ezd_content );
    	$all_shortcoded = '';
    	foreach ( $all_shortcodes as $all_shortcode ) {
    		$all_shortcoded .= '<span>' . do_shortcode( $all_shortcode[0] ) . '</span>';
    	}
    
    	$ezd_footnote_title = '';
    	if ( ! empty( $notes_title_text ) && $is_notes_title == '1' && has_shortcode( $ezd_content, 'reference' ) ) {
    		$ezd_footnote_title = sprintf( '<div class="ezd-footnote-title">%s</div>', $notes_title_text );
    	}
    
    	$footnotes_contents = '';
    	if ( has_shortcode( $ezd_content, 'reference' ) ) {
    		$footnotes_contents = $ezd_footnote_title . "<div ezd-data-column='" . $footnotes_column . "' class='ezd-footnote-footer'>" . $all_shortcoded
    		                      . "</div>";
    	}
    
    	return $ezd_content . $footnotes_contents;
    } );

    You should apply this filter to certain post types ONLY

    And ONLY when the content has ‘reference’ shortcode

    Or at least provide a function name so we can remove the filter.

    function ezd_reference_content_filter($content) {
        $types = apply_filters('ezd_xxxx', ['doc']);
        if ( !in_array( get_post_type(), $types ) || !has_shortcode( $content, 'reference' ) ) {
            return $content;
        }
        xxxxxx
        xxxxxx
        return $content;
    }
    add_filter( 'the_content', 'ezd_reference_content_filter' );

    Thanks in advance

    I am waiting for this security patch as well

    Hosting provider recommended me to delete plugins right now ??

    Thread Starter Cheon, YoungMin

    (@082net)

    Thank you for your reply, I’ll wait for next updates.

    Thread Starter Cheon, YoungMin

    (@082net)

    I’m using Flexible Posts Widget plugin. It has another issue with SiteOrigin Builder on ‘hooks’, but still you may debug passed form-values.

    BTW, I’ve made a simple patch for this issue with help of $.deparam method from jQuery BBQ Plugin.

    /*
     * jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
     * https://benalman.com/projects/jquery-bbq-plugin/
     *
     * Copyright (c) 2010 "Cowboy" Ben Alman
     * Dual licensed under the MIT and GPL licenses.
     * https://benalman.com/about/license/
     */
     // borrowed only $.deparam method
    (function($){$.deparam=m=function(L,I){var t=decodeURIComponent,K={},J={"true":!0,"false":!1,"null":null};$.each(L.replace(/\+/g," ").split("&"),function(O,T){var N=T.split("="),S=t(N[0]),M,R=K,P=0,U=S.split("]["),Q=U.length-1;if(/\[/.test(U[0])&&/\]$/.test(U[Q])){U[Q]=U[Q].replace(/\]$/,"");U=U.shift().split("[").concat(U);Q=U.length-1}else{Q=0}if(N.length===2){M=t(N[1]);if(I){M=M&&!isNaN(M)?+M:M==="undefined"?h:J[M]!==h?J[M]:M}if(Q){for(;P<=Q;P++){S=U[P]===""?R.length:U[P];R=R[S]=P<Q?R[S]||(U[P+1]&&isNaN(U[P+1])?{}:[]):M}}else{if($.isArray(K[S])){K[S].push(M)}else{if(K[S]!==h){K[S]=[K[S],M]}else{K[S]=M}}}}else{if(S){K[S]=I?h:""}}});return K};})(jQuery);
    ......
    ......
    
            getFormValues: function(formSelector){
                if(typeof formSelector === 'undefined') {
                    formSelector = '.so-content';
                }
    
                var $f = this.$(formSelector);
    
                $f.wrap('<form></form>');
                // var data = $f.parent().serialize();
                var data = $.deparam( $f.parent().serialize() );
    
                return data;
            },
    ......
    ......

    {@Tim
    Jetpack Team Lead} We are aware of the issue and we are investigating methods to handle this. Thanks for the report.

    That posted 7 months ago, and the problem still exists ??

    Add lines below to custom-post-templates.php:176 (version 1.5)

    $post_templates = array();
    
    		$files = (array) $theme->get_files( 'php', 1 );
    		// MOD START
    		if ( $theme->parent() )
    			$files += (array) $theme->parent()->get_files( 'php', 1 );
    		// MOD END

    You can easily translate it yourself with ‘PoEdit‘.

    Leave a link or mail me when you’re done, I’ll apply it on next version.

    Thanks!

    I’ve just tested with WordPress 2.8.4 and it worked ??

    Did you mean SlimStat-Ex?

    Maybe it’s a pre-inserted(wp_slimex_resource) title while you have the problem.

    It was not a K2 bug.

    It’s the matter of when $wp_the_query->get_queried_object() is firstly called.

    As I mentioned above, $wp_the_query->post is overrod by $post.

    wp-settings.php
    $wp_the_query =& new WP_Query();
    $wp_query     =& $wp_the_query;
    
    wp-includes/class.php WP::register_globals()
    $GLOBALS['posts'] = & $wp_query->posts;
    $GLOBALS['post'] = & $wp_query->post;

    If a page haven’t called $wp_the_query->get_queried_object() before a ‘custom loop’ (or something overriding $post or $posts), get_queried_object_id() would retun last post id of the ‘custom loop’.

    $wp_the_query->get_queried_object() would not stable until it is firstly called before any plugin or theme.

    It seems stable ’cause it returns pre-set value if available.

    function get_queried_object() {
    	if (isset($this->queried_object)) {
    		return $this->queried_object;
    	}

    Because almost wordpress theme use ‘wp_title()’ for <title> </title> and wp_title call ‘wp_query->get_queried_object()’, there seems no problem.

    For current K2 does not use wp_title() but the_title() which does not call ‘get_queried_object’, this issue seems related to K2.

    Here’s my suggestion to wordpress and I think it will help make $wp_the_query stable.

    wp-includes/class.php ‘WP::query_posts()’

    function query_posts() {
    	global $wp_the_query;
    	$this->build_query_string();
    	$wp_the_query->query($this->query_vars);
    	$wp_the_query->get_queried_object();// add this line
    }

    And temporary patch for K2 is replacing the_title() with wp_title() on header.php but it will not solve the whole problem.

    I had a big mistake on my testing. I’ve tested with $wp_the_query->post->ID not with $wp_the_query->get_queried_object_id(), so it returned wrong(overridden) value. ( I thought they are the same ?? )

    BTW, $wp_the_query->queried_object_id was overrode by K2 and $wp_the_query->get_queried_object_id() always returned last post id of recent entries on wp_footer or shutdown hook when it has a ‘latest posts’ module on single post page.

    I’ll report this to K2 team and ask them if it’s a bug.

    I was wrong, it’s not about WP_Query but $post.

    $post variable overrides $wp_query->post and $wp_the_query->post.

    And any plugin or theme using ‘custom loop’ would replace the wordpress $post, and ‘latest post’ sidebar module is one of them.

    e.g.
    foreach($myposts as $post) {……}
    or
    while($myposts->have_posts): $myposts->the_post(); …… endwhile;

    $myposts would be get_posts(‘query…’) or new WP_Query(‘query…’)

    Since almost stat plugin do their job at the end of the page load, they got overridden post values.

    And here’s a temporary patch.

    WordPress.com Stats
    Find :

    if ( ( $wp_the_query->is_single || $wp_the_query->is_page ) && !$wp_the_query->is_attachment )
    		$a['post'] = $wp_the_query->get_queried_object_id();
    	else

    Replace with :

    if ( ( $wp_the_query->is_single || $wp_the_query->is_page ) && !$wp_the_query->is_attachment ) {
    		$wp_the_query->rewind_posts();
    		$a['post'] = $wp_the_query->get_queried_object_id();
    	} else

    SlimStat-Ex
    (I’ll update this plugin soon.)
    Find : (inside of function _getPostTitle – lib/functions.php)

    if($track) {
    			$_query =& $wp_query;
    		} else {

    Replace with :

    if($track) {
    			$_query =& $wp_query;
    			$_query->rewind_posts();
    		} else {

Viewing 13 replies - 1 through 13 (of 13 total)