Skip to content

Commit

Permalink
Replaces is_admin() with custom check
Browse files Browse the repository at this point in the history
  • Loading branch information
cabrerahector committed Jun 11, 2014
1 parent 4d51c1d commit a112b8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions views/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
4 changes: 2 additions & 2 deletions wordpress-popular-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
}

Expand Down

0 comments on commit a112b8e

Please sign in to comment.