Exemplo n.º 1
0
/**
 * ajax  handle callback
 * @hook wp_ajax_{hw_help_popup}
 */
function hw_ajax_hw_help_popup()
{
    if (!wp_verify_nonce($_REQUEST['nonce'], "hw-module-help-nonce")) {
        exit("No naughty business please");
    }
    if (!isset($_REQUEST['file'])) {
        return;
    }
    HW_HOANGWEB::load_class('HW_WP');
    //enqueue syntax highlighter library
    if (class_exists('HW_Libraries', false)) {
        HW_Libraries::enqueue_jquery_libs('syntaxhighlighter_3.0.83');
        HW_Libraries::get('syntaxhighlighter_3.0.83')->enqueue_scripts('shBrushJScript.js', 'shBrushXml.js', 'shBrushPhp.js');
    }
    $file = HW_Encryptor::decrypt(urldecode($_REQUEST['file']));
    if (file_exists($file)) {
        echo file_get_contents($file);
    }
    HW_WP::hw_clean_wp_head();
    //wp_head();
    wp_footer();
    //init SyntaxHighlighter
    echo '
        <script type="text/javascript">
    //SyntaxHighlighter
    if(typeof SyntaxHighlighter != "undefined") SyntaxHighlighter.all();
    </script>
    ';
    die;
}
Exemplo n.º 2
0
<?php

//mimic the actuall admin-ajax
define('DOING_AJAX', true);
define('WP_DEBUG', false);
//turn off debug
if (!isset($_REQUEST['action'])) {
    die('-1');
}
//make sure you update this line
//to the relative location of the wp-load.php
//require_once('../../../wp-load.php');
#$_SERVER['HTTP_HOST'] = 'yourdomain.com';
ini_set('display_errors', true);
include 'classes/class-core.php';
HW_WP::load_wp();
function switch_to_blog_cache_clear($blog_id, $prev_blog_id = 0)
{
    if ($blog_id === $prev_blog_id) {
        return;
    }
    wp_cache_delete('notoptions', 'options');
    wp_cache_delete('alloptions', 'options');
}
add_action('switch_blog', 'switch_to_blog_cache_clear', 10, 2);
/**
 * END LOAD WORDPRESS
 */
#switch_to_blog( 31 );
#var_dump(get_bloginfo('name'));
#restore_current_blog();
Exemplo n.º 3
0
 /**
  * @param $callback
  */
 public static function change_footer_stuffs($callback)
 {
     if (is_callable($callback)) {
         self::$footer_output = $callback;
     }
     add_action('wp_footer', array(__CLASS__, '_start_footer_ob'), 1);
     add_action('wp_footer', array(__CLASS__, '_end_footer_ob'), 10000);
 }