/**
  * setup form fields
  */
 public function setUp()
 {
     // Set the root menu
     $this->setRootMenuPage('Settings');
     // specifies to which parent menu to add.
     // Add the sub menus and the pages
     $this->addSubMenuItems(array('title' => 'Lưu cấu hình widgets', 'page_slug' => self::PAGE_SLUG));
     //define tabs
     $this->addInPageTabs(self::PAGE_SLUG, array('tab_slug' => 'widgets-config', 'title' => __('Cấu hình widgets')));
     $this->setInPageTabTag('h2');
     // sets the tag used for in-page tabs
     //init fields
     $this->addSettingFields(array('field_id' => 'list_saved_widgets_setting', 'type' => 'hw_admin_table', 'title' => '', 'show_title_column' => false, 'WP_List_Table' => 'HW_List_Table_Widgets_settings', 'columns' => array('id' => __('ID'), 'name' => __('Tên'), 'group' => __('Nhóm'), 'widget' => __('Widget'), 'description' => __('Mô tả'), 'setting' => __('Config')), 'sortable_columns' => array('id' => array('id', false), 'name' => array('name', false), 'group' => array('group', false))));
     /*$this->addSettingFields(
                 array(
                     'field_id' => 'test',
                     'type' => 'text',
                     'title' => 'Title 1',
     
                 )
             );*/
     //actions
     if (class_exists('HW_HELP')) {
         $page_hook = HW_HELP::load_settings_page_hook_slug(self::PAGE_SLUG);
     } else {
         $page_hook = 'load-settings_page_' . self::PAGE_SLUG;
     }
     add_action($page_hook, array($this, '_add_options'));
     if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen('hw_widgets_settings')) {
         add_action('admin_enqueue_scripts', array($this, '_admin_enqueue_scripts'));
     }
 }
 /**
  * for backend
  */
 public function _admin_enqueue_scripts()
 {
     if (HW_HOANGWEB::is_current_screen('widgets')) {
         //ckeditor
         HW_Libraries::enqueue_jquery_libs('ckeditor');
         wp_enqueue_script('media');
         wp_enqueue_media();
     }
 }
Exemplo n.º 3
0
 /**
  * whether current context is widgets page
  * @return bool
  */
 public static function is_widgets_page()
 {
     return HW_HOANGWEB::is_current_screen(array('widgets'));
 }
 /**
  * @wp_hook action admin_enqueue_scripts
  */
 public function _admin_enqueue_scripts()
 {
     if (HW_HOANGWEB::is_current_screen(array('widgets'))) {
         $this->enqueue_script('title_link.js', array('jquery'));
         // plugins_url('/title_link.js', __FILE__)
         //wp link poup
         wp_enqueue_script('wplink');
         wp_enqueue_script('wpdialogs');
         wp_enqueue_script('wpdialogs-popup');
         //also might need this
         // need these styles
         wp_enqueue_style('wp-jquery-ui-dialog');
         wp_enqueue_style('editor.min.css', includes_url('css/editor.min.css'), null);
         wp_enqueue_style('thickbox');
     }
 }
 /**
  * enqueue scripts/stylesheets in admin
  * @hook admin_enqueue_scripts
  */
 public function _admin_enqueue_scripts()
 {
     if (HW_HOANGWEB::is_current_screen('hw_widgets_settings')) {
         wp_enqueue_script('hw_awc_widgetfeature_js', plugins_url('scripts.js', __FILE__));
         wp_localize_script('hw_awc_widgetfeature_js', '__hw_awc_widgetfeature_saveconfig', array());
     }
 }
 /**
  * admin enqueue scripts
  * @hook admin_enqueue_scripts
  */
 public function _admin_enqueue_scripts()
 {
     if (class_exists('HW_HOANGWEB', false) && HW_HOANGWEB::is_current_screen('pagenavi')) {
         wp_enqueue_style('hw-pagenavi-style', HW_PAGENAVI_URL . '/css/style.css');
     }
 }
 /**
  * before output hw_skin apf field
  * @param $skin: HW_SKIN object
  * @param $Output: chunk of string to output
  * @param $field_output: field output in string
  */
 public function _apf_hwskin_field_output($aOutput = array(), $skin, $field_output = '')
 {
     if (class_exists('HW_HOANGWEB') && !HW_HOANGWEB::is_current_screen(self::page_setting_slug)) {
         return $aOutput;
     }
     $aOutput[] = '<div>Lưu ý: Những tùy chọn cài đặt này là options của skin bạn đã áp dụng cho menu và sẽ được bổ xung vào tùy các cài đặt mặc định của skin. VD: container_class, menu_class..</div>';
     return $aOutput;
 }
