/**
  * update skin config status
  */
 public static function _hw_update_skin_enqueue_status()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "hw_update_skin_enqueue_status_nonce")) {
         exit("No naughty business please");
     }
     if (!isset($_REQUEST['config_id'])) {
         echo 'Không tìm thấy config này';
         return;
     }
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
         //$result = json_encode($result);
         hwskin_update_skin_enqueue_status(hw__req('config_id'), hw__req('status'));
         echo 'Đã ' . (hw__req('status') ? "kích hoạt" : "hủy kích hoạt") . " preload cho skin ID=" . hw__req('config_id');
     } else {
         header("Location: " . $_SERVER["HTTP_REFERER"]);
     }
     die;
 }
/**
 * get search query
 * @return string|void
 */
function hw_admin_search_query($name = 's')
{
    return esc_attr(wp_unslash(hw__req($name)));
}
 /**
  * hw_html field callback
  * @callback hw_html field
  */
 public function modules_installation_page()
 {
     if (!isset($_GET['tab'])) {
         $_GET['tab'] = 'shows';
     }
     if ($_GET['tab'] == 'upload') {
         //after upload complete
         if (APF_hw_upload_field::is_success() && hw__req('action') == 'upload-module') {
             $this->do_upload_module();
         } else {
             hw_include_template('module-upload');
         }
         return;
     } elseif ($_GET['tab'] == 'shows' && hw__req('action') != 'install-module') {
         $this->shows();
     } else {
         if (hw__req('action') == 'install-module') {
             $this->do_install_module();
         }
     }
 }
 /**
  * return ajax handle
  */
 public static function get_active_ajax_handle()
 {
     $handle = hw__req('ajax_name');
     return self::register_ajax($handle);
 }
Example #5
0
 /**
  * fields setting for managing sidebars tab
  */
 private function setting_form_sidebars_tab()
 {
     global $wp_registered_sidebars;
     //if(count($wp_registered_sidebars)) $sidebar = reset($wp_registered_sidebars);
     #else
     $sidebar = array();
     //del sidebar
     if (hw__req('del_sidebar')) {
         hwawc_unregister_sidebar(hw__req('del_sidebar'));
     }
     if (hw__req('edit')) {
         $param = hwawc_get_registers_sidebars(hw__req('edit'));
         $sidebar = array_merge($sidebar, $param);
     }
     //add tab
     $setting_tab = $this->add_tab(array('id' => 'sidebars', 'title' => 'Quản lý Sidebars', 'description' => 'Quản lý Sidebars'));
     $setting_tab->addFieldLabel('Danh sách sidebars');
     $setting_tab->addFields(array('field_id' => 'list-registered-sidebars', 'type' => 'hw_html', 'output_callback' => array($this, 'list_registers_sidebars'), 'show_title_column' => false));
     $setting_tab->addFieldLabel('Thêm sidebar');
     $setting_tab->addFieldLabel(array('description' => '<a href="' . $this->get_setting_page_url() . '">Thêm mới sidebar</a>'));
     $setting_tab->addFields(array('field_id' => 'sidebar_name', 'type' => 'text', 'title' => 'Tên sidebar', 'description' => 'Tên sidebar', 'value' => isset($sidebar['name']) ? $sidebar['name'] : ''), array('field_id' => 'sidebar_desc', 'type' => 'text', 'title' => 'Mô tả', 'description' => 'Mô tả sidebar.', 'value' => isset($sidebar['description']) ? $sidebar['description'] : ''), array('field_id' => 'before_widget', 'type' => 'text', 'title' => 'Before Widget', 'value' => isset($sidebar['before_widget']) ? $sidebar['before_widget'] : '', 'description' => htmlentities('Vd: <div id="%1$s" class="boxtourhome %2$s *1" >')), array('field_id' => 'before_title', 'type' => 'text', 'title' => 'Before title', 'value' => isset($sidebar['before_title']) ? $sidebar['before_title'] : '', 'description' => htmlentities('Vd: <h2 class="titteA" style="%1$s {css_title}">')), array('field_id' => 'after_title', 'type' => 'text', 'title' => 'After title', 'value' => isset($sidebar['after_title']) ? $sidebar['after_title'] : '', 'description' => htmlentities('vd: </h2>')), array('field_id' => 'after_widget', 'type' => 'text', 'title' => 'After Widget', 'value' => isset($sidebar['after_widget']) ? $sidebar['after_widget'] : '', 'description' => htmlentities('</div>')));
 }
 /**
  * @ajax hw_run_cli
  */
 public function _ajax_run_cli_command()
 {
     $cmd = hw__req('_cmd');
     $subcmd = hw__req('_subcmd');
     $params = hw__req('_params', '');
     $module = $this->get_active_module_from_installer($cmd);
     //refer to hw-import module
     //if(empty($module)) $module = HW_Module_Settings_page::get_modules('hw-importer'); //default module for installer, intergate in get_active_module_from_installer
     $config = $module->get_config();
     $script = $config->get_cli_cmd($subcmd, $params, $cmd);
     #__print($script);
     if (!empty($script)) {
         $this->realtime_exec($script, array($this, '_cli_command_output'));
     }
 }