public function get_fields(&$sections) { //get all my custom metaslider if (class_exists('HWML_Slider_Settings_Metabox')) { $edit_slider_link = HWML_Slider_Settings_Metabox::get_edit_sliders_url(); $edit_hw_slider_link = HWML_Slider_Settings_Metabox::get_edit_hw_sliders_url(); $ml_slides = HWML_Slider_Settings_Metabox::get_all_mlsliders(); $hw_sliders = hwml_get_all_sliders(); //hwml_shortcode posts list } else { $edit_slider_link = admin_url('admin.php?page=hw-metaslider'); $edit_hw_slider_link = ''; $ml_slides = array(); $hw_sliders = array(); } if (class_exists('HW_HELP')) { //$gmap_help = HW_HELP_HOANGWEB::current()->help_static_link('gmap.html'); //old way $gmap_help = HW_HELP::generate_help_popup(array('HW_HELP_HOANGWEB', 'gmap.html'), 'Hướng dẫn.'); } else { $gmap_help = ''; } //general settings $sections['general'] = array('icon' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_151_edit.png', 'title' => 'Thông tin', 'fields' => array('site_name' => array('id' => 'site_name', 'type' => 'text', 'title' => 'Tên website'), 'slogan' => array('id' => 'slogan', 'type' => 'text', 'title' => 'Khẩu hiệu'), 'admin_logo' => array('id' => 'admin_logo', 'type' => 'upload', 'title' => 'Logo', 'desc' => 'Logo hiển thị ở trang đăng nhập và trên website.', 'validate_callback' => array($this, 'validate_header_fields_cb')), 'site_banner' => array('id' => 'site_banner', 'type' => 'upload', 'title' => 'Banner', 'desc' => 'Banner hiển thị ở phần header của website.', 'validate_callback' => array($this, 'validate_header_fields_cb')), 'phone' => array('id' => 'phone', 'type' => 'text', 'title' => 'Số điện thoại', 'desc' => 'Nhập số hotline hiển thị trên web'), 'admin_email' => array('id' => 'admin_email', 'type' => 'text', 'title' => 'Email', 'desc' => 'Địa chỉ email.', 'validate' => 'email'), 'address' => array('id' => 'address', 'type' => 'text', 'title' => 'Địa chỉ bản đồ', 'desc' => 'Nhập khu vực/địa chỉ của bạn muốn xuất hiện trên bản đồ. ', 'sub_desc' => $gmap_help), 'home_slider_id' => array('id' => 'main_slider_id', 'type' => 'select', 'title' => 'Slider', 'desc' => 'Chọn slider', 'sub_desc' => 'Chọn slider chính. Thêm/sửa slider <a href="' . $edit_slider_link . '" target="_blank">tại đây</a>.', 'options' => $ml_slides), 'main_hw_slider' => array('id' => 'main_hw_slider', 'type' => 'select', 'title' => 'Hoangweb slider', 'sub_desc' => 'Chọn hoangweb slider. Thêm/sửa sliders, <a href="' . $edit_hw_slider_link . '" target="_blank">tại đây</a>', 'options' => $hw_sliders), 'testimonials' => array('id' => 'testimonials', 'type' => 'hw_ckeditor', 'title' => 'Testimonials', 'desc' => 'Lời chứng thực ở trang chủ.'), 'wp_head_script' => array('id' => 'wp_head_script', 'type' => 'textarea', 'title' => 'Chèn thêm scripts vào thẻ < head'), 'wp_footer_code' => array('id' => 'wp_footer_code', 'type' => 'textarea', 'title' => 'Chèn mã HTML, JS, CSS vào dưới chân website'))); }
/** * init class */ public static function init() { if (is_admin()) { if (class_exists('HWML_Shortcodes_List') && class_exists('HWML_Slider_Settings_Metabox') && current_user_can('administrator')) { new HWML_Shortcodes_List(HWML_Shortcodes_List::hwml_slider_posttype); // the post type slug //main metabox if (class_exists('HWML_Slider_Settings_Metabox')) { HWML_Slider_Settings_Metabox::setInstance(new HWML_Slider_Settings_Metabox(null, __('Tạo dữ liệu shortcode cho slider', 'hwml'), array(HWML_Shortcodes_List::hwml_slider_posttype), 'normal', 'low')); } //second metabox if (class_exists('HWML_Setting_Shortcode_Metabox')) { new HWML_Setting_Shortcode_Metabox(null, __('Nội dung Shortcode', 'hwml'), array(HWML_Shortcodes_List::hwml_slider_posttype), 'normal', 'low'); } /*new HWML_Setting_Shortcode_Metabox( //test for existing post type null, __('Nội dung','hwml'), array( 'post' ), 'normal', // context 'low' // priority );*/ } } }
/** * set class instance * @param $inst: an object instanceof this class */ public static function setInstance($inst) { if ($inst instanceof HWML_Slider_Settings_Metabox) { self::$instance = $inst; } }
/** * get all metalsliders data */ function hwmq_get_all_mlsliders() { return HWML_Slider_Settings_Metabox::get_all_mlsliders(); }