Exemplo n.º 8
0
 /**
  * admin enqueue scripts hook
  */
 function _hwrp_admin_enqueue_scripts()
 {
     if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen('hw_yarpp')) {
         //ajax url
         $nonce = wp_create_nonce("hwrp_load_more_skins_nonce");
         $load_skins_ajax_link = admin_url('admin-ajax.php?action=hwrp_load_more_skins&nonce=' . $nonce);
         $this->localize_data['load_skins_ajax'] = $load_skins_ajax_link;
         wp_enqueue_script('hwrp-admin-js', HWRP_PLUGIN_URL . '/js/hwrp-admin-js.js', array('jquery'));
         wp_enqueue_style('hwrp-style', HWRP_PLUGIN_URL . '/css/hwrp-style.css');
         wp_localize_script('hwrp-admin-js', '__hwrp_object', $this->localize_data);
     }
 }
 /**
  * enqueue script/stylesheet for admin
  */
 public function _admin_enqueue_scripts()
 {
     if (class_exists('HW_HOANGWEB') and HW_HOANGWEB::is_current_screen('breadcrumb-navxt')) {
         wp_enqueue_style('hw-bcn-style', HW_BREADCRUMB_URL . '/css/style.css');
         wp_enqueue_script('hw-bcn-js', HW_BREADCRUMB_URL . '/js/js.js');
         wp_localize_script('hw-bcn-js', '__hw_breadcrumb', array());
     }
 }
 /**
  * setup form fields
  */
 public function setUp()
 {
     $current_module_tab = hw__get('module');
     //get current module setting tab $_GET['tab']==$_GET['module']
     if (HW_HOANGWEB::is_current_screen(self::PAGE_SLUG) && hw__get('tab') && $current_module_tab && (!HW_Module::is_active($current_module_tab) || isset(self::$modules[$current_module_tab]) && !self::$modules[$current_module_tab]->option('enable_tab_settings'))) {
         wp_die('Xin lỗi: Module này chưa kích hoạt hoặc không có form cài đặt.');
     }
     // Set the root menu (http://admin-page-framework.michaeluno.jp/en/v2/classes/AdminPageFramework_Menu.html)
     #$this->setRootMenuPage( 'Settings' );        // specifies to which parent menu to add.
     $this->setRootMenuPage('(H) Cấu hình modules', HW_HOANGWEB_URL . '/images/ie-gear-icon.png');
     // Add the sub menus and the pages/ addSubMenuItems
     $this->addSubMenuItem(array('title' => 'Cấu hình modules', 'page_slug' => self::PAGE_SLUG));
     /*$this->addSubMenuItem(array(
           'title' => 'sdf',
           'href' =>  self::get_module_setting_page('abc'),
           #'page_slug'    =>    self::PAGE_SLUG
       ));*/
     //define tabs
     $this->addInPageTabs(self::PAGE_SLUG, array('tab_slug' => 'modules-config', 'title' => __('Cấu hình chung')));
     //add more tabs
     foreach (self::$modules as $name => $inst) {
         $info = HW_Plugins_Manager::get_module($name);
         if (!empty($info) && $inst->option('enable_tab_settings')) {
             $this->addInPageTab(array('tab_slug' => $name, 'title' => $info['name']));
             // load + page slug + tab slug
             add_action('load_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, '_replyToAddFormElements'));
             //triggered before rendering the page.
             add_action('do_before_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'do_before_tab_hook'));
             // triggered in the middle of rendering the page.
             add_action('do_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'do_tab_hook'));
             //triggered after rendering the page
             add_action('do_after_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'do_after_tab_hook'));
             /**
              * filters
              */
             //receives the output of the middle part of the page including form input fields.
             add_filter('content_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'content_tab_filter'));
             /*
                            ==> find in : hw-hoangweb\lib\admin-page-framework\development
                             //receives the output of the top part of the page.
                             add_filter('head_'. self::PAGE_SLUG  . '_' . self::valid_tab_slug($name), array($inst, 'head_tab_filter'));
             
                             // receives the output of the bottom part of the page.
                             add_filter('foot_'. self::PAGE_SLUG  . '_' . self::valid_tab_slug($name), array($inst, 'foot_tab_filter'));
             
                             //receives the exporting array sent from the tab page.
                             add_filter('export_'. self::PAGE_SLUG  . '_' . self::valid_tab_slug($name), array($inst, 'export_tab_filter'));
                             //receives the importing array submitted from the tab page.
                             add_filter('import_'. self::PAGE_SLUG  . '_' . self::valid_tab_slug($name), array($inst, 'import_tab_filter'));
             */
             #add_filter(''. self::PAGE_SLUG  . '_' . self::valid_tab_slug($name), array($inst, 'tab_filter'));
             //receives the output of the CSS rules applied to the tab page of the slug.
             add_filter('style_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'print_styles'));
             //receives the output of the JavaScript script applied to the tab page of the slug.
             add_filter('script_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, 'print_scripts'));
             //receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
             add_filter('validation_' . self::PAGE_SLUG . '_' . self::valid_tab_slug($name), array($inst, '_validation_tab_filter'));
         }
     }
     $this->setInPageTabTag('h2');
     // sets the tag used for in-page tabs
     //submit button
     /*$this->addSettingFields(
           array(
               'field_id' => 'submit_button',
               'type' => 'submit',
               'show_title_column' => false,
           )
       );*/
 }
 /**
  * admin enqueue scripts
  */
 public function _admin_enqueue_scripts()
 {
     if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen(array('hw_navmenu_settings', 'nav-menus'))) {
         wp_enqueue_media();
         wp_enqueue_style('hw-menu-admin-style', HW_MENU_URL . '/css/hw-menu-style.css');
         wp_enqueue_script('hw-menu-js', HW_MENU_URL . '/js/hw-menu-js.js', array('jquery'));
         wp_localize_script('hw-menu-js', '__hw_navmenu', array());
         //should do after localize script
         wp_enqueue_script('hw-menu-item-custom-field', HW_MENU_URL . '/js/hw-menu-item-custom-field.js', array('hw-menu-js'));
     }
 }
 /**
  * @hook admin_enqueue_scripts
  * enqueue scripts/styles
  */
 public function _admin_enqueue_scripts()
 {
     if (HW_HOANGWEB::is_current_screen('hoangweb-theme-options')) {
         HW_Libraries::enqueue_jquery_libs('jquery-colorbox');
         //jquery colorbox lib
     }
 }
 /**
  * put stylesheet & js together on admin head page
  */
 public function _hw_awc_admin_enqueue_scripts()
 {
     global $wp_customize;
     //get working page
     if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen(array('widgets', 'hw_sidebar_widgets_settings')) || !empty($wp_customize)) {
         wp_enqueue_style('hw-awc-style', HW_AWC_URL . '/style.css');
         wp_enqueue_script('hw-awc-script', HW_AWC_URL . '/js/hw-awc-admin-js.js', array('jquery'));
         #wp_enqueue_script('jscolor', HW_AWC_URL.('/js/jscolor/jscolor.js'));    //jscolor lib
         HW_Libraries::enqueue_jquery_libs('colors/jscolor');
         wp_localize_script('hw-awc-script', 'HW_AWC', array());
         //create js object for this module
         //load media upload box in admin
         wp_enqueue_script('thickbox');
         wp_enqueue_style('thickbox');
         wp_enqueue_script('media-upload');
     }
     /*if(HW_HOANGWEB::is_current_screen('widgets')){        //wp link popup moved to new widget feature
     
                 // need these styles
                 wp_enqueue_style('wp-jquery-ui-dialog');
                 wp_enqueue_style('editor.min.css', includes_url('css/editor.min.css'), null);
             }*/
 }
 /**
  * @hook load + page slug + tab slug
  * @param $oAdminPage
  */
 public function replyToAddFormElements_tab_my_posttype_settings($oAdminPage)
 {
     if (HW_HOANGWEB::is_current_screen('hw_settings')) {
         //post type tab
         $this->setUp_tab_posttype($oAdminPage, 'my_posttype_settings');
         //post type setting
     }
 }
 /**
  * callback the hook 'admin_enqueue_scripts' to enqueue stuff to backend in head
  * @hook admin_enqueue_scripts
  */
 public function _admin_enqueue_scripts()
 {
     if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen(array('post', 'metaslider', 'hwml_shortcode'))) {
         wp_enqueue_style('hwml-admin-css', HWML_PLUGIN_URL . '/css/admin-style.css');
     }
     //wp_localize_script('hw-skin-js-', 'hw_skinxx',$this->skins_data);
 }
Exemplo n.º 16
0
 /**
  * whether in current module setting page
  * @return bool
  */
 public function is_module_setting_page()
 {
     if (HW_HOANGWEB::is_current_screen(HW_Module_Settings_page::PAGE_SLUG) && hw__get('tab') == HW_Module_Settings_page::valid_tab_slug($this->option('module_name'))) {
         return true;
     }
     return false;
 }