got_infinity() static public method

Has infinite scroll been triggered?
static public got_infinity ( )
 /**
  * Show Post Flair on Infinite Scroll queries, only if it should show for regular queries as well.
  *
  * @param bool $show
  * @param bool $default
  * @uses The_Neverending_Home_Page::got_infinity
  * @filter post_flair_should_show
  * @return bool
  */
 function wpcom_infinite_scroll_show_postflair($show, $default)
 {
     if ($default && The_Neverending_Home_Page::got_infinity()) {
         $show = true;
     }
     return $show;
 }
Esempio n. 2
0
 public static function outputStart()
 {
     if (class_exists('The_Neverending_Home_Page', false) && The_Neverending_Home_Page::got_infinity()) {
         add_filter('infinite_scroll_results', "N2Wordpress::infiniteScrollRenderEnd", 1, 3);
     } else {
         self::$nextend_wp_head = true;
         if (N2Settings::get('safemode') != 1) {
             ob_start("N2Wordpress::platformRenderEnd");
             ob_start();
         }
     }
 }
Esempio n. 3
0
    }
    new The_Neverending_Home_Page();
}
add_action('init', 'the_neverending_home_page_init', 20);
/**
 * Check whether the current theme is infinite-scroll aware.
 * If so, include the files which add theme support.
 */
function the_neverending_home_page_theme_support()
{
    $theme_name = get_stylesheet();
    $customization_file = apply_filters('infinite_scroll_customization_file', dirname(__FILE__) . "/themes/{$theme_name}.php", $theme_name);
    if (is_readable($customization_file)) {
        require_once $customization_file;
    }
}
add_action('after_setup_theme', 'the_neverending_home_page_theme_support', 5);
/**
 * Early accommodation of the Infinite Scroll AJAX request
 */
if (The_Neverending_Home_Page::got_infinity()) {
    /**
     * If we're sure this is an AJAX request (i.e. the HTTP_X_REQUESTED_WITH header says so),
     * indicate it as early as possible for actions like init
     */
    if (!defined('DOING_AJAX') && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtoupper($_SERVER['HTTP_X_REQUESTED_WITH']) == 'XMLHTTPREQUEST') {
        define('DOING_AJAX', true);
    }
    // Don't load the admin bar when doing the AJAX response.
    show_admin_bar(false);
}