From a112b8ea511c28eb19a236b4908e80a3280c798f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Cabrera?= Date: Wed, 11 Jun 2014 15:51:15 -0430 Subject: [PATCH] Replaces is_admin() with custom check --- views/admin.php | 2 ++ wordpress-popular-posts.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/views/admin.php b/views/admin.php index fd67d8e3..cb17053b 100644 --- a/views/admin.php +++ b/views/admin.php @@ -2,6 +2,8 @@ if (basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__)) exit('Please do not load this page directly'); +define('WPP_ADMIN', true); + // Set active tab if ( isset($_GET['tab']) ) $current = $_GET['tab']; diff --git a/wordpress-popular-posts.php b/wordpress-popular-posts.php index e5969de3..09b42b1c 100644 --- a/wordpress-popular-posts.php +++ b/wordpress-popular-posts.php @@ -1569,7 +1569,7 @@ private function __get_popular_posts( $instance ) { $content = ""; // Fetch posts - if ( !is_admin() && $this->user_settings['tools']['cache']['active'] ) { + if ( !defined('WPP_ADMIN') && $this->user_settings['tools']['cache']['active'] ) { $transient_name = md5(json_encode($instance)); $mostpopular = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_transient( $transient_name ) @@ -1631,7 +1631,7 @@ private function __get_popular_posts( $instance ) { // Allow WP themers / coders access to raw data // so they can build their own output - if ( has_filter( 'wpp_custom_html' ) && !is_admin() ) { + if ( has_filter( 'wpp_custom_html' ) && !defined('WPP_ADMIN') ) { return apply_filters( 'wpp_custom_html', $mostpopular, $instance ); }