/** * load form settings * @param unknown $oAdminPage */ public function load_hw_social_option($oAdminPage) { // load_{page slug} $HW_Socials_fields = hwss_option(); //get list of pages $pages = get_pages(); $list = array('__all__' => 'Tất cả', '__home__' => 'Trang Chủ'); foreach ($pages as $page) { $list[$page->post_name] = $page->post_title; } //get socials button & also order by user $socials = self::get_sort_socials_selected(); //list avaiable sharing services $services = array(); foreach (HW_SocialShare_widget::$sharing_services as $key => $item) { if (isset($item['enable']) && !$item['enable']) { continue; } $services[$key] = ucfirst($item['text']); } //default custom css $custom_css_def = ''; if (!empty($HW_Socials_fields['wrap_id'])) { $custom_css_def = '#' . $HW_Socials_fields['wrap_id'] . '{position:relative;}'; } //help popup if (class_exists('HW_HELP')) { $guide_link = 'Xem ' . HW_HELP::generate_help_popup(array('HW_HELP_SHARE', 'share.html'), 'hướng dẫn chi tiết', 'hướng dẫn tạo nút chia sẻ'); } else { $guide_link = ''; } $this->addSettingSections('hw_social_option', array('section_id' => 'my_first_section', 'title' => 'My First Form Section', 'description' => 'This section is for text fields.'), array('section_id' => 'my_second_section', 'title' => 'My Second Form Section', 'description' => 'This section is for selectors.')); $this->addSettingFields(array('field_id' => 'help', 'type' => 'title', 'description' => $guide_link), array('field_id' => 'enable_side_share_bar', 'type' => 'checkbox', 'title' => __('Kích hoạt', 'hwss'), 'description' => __('Kích hoạt thanh chia sẻ ở sườn website.', 'hwss')), array('field_id' => 'sharing_service', 'type' => 'select', 'title' => __('Chọn dịch vụ', 'hwss'), 'description' => __('Lựa chọn dịch vụ chia sẻ như addthis, sharethis,..', 'hwss'), 'label' => $services), array('field_id' => 'wrap_id', 'type' => 'text', 'title' => __('Wrap DIV selector', 'hwss'), 'description' => __('ID/class thẻ div bao khung website. Cần chỉ định giá trị này để hiển thị nút chia sẻ ở sườn website.<br/>VD: .site-inner', 'hwss'), 'default' => ''), array('field_id' => 'pages_list', 'type' => 'select', 'title' => __('Hiển thị ở trang', 'hwss'), 'description' => __('Chọn trang hiển thị.', 'hwss'), 'label' => $list, 'is_multiple' => true, 'attributes' => array('select' => array('size' => 5))), array('field_id' => 'socials_button', 'type' => 'socials_button_picker', 'title' => __('Chọn nút & xắp xếp', 'hwss'), 'description' => __('Chọn một hoặc nhiều nút mạng xã hội, bạn có thể di chuyển xắp lại thứ tự hiển thị.', 'hwss'), 'label' => $socials, 'is_multiple' => true, 'attributes' => array('select' => array('size' => 10))), array('field_id' => 'custom_css', 'type' => 'textarea', 'title' => __('Tùy biến CSS', 'hwss'), 'description' => __('Chèn thêm CSS.', 'hwss'), 'default' => '/*chèn CSS ở đây*/' . $custom_css_def), array('field_id' => 'button_size', 'type' => 'text', 'title' => 'Kích thước', 'description' => 'Kích thước co dãn. VD: 1 (small), 1.5 (medium),..', 'default' => '1'), array('field_id' => 'socials_button_hidden', 'type' => 'hidden'), array('field_id' => 'enable_standard_buttons_in_post', 'type' => 'checkbox', 'title' => __('Kích hoạt trong bài viết.', 'hwss'), 'description' => __('Kích hoạt nút socials chuẩn trong bài viết chi tiết.', 'hwss')), array('field_id' => 'submit_button', 'type' => 'submit')); }
/** * show float share bar */ public static function show_float_sharebar() { $HW_Socials_fields = hwss_option(); $pick_socials = hwss_option('socials_button', array()); $display = self::is_show_float_sharebar(); if ($display) { $id = rand(); echo '<div id="' . $id . '">'; if (isset($HW_Socials_fields['wrap_id']) && $HW_Socials_fields['wrap_id']) { echo '<style>' . $HW_Socials_fields['wrap_id'] . '{position:relative !important;}</style>'; } echo '<script> jQuery(document).ready(function($){ $(".' . self::class_socials_button_wrapper . '").sticky({topSpacing:0}); if(jQuery("#' . $id . '").length) { $("' . $HW_Socials_fields['wrap_id'] . '").prepend(jQuery("#' . $id . '").html()); jQuery("#' . $id . '").remove(); } }); </script>'; $final_socials = HW_SocialsShare_Settings::get_sort_socials_selected($pick_socials); //additionl options $options = array('class_socials_button_wrapper' => self::class_socials_button_wrapper, 'sharing_service' => $HW_Socials_fields['sharing_service']); if (isset($HW_Socials_fields['button_size'])) { //button size $options['button_size'] = $HW_Socials_fields['button_size']; } if (isset($HW_Socials_fields['custom_css'])) { $options['custom_css'] = $HW_Socials_fields['custom_css']; } hwss_vertical_box_count_socials_share($final_socials, $options); echo '</div>'; } }