コード例 #1
0
 public function get_fields(&$sections)
 {
     if (class_exists('HW_NAVMENU_settings')) {
         $tip = '<a href="' . HW_NAVMENU_settings::get_admin_setting_page() . '">tại trang này</a>';
     } else {
         $tip = 'Kích hoạt plugin ' . hw_install_plugin_link('hw-menu', 'hw-menu') . '. Để thêm nút chọn ngôn ngữ vào menu.';
     }
     $sections['multilang'] = array('icon' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_266_flag.png', 'title' => 'Đa ngôn ngữ', 'fields' => array('mqtrans_multilang_guide' => array('id' => 'mqtrans_multilang_guide', 'type' => 'info', 'desc' => 'Chú ý: gắn nút chọn ngôn ngữ vào menu ' . $tip . '. Hoặc tự chèn vào template với shortcode: <code>[hw_multiLanguages]</code>' . '. Hoặc sử dụng widget "Đa ngôn ngữ".'), 'mqtrans_style' => array('id' => 'mqtrans_style', 'type' => 'select', 'title' => 'Kiểu hiển thị', 'options' => array('dropdown' => 'Danh sách chọn', 'image' => 'Hình ảnh', 'both' => 'Cả hình+chữ')), 'mqtrans_skin' => array('id' => 'mqtrans_skin', 'type' => 'hw_skin', 'title' => 'Giao diện', 'desc' => 'Giao diện chọn ngôn ngữ.', 'external_skins_folder' => 'hw_mqtrans_skins', 'skin_filename' => 'hw-mqtrans-skin.php', 'enable_external_callback' => false, 'skins_folder' => 'skins', 'apply_current_path' => plugin_dir_path(dirname(dirname(__FILE__))), 'plugin_url' => plugins_url('', dirname(dirname(__FILE__))), 'group' => 'langs-switcher'), 'enable_googletranslate' => array('id' => 'enable_googletranslate', 'type' => 'checkbox', 'title' => 'Google translate', 'desc' => 'Kích hoạt dịch vụ google translate.<br/><img src="' . HW_HOANGWEB_URL . '/images/pv_dm_inline_dropdown.png"/>', 'sub_desc' => 'Không hỗ trợ "kiểu hiển thị" & "Giao diện" ở trên.')));
     return $sections;
 }
コード例 #2
0
 public function hw_nhp_theme_options()
 {
     $args = array();
     $args['share_icons']['twitter'] = array('link' => 'http://twitter.com/hoangweb', 'title' => 'Folow me on Twitter', 'img' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_322_twitter.png');
     $args['share_icons']['linked_in'] = array('link' => 'http://www.linkedin.com/in/hoangweb', 'title' => 'Find me on LinkedIn', 'img' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_337_linked_in.png');
     $args['page_slug'] = 'hoangweb-theme-options';
     $args['show_import_export'] = true;
     //enable import/export settings
     $args['page_position'] = 102419882;
     $args['dev_mode'] = false;
     $install_video_manager = hw_install_plugin_link('video-list-manager', 'Cài đặt video', true);
     //video setting
     $sections['video'] = array('icon' => '', 'title' => 'Cài đặt Videos', 'fields' => array('support_posttype' => array('id' => 'support_posttype', 'type' => 'hw_post_type_multi_select', 'title' => 'Hỗ trợ post type', 'desc' => 'Chọn post type sử dụng quản lý đăng videos.' . $install_video_manager, 'options' => array())));
     new NHP_Options($sections, $args);
 }
コード例 #3
0
 /**
  * fields definition
  * @param $sections
  */
 public function get_fields(&$sections)
 {
     //install plugins link
     if (is_plugin_active('multi-image-metabox')) {
         $install_multi_image_link = hw_install_plugin_link('multi-image-metabox', 'Cài đặt');
     } else {
         $install_multi_image_link = '';
     }
     //help for multi image metabox
     if (class_exists('HW_HELP_HOANGWEB', false)) {
         //$multi_image_help = HW_HELP_HOANGWEB::current()->help_static_link('multi-image-metabox.html');
         $multi_image_help = HW_HELP::generate_help_popup(array('HW_HELP_HOANGWEB', 'multi-image-metabox.html'), 'Hướng dẫn.', 'Hướng dẫn Multi Image Metabox');
     } else {
         $multi_image_help = '';
     }
     //gallery
     $sections['gallery'] = array('icon' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_001_leaf.png', 'title' => 'Gallery', 'fields' => array('enable_multi_images' => array('id' => 'enable_multi_images', 'type' => 'checkbox', 'title' => 'Kích hoạt gallery ảnh', 'desc' => 'Kích hoạt gallery ảnh cho mỗi bài viết/post type. ' . $install_multi_image_link, 'sub_desc' => $multi_image_help), 'posttype_multi_images' => array('id' => 'posttype_multi_images', 'type' => 'hw_post_type_multi_select', 'title' => 'Chọn post types cho multi-images.', 'sub_desc' => 'Chọn một hoặc nhiều post type sử dụng tính năng gallery ảnh.', 'size' => 8), 'multi_images_num' => array('id' => 'multi_images_num', 'type' => 'text', 'title' => 'Số lượng multi-images.', 'sub_desc' => 'Số lượng ảnh gallery cho phép sử dụng.', 'std' => '200'), 'divide' => array('type' => 'hw_divide', 'label' => 'Envira Gallery'), 'envira_exclude_posttypes' => array('id' => 'envira_exclude_posttypes', 'type' => 'hw_post_type_multi_select', 'title' => 'Loại bỏ post types', 'sub_desc' => 'Chọn một hoặc nhiều post type không muốn tích hợp Envira gallery.')));
 }
コード例 #4
0
 /**
  * nhp theme options
  */
 public function _hw_nhp_theme_options()
 {
     $page_slug = self::HW_NHP_THEME_OPTIONS_PAGE_SLUG;
     //nhp theme options page slug
     $args = array();
     $args['share_icons']['twitter'] = array('link' => 'http://twitter.com/hoangweb', 'title' => 'Folow me on Twitter', 'img' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_322_twitter.png');
     $args['share_icons']['linked_in'] = array('link' => 'http://www.linkedin.com/in/hoangweb', 'title' => 'Find me on LinkedIn', 'img' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_337_linked_in.png');
     $args['opt_name'] = self::SETTINGS_OPTION_NAME;
     $args['menu_title'] = '(H) Chức năng';
     $args['page_title'] = 'Theme Options';
     $args['page_slug'] = $page_slug;
     $args['show_import_export'] = true;
     //enable import/export settings
     $args['page_position'] = 102419882;
     $args['dev_mode'] = false;
     $sections = array();
     global $pagenow;
     //only load when visit theme options of mainy page, something conflict with other feature such as AdminPageFramework
     if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == $page_slug) {
         //install plugins link
         $install_video_manager = hw_install_plugin_link('video-list-manager', 'Cài đặt video', true);
         /**
          * general
          */
         new NHP_Options_general($sections);
         /**
          * features
          */
         new NHP_Options_features($sections);
         /**
          * template
          */
         new NHP_Options_template($sections);
         /**
          * post settings
          */
         new NHP_Options_article($sections);
         /**
          * gallery
          */
         new NHP_Options_gallery($sections);
         /**
          * multi-languages
          */
         new NHP_Options_mqtranslate($sections);
         /**
          * footer setting
          */
         new NHP_Options_footer($sections);
         /**
          * advertising
          */
         new NHP_Options_ads($sections);
         /**
          * social options
          */
         new NHP_Options_socials($sections);
         /*video setting
                     $sections['video'] = array(
                         'icon' => '',
                         'title' => 'Cài đặt Videos',
                         'fields' => array(
                             'support_posttype' => array(
                                 'id' => 'support_posttype',
                                 'type' => 'hw_post_type_multi_select',
                                 'title' => 'Hỗ trợ post type',
                                 'desc' => 'Chọn post type sử dụng quản lý đăng videos.'.$install_video_manager,
                                 'options' => array()
                             ),
         
                         )
                     );*/
         //contact form
         /*'contact-form' => array(
                   'icon'=>NHP_OPTIONS_URL.'img/glyphicons/glyphicons_280_settings.png',
                   'title' => 'Form liên hệ/đặt hàng',
                   'fields' => array(
                       'wpcf7_js' => array(
                           'id' => 'wpcf7_js',
                           'type' => 'checkbox',
                           'title' => 'Sử lý Ajax trong Contact Form',
                           'desc' => '',
                           'std' => '0'	#disable wpcf7 script for default
                       ),
                       'gform_ID'=> array(
                           'id' => 'gform_ID',
                           'type' => 'text',
                           'title' => 'Google Form ID',
                           'desc' => '',
                       ),
                       'gform_fields' => array(
                           'id' => 'gform_fields',
                           'type' =>'textarea',
                           'title' => 'Google Form Fields',
                           'desc' => 'Nhập tên trường Google Form theo thứ tự là:'.PHP_EOL.'Họ & tên|Công ty|Email|SĐT|Địa chỉ|Tin nhắn|sendEmail|admin_email|website'.PHP_EOL.'VD: entry.652402672|entry.1230491504|entry.343949848|entry.1151396680|entry.1407459728|entry.1998434718|entry.2042320298|entry.1355297923|entry.1522563801'
                       )
                   )
           ),*/
         /*ecommerce settings*/
         $sections['ecommerce'] = array('title' => 'eCommerce', 'icon' => NHP_OPTIONS_URL . 'img/glyphicons/glyphicons_202_shopping_cart.png', 'fields' => array('product_footer_info' => array('id' => 'product_footer_info', 'type' => 'editor', 'title' => 'Nội dung hiển thị dưới mỗi trang sản phẩm chi tiết'), 'tcp_buy_button_bottom' => array('id' => 'tcp_buy_button_bottom', 'type' => 'editor', 'title' => 'Nội dung hiển thị dưới nút mua hàng ở trang chi tiết.')));
         $sections['optimize'] = array('title' => 'Tối ưu', 'fields' => array('permalink' => array('id' => 'permalink', 'type' => 'text', 'title' => 'Đổi permalink'), ''));
     } else {
         $sections['tip'] = array('title' => 'Nhấn vào chức năng để xem thêm');
     }
     new NHP_Options($sections, $args);
 }
 /**
  * install my modules
  */
 protected function hw_do_module_install()
 {
     // All plugin information will be stored in an array for processing.
     $plugin = array();
     if (isset($_GET['module']) && (isset($_GET['tgmpa-activate']) && 'activate-plugin' == $_GET['tgmpa-activate'])) {
         check_admin_referer('tgmpa-activate', 'tgmpa-activate-nonce');
         //check require plugin/module
         if (!empty($this->plugins[$_GET['module']]['require_wp_plugin'])) {
             $require_plugin = $this->plugins[$_GET['module']]['require_wp_plugin'];
             if (!is_plugin_active($require_plugin)) {
                 hw_inline_msg("Xin lỗi, module '{$_GET['module']}' yêu cầu cài trước plugin " . hw_install_plugin_link($require_plugin));
                 return;
             }
         }
         if (isset($this->plugins[$_GET['module']]['require_module'])) {
             $require_module = $this->plugins[$_GET['module']]['require_module'];
             if (!hw_is_active_module($require_module)) {
                 hw_inline_msg("Xin lỗi, module {$_GET['module']} yêu cầu cài trước module " . $require_module);
                 return;
             }
         }
         // Populate $plugin array with necessary information.
         $plugin[] = $_GET['module'];
         $plugin[] = $_GET['module_name'];
         if (isset($this->plugins[$_GET['module']]['source']) && $this->plugins[$_GET['module']]['source']) {
             $plugin[] = $this->plugins[$_GET['module']]['source'];
         }
         if (!hw_activate_modules($plugin)) {
             hw_inline_msg(sprintf('Xin lỗi, module %s đã cài trước đó hoặc yêu cầu module khác đã không tim thấy !', $_GET['module']));
         } else {
             hw_inline_msg(sprintf('Cài đặt module %s thành công !', $_GET['module']), 'updated');
         }
         echo '<p><a href="' . esc_url(add_query_arg('page', urlencode($this->menu), admin_url('admin.php'))) . '" title="' . esc_attr($this->strings['return']) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
         // Make sure message doesn't display again if bulk activation is performed immediately after a single activation.
         if (!isset($_POST['action'])) {
             $msg = $this->strings['activated_successfully'] . ' <strong>' . $_GET['module_name'] . '.</strong>';
             echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
         }
     } elseif (isset($_GET['module']) && (isset($_GET['tgmpa-deactivate']) && 'deactivate-plugin' == $_GET['tgmpa-deactivate'])) {
         check_admin_referer('tgmpa-deactivate', 'tgmpa-deactivate-nonce');
         // Populate $plugin array with necessary information.
         // Populate $plugin array with necessary information.
         $plugin[] = $_GET['module'];
         $plugin[] = $_GET['module_name'];
         if (isset($this->plugins[$_GET['module']]['source']) && $this->plugins[$_GET['module']]['source']) {
             $plugin[] = $this->plugins[$_GET['module']]['source'];
         }
         hw_deactivate_modules($plugin);
         // Make sure message doesn't display again if bulk activation is performed immediately after a single activation.
         if (!isset($_POST['action'])) {
             $msg = $this->strings['deactivated_successfully'] . ' <strong>' . $_GET['module_name'] . '.</strong>';
             echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
         }
     }
 }
コード例 #6
0
 public function setUp()
 {
     $menu = self::get_active_menu();
     //current menu
     /**
      * Adds setting fields in the meta box.
      */
     /*$settings_fields[] = array(
           'field_id' => 'test',
           'type'=>'text',
           'title' => 'sdfsf'
       );*/
     $settings_fields[] = array('type' => 'submit', 'field_id' => 'submit_button1', 'show_title_column' => false, 'label' => 'Lưu lại');
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('enable_filter_menu'), 'type' => 'checkbox', 'title' => 'Kích hoạt tùy chỉnh menu', 'label' => 'Kích hoạt cho phép tùy chỉnh menu với các cài đặt dưới.');
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('show_searchbox'), 'type' => 'checkbox', 'title' => 'Hiển thị searchbox vào menu', 'label' => 'Hiển thị thêm searchbox vào menu hiện tại.');
     //mqtranslate integration
     if (!is_plugin_active('mqtranslate/mqtranslate.php') || !is_plugin_active('qtranslate-x/mqtranslate.php')) {
         $tip = 'Chú ý: <br/>- Yêu cầu cài đặt plugin ' . hw_install_plugin_link('mqtranslate/mqtranslate.php', 'mqtranslate') . ' hoặc ' . hw_install_plugin_link('qtranslate-x/mqtranslate.php', 'qtranslate-x');
         $tip .= '<br/>- Với qtranslate-x bạn cần kích hoạt <a target="_blank" href="' . admin_url('options-general.php?page=qtranslate-x#integration') . '">chế độ tương thích</a>.';
         $tip .= '<br/>- Kích hoạt module translate.';
     } else {
         $tip = 'Plugin "mqtranslate/qtranslate-x" đã sẵn sàng.';
     }
     $tip .= '<br/>Chọn giao diện hiển thị nút thay đổi ngôn ngữ <a href="' . admin_url('admin.php?page=hoangweb-theme-options&tab=multilang') . '" target="_blank">tại đây</a>.';
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('show_langs_switcher'), 'type' => 'checkbox', 'title' => 'Thêm chọn đa ngôn ngữ vào menu', 'label' => 'Hiển thị thêm chọn đa ngôn ngữ vào menu hiện tại.', 'description' => $tip);
     //remove ul wrap
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('remove_ul_wrap'), 'type' => 'checkbox', 'title' => 'Xóa ul wrap', 'label' => 'Xóa thẻ ul bao quanh nội dung menu.');
     //remove ul,li around wp_nav_menu output
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('only_anchor_tag_nav_menu'), 'type' => 'checkbox', 'title' => 'Xóa ul,li bao quanh menu', 'label' => 'Xóa ul,li bao quanh menu, chỉ hiển thị thẻ liên kết ' . htmlspecialchars('<a'));
     /*$settings_fields[] = array(
           'field_id' => self::create_menu_field_setting('allow_tags_nav_menu'),
           'type' => 'checkbox',
           'title' => 'HTML cho phép của nav menu',
           'label' => 'HTML cho phép trong nội dung wp_nav_menu'
       );*/
     //add home menu to first of nav menu
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('show_home_menu'), 'type' => 'checkbox', 'title' => 'Hiển thị menu home', 'label' => 'Hiển thị menu home vào trước nav menu');
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('show_icon'), 'type' => 'checkbox', 'title' => 'Hiển thị biểu tượng', 'label' => 'Hiển thị biểu tượng vào mỗi nav menu item đã thiết lập.');
     //enable menu skin
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('enable_skin'), 'type' => 'checkbox', 'title' => 'Kích hoạt giao diện', 'label' => 'Kích hoạt cho phép sử dụng giao diện.');
     //hw_skin
     $settings_fields[] = array('field_id' => self::create_menu_field_setting('skin'), 'type' => 'hw_skin', 'title' => 'Giao diện', 'label' => 'Chọn giao diện cho menu', 'external_skins_folder' => 'hw_navmenu_skins', 'skin_filename' => 'navmenu-skin.php', 'enable_external_callback' => false, 'skins_folder' => 'skins', 'apply_current_path' => HW_MENU_PATH, 'plugin_url' => HW_MENU_URL, 'template_header_data' => array('name' => 'HW Template'));
     $settings_fields[] = array('type' => 'submit', 'field_id' => 'submit_button2', 'show_title_column' => false, 'label' => 'Lưu lại');
     //register fields
     foreach ($settings_fields as $aFieldSetting) {
         $this->addSettingField($aFieldSetting);
     }
     // content_{page slug}_{tab slug}
     add_filter('content_' . HW_NAVMENU_settings::page_setting_slug, array($this, 'replyToInsertContents'));
 }
コード例 #7
0
    /**
     * extra fields to any widget
     * @param object $t: widget class object
     * @param $return
     * @param array $instance: widget instance
     */
    public function _hw_awc_in_widget_form($t, $return, $instance)
    {
        /*begin custom sidebar format*/
        static $sw_list;
        if (!$sw_list) {
            $sw_list = get_option('sidebars_widgets');
        }
        //get all widgets
        global $wp_registered_sidebars;
        foreach ($sw_list as $sidebar => $widgets) {
            //get sidebar where widget nested on it
            if (is_array($widgets) && in_array($t->id, $widgets)) {
                //make sure you ignore the key 'array_version'
                $found_sidebar = true;
                break;
            }
        }
        if ($sidebar == 'array_version' || !isset($found_sidebar) || !isset($wp_registered_sidebars[$sidebar])) {
            echo '<div style="background:#fafafa;border:1px solid #dadada;padding:5px;"><p>Nhấn nút Lưu để hiển thị công cụ tùy chỉnh widget này hoặc nếu không thấy thì xóa widget và thêm lại.</p></div>';
            return;
        }
        //first check
        if (isset($wp_registered_sidebars[$sidebar]['old_id'])) {
            $old_sidebar = $wp_registered_sidebars[$sidebar]['old_id'];
        } else {
            $old_sidebar = $sidebar;
        }
        if (!HW_AWC_Sidebar_Settings::check_valid_sidebar_name($old_sidebar)) {
            echo "<div class='hwawc-message'>Do Sidebar cũ có ID ({$old_sidebar}) không hợp lệ, nên tạo mới sidebar với tên: ({$sidebar})";
            echo '<br/>Hiển thị sidebar:<code>dynamic_sidebar("' . $sidebar . '")</code>';
            echo '</div>';
            // return;  //fixed from callback '_hw_awc_init'
        }
        $params = $wp_registered_sidebars[$sidebar];
        //get sidebar param where widget nested on it
        //create feature tog
        if (class_exists('HW_ButtonToggle_widget')) {
            $btn_tog = new HW_ButtonToggle_widget($t, $instance);
        }
        //instance HW_SKIN for widget box title
        $skin = new HW_SKIN($t, HW_AWC_PATH, 'hw_awc_skins', 'hwawc-skin.php', 'skins');
        $skin->plugin_url = HW_AWC_URL;
        $skin->external_callback = false;
        $skin->init();
        //seem no longer use
        ?>
        <?php 
        if (isset($btn_tog)) {
            $btn_tog->set_button_toggle_start_wrapper('Tùy chỉnh widget');
        }
        ?>
        <div style="background:#fafafa;border:1px solid #dadada;padding:5px;">
            <!-- show widget ID on each widget in admin. -->
            <p>
            <div id="<?php 
        echo $t->get_field_id('show_widget_id');
        ?>
" style="padding:5px;background:pink;border:1px solid red;" name="<?php 
        echo $t->get_field_name('show_widget_id');
        ?>
" >
                ID: <strong><?php 
        echo $t->id;
        ?>
</strong><br/>
                <?php 
        if (is_plugin_active('amr-shortcode-any-widget/amr-shortcode-any-widget.php')) {
            echo 'Hiển thị nội dung widget này bởi shortcode:<br/>';
            echo '<code>[do_widget id=' . $t->id . ']</code>';
            echo '<a href="' . HW_AWC_URL . '/docs/amr-shortcode-any-widget.html' . '" target="_blank">Hướng dẫn</a>';
        } else {
            echo hw_install_plugin_link('amr-shortcode-any-widget', 'Nhúng widget này bằng shortcode');
        }
        //display widget content with feature "shortcode_params"
        if (!HW_AWC_WidgetFeatures::check_widget_feature($t, 'shortcode_params') && class_exists('HW_HOANGWEB_Settings')) {
            echo '<p>Kích hoạt feature "<a target="_blank" href="' . admin_url('options-general.php?page=' . HW_HOANGWEB_Settings::HW_SETTINGS_PAGE) . '">Tạo shortcode widget</a>" để hiển thị nội dung của widget này.</p>';
        }
        ?>
            </div>
            </p>
            <!-- widget features -->
            <?php 
        $this->load_widget_features($t, $instance);
        ?>
            <p>

            </p>
            <hr/>
            <!-- sidebar custom after_title & before_title -->
            <?php 
        if (isset($params['before_title'])) {
            ?>

                <p>
                    <label for="<?php 
            echo $t->get_field_id('awc_clear_widget_title');
            ?>
"><strong><?php 
            _e('Xóa tiêu đề widget');
            ?>
</strong></label><br/>
                    <input type="checkbox" name="<?php 
            echo $t->get_field_name('awc_clear_widget_title');
            ?>
" id="<?php 
            echo $t->get_field_id('awc_clear_widget_title');
            ?>
" <?php 
            checked(isset($instance['awc_clear_widget_title']) && $instance['awc_clear_widget_title'] ? 1 : 0);
            ?>
/><?php 
            _e('Xóa before_title & after_title');
            ?>
                    <br/>
                    <span style="font-size:12px">Nếu xóa tiêu đề (xóa before_title & after_title) thì check vào đây. <i>(Tùy chọn này sẽ xóa thẻ HTML có trong before_title & after_title và cả before_widget,after_widget nếu cần thiết để có thể hiển thị tốt widget mà không có title.)</i></span>
                    <br/>

                </p><hr/>

                <p>
                    <label><strong><?php 
            _e('Sửa before_title');
            ?>
</strong></label><br/>
                    <em>Hiện tại: (<font color="blue"><?php 
            echo htmlentities($params['before_title']);
            ?>
</font>)</em><br/>
                    <em><?php 
            if (!preg_match('#%\\d\\$s#', $params['before_title'])) {
                echo '<font color="red">Cảnh báo: before_title chưa sẵn sàng.</font>';
            }
            ?>
</em><br/>
                    <input <?php 
            ?>
 type="text" name="<?php 
            echo $t->get_field_name('format_before_title');
            ?>
" id="<?php 
            echo $t->get_field_id('format_before_title');
            ?>
" value="<?php 
            echo isset($instance['format_before_title']) ? $instance['format_before_title'] : '';
            ?>
"><br/>
                    <span style="font-size:12px"><i>(mỗi ID or chuỗi class ngăn cách bởi '|')</i></span>
                    <br/>
                    <span><em>ie: before_title=>"<?php 
            echo htmlentities('<h2 id="%1$s" class="%2$s" style="%3$s">');
            ?>
"</em></span>
                </p><hr/>
            <?php 
        }
        ?>
            <p>
                <label><strong><?php 
        _e('Sửa after_title');
        ?>
</strong></label><br/>
                <em>Hiện tại: (<font color="blue"><?php 
        echo htmlentities($params['after_title']);
        ?>
</font>)</em><br/>
                <em><?php 
        if (!preg_match('#%\\d\\$s#', $params['after_title'])) {
            echo '<font color="red">Cảnh báo: after_title chưa sẵn sàng.</font>';
        }
        ?>
</em><br/>
                <input <?php 
        ?>
 type="text" name="<?php 
        echo $t->get_field_name('format_after_title');
        ?>
" id="<?php 
        echo $t->get_field_id('format_after_title');
        ?>
" value="<?php 
        echo isset($instance['format_after_title']) ? $instance['format_after_title'] : '';
        ?>
"><br/>
                <span style="font-size:12px"><i>(mỗi ID or chuỗi class ngăn cách bởi '|')</i></span>
                <br/>
                <span><em>ie: after_title=>"<?php 
        echo htmlentities('</h2><div id="%1$s" class="%2$s" style="%3$s">');
        ?>
"</em></span>
            </p><hr/>
            <p>
                <label><strong><?php 
        _e('Sửa before_widget');
        ?>
</strong></label><br/>
                <em>Thêm class theo thứ tự bằng cách chèn tag (*1,*2,..) vào tham số before_widget: <br/>(Hiện tại:<font color="blue"><?php 
        echo htmlentities($params['before_widget']);
        ?>
</font>)</em><br/>
                <em><?php 
        if (!preg_match('#\\*\\d+#', $params['before_widget'])) {
            echo '<font color="red">Cảnh báo: before_widget chưa sẵn sàng.</font>';
        }
        ?>
</em>
                <input type="text" name="<?php 
        echo $t->get_field_name('preclasses_before_widget');
        ?>
" id="<?php 
        echo $t->get_field_id('preclasses_before_widget');
        ?>
" value="<?php 
        echo isset($instance['preclasses_before_widget']) ? $instance['preclasses_before_widget'] : '';
        ?>
"><br/>
                <span style="font-size:12px"><i>(mỗi chuỗi class tương ứng với *1|*2.. ngăn cách bởi '|'. VD: class1 class2|class3 class4 class5)</i></span>
            </p>
            <hr/>
            <p>
                <label for="<?php 
        echo $t->get_field_id('widget_skin');
        ?>
"><strong><?php 
        _e('Giao diện widget');
        ?>
</strong></label>
            <div>
                <select name="<?php 
        echo $t->get_field_name('widget_skin');
        ?>
" id="<?php 
        echo $t->get_field_id('widget_skin');
        ?>
">
                    <?php 
        foreach (HW_AWC_Sidebar_Settings::available_widget_skins() as $name => $field) {
            ?>
                        <option <?php 
            selected(isset($instance['widget_skin']) && $name == $instance['widget_skin'] ? 1 : 0);
            ?>
 value="<?php 
            echo $name;
            ?>
"><?php 
            echo isset($field['title']) ? $field['title'] : $name;
            ?>
</option>
                    <?php 
        }
        ?>
                </select><br/>
                <span>Quản lý skins, nhấn <a target="_blank" href="<?php 
        echo HW_AWC_Sidebar_Settings::get_edit_sidebar_setting_page_link($sidebar);
        ?>
">vào đây</a>.</span>
            </div>
            </p>
            <p>
                <strong>Mầu sắc</strong><br/>
                <em>Lưu ý: TH nếu xóa mầu và khi load lại trang cần xóa lại vì mầu khởi đầu là #FFFFFF.<br/> Nếu không xuất hiện hộp chọn mầu thì tự điền mã mầu và lưu lại để khởi tạo lại trình chọn mã mầu.</em>
            </p>
            <p>
                <input type="text" size="5" class="color {hash:true}" name="<?php 
        echo $t->get_field_name('bgcolor_widget');
        ?>
" id="<?php 
        echo $t->get_field_id('bgcolor_widget');
        ?>
" value="<?php 
        echo isset($instance['bgcolor_widget']) ? $instance['bgcolor_widget'] : '';
        ?>
"/>
                <label for="<?php 
        echo $t->get_field_id('bgcolor_widget');
        ?>
">Mầu nền widget</label>
                <a class="clear-jscolor button" href="javascript:void(0)">Xóa</a>
            </p>
            <p>
                <input type="text" size="5" class="color {hash:true}" name="<?php 
        echo $t->get_field_name('bgcolor_title');
        ?>
" id="<?php 
        echo $t->get_field_id('bgcolor_title');
        ?>
" value="<?php 
        echo isset($instance['bgcolor_title']) ? $instance['bgcolor_title'] : '';
        ?>
"/>
                <label for="<?php 
        echo $t->get_field_id('bgcolor_title');
        ?>
">Mầu nền tiêu đề</label>
                <a class="clear-jscolor button" href="javascript:void(0)" onclick="">Xóa</a>
            </p>
            <p>
                <input type="text" size="5" class="color {hash:true}" name="<?php 
        echo $t->get_field_name('bgcolor_box');
        ?>
" id="<?php 
        echo $t->get_field_id('bgcolor_box');
        ?>
" value="<?php 
        echo isset($instance['bgcolor_box']) ? $instance['bgcolor_box'] : '';
        ?>
"/>
                <label for="<?php 
        echo $t->get_field_id('bgcolor_box');
        ?>
">Mầu nền nội dung</label>
                <a class="clear-jscolor button" href="javascript:void(0)">Xóa</a>
            </p>

            <!-- bg title -->
            <p>
                <label><strong><?php 
        _e('Ảnh nền cho tiêu đề widget');
        ?>
</strong></label>
            <div>
                <?php 
        if (strpos($params['before_title'], '{css_title}') === false) {
            echo '<font color="red">Warning: không tìm thấy {css_title} tag trong tham số <em>before_title</em>. Để sử dụng trường này bạn cần thêm tag này vào tham số <em>before_title</em> cho sidebar hiện tại.</font>';
        }
        ?>
                <?php 
        if (isset($instance['bgimg_title'])) {
            ?>
                    <img class="user-preview-image" style="max-width:100%;" src="<?php 
            echo $instance['bgimg_title'];
            ?>
"><!-- display image -->
                <?php 
        }
        ?>
                <input type="hidden" name="<?php 
        echo $t->get_field_name('bgimg_title');
        ?>
" id="<?php 
        echo $t->get_field_id('bgimg_title');
        ?>
" value="<?php 
        echo isset($instance['bgimg_title']) ? $instance['bgimg_title'] : '';
        ?>
" class="regular-text" /><!-- show image url -->
                <input type='button' class="button-primary" value="Upload" id="<?php 
        echo $t->get_field_id('hw_awc_uploadimage');
        ?>
"/><br /><!-- upload button -->
                <script type="text/javascript">
                    jQuery(function( $ ) {
                        if(typeof hw_awc_btn_upload_image == 'function') {
                            hw_awc_btn_upload_image($( '#<?php 
        echo $t->get_field_id('hw_awc_uploadimage');
        ?>
' ), $( '#<?php 
        echo $t->get_field_id('bgimg_title');
        ?>
' ));
                        }

                    });
                </script>
                <p>

                    <input type="checkbox" name="<?php 
        echo $t->get_field_name('bgimg_title_css');
        ?>
" id="<?php 
        echo $t->get_field_id('bgimg_title_css');
        ?>
" onlick="this.value = this.checked" <?php 
        checked(isset($instance['bgimg_title_css']) ? 1 : 0);
        ?>
/>
                    <label for="<?php 
        echo $t->get_field_id('bgimg_title_css');
        ?>
"><?php 
        _e('Hiển thị ảnh nền cho tiêu đề widget');
        ?>
</label>
                </p>
            </div>
            </p>
            <!-- bg box -->
            <p>
                <label for="<?php 
        echo $t->get_field_id('hw_awc_upload_bgimg_box');
        ?>
"><strong><?php 
        _e('Ảnh nền cho nội dung widget');
        ?>
</strong></label><br/>
                <?php 
        if (strpos($params['after_title'], '{css_box}') === false && strpos($params['before_widget'], '{css_box}') === false) {
            echo '<div><font color="red">Warning: không tìm thấy {css_box} tag trong tham số <em>after_title</em> hoặc <em>before_widget</em>. Để sử dụng trường này bạn cần thêm tag này cho sidebar hiện tại.</font></div>';
        }
        ?>
                <?php 
        if (isset($instance['bgimg_box'])) {
            ?>
                    <img class="user-preview-image" style="max-width:100%;" src="<?php 
            echo $instance['bgimg_box'];
            ?>
"><!-- display image -->
                <?php 
        }
        ?>
                <input type="hidden" name="<?php 
        echo $t->get_field_name('bgimg_box');
        ?>
" id="<?php 
        echo $t->get_field_id('bgimg_box');
        ?>
"
                       value="<?php 
        echo isset($instance['bgimg_box']) ? $instance['bgimg_box'] : '';
        ?>
" class="regular-text" /><!-- show image url -->
                <input type='button' class="button-primary" value="Upload" id="<?php 
        echo $t->get_field_id('hw_awc_upload_bgimg_box');
        ?>
"/><br /><!-- upload button -->
            </p>
            <script type="text/javascript">
                jQuery(function( $ ) {
                    if(typeof hw_awc_btn_upload_image == 'function') {
                        hw_awc_btn_upload_image($( '#<?php 
        echo $t->get_field_id('hw_awc_upload_bgimg_box');
        ?>
' ),$('#<?php 
        echo $t->get_field_id('bgimg_box');
        ?>
'));
                    }

                });
                jQuery(function($){
                    //empty color input
                    var empty_color_input = function(obj){
                        $(obj).attr('value','').css({background:'#fff'});
                        $(obj).empty();
                        //remove color from input
                        //HW_AWC.jscolor_set(obj,'');//wrong it will reset to white color
                    };
                    //init jscolor when ajax response for all input field has 'color' class
                    $('input.color').each(function(i,obj){
                        var color = $(obj).val(),
                            clear_btn = $($(obj).next().next());

                        $(obj).data('clear_btn', clear_btn);
                        //bind clear color button
                        if(!$(obj).data('clear_color_btn')){
                            $(obj).data({
                                clear_color_btn:function(){
                                    empty_color_input(obj);
                                    //remove color from input
                                    //HW_AWC.jscolor_set(obj,'');//wrong it will reset to white color
                                }
                            });
                        }
                        clear_btn.bind('click',$(obj).data('clear_color_btn'));
                        //update color
                        if(color && $(obj).attr('value')){
                            HW_AWC.jscolor_set(obj,color);  //resume color in input tag
                        }
                        else {
                            setTimeout(function(){
                                empty_color_input(obj); //clear default white color
                                $(obj).data('clear_btn').trigger('click');
                            },1000);
                        }

                    });
                });

            </script>
        </div>
        <?php 
        if (isset($btn_tog)) {
            $btn_tog->set_button_toggle_end_wrapper();
        }
        //close feature tog
    }
コード例 #8
0
 /**
  * general tab
  * @param $oAdminPage AdminPageFramework
  * @param $tab_id
  */
 private function setUp_tab_general($oAdminPage, $tab_id)
 {
     /**
      * general tab
      */
     //$post_types = get_post_types( '', 'names' );
     //custom menu labels tip
     $custom_admin_menu_tip = '<ul>';
     if (function_exists('is_plugin_active') && is_plugin_active('adminimize/adminimize.php')) {
         $custom_admin_menu_tip .= '<li>Truy cập <a href="' . admin_url('options-general.php?page=adminimize/adminimize.php') . '" target="_blank">vào đây</a> để tùy biến.</li>';
     } else {
         $custom_admin_menu_tip = '<li>Kích hoạt plugin ' . hw_install_plugin_link('adminimize/adminimize.php', '<em>adminimize</em>') . ' để tùy biến.</li>';
     }
     if (function_exists('is_plugin_active') && is_plugin_active('admin-menu-editor/menu-editor.php')) {
         $custom_admin_menu_tip .= '<li>Truy cập <a href="' . admin_url('options-general.php?page=menu_editor') . '" target="_blank">vào đây</a> để tùy biến.</li>';
     } else {
         $custom_admin_menu_tip .= '<li>Kích hoạt plugin ' . hw_install_plugin_link('admin-menu-editor/menu-editor.php', '<em>adminimize</em>') . ' để tùy biến.</li>';
     }
     $custom_admin_menu_tip .= '</ul>';
     $tab = $this->get_tabs($tab_id);
     $oAdminPage->addSettingSections(self::HW_SETTINGS_PAGE, array('section_id' => $tab_id, 'title' => $tab['title'], 'description' => $tab['description'], 'section_tab_slug' => 'setting_tabs', 'repeatable' => false));
     $oAdminPage->addSettingFields($tab_id, array('field_id' => 'enable_developer_feature', 'type' => 'checkbox', 'title' => 'Kích hoạt tính năng phát triển', 'description' => 'Hiển thị các tính năng nâng cao dành cho Developer.' . $custom_admin_menu_tip), array('field_id' => 'match_occurence', 'type' => 'select', 'title' => 'Phát hiện điều kiện.', 'label' => array('first_occurence' => __('Điều kiện đầu tiên'), 'last_occurence' => __('Điều kiện sau cùng'))), array('field_id' => 'allow_uploadfile_type', 'type' => 'checkbox', 'title' => 'Cho phép upload kiểu tệp', 'description' => 'Hiển thị các tính năng nâng cao dành cho Developer.', 'label' => hw_list_mines_type(), 'select_all_button' => true, 'select_none_button' => true), array('field_id' => 'submit', 'type' => 'submit', 'label' => 'Lưu lại', 'show_title_column' => false));
 }
コード例 #9
0
 /**
  * getting start & help user how to begin install hoangweb plugins by show notice in admin
  */
 function hw_getting_start_notices()
 {
     if (!is_plugin_active('wpfavs/wpfavs.php')) {
         ?>
         <div class="updated">
             <p>
                 <?php 
         if (!is_plugin_active('wpfavs/wpfavs.php')) {
             echo 'Để cài đặt và quản lý các plugins cần thiết cho các tính năng của website này, nhấn ' . hw_install_plugin_link('wpfavs', 'vào đây');
         }
         ?>
             </p>
         </div>
     <?php 
     }
 }