/** * 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; }
/** * config data * @param $values * @param $fieldname */ public static function config($values, $fieldname) { if (!isset($values[$fieldname])) { return; } //valid form data self::valid_form_data(); if (!empty($values[$fieldname]['config'])) { $configuration = HW_Encryptor::decrypt($values[$fieldname]['config']); } else { $configuration = array(); } return (object) $configuration; }