Plugin Directory

Changeset 3365361


Ignore:
Timestamp:
09/21/2025 05:33:56 PM (6 months ago)
Author:
amanstacker
Message:

Version 1.0.4 dtoc trunk released

Location:
digital-table-of-contents
Files:
15 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • digital-table-of-contents/trunk/admin/class-digital-toc-settings.php

    r3361111 r3365361  
    2727        [$this, 'dtoc_settings_page_render']               
    2828    );
    29     // add_submenu_page(
    30     //  'dtoc',
    31     //  'Digital Table of Contents In-Content',
    32     //     'In-Content Mobile',
    33     //  'manage_options',
    34     //  'dtoc_incontent_mobile',
    35     //     [$this, 'dtoc_settings_page_render']             
    36     // );
    37     // add_submenu_page(
    38     //  'dtoc',
    39     //  'Digital Table of Contents In-Content',
    40     //     'In-Content Tablet',
    41     //  'manage_options',
    42     //  'dtoc_incontent_tablet',
    43     //     [$this, 'dtoc_settings_page_render']             
    44     // );   
    45    
    46     // add_submenu_page(
    47     //  'dtoc',
    48     //  'Digital Table of Contents Sticky',
    49     //     'Sticky Mobile',
    50     //  'manage_options',
    51     //  'dtoc_sliding_sticky_mobile',
    52     //     [$this, 'dtoc_settings_page_render']             
    53     // );
    54     // add_submenu_page(
    55     //  'dtoc',
    56     //  'Digital Table of Contents Sticky',
    57     //     'Sticky Tablet',
    58     //  'manage_options',
    59     //  'dtoc_sliding_sticky_tablet',
    60     //     [$this, 'dtoc_settings_page_render']             
    61     // );
    62     // add_submenu_page(
    63     //  'dtoc',
    64     //  'Digital Table of Contents Floating',
    65     //     'Floating',
    66     //  'manage_options',
    67     //  'dtoc_floating',
    68     //     [$this, 'dtoc_settings_page_render']             
    69     // );
    70     // add_submenu_page(
    71     //  'dtoc',
    72     //  'Digital Table of Contents Floating',
    73     //     'Floating Mobile',
    74     //  'manage_options',
    75     //  'dtoc_floating_mobile',
    76     //     [$this, 'dtoc_settings_page_render']             
    77     // );
    78     // add_submenu_page(
    79     //  'dtoc',
    80     //  'Digital Table of Contents Floating',
    81     //     'Floating Tablet',
    82     //  'manage_options',
    83     //  'dtoc_floating_tablet',
    84     //     [$this, 'dtoc_settings_page_render']
    85     // );
     29    add_submenu_page(
     30        'dtoc',
     31        'Digital Table of Contents In-Content',
     32        'In-Content Mobile',
     33        'manage_options',
     34        'dtoc_incontent_mobile',
     35        [$this, 'dtoc_settings_page_render']               
     36    );     
     37           
     38    add_submenu_page(
     39        'dtoc',
     40        'Digital Table of Contents Floating',
     41        'Floating',
     42        'manage_options',
     43        'dtoc_floating',
     44        [$this, 'dtoc_settings_page_render']               
     45    ); 
    8646    add_submenu_page(
    8747        'dtoc',
     
    10060        [$this, 'dtoc_settings_page_render']               
    10161    );
    102     // add_submenu_page(
    103     //  'dtoc',
    104     //  'Digital Table of Contents Shortcode',
    105     //     'Shortcode Mobile',
    106     //  'manage_options',
    107     //  'dtoc_shortcode_mobile',
    108     //     [$this, 'dtoc_settings_page_render']             
    109     // );
    110     // add_submenu_page(
    111     //  'dtoc',
    112     //  'Digital Table of Contents Shortcode',
    113     //     'Shortcode Tablet',
    114     //  'manage_options',
    115     //  'dtoc_shortcode_tablet',
    116     //     [$this, 'dtoc_settings_page_render']
    117     // );       
     62    add_submenu_page(
     63        'dtoc',
     64        'Digital Table of Contents Sliding Sticky Mobile',
     65        'Sliding Sticky Mobile',
     66        'manage_options',
     67        'dtoc_sliding_sticky_mobile',
     68        [$this, 'dtoc_settings_page_render']               
     69    );     
    11870
    11971}
     
    14597                break;
    14698            case 'dtoc_sliding_sticky_mobile':     
    147                 $this->_page_title     = 'Sticky Mobile';       
     99                $this->_page_title     = 'Sliding Sticky Mobile';       
    148100                $this->_setting_option = $dtoc_sliding_sticky_mobile;
    149101                break;
     
    368320
    369321    $settings_groups = [
    370         'dtoc_incontent_group'         => 'dtoc_incontent',
    371         'dtoc_incontent_mobile_group'  => 'dtoc_incontent_mobile',
    372         'dtoc_incontent_tablet_group'  => 'dtoc_incontent_tablet',
    373 
    374         'dtoc_sliding_sticky_group'            => 'dtoc_sliding_sticky',
    375         'dtoc_sliding_sticky_mobile_group'     => 'dtoc_sliding_sticky_mobile',
    376         'dtoc_sliding_sticky_tablet_group'     => 'dtoc_sliding_sticky_tablet',
    377 
    378         'dtoc_floating_group'          => 'dtoc_floating',
    379         'dtoc_floating_mobile_group'   => 'dtoc_floating_mobile',
    380         'dtoc_floating_tablet_group'   => 'dtoc_floating_tablet',
    381 
    382         'dtoc_shortcode_group'         => 'dtoc_shortcode',
    383         'dtoc_shortcode_mobile_group'  => 'dtoc_shortcode_mobile',
    384         'dtoc_shortcode_tablet_group'  => 'dtoc_shortcode_tablet',
     322        'dtoc_incontent_group'             => 'dtoc_incontent',
     323        'dtoc_incontent_mobile_group'      => 'dtoc_incontent_mobile',     
     324        'dtoc_sliding_sticky_group'        => 'dtoc_sliding_sticky',
     325        'dtoc_sliding_sticky_mobile_group' => 'dtoc_sliding_sticky_mobile',     
     326        'dtoc_floating_group'              => 'dtoc_floating',             
     327        'dtoc_shortcode_group'             => 'dtoc_shortcode',             
    385328    ];
    386329
     
    412355     * ---------------------------------
    413356     * Settings Fields (generic config)
    414      * Each field can define "pages" => ['dtoc_incontent', 'dtoc_sliding_sticky', ...]
     357     * Each field can define "pages" => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', ...]
    415358     * If "pages" not set, it will show everywhere.
    416359     * ---------------------------------
     
    422365            'callback' => 'dtoc_general_rendering_style_cb',
    423366            'section'  => 'dtoc_general_setting_section',
    424             'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     367            'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
    425368        ],
    426369        'dtoc_display_title' => [
     
    428371            'callback' => 'dtoc_display_title_cb',
    429372            'section'  => 'dtoc_general_setting_section',
    430             'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     373            'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
    431374            'args'     => [ 'label_for' => 'display_title' ],
    432375        ],
    433         'dtoc_general_header_text' => [
     376        'dtoc_general_header_text' => [
    434377            'title'    => __( 'Text', 'digital-table-of-contents' ),
    435378            'callback' => 'dtoc_general_header_text_cb',
    436379            'section'  => 'dtoc_general_setting_section',
    437             'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     380            'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
    438381            'args'     => [ 'class' => 'dtoc_child_opt dtoc_display_title' ],
     382        ], 
     383        'dtoc_general_header_text_sm' => [
     384            'title'    => __( 'Title Text', 'digital-table-of-contents' ),
     385            'callback' => 'dtoc_general_header_text_cb',
     386            'section'  => 'dtoc_general_setting_section',
     387            'pages'    => [ 'dtoc_sliding_sticky_mobile' ],         
    439388        ], 
    440389        'dtoc_display_toggle_body' => [
     
    442391        'callback' => 'dtoc_display_toggle_body_cb',
    443392        'section'  => 'dtoc_general_setting_section',
    444         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     393        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    445394        'args'     => [
    446395            'class'     => 'dtoc_child_opt dtoc_display_title',
     
    452401        'callback' => 'dtoc_display_toggle_initial_cb',
    453402        'section'  => 'dtoc_general_setting_section',
    454         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     403        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    455404        'args'     => [
    456405            'class' => 'dtoc_child_opt dtoc_2_label_child_opt dtoc_display_title',
    457406        ],
    458407    ],   
    459     'dtoc_display_toggle_initial' => [
     408    'dtoc_display_toggle_initial_sm' => [
    460409        'title'    => __( 'Initial Body View', 'digital-table-of-contents' ),
    461410        'callback' => 'dtoc_display_toggle_initial_cb',
    462411        'section'  => 'dtoc_general_setting_section',
    463         'pages'    => [ 'dtoc_sliding_sticky' ],       
     412        'pages'    => [ 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile' ],     
    464413    ],
    465414    'dtoc_general_toggle_btn_text' => [
     
    473422        'callback' => 'dtoc_general_header_icon_cb',
    474423        'section'  => 'dtoc_general_setting_section',
    475         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     424        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    476425        'args'     => [
    477426            'class' => 'dtoc_child_opt dtoc_2_label_child_opt dtoc_display_title',
     
    482431        'callback' => 'dtoc_general_show_text_cb',
    483432        'section'  => 'dtoc_general_setting_section',
    484         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     433        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    485434        'args'     => [
    486435            'class' => 'dtoc_child_opt dtoc_2_label_child_opt dtoc_3_label_child_opt dtoc_display_title',
     
    491440        'callback' => 'dtoc_general_hide_text_cb',
    492441        'section'  => 'dtoc_general_setting_section',
    493         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     442        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    494443        'args'     => [
    495444            'class' => 'dtoc_child_opt dtoc_2_label_child_opt dtoc_3_label_child_opt dtoc_display_title',
     
    500449        'callback' => 'dtoc_general_jump_links_cb',
    501450        'section'  => 'dtoc_general_setting_section',
    502         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     451        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    503452        'args'     => [
    504453            'label_for' => 'jump_links',
     
    509458        'callback' => 'dtoc_general_scroll_behavior_cb',
    510459        'section'  => 'dtoc_general_setting_section',
    511         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     460        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    512461        'args'     => [
    513462            'class' => 'dtoc_child_opt dtoc_jump_links',
    514463        ],
    515464    ],
    516     'dtoc_general_scroll_back_to_toc' => [
    517         'title'    => __( 'Scroll Back to TOC', 'digital-table-of-contents' ),
    518         'callback' => 'dtoc_general_scroll_back_to_toc_cb',
    519         'section'  => 'dtoc_general_setting_section',
    520         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
    521         'args'     => [
    522             'label_for' => 'scroll_back_to_toc',
    523             'class'     => 'dtoc_child_opt dtoc_jump_links',
    524         ],
    525     ],
     465    // 'dtoc_general_scroll_back_to_toc' => [
     466    // 'title'    => __( 'Scroll Back to TOC', 'digital-table-of-contents' ),
     467    // 'callback' => 'dtoc_general_scroll_back_to_toc_cb',
     468    // 'section'  => 'dtoc_general_setting_section',
     469    //  'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_shortcode' ],
     470    // 'args'     => [
     471    //      'label_for' => 'scroll_back_to_toc',
     472    //      'class'     => 'dtoc_child_opt dtoc_jump_links',
     473    // ],
     474    // ],
    526475    'dtoc_general_alignment' => [
    527476        'title'    => __( 'Alignment', 'digital-table-of-contents' ),
    528477        'callback' => 'dtoc_general_alignment_cb',
    529478        'section'  => 'dtoc_general_setting_section',
    530         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     479        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_shortcode' ],
    531480    ],
    532481    'dtoc_general_wrap_content' => [
     
    534483        'callback' => 'dtoc_general_wrap_content_cb',
    535484        'section'  => 'dtoc_general_setting_section',
    536         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     485        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_shortcode' ],
    537486        'args'     => [
    538487            'label_for' => 'wrap_content',
     
    543492        'callback' => 'dtoc_general_when_cb',
    544493        'section'  => 'dtoc_general_setting_section',
    545         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     494        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    546495    ],
    547496    'dtoc_position' => [
     
    549498        'callback' => 'dtoc_general_position_cb',
    550499        'section'  => 'dtoc_general_setting_section',
    551         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
    552     ],
    553     'dtoc_position' => [
     500        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_shortcode' ],
     501    ],
     502    'dtoc_position_ss' => [
    554503        'title'    => __( 'Position', 'digital-table-of-contents' ),
    555504        'callback' => 'dtoc_general_sticky_position_cb',
     
    557506        'pages'    => [ 'dtoc_sliding_sticky'],
    558507    ],
     508    'dtoc_position_sm' => [
     509        'title'    => __( 'Position', 'digital-table-of-contents' ),
     510        'callback' => 'dtoc_general_sticky_mobile_position_cb',
     511        'section'  => 'dtoc_general_setting_section',
     512        'pages'    => ['dtoc_sliding_sticky_mobile'],
     513    ],
    559514    'dtoc_paragraph_number' => [
    560515        'title'    => __( 'Paragraph Number', 'digital-table-of-contents' ),
    561516        'callback' => 'dtoc_general_paragraph_number_cb',
    562517        'section'  => 'dtoc_general_setting_section',
    563         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     518        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    564519        'args'     => [
    565520            'label_for' => 'paragraph_number',
     
    571526        'callback' => 'dtoc_general_list_style_type_cb',
    572527        'section'  => 'dtoc_general_setting_section',
    573         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     528        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    574529    ],
    575530    'dtoc_general_headings_include' => [
     
    577532        'callback' => 'dtoc_general_headings_include_cb',
    578533        'section'  => 'dtoc_general_setting_section',
    579         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     534        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky','dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    580535    ],
    581536    'dtoc_customization_title_bg_color' => [
     
    583538        'callback' => 'dtoc_customization_title_bg_color_cb',
    584539        'section'  => 'dtoc_customization_title_section',
    585         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     540        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    586541    ],
    587542    'dtoc_customization_title_fg_color' => [
     
    589544        'callback' => 'dtoc_customization_title_fg_color_cb',
    590545        'section'  => 'dtoc_customization_title_section',
    591         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     546        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    592547    ],
    593548    'dtoc_customization_title_font_size' => [
     
    595550        'callback' => 'dtoc_customization_title_font_size_cb',
    596551        'section'  => 'dtoc_customization_title_section',
    597         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     552        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    598553    ],
    599554    'dtoc_customization_title_font_weight' => [
     
    601556        'callback' => 'dtoc_customization_title_font_weight_cb',
    602557        'section'  => 'dtoc_customization_title_section',
    603         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     558        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    604559    ],
    605560    'dtoc_customization_title_padding' => [
     
    607562        'callback' => 'dtoc_customization_title_padding_cb',
    608563        'section'  => 'dtoc_customization_title_section',
    609         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     564        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    610565    ],
    611566    'dtoc_customization_toggle_btn_bg_color' => [
     
    613568        'callback' => 'dtoc_customization_toggle_btn_bg_color_cb',
    614569        'section'  => 'dtoc_customization_toggle_btn_section',
    615         'pages'    => [ 'dtoc_sliding_sticky'],
     570        'pages'    => [ 'dtoc_sliding_sticky' ],
    616571    ],
    617572    'dtoc_customization_toggle_btn_fg_color' => [
     
    661616        'callback' => 'dtoc_customization_icon_bg_color_cb',
    662617        'section'  => 'dtoc_customization_icon_section',
    663         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     618        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    664619    ],
    665620    'dtoc_customization_icon_fg_color' => [
     
    667622        'callback' => 'dtoc_customization_icon_fg_color_cb',
    668623        'section'  => 'dtoc_customization_icon_section',
    669         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     624        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    670625    ],
    671626    'dtoc_customization_icon_size_color' => [
     
    673628        'callback' => 'dtoc_customization_icon_size_cb',
    674629        'section'  => 'dtoc_customization_icon_section',
    675         'pages'    => [ 'dtoc_incontent', 'dtoc_shortcode' ],
     630        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_shortcode' ],
    676631    ],
    677632    'dtoc_customization_icon_border_type' => [
     
    679634        'callback' => 'dtoc_customization_icon_border_type_cb',
    680635        'section'  => 'dtoc_customization_icon_section',
    681         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     636        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    682637    ],
    683638    'dtoc_customization_icon_border_color' => [
     
    685640        'callback' => 'dtoc_customization_icon_border_color_cb',
    686641        'section'  => 'dtoc_customization_icon_section',
    687         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     642        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    688643    ],
    689644    'dtoc_customization_icon_border_width' => [
     
    691646        'callback' => 'dtoc_customization_icon_border_width_cb',
    692647        'section'  => 'dtoc_customization_icon_section',
    693         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     648        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    694649    ],
    695650    'dtoc_customization_icon_border_radius' => [
     
    697652        'callback' => 'dtoc_customization_icon_border_radius_cb',
    698653        'section'  => 'dtoc_customization_icon_section',
    699         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     654        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    700655    ],
    701656    'dtoc_customization_icon_padding' => [
     
    703658        'callback' => 'dtoc_customization_icon_padding_cb',
    704659        'section'  => 'dtoc_customization_icon_section',
    705         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     660        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    706661    ],
    707662    'dtoc_customization_icon_margin' => [
     
    709664        'callback' => 'dtoc_customization_icon_margin_cb',
    710665        'section'  => 'dtoc_customization_icon_section',
    711         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     666        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    712667    ],
    713668   
     
    716671        'callback' => 'dtoc_customization_bg_color_cb',
    717672        'section'  => 'dtoc_customization_container_section',
    718         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     673        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    719674    ],
    720675    'dtoc_customization_link_color' => [
     
    722677        'callback' => 'dtoc_customization_link_color_cb',
    723678        'section'  => 'dtoc_customization_link_section',
    724         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     679        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    725680    ],
    726681    'dtoc_customization_link_hover_color' => [
     
    728683        'callback' => 'dtoc_customization_link_hover_color_cb',
    729684        'section'  => 'dtoc_customization_link_section',
    730         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     685        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    731686    ],
    732687    'dtoc_customization_link_visited_color' => [
     
    734689        'callback' => 'dtoc_customization_link_visited_color_cb',
    735690        'section'  => 'dtoc_customization_link_section',
    736         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     691        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    737692    ],
    738693    'dtoc_customization_link_padding' => [
     
    740695        'callback' => 'dtoc_customization_link_padding_cb',
    741696        'section'  => 'dtoc_customization_link_section',
    742         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     697        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    743698    ],
    744699    'dtoc_customization_link_margin' => [
     
    746701        'callback' => 'dtoc_customization_link_margin_cb',
    747702        'section'  => 'dtoc_customization_link_section',
    748         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     703        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    749704    ],
    750705    'dtoc_customization_container_width' => [
     
    752707        'callback' => 'dtoc_customization_container_width_cb',
    753708        'section'  => 'dtoc_customization_container_section',
    754         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     709        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    755710    ],
    756711    'dtoc_customization_container_height' => [
     
    758713        'callback' => 'dtoc_customization_container_height_cb',
    759714        'section'  => 'dtoc_customization_container_section',
    760         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     715        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    761716    ],
    762717    'dtoc_customization_container_margin' => [
     
    764719        'callback' => 'dtoc_customization_container_margin_cb',
    765720        'section'  => 'dtoc_customization_container_section',
    766         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     721        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    767722    ],
    768723    'dtoc_customization_container_padding' => [
     
    770725        'callback' => 'dtoc_customization_container_padding_cb',
    771726        'section'  => 'dtoc_customization_container_section',
    772         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     727        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    773728    ],
    774729    'dtoc_customization_border_type' => [
     
    776731        'callback' => 'dtoc_customization_border_type_cb',
    777732        'section'  => 'dtoc_customization_border_section',
    778         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     733        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    779734    ],
    780735    'dtoc_customization_border_color' => [
     
    782737        'callback' => 'dtoc_customization_border_color_cb',
    783738        'section'  => 'dtoc_customization_border_section',
    784         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     739        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    785740    ],
    786741    'dtoc_customization_border_width' => [
     
    788743        'callback' => 'dtoc_customization_border_width_cb',
    789744        'section'  => 'dtoc_customization_border_section',
    790         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     745        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    791746    ],
    792747    'dtoc_customization_border_radius' => [
     
    794749        'callback' => 'dtoc_customization_border_radius_cb',
    795750        'section'  => 'dtoc_customization_border_section',
    796         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     751        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    797752    ],
    798753    'dtoc_display_hierarchy' => [
     
    800755        'callback' => 'dtoc_display_hierarchy_cb',
    801756        'section'  => 'dtoc_advanced_setting_section',
    802         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     757        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
    803758        'args'     => [ 'label_for' => 'hierarchy' ],
    804759    ],
     
    807762    //  'callback' => 'dtoc_display_exp_col_subheadings_cb',
    808763    //  'section'  => 'dtoc_advanced_setting_section',
    809     //  'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     764    //  'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    810765    //  'args'     => [ 'label_for' => 'exp_col_subheadings', 'class' => 'dtoc_child_opt dtoc_hierarchy' ],
    811766    // ],
     
    814769    //  'callback' => 'dtoc_display_show_more_cb',
    815770    //  'section'  => 'dtoc_advanced_setting_section',
    816     //  'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     771    //  'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    817772    //  'args'     => [ 'label_for' => 'show_more' ],
    818773    // ],
    819     // 'dtoc_display_combine_page_break' => [
    820     // 'title'    => __( 'Combine Page Break', 'digital-table-of-contents' ),
    821     // 'callback' => 'dtoc_display_combine_page_break_cb',
    822     // 'section'  => 'dtoc_advanced_setting_section',
    823     //  'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
    824     // 'args'     => [ 'label_for' => 'combine_page_break' ],
    825     // ],
     774    'dtoc_display_combine_page_break' => [
     775        'title'    => __( 'Combine Page Break', 'digital-table-of-contents' ),
     776        'callback' => 'dtoc_display_combine_page_break_cb',
     777        'section'  => 'dtoc_advanced_setting_section',
     778        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
     779        'args'     => [ 'label_for' => 'combine_page_break' ],
     780    ],
    826781    'dtoc_display_accessibility' => [
    827782        'title'    => __( 'Accessibility', 'digital-table-of-contents' ),
    828783        'callback' => 'dtoc_display_accessibility_cb',
    829784        'section'  => 'dtoc_advanced_setting_section',
    830         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     785        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    831786        'args'     => [ 'label_for' => 'accessibility' ],
    832787    ],
     
    835790        'callback' => 'dtoc_display_preserve_line_breaks_cb',
    836791        'section'  => 'dtoc_advanced_setting_section',
    837         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     792        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    838793        'args'     => [ 'label_for' => 'preserve_line_breaks' ],
    839794    ],
     
    842797        'callback' => 'dtoc_display_exclude_headings_cb',
    843798        'section'  => 'dtoc_advanced_setting_section',
    844         'pages'    => [ 'dtoc_incontent', 'dtoc_sliding_sticky', 'dtoc_shortcode' ],
     799        'pages'    => [ 'dtoc_incontent', 'dtoc_incontent_mobile', 'dtoc_floating', 'dtoc_sliding_sticky', 'dtoc_sliding_sticky_mobile', 'dtoc_shortcode' ],
    845800        'args'     => [ 'label_for' => 'exclude_headings' ],
    846801    ],
     
    18331788}
    18341789
     1790public function dtoc_general_sticky_mobile_position_cb() {
     1791    $this->dtoc_resolve_meta_settings_name();
     1792    ?>
     1793    <select class="smpg-input" name="<?php echo esc_attr( $this->_setting_name ); ?>[display_position]" id="display_position">
     1794        <option value="bottom-sheet" <?php echo ( isset( $this->_setting_option['display_position'] ) && $this->_setting_option['display_position'] === 'bottom-sheet' ? 'selected' : '' ); ?>>
     1795            <?php echo esc_html__( 'Bottom Sheet', 'digital-table-of-contents' ); ?>
     1796        </option>
     1797        <option value="top-sheet" <?php echo ( isset( $this->_setting_option['display_position'] ) && $this->_setting_option['display_position'] === 'top-sheet' ? 'selected' : '' ); ?>>
     1798            <?php echo esc_html__( 'Top Sheet', 'digital-table-of-contents' ); ?>
     1799        </option>       
     1800    </select>
     1801    <?php
     1802}
     1803
    18351804public function dtoc_general_paragraph_number_cb(){
    18361805    $this->dtoc_resolve_meta_settings_name();     
  • digital-table-of-contents/trunk/admin/dashboard_page.php

    r3361111 r3365361  
    115115        ],
    116116        [
    117             'title' => 'Floating',
    118             'desc'  => 'A Floating TOC is a movable, draggable, or collapsible navigation element that isn\'t fixed, allowing repositioning and enhanced interaction',
    119             'name'  => 'floating',
    120             'url'   => admin_url( 'admin.php?page=dtoc_floating'),
    121             'learn' => 'https://digitaltableofcontents/documentation'
    122         ],       
     117            'title' => 'Sliding Sticky Mobile',
     118            'desc'  => 'A sticky TOC that stays hidden and slides in from the Bottom to Topp or Top to Bottom when toggled. Best for users who want to save space and show TOC only when needed.',
     119            'name'  => 'sliding_sticky_mobile',
     120            'url'   => admin_url( 'admin.php?page=dtoc_sliding_sticky_mobile'),
     121            'learn' => 'https://digitaltableofcontents/documentation'
     122        ],
    123123        [           
    124124            'title' => 'In-Content Mobile',
     
    129129        ],
    130130        [
    131             'title' => 'In-Content Tablet',
    132             'desc'  => 'Enable for advanced, separate customization of the In-Content TOC in tablet. If disabled, the TOC will display by default based on the In-Content module.',
    133             'name'  => 'incontent_tablet',
    134             'url'   => admin_url( 'admin.php?page=dtoc_incontent_tablet'),
    135             'learn' => 'https://digitaltableofcontents/documentation'
    136         ],       
    137         [           
    138             'title' => 'Sticky Mobile',
    139             'desc'  => 'Enable for advanced, separate customization of the Sticky TOC in mobile. If disabled, the TOC will display by default based on the Sticky module.',
    140             'name'  => 'sticky_mobile',
    141             'url'   => admin_url( 'admin.php?page=dtoc_sliding_sticky_mobile'),
    142             'learn' => 'https://digitaltableofcontents/documentation'
    143         ],
    144         [
    145             'title' => 'Sticky Tablet',
    146             'desc'  => 'Enable for advanced, separate customization of the Sticky TOC in tablet. If disabled, the TOC will display by default based on the Sticky module.',
    147             'name'  => 'sticky_tablet',
    148             'url'   => admin_url( 'admin.php?page=dtoc_sliding_sticky_tablet'),
    149             'learn' => 'https://digitaltableofcontents/documentation'
    150         ],       
    151         [
    152             'title' => 'Floating Mobile',
    153             'desc'  => 'Enable for advanced, separate customization of the Floating TOC in mobile. If disabled, the TOC will display by default based on the floating module.',
    154             'name'  => 'floating_mobile',
    155             'url'   => admin_url( 'admin.php?page=dtoc_floating_mobile'),
    156             'learn' => 'https://digitaltableofcontents/documentation'
    157         ],
    158         [           
    159             'title' => 'Floating Tablet',
    160             'desc'  => 'Enable for advanced, separate customization of the Floating TOC in tablet. If disabled, the TOC will display by default based on the floating module.',
    161             'name'  => 'floating_tablet',
    162             'url'   => admin_url( 'admin.php?page=dtoc_floating_tablet'),
    163             'learn' => 'https://digitaltableofcontents/documentation'
    164         ],       
    165         [
    166             'title' => 'Shortcode Mobile',
    167             'desc'  => 'Enable for advanced, separate customization of the Shortcode in mobile. If disabled, the TOC will display by default based on the Shortcode module.',
    168             'name'  => 'shortcode_mobile',
    169             'url'   => admin_url( 'admin.php?page=dtoc_shortcode_mobile'),
    170             'learn' => 'https://digitaltableofcontents/documentation'
    171         ],
    172         [
    173             'title' => 'Shortcode Tablet',
    174             'desc'  => 'Enable for advanced, separate customization of the Shortcode in tablet. If disabled, the TOC will display by default based on the Shortcode module.',
    175             'name'  => 'shortcode_tablet',
    176             'url'   => admin_url( 'admin.php?page=dtoc_shortcode_tablet'),
    177             'learn' => 'https://digitaltableofcontents/documentation'
    178         ]               
     131            'title' => 'Floating',
     132            'desc'  => 'A Floating TOC is a movable, draggable, or collapsible navigation element that isn\'t fixed, allowing repositioning and enhanced interaction',
     133            'name'  => 'floating',
     134            'url'   => admin_url( 'admin.php?page=dtoc_floating'),
     135            'learn' => 'https://digitaltableofcontents/documentation'
     136        ],                                               
    179137    ];
    180138    ?>
     
    196154            <div class="dtoc-loader"></div>
    197155            <label class="dtoc-switch">
    198                 <input type="checkbox" class="dtoc-grid-checkbox" name="<?php echo esc_attr($value['name']) ?>" <?php if($dtoc_dashboard['modules'][$value['name']] == true){ echo 'checked';}?> >
     156                <input type="checkbox" class="dtoc-grid-checkbox" name="<?php echo esc_attr($value['name']) ?>" <?php if( !empty( $dtoc_dashboard['modules'][$value['name']] ) ){ echo 'checked';}?> >
    199157                <span class="dtoc-slider"></span>
    200158            </label>
  • digital-table-of-contents/trunk/admin/misc.php

    r3361111 r3365361  
    2323        $setting_name   = str_replace( 'digital-toc_page_','',$screen_id );
    2424
    25         global $dtoc_dashboard, $dtoc_incontent, $dtoc_incontent_mobile,$dtoc_incontent_tablet, $dtoc_sliding_sticky, $dtoc_sliding_sticky_mobile, $dtoc_sliding_sticky_tablet, $dtoc_floating, $dtoc_floating_mobile, $dtoc_floating_tablet, $dtoc_shortcode, $dtoc_shortcode_mobile, $dtoc_shortcode_tablet;
     25        global $dtoc_dashboard, $dtoc_incontent, $dtoc_incontent_mobile, $dtoc_sliding_sticky, $dtoc_sliding_sticky_mobile, $dtoc_floating, $dtoc_shortcode;
    2626               
    2727        $admin_data = [];
     
    5656                $reg_url = DTOC_URL . 'assets/admin/js/admin-incontent.js';
    5757                break;
    58             case 'dtoc_sliding_sticky':             
     58            case 'dtoc_sliding_sticky':                        
    5959                $admin_data['module_state'] = $dtoc_sliding_sticky;     
     60                $reg_url = DTOC_URL . 'assets/admin/js/admin-sticky.js';                   
     61            break;           
     62            case 'dtoc_sliding_sticky_mobile':             
     63                $admin_data['module_state'] = $dtoc_sliding_sticky_mobile;     
    6064                $reg_url = DTOC_URL . 'assets/admin/js/admin-sticky.js';                   
    6165            break;
     
    6468                $admin_data['module_default_state'] = dtoc_default_shortcode_options();                               
    6569                $reg_url = DTOC_URL . 'assets/admin/js/admin-incontent.js';
    66                 break;         
     70                break;
     71            case 'dtoc_floating':
     72                $admin_data['module_state'] = $dtoc_floating;               
     73                $reg_url = DTOC_URL . 'assets/admin/js/admin-floating.js';
     74            break;
     75            case 'dtoc_incontent_mobile':               
     76                $admin_data['module_state'] = $dtoc_incontent_mobile;               
     77                $reg_url = DTOC_URL . 'assets/admin/js/admin-incontent.js';
     78            break;         
    6779                # code...
    6880                break;
     
    217229                update_option('dtoc_sliding_sticky', $options['sliding_sticky']);
    218230            }
    219             if (isset($options['sticky_mobile'])) {
    220                 update_option('dtoc_sliding_sticky_mobile', $options['sticky_mobile']);
     231            if (isset($options['sliding_sticky_mobile'])) {
     232                update_option('dtoc_sliding_sticky_mobile', $options['sliding_sticky_mobile']);
    221233            }
    222234            if (isset($options['sticky_tablet'])) {
  • digital-table-of-contents/trunk/assets/admin/css/admin.css

    r3361111 r3365361  
    487487}
    488488
    489 
    490 /* Overlay for all .dtoc-grid-item except the first one */
    491 .dtoc-grid-container .dtoc-grid-item:not(:first-child):not(:nth-child(2)):not(:nth-child(3))::after {
    492 
    493   content: "Coming Soon";
    494   position: absolute;
    495   top: 0;
    496   left: 0;
    497   width: 100%;
    498   height: 100%;
    499   background: rgba(255,255,255,0.8);
    500   color: rgb(55, 156, 9);
    501   font-size: 16px;
    502   font-weight: bold;
    503   display: flex;
    504   justify-content: center;
    505   align-items: center;
    506   pointer-events: all;
    507   z-index: 9;
    508   text-transform: uppercase;
    509   border-radius: 6px;
    510 }
    511 
    512 .dtoc-grid-container .dtoc-grid-item:not(:first-child):not(:nth-child(2)):not(:nth-child(3)) {
    513   position: relative;
    514   pointer-events: none; /* Disable interaction */
    515   opacity: 0.6;
    516 }
    517489.dtoc-shortcode_source{
    518490  padding: 10px;
  • digital-table-of-contents/trunk/digital-table-of-contents.php

    r3361202 r3365361  
    33Plugin Name: Digital Table of Contents
    44Description: Show automated table of contents generated from the post content.
    5 Version: 1.0.3.1
     5Version: 1.0.4
    66Text Domain: digital-table-of-contents
    77Domain Path: /languages
     
    1414if ( ! defined( 'ABSPATH' ) ) exit;
    1515
    16 define('DTOC_VERSION', '1.0.3.1');
     16define('DTOC_VERSION', '1.0.4');
    1717define('DTOC_DIR_NAME', plugin_basename( dirname( __FILE__ ) ) );
    1818define('DTOC_BASE_NAME', plugin_basename( __FILE__ ) );
     
    3737require_once( DTOC_PATH . '/includes/misc.php' );
    3838require_once( DTOC_PATH . '/includes/generic_functions.php' );
    39 require_once( DTOC_PATH . '/includes/incontent/in_content.php' );
     39require_once( DTOC_PATH . '/includes/incontent/in-content.php' );
     40require_once( DTOC_PATH . '/includes/incontent/in-content-mobile.php' );
     41require_once( DTOC_PATH . '/includes/shortcode/shortcode.php' );
    4042require_once( DTOC_PATH . '/includes/sticky/sliding-sticky.php' );
     43require_once( DTOC_PATH . '/includes/sticky/sliding-sticky-mobile.php' );
    4144require_once( DTOC_PATH . '/includes/floating/floating.php' );
    42 require_once( DTOC_PATH . '/includes/shortcode/shortcode.php' );
  • digital-table-of-contents/trunk/includes/floating/floating.php

    r3338299 r3365361  
    33if ( ! defined( 'ABSPATH' ) ) exit;
    44
    5 add_filter( 'the_content', 'dtoc_floating_content_callback');
     5add_filter( 'the_content', 'dtoc_floating_callback' );
    66
    7 function dtoc_floating_content_callback($content){
     7function dtoc_floating_callback( $content ) {
     8
     9    global $dtoc_dashboard;
    810   
     11    if ( empty( $dtoc_dashboard['modules']['floating'] ) ) {
     12        return $content;
     13    }
     14
    915    if ( is_singular() && in_the_loop() && is_main_query() ) {
    1016
    11         global $dtoc_floating, $dtoc_dashboard;
     17        $options = dtoc_get_options_by_device( 'floating' );       
     18
     19        if ( ! empty( $options ) && dtoc_placement_condition_matched( $options ) ) {
    1220           
    13         if(isset($dtoc_dashboard['modules']['floating']) && $dtoc_dashboard['modules']['floating'] == 1 && dtoc_placement_condition_matched($dtoc_floating)){
    14             $matches     = dtoc_filter_heading($content,$dtoc_floating);
     21            $matches     = dtoc_filter_heading( $content, $options );
    1522                     
    16             if(!empty($matches)){
    17                 $html        = '';   
    18                 $headings    = dtoc_get_headings($matches);                 
    19                 if(isset($dtoc_floating['jump_links']) && $dtoc_floating['jump_links'] == true){                   
    20                     $anchors     = dtoc_get_headings_with_anchors($matches);
    21                     $content     = dtoc_add_jumb_ids( $headings, $anchors, $content );
    22                 }
    23                 $html .= '<div class="dtoc-floating-container">';
    24                 $html .= '<div class="dtoc-floating-body">';
    25                 $html .= dtoc_get_plain_toc_html($matches , $dtoc_floating);
    26                 $html .= '</div>';
    27                 $html .= '</div>';
     23            if ( ! empty( $matches ) ) {
    2824
    29                 $content = $content.$html;   
    30             }           
     25                $headings    = dtoc_get_headings( $matches );
     26                               
     27                if ( count( $headings ) ) {
     28
     29                    if ( ! empty( $options['jump_links']) ) {
     30
     31                        $anchors     = dtoc_get_headings_with_anchors( $matches );                       
     32                        $content     = dtoc_add_jumb_ids( $headings, $anchors, $content );
     33   
     34                    }   
     35   
     36                    $content     = $content.dtoc_floating_box( $matches, $options );
     37
     38                }               
     39               
     40            }
    3141        }                   
    3242               
     
    3545    return $content;   
    3646}
     47
     48function dtoc_floating_box( $matches, $options = [] ) {
     49   
     50    $dbc_style = dtoc_box_container_style( $options );
     51    $html = '<div class="dtoc-floating-box-container" style="'.$dbc_style.'">';
     52   
     53    if ( ! empty( $options['display_title'] ) ) {
     54
     55        $heading_text = '';                       
     56        if ( isset( $options['header_text'] ) && $options['header_text'] === 'Table of Contents' ) {
     57            $heading_text = '<span class="dtoc-floating-title-str">'.esc_html__( 'Table of Contents', 'digital-table-of-contents' ).'</span>';
     58        }else{
     59            $heading_text = '<span class="dtoc-floating-title-str">'.esc_html( $options['header_text'] ).'</span>';
     60        }
     61
     62        $t_style = dtoc_get_title_style( $options );       
     63        $html .= '<div class="dtoc-floating-toggle-label" style="'.$t_style.'">';
     64        $html .= '<span class="dtoc-floating-left-grp">';
     65        $html .= '<span class="dtoc-floating-drag-icon" aria-hidden="true"></span>';
     66        $html .= $heading_text;
     67        $html .= '</span>';
     68        $html .= dtoc_get_header_icon( $options );
     69        $html .= '</div>';       
     70    }
     71    $html .= dtoc_get_custom_style( $options );
     72    $html .= dtoc_get_toc_link_style( $options, 'incontent' );
     73    $html .= '<div class="dtoc-floating-box-body">';
     74    $html .= dtoc_get_plain_toc_html( $matches, $options );
     75    $html .= '</div>';
     76   
     77    $html .= '</div>';
     78
     79    return $html;
     80}
     81 
     82 add_filter('dtoc_regex_filter_incontent','dtoc_regex_heading_include_floating',10,1);
     83
     84 function dtoc_regex_heading_include_floating( $regex ) {
     85
     86    global $dtoc_dashboard, $dtoc_incontent, $dtoc_incontent_mobile, $dtoc_incontent_tablet;
     87    $options     = $dtoc_incontent;
     88    $device_type = dtoc_get_device_type();
     89   
     90     switch ($device_type) {
     91         
     92                case 'mobile':
     93                $options = $dtoc_incontent_mobile;
     94                break;
     95               
     96                case 'tablet':
     97                $options = $dtoc_incontent_tablet;
     98                break;
     99               
     100                default:
     101                break;
     102               
     103     }
     104    if(!empty($options['headings_include']))
     105    {
     106        $allowed_heading = array_keys($options['headings_include']);
     107        $allowed_heading = is_array($allowed_heading)?implode(',',$allowed_heading):null;
     108       
     109        if($allowed_heading){
     110           
     111            return '/(<h(['.esc_attr($allowed_heading).']{1})[^>]*>)(.*)<\/h\2>/msuU';
     112        }
     113    }
     114    return $regex;
     115 }
  • digital-table-of-contents/trunk/includes/generic_functions.php

    r3361111 r3365361  
    22// Exit if accessed directly.
    33if ( ! defined( 'ABSPATH' ) ) exit;
    4 
    5 function dtoc_sliding_sticky_box_on_css( $matches , $options = [] ) {
    6 
    7     $dbc_style = dtoc_box_container_style( $options );
    8 
    9     // Handle toggle initial state
    10     $initial_state = ! empty( $options['toggle_initial'] ) ? $options['toggle_initial'] : 'hide';
    11     $checked_attr  = ( $initial_state === 'show' ) ? ' checked="checked"' : '';
    12 
    13     // Add checkbox with conditional checked
    14     $html  = '<input type="checkbox" id="dtoc-sliding-sticky-toggle"'. $checked_attr .'>' . "\n";
    15 
    16     $html .= '<div class="dtoc-sliding-sticky-container dtoc-'. esc_attr( $options['display_position'] ) .'" style="'.$dbc_style.'">' . "\n";
    17    
    18     $t_style = dtoc_get_toggle_btn_style( $options );
    19     $html .= '<label for="dtoc-sliding-sticky-toggle" class="dtoc-sliding-sticky-toggle-btn" style="'.$t_style.'">'. esc_html( $options['toggle_btn_text'] ) .'</label>' . "\n";   
    20    
    21     // Scrollable inner wrapper
    22     $html .= '<div class="dtoc-sliding-sticky-inner">' . "\n";
    23 
    24     if ( ! empty( $options['display_title'] ) ) {
    25         $t_style = dtoc_get_title_style( $options );       
    26         $html .= '<span class="dtoc-sliding-sticky-title-str" style="'.$t_style.'">'. esc_html( $options['header_text'] ) .'</span>' . "\n";               
    27     }
    28 
    29     $html .= dtoc_get_custom_style( $options );
    30     $html .= dtoc_get_toc_link_style( $options, 'sliding_sticky' );       
    31 
    32     $html .= '<div class="dtoc-sliding-sticky-box-body dtoc-sliding-sticky-box-on-css-body">' . "\n";
    33     $html .= dtoc_get_plain_toc_html( $matches, $options );   
    34     $html .= '</div>' . "\n"; // close body
    35 
    36     $html .= '</div>' . "\n"; // close inner
    37     $html .= '</div>' . "\n"; // close container
    38 
    39     return $html;
    40 }
    41 
    42 
    43 function dtoc_sliding_sticky_box_on_js( $matches, $options = [] ) {
    44 
    45     $dbc_style = dtoc_box_container_style( $options );
    46 
    47     // Initial state (show/hide)
    48     $initial_state = ! empty( $options['toggle_initial'] ) ? $options['toggle_initial'] : 'hide';
    49     $initial_class = ( $initial_state === 'show' ) ? ' dtoc-open' : ' dtoc-closed';
    50 
    51     // Detect if left or right positioned
    52     $is_left = strpos( $options['display_position'], 'left' ) !== false;
    53 
    54     // Safe offset to avoid flicker (about 300px, adjust if needed)
    55     if ( $initial_state === 'show' ) {
    56         $dbc_style .= $is_left ? 'left:0;' : 'right:0;';
    57     } else {
    58         $dbc_style .= $is_left ? 'left:-300px;visibility:hidden;' : 'right:-300px;visibility:hidden;';
    59     }
    60 
    61     $html  = '<div class="dtoc-sliding-sticky-container dtoc-' . esc_attr( $options['display_position'] ) . $initial_class . '" style="' . esc_attr( $dbc_style ) . '">' . "\n";
    62 
    63     // Toggle button
    64     $t_style = dtoc_get_toggle_btn_style( $options );
    65     $html .= '<button type="button" class="dtoc-sliding-sticky-toggle-btn" style="' . esc_attr( $t_style ) . '">' . esc_html( $options['toggle_btn_text'] ) . '</button>' . "\n";
    66 
    67     // Scrollable inner wrapper
    68     $html .= '<div class="dtoc-sliding-sticky-inner">' . "\n";
    69 
    70     if ( ! empty( $options['display_title'] ) ) {
    71         $t_style = dtoc_get_title_style( $options );
    72         $html   .= '<span class="dtoc-sliding-sticky-title-str" style="' . esc_attr( $t_style ) . '">' . esc_html( $options['header_text'] ) . '</span>' . "\n";
    73     }
    74 
    75     $html .= dtoc_get_custom_style( $options );
    76     $html .= dtoc_get_toc_link_style( $options, 'sliding_sticky' );
    77 
    78     $html .= '<div class="dtoc-sliding-sticky-box-body dtoc-sliding-sticky-box-on-js-body">' . "\n";
    79     $html .= dtoc_get_plain_toc_html( $matches, $options );
    80     $html .= '</div>' . "\n"; // close body
    81 
    82     $html .= '</div>' . "\n"; // close inner
    83     $html .= '</div>' . "\n"; // close container
    84 
    85     return $html;
    86 }
    87 
    884
    895function dtoc_box_on_css( $matches , $options = [] ) {
  • digital-table-of-contents/trunk/includes/misc.php

    r3361202 r3365361  
    33if ( ! defined( 'ABSPATH' ) ) exit;
    44
     5add_action( 'wp_enqueue_scripts', 'dtoc_floating_modules_enqueue' );
     6
     7function dtoc_floating_modules_enqueue() {
     8
     9        global $dtoc_dashboard, $dtoc_floating;
     10
     11        if (  ! empty( $dtoc_dashboard['modules']['floating'] ) ) {
     12                       
     13                $data = [];
     14               
     15                $data['scroll_behaviour'] = isset( $dtoc_floating['scroll_behavior'] ) ? $dtoc_floating['scroll_behavior'] : 'auto';
     16                $data['toggle_body']      = isset( $dtoc_floating['toggle_body'] ) ? 1 : 0;
     17                               
     18                $data = apply_filters( 'dtoc_localize_frontend_assets', $data, 'dtoc_localize_frontend_data' );
     19
     20                wp_register_script( 'dtoc-floating-frontend', DTOC_URL  . 'assets/frontend/js/dtoc_floating.js', array('jquery'), DTOC_VERSION , true );                       
     21                wp_localize_script( 'dtoc-floating-frontend', 'dtoc_localize_frontend_data', $data );       
     22                wp_enqueue_script( 'dtoc-floating-frontend' );                       
     23
     24                wp_enqueue_style( 'dtoc-floating-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-floating.css', false , DTOC_VERSION );   
     25                               
     26                $list_style_type = 'decimal';
     27                        $counter_end =  "'.'";
     28                if(!empty($dtoc_floating['list_style_type'])){
     29                        $list_style_type = $dtoc_floating['list_style_type'];
     30                                        if(in_array($list_style_type,array('circle','disc','square'))){
     31                                                $counter_end =  '';
     32                                        }
     33                                       
     34                }
     35                $custom_css = "";
     36                $custom_css = "
     37                        .dtoc-floating-box-container ul{
     38                                counter-reset: dtoc_item;
     39                                list-style-type: none;                 
     40                        }
     41                        .dtoc-floating-box-container ul li::before{
     42                                counter-increment: dtoc_item;
     43                                content: counters(dtoc_item,'.', $list_style_type) $counter_end;
     44                                padding-right: 4px;
     45                        }";
     46                       
     47                        if ( isset( $dtoc_floating['display_title'] ) && isset( $dtoc_floating['toggle_body'] ) ) {       
     48
     49                                if ( $dtoc_floating['toggle_initial'] == 'hide' ) {
     50
     51                                        $custom_css .= ".dtoc-floating-box-body{
     52                                                display: none;
     53                                        }
     54                                        .dtoc-hide-text {
     55                                                display: none;
     56                                        }                               
     57                                        ";     
     58                                       
     59                                }else{
     60
     61                                        $custom_css .= "
     62                                        .dtoc-show-text {
     63                                                display: none;
     64                                        }                               
     65                                        ";     
     66                                }
     67
     68                                $custom_css .= "
     69                                        .dtoc-floating-toggle-label{
     70                                                cursor: pointer;
     71                                        }                               
     72                                        ";
     73
     74                               
     75                        }                                                                     
     76                               
     77                if(isset($dtoc_floating['custom_css']) && !empty($dtoc_floating['custom_css'])){
     78                        $custom_css .= $dtoc_floating['custom_css'];
     79                }   
     80                wp_add_inline_style( 'dtoc-frontend', $custom_css );
     81
     82        }                       
     83                       
     84}
     85
     86add_action( 'wp_enqueue_scripts', 'dtoc_sliding_sticky_mobile_modules_enqueue' );
     87
     88function dtoc_sliding_sticky_mobile_modules_enqueue() {
     89
     90        global $dtoc_dashboard, $dtoc_sliding_sticky_mobile;
     91
     92        if ( empty( $dtoc_dashboard['modules']['sliding_sticky_mobile'] ) ) {
     93           return '';
     94        }               
     95               
     96        $data = [];       
     97
     98        $data['scroll_behaviour'] = isset( $dtoc_sliding_sticky_mobile['scroll_behavior'] ) ? $dtoc_sliding_sticky_mobile['scroll_behavior'] : 'auto';
     99        $data['toggle_body']      = isset( $dtoc_sliding_sticky_mobile['toggle_body'] ) ? 1 : 0;
     100        $data['display_position'] = $dtoc_sliding_sticky_mobile['display_position'];                                               
     101
     102        wp_register_script( 'dtoc-sliding-sticky-mobile-frontend', DTOC_URL  . 'assets/frontend/js/dtoc-sliding-sticky-mobile.js', array('jquery'), DTOC_VERSION , true );                       
     103        wp_localize_script( 'dtoc-sliding-sticky-mobile-frontend', 'dtoc_localize_frontend_sticky_data', $data );       
     104        wp_enqueue_script( 'dtoc-sliding-sticky-mobile-frontend' );                       
     105        wp_enqueue_style( 'dtoc-sliding-sticky-mobile-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-sliding-sticky-mobile.css', false , DTOC_VERSION );
     106                                           
     107        $list_style_type = 'decimal';
     108        $counter_end =  "'.'";
     109
     110        if ( ! empty( $dtoc_sliding_sticky_mobile['list_style_type'] ) ) {
     111
     112                $list_style_type = $dtoc_sliding_sticky_mobile['list_style_type'];
     113
     114                if ( in_array( $list_style_type, array( 'circle','disc','square' ) ) ) {
     115                        $counter_end =  '';
     116                }
     117                               
     118        }
     119        $custom_css = "";
     120        $custom_css = "
     121                .dtoc-sliding-sticky-mobile-container ul{
     122                        counter-reset: dtoc_item;
     123                        list-style-type: none;                 
     124                }
     125                .dtoc-sliding-sticky-mobile-container ul li::before{
     126                        counter-increment: dtoc_item;
     127                        content: counters(dtoc_item,'.', $list_style_type) $counter_end;
     128                        padding-right: 4px;
     129                }";                               
     130                if ( isset( $dtoc_sliding_sticky_mobile['scroll_behavior'] ) && $dtoc_sliding_sticky_mobile['scroll_behavior'] == 'smooth' ) {
     131                        $custom_css .= "html {
     132                                scroll-behavior: smooth;
     133                        }";
     134                }
     135               
     136               
     137        if(isset($dtoc_sliding_sticky_mobile['custom_css']) && !empty($dtoc_sliding_sticky_mobile['custom_css'])){
     138                $custom_css .= $dtoc_sliding_sticky_mobile['custom_css'];
     139        }   
     140        wp_add_inline_style( 'dtoc-sliding-sticky-mobile-frontend', $custom_css );
     141
     142}
     143
    5144add_action( 'wp_enqueue_scripts', 'dtoc_sliding_sticky_modules_enqueue' );
    6145
     
    25164                wp_localize_script( 'dtoc-sliding-sticky-frontend', 'dtoc_localize_frontend_sticky_data', $data );       
    26165                wp_enqueue_script( 'dtoc-sliding-sticky-frontend' );                       
    27                 wp_enqueue_style( 'dtoc-sliding-sticky-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-sliding-sticky-front-js-based.css', false , DTOC_VERSION );
     166                wp_enqueue_style( 'dtoc-sliding-sticky-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-sliding-sticky-js-based.css', false , DTOC_VERSION );
    28167
    29168        }else{
    30169
    31                 wp_enqueue_style( 'dtoc-sliding-sticky-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-sliding-sticky-front-css-based.css', false , DTOC_VERSION );
     170                wp_enqueue_style( 'dtoc-sliding-sticky-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-sliding-sticky-css-based.css', false , DTOC_VERSION );
    32171        }
    33172               
     
    77216        global $dtoc_dashboard, $dtoc_incontent;
    78217
    79         if ( !empty( $dtoc_dashboard['modules']['incontent'] ) || !empty( $dtoc_dashboard['modules']['shortcode'] ) ) {
     218        if ( !empty( $dtoc_dashboard['modules']['incontent'] ) || !empty( $dtoc_dashboard['modules']['incontent_mobile'] ) || !empty( $dtoc_dashboard['modules']['shortcode'] ) ) {
    80219                       
    81220                $data = [];
     
    88227                        $data = apply_filters( 'dtoc_localize_frontend_assets', $data, 'dtoc_localize_frontend_data' );
    89228
    90                         wp_register_script( 'dtoc-frontend', DTOC_URL  . 'assets/frontend/js/dtoc_auto_place.js', array('jquery'), DTOC_VERSION , true );                       
     229                        wp_register_script( 'dtoc-frontend', DTOC_URL  . 'assets/frontend/js/dtoc_incontent.js', array('jquery'), DTOC_VERSION , true );                       
    91230                        wp_localize_script( 'dtoc-frontend', 'dtoc_localize_frontend_data', $data );       
    92231                        wp_enqueue_script( 'dtoc-frontend' );                       
     
    94233                }
    95234                       
    96                 wp_enqueue_style( 'dtoc-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-front.css', false , DTOC_VERSION );   
     235                wp_enqueue_style( 'dtoc-frontend', DTOC_URL  . 'assets/frontend/css/dtoc-incontent.css', false , DTOC_VERSION );   
    97236                               
    98237                $list_style_type = 'decimal';
  • digital-table-of-contents/trunk/includes/sticky/sliding-sticky.php

    r3361111 r3365361  
    5252    return $content;   
    5353}
     54
     55function dtoc_sliding_sticky_box_on_css( $matches , $options = [] ) {
     56
     57    $dbc_style = dtoc_box_container_style( $options );
     58
     59    // Handle toggle initial state
     60    $initial_state = ! empty( $options['toggle_initial'] ) ? $options['toggle_initial'] : 'hide';
     61    $checked_attr  = ( $initial_state === 'show' ) ? ' checked="checked"' : '';
     62
     63    // Add checkbox with conditional checked
     64    $html  = '<input type="checkbox" id="dtoc-sliding-sticky-toggle"'. $checked_attr .'>' . "\n";
     65
     66    $html .= '<div class="dtoc-sliding-sticky-container dtoc-'. esc_attr( $options['display_position'] ) .'" style="'.$dbc_style.'">' . "\n";
     67   
     68    $t_style = dtoc_get_toggle_btn_style( $options );
     69    $html .= '<label for="dtoc-sliding-sticky-toggle" class="dtoc-sliding-sticky-toggle-btn" style="'.$t_style.'">'. esc_html( $options['toggle_btn_text'] ) .'</label>' . "\n";   
     70   
     71    // Scrollable inner wrapper
     72    $html .= '<div class="dtoc-sliding-sticky-inner">' . "\n";
     73
     74    if ( ! empty( $options['display_title'] ) ) {
     75        $t_style = dtoc_get_title_style( $options );       
     76        $html .= '<span class="dtoc-sliding-sticky-title-str" style="'.$t_style.'">'. esc_html( $options['header_text'] ) .'</span>' . "\n";               
     77    }
     78
     79    $html .= dtoc_get_custom_style( $options );
     80    $html .= dtoc_get_toc_link_style( $options, 'sliding_sticky' );       
     81
     82    $html .= '<div class="dtoc-sliding-sticky-box-body dtoc-sliding-sticky-box-on-css-body">' . "\n";
     83    $html .= dtoc_get_plain_toc_html( $matches, $options );   
     84    $html .= '</div>' . "\n"; // close body
     85
     86    $html .= '</div>' . "\n"; // close inner
     87    $html .= '</div>' . "\n"; // close container
     88
     89    return $html;
     90}
     91
     92
     93function dtoc_sliding_sticky_box_on_js( $matches, $options = [] ) {
     94
     95    $dbc_style = dtoc_box_container_style( $options );
     96
     97    // Initial state (show/hide)
     98    $initial_state = ! empty( $options['toggle_initial'] ) ? $options['toggle_initial'] : 'hide';
     99    $initial_class = ( $initial_state === 'show' ) ? ' dtoc-open' : ' dtoc-closed';
     100
     101    // Detect if left or right positioned
     102    $is_left = strpos( $options['display_position'], 'left' ) !== false;
     103
     104    // Safe offset to avoid flicker (about 300px, adjust if needed)
     105    if ( $initial_state === 'show' ) {
     106        $dbc_style .= $is_left ? 'left:0;' : 'right:0;';
     107    } else {
     108        $dbc_style .= $is_left ? 'left:-300px;visibility:hidden;' : 'right:-300px;visibility:hidden;';
     109    }
     110
     111    $html  = '<div class="dtoc-sliding-sticky-container dtoc-' . esc_attr( $options['display_position'] ) . $initial_class . '" style="' . esc_attr( $dbc_style ) . '">' . "\n";
     112
     113    // Toggle button
     114    $t_style = dtoc_get_toggle_btn_style( $options );
     115    $html .= '<button type="button" class="dtoc-sliding-sticky-toggle-btn" style="' . esc_attr( $t_style ) . '">' . esc_html( $options['toggle_btn_text'] ) . '</button>' . "\n";
     116
     117    // Scrollable inner wrapper
     118    $html .= '<div class="dtoc-sliding-sticky-inner">' . "\n";
     119
     120    if ( ! empty( $options['display_title'] ) ) {
     121        $t_style = dtoc_get_title_style( $options );
     122        $html   .= '<span class="dtoc-sliding-sticky-title-str" style="' . esc_attr( $t_style ) . '">' . esc_html( $options['header_text'] ) . '</span>' . "\n";
     123    }
     124
     125    $html .= dtoc_get_custom_style( $options );
     126    $html .= dtoc_get_toc_link_style( $options, 'sliding_sticky' );
     127
     128    $html .= '<div class="dtoc-sliding-sticky-box-body dtoc-sliding-sticky-box-on-js-body">' . "\n";
     129    $html .= dtoc_get_plain_toc_html( $matches, $options );
     130    $html .= '</div>' . "\n"; // close body
     131
     132    $html .= '</div>' . "\n"; // close inner
     133    $html .= '</div>' . "\n"; // close container
     134
     135    return $html;
     136}
  • digital-table-of-contents/trunk/readme.txt

    r3361202 r3365361  
    66Tested up to: 6.8 
    77Requires PHP: 7.4
    8 Stable tag: 1.0.3.1 
     8Stable tag: 1.0.4
    99License: GPLv2 or later 
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html 
     
    2828* <strong>Rendering Style   </strong>: Choose between CSS-based (lightweight and fast with basic interactions) or JavaScript-based rendering (more interactive and dynamic behavior) depending on your performance and functionality needs.
    2929* <strong>Multiple Header Icon Options</strong>: Choose from various icon styles like List Icon (☰), Show/Hide, Plus (+)/Minus (−), or even use a custom icon of your choice.
    30 * <strong>Full Customization</strong>: No need to rely on predefined designs — easily customize colors, styles, icons, background, link colors, title, borders, and much more, all hassle-free.
     30* <strong>Full Customization</strong>: No need to rely on predefined designs — easily customize colors, styles, icons, backgrounds, links, titles, borders, and much more. Hassle-free, giving you the freedom to create almost any type of table of contents design.
    3131* <strong>Custom CSS</strong>: If the built-in customization options aren’t sufficient, you can add your own CSS directly in the provided Custom CSS box.
    3232* <strong>Jump Links Control</strong>: Option to generate a TOC without clickable jump links, ideal for visual structure without navigation.
    3333* <strong>Lightweight & Performance-Friendly</strong>: Built for speed and efficiency, the plugin is optimized to have minimal impact on your site’s load time and overall performance.
    3434* <strong>Import / Export</strong>: Easily back up or transfer your TOC settings and configurations between sites with the one-click import/export feature.
    35 * <strong>Delete Data on Uninstall</strong>: Option to remove all Digital Table of Contents plugin data from the database when Digital Table of Contents plugin is uninstalled, ensuring a clean removal.
    36 * <strong>Fast Help & Support</strong>: If you are unable to find any features related to Digital Table of Contents or found any bug. Please contact us, Digital Table of Contents team would try to solve it quickly.
     35* <strong>Delete Plugin Data & Reset</strong>: Option to remove all Digital Table of Contents plugin data from the database when Digital Table of Contents plugin is uninstalled, ensuring a clean removal.
     36* <strong>Fast Help & Support</strong>: Facing issues or unable to find a feature in Digital Table of Contents? Our team is available 24/7 to assist you and resolve bugs or concerns as quickly as possible.
    3737
    3838**Shortcode:**
     
    4747
    4848
    49 **Available Modules (More Coming Soon!):**
     49**Available Modules :**
    5050
    51 - ✅ In-Content
    52 - ✅ Shortcode
    53 - ✅ Sliding Sticky
    54 - 🔜 Sidebar Sticky 
    55 - 🔜 Floating TOC   
    56 - 🔜 In-Content (Mobile) 
    57 - 🔜 In-Content Table 
    58 - 🔜 Sticky (Mobile) 
    59 - 🔜 Sticky Table 
    60 - 🔜 Floating (Mobile) 
    61 - 🔜 Floating Table
     51- ✅ <strong>In-Content<strong> : Embed the table of contents directly within your post or page content for seamless navigation.
     52- ✅ <strong>In-Content Mobile<strong> : Optimized version of In-Content specifically designed for mobile devices.
     53- ✅ <strong>Shortcode<strong> : Easily insert the TOC anywhere using a simple shortcode, giving you full placement flexibility.
     54- ✅ <strong>Sliding Sticky<strong> : A sticky TOC that stays hidden and slides in from the left or right when toggled. Best for users who want to save space and show TOC only when needed.
     55- ✅ <strong>Sliding Sticky Mobile<strong> : A sticky TOC that stays hidden and slides in from the Bottom to Topp or Top to Bottom when toggled. Best for users who want to save space and show TOC only when needed.
     56- ✅ <strong>Floating<strong> : A Floating TOC is a movable, draggable, or collapsible navigation element that isn't fixed, allowing repositioning and enhanced interaction
    6257
    6358== Screenshots ==
     
    110105== Changelog ==
    111106
     107
     108= 1.0.4 =
     109* Sliding Sticky Mobile module added.
     110* Incontent Mobile module added.
     111* Floating module added.
     112
    112113= 1.0.3.1 =
    113114* Fixed Incontent toc is broken
  • digital-table-of-contents/trunk/shared/functions.php

    r3361111 r3365361  
    77function dtoc_options_init(){
    88   
    9     global $dtoc_dashboard, $dtoc_incontent, $dtoc_incontent_mobile, $dtoc_incontent_tablet, $dtoc_sliding_sticky, $dtoc_sliding_sticky_mobile, $dtoc_sliding_sticky_tablet, $dtoc_floating, $dtoc_floating_mobile, $dtoc_floating_tablet, $dtoc_shortcode, $dtoc_shortcode_mobile, $dtoc_shortcode_tablet, $dtoc_compatibility;
     9    global $dtoc_dashboard, $dtoc_incontent, $dtoc_incontent_mobile, $dtoc_sliding_sticky, $dtoc_sliding_sticky_mobile, $dtoc_floating, $dtoc_shortcode, $dtoc_compatibility;
    1010
    1111        $dtoc_dashboard          = get_option( 'dtoc_dashboard', dtoc_default_dashboard_options() );
    1212
    1313        $dtoc_incontent          = get_option( 'dtoc_incontent', dtoc_default_incontent_options() );
    14         $dtoc_incontent_mobile   = get_option( 'dtoc_incontent_mobile', dtoc_default_incontent_mobile_options() );
    15         $dtoc_incontent_tablet   = get_option( 'dtoc_incontent_tablet', dtoc_default_incontent_tablet_options() );
    16 
    17         $dtoc_shortcode          = get_option( 'dtoc_shortcode', dtoc_default_shortcode_options() );
    18         $dtoc_shortcode_mobile   = get_option( 'dtoc_shortcode_mobile', dtoc_default_shortcode_mobile_options() );
    19         $dtoc_shortcode_tablet   = get_option( 'dtoc_shortcode_tablet', dtoc_default_shortcode_tablet_options() );
     14        $dtoc_incontent_mobile   = get_option( 'dtoc_incontent_mobile', dtoc_default_incontent_mobile_options() );       
     15
     16        $dtoc_shortcode          = get_option( 'dtoc_shortcode', dtoc_default_shortcode_options() );       
    2017
    2118        $dtoc_sliding_sticky             = get_option( 'dtoc_sliding_sticky', dtoc_default_sticky_options() );
    22         $dtoc_sliding_sticky_mobile      = get_option( 'dtoc_sliding_sticky_mobile', dtoc_default_sticky_mobile_options() );
    23         $dtoc_sliding_sticky_tablet      = get_option( 'dtoc_sliding_sticky_tablet', dtoc_default_sticky_tablet_options() );
    24 
    25         $dtoc_floating           = get_option( 'dtoc_floating', dtoc_default_floating_options() );
    26         $dtoc_floating_mobile    = get_option( 'dtoc_floating_mobile', dtoc_default_floating_mobile_options() );
    27         $dtoc_floating_tablet    = get_option( 'dtoc_floating_tablet', dtoc_default_floating_tablet_options() );
     19        $dtoc_sliding_sticky_mobile      = get_option( 'dtoc_sliding_sticky_mobile', dtoc_default_sticky_mobile_options() );       
     20
     21        $dtoc_floating           = get_option( 'dtoc_floating', dtoc_default_floating_options() );       
    2822
    2923        $dtoc_compatibility      = get_option( 'dtoc_compatibility', dtoc_default_compatibility_options() );
     
    3226function dtoc_default_floating_options(){
    3327       
    34         $default = dtoc_option_types('all',['floating'],'default');
    35         $default = apply_filters("dtoc_default_floating_options_filter", $default);
    36         return $default;   
    37 }
    38 function dtoc_default_floating_mobile_options(){
    39         $default = dtoc_option_types('all',['floating_mobile'],'default');
    40         $default = apply_filters("dtoc_default_floating_mobile_options_filter", $default);
    41         return $default;   
    42 }
    43 function dtoc_default_floating_tablet_options(){
    44         $default = dtoc_option_types('all',['floating_tablet'],'default');
    45         $default = apply_filters("dtoc_default_floating_tablet_options_filter", $default);
     28        $default = [
     29            "rendering_style" => "js",
     30            "display_title" => 1,
     31            "header_text" => "Table of Contents",
     32            "toggle_body" => 1,
     33            "toggle_initial" => "show",
     34            "header_icon" => "list_icon",
     35            "custom_icon_url" => "",
     36            "show_text" => "show",
     37            "hide_text" => "hide",
     38            "jump_links" => 1,
     39            "scroll_behavior" => "smooth",
     40            "alignment" => "left",
     41            "display_when" => 2,
     42            "display_position" => "top_of_the_content",
     43            "paragraph_number" => 1,
     44            "list_style_type" => "decimal",
     45            "headings_include" => [
     46                "1" => 1,
     47                "2" => 1,
     48                "3" => 1,
     49                "4" => 1,
     50                "5" => 1,
     51                "6" => 1,
     52            ],
     53            "hierarchy"          => 0,
     54            "combine_page_break" => 0,
     55            "accessibility"     => 1,
     56            "preserve_line_breaks" => 0,
     57            "exclude_headings"  => '',
     58            "placement" => [
     59                "post" => [
     60                    "is_enabled" => 1,
     61                    "taxonomy" => [
     62                        "post_tag" => [
     63                            "ope" => "OR",
     64                        ],
     65                    ],
     66                ],
     67            ],
     68            "bg_color" => "#f9f9f9",
     69            "container_width_mode" => "default",
     70            "container_width" => 0,
     71            "container_width_unit" => "px",
     72            "container_height_mode" => "default",
     73            "design_type" => "px",
     74            "container_margin_mode" => "default",
     75            "container_margin_top" => 0,
     76            "container_margin_right" => 0,
     77            "container_margin_bottom" => 0,
     78            "container_margin_left" => 0,
     79            "container_margin_unit" => "px",
     80            "container_padding_mode" => "default",
     81            "container_padding_top" => 0,
     82            "container_padding_right" => 0,
     83            "container_padding_bottom" => 0,
     84            "container_padding_left" => 0,
     85            "container_padding_unit" => "px",
     86            "border_type" => "solid",
     87            "border_color" => "#dddddd",
     88            "border_width_mode" => "custom",
     89            "border_width_top" => 1,
     90            "border_width_right" => 1,
     91            "border_width_bottom" => 1,
     92            "border_width_left" => 1,
     93            "border_width_unit" => "px",
     94            "border_radius_mode" => "default",
     95            "border_radius_top_left" => 0,
     96            "border_radius_top_right" => 0,
     97            "border_radius_bottom_left" => 0,
     98            "border_radius_bottom_right" => 0,
     99            "border_radius_unit" => "px",
     100            "title_bg_color" => "#eeeeee",
     101            "title_fg_color" => "#222222",
     102            "title_font_size_mode" => "default",
     103            "title_font_size" => 0,
     104            "title_font_size_unit" => "px",
     105            "title_font_weight_mode" => "default",
     106            "title_font_weight" => 0,
     107            "title_padding_mode" => "default",
     108            "title_padding_top" => 0,
     109            "title_padding_right" => 0,
     110            "title_padding_bottom" => 0,
     111            "title_padding_left" => 0,
     112            "title_padding_unit" => "px",
     113            "icon_bg_color" => "#e0e0e0",
     114            "icon_fg_color" => "#333333",
     115            "icon_size_mode" => "default",
     116            "icon_width" => 25,
     117            "icon_height" => 25,
     118            "icon_size_unit" => "px",
     119            "icon_border_type" => "default",
     120            "icon_border_color" => "#D5E0EB",
     121            "icon_border_width_mode" => "default",
     122            "icon_border_width_top" => 0,
     123            "icon_border_width_right" => 0,
     124            "icon_border_width_bottom" => 0,
     125            "icon_border_width_left" => 0,
     126            "icon_border_width_unit" => "px",
     127            "icon_border_radius_mode" => "default",
     128            "icon_border_radius_top_left" => 0,
     129            "icon_border_radius_top_right" => 0,
     130            "icon_border_radius_bottom_left" => 0,
     131            "icon_border_radius_bottom_right" => 0,
     132            "icon_border_radius_unit" => "px",
     133            "icon_padding_mode" => "default",
     134            "icon_padding_top" => 0,
     135            "icon_padding_right" => 0,
     136            "icon_padding_bottom" => 0,
     137            "icon_padding_left" => 0,
     138            "icon_padding_unit" => "px",
     139            "icon_margin_mode" => "default",
     140            "icon_margin_top" => 0,
     141            "icon_margin_right" => 0,
     142            "icon_margin_bottom" => 0,
     143            "icon_margin_left" => 0,
     144            "icon_margin_unit" => "px",
     145            "link_color" => "#1a73e8",
     146            "link_hover_color" => "#0c47a1",
     147            "link_visited_color" => "#5f6368",
     148            "link_padding_mode" => "default",
     149            "link_padding_top" => 0,
     150            "link_padding_right" => 0,
     151            "link_padding_bottom" => 0,
     152            "link_padding_left" => 0,
     153            "link_padding_unit" => "px",
     154            "link_margin_mode" => "default",
     155            "link_margin_top" => 0,
     156            "link_margin_right" => 0,
     157            "link_margin_bottom" => 0,
     158            "link_margin_left" => 0,
     159            "link_margin_unit" => "px",
     160            "custom_css" => "",
     161        ];
     162       
     163        $default = apply_filters("dtoc_default_incontent_options_filter", $default);
    46164        return $default;   
    47165}
     
    167285}
    168286function dtoc_default_sticky_mobile_options(){
    169         $default = dtoc_option_types('all',['sticky_mobile'],'default');
    170         $default = apply_filters("dtoc_default_sticky_mobile_options_filter", $default);
    171         return $default;   
    172 }
    173 function dtoc_default_sticky_tablet_options(){
    174         $default = dtoc_option_types('all',['sticky_tablet'],'default');
    175         $default = apply_filters("dtoc_default_sticky_tablet_options_filter", $default);
    176         return $default;   
     287        $default = [               
     288        "header_text" => "Table of Contents",
     289        "toggle_initial" => "hide",     
     290        "jump_links" => 1,
     291        "scroll_behavior" => "smooth",
     292        "display_when" => 2,
     293        "display_position" => "bottom-sheet",       
     294        "list_style_type" => "decimal",
     295        "headings_include" => [
     296            "1" => 1,
     297            "2" => 1,
     298            "3" => 1,
     299            "4" => 1,
     300            "5" => 1,
     301            "6" => 1,
     302        ],
     303        "accessibility" => 1,
     304        "exclude_headings" => "",
     305        "placement" => [
     306            "post" => [
     307                "is_enabled" => 1,
     308            ],
     309        ],
     310        "bg_color" => "#f9f9f9",
     311        "container_width_mode" => "default",
     312        "container_width" => 0,
     313        "container_width_unit" => "px",
     314        "container_height_mode" => "default",
     315        "design_type" => "px",
     316        "container_margin_mode" => "default",
     317        "container_margin_top" => 0,
     318        "container_margin_right" => 0,
     319        "container_margin_bottom" => 0,
     320        "container_margin_left" => 0,
     321        "container_margin_unit" => "px",
     322        "container_padding_mode" => "default",
     323        "container_padding_top" => 0,
     324        "container_padding_right" => 0,
     325        "container_padding_bottom" => 0,
     326        "container_padding_left" => 0,
     327        "container_padding_unit" => "px",
     328        "border_type" => "solid",
     329        "border_color" => "#dddddd",
     330        "border_width_mode" => "custom",
     331        "border_width_top" => 1,
     332        "border_width_right" => 1,
     333        "border_width_bottom" => 1,
     334        "border_width_left" => 1,
     335        "border_width_unit" => "px",
     336        "border_radius_mode" => "default",
     337        "border_radius_top_left" => 0,
     338        "border_radius_top_right" => 0,
     339        "border_radius_bottom_left" => 0,
     340        "border_radius_bottom_right" => 0,
     341        "border_radius_unit" => "px",
     342        "title_bg_color" => "#f9f9f9",
     343        "title_fg_color" => "#222222",
     344        "title_font_size_mode" => "default",
     345        "title_font_size" => 0,
     346        "title_font_size_unit" => "px",
     347        "title_font_weight_mode" => "default",
     348        "title_font_weight" => 0,
     349        "title_padding_mode" => "default",
     350        "title_padding_top" => 0,
     351        "title_padding_right" => 0,
     352        "title_padding_bottom" => 0,
     353        "title_padding_left" => 0,
     354        "title_padding_unit" => "px",
     355        "toggle_btn_bg_color" => "#d3d3d3",
     356        "toggle_btn_fg_color" => "#000000",
     357        "toggle_btn_size_mode" => "default",
     358        "toggle_btn_width" => 25,
     359        "toggle_btn_height" => 25,
     360        "toggle_btn_size_unit" => "px",
     361        "toggle_btn_border_type" => "default",
     362        "toggle_btn_border_color" => "#d3d3d3",
     363        "toggle_btn_border_width_mode" => "default",
     364        "toggle_btn_border_width_top" => 0,
     365        "toggle_btn_border_width_right" => 0,
     366        "toggle_btn_border_width_bottom" => 0,
     367        "toggle_btn_border_width_left" => 0,
     368        "toggle_btn_border_width_unit" => "px",
     369        "toggle_btn_border_radius_mode" => "default",
     370        "toggle_btn_border_radius_top_left" => 0,
     371        "toggle_btn_border_radius_top_right" => 0,
     372        "toggle_btn_border_radius_bottom_left" => 0,
     373        "toggle_btn_border_radius_bottom_right" => 0,
     374        "toggle_btn_border_radius_unit" => "px",
     375        "toggle_btn_padding_mode" => "default",
     376        "toggle_btn_padding_top" => 0,
     377        "toggle_btn_padding_right" => 0,
     378        "toggle_btn_padding_bottom" => 0,
     379        "toggle_btn_padding_left" => 0,
     380        "toggle_btn_padding_unit" => "px",
     381        "link_color" => "#1a73e8",
     382        "link_hover_color" => "#0c47a1",
     383        "link_visited_color" => "#465568",
     384        "link_padding_mode" => "default",
     385        "link_padding_top" => 0,
     386        "link_padding_right" => 0,
     387        "link_padding_bottom" => 0,
     388        "link_padding_left" => 0,
     389        "link_padding_unit" => "px",
     390        "link_margin_mode" => "default",
     391        "link_margin_top" => 0,
     392        "link_margin_right" => 0,
     393        "link_margin_bottom" => 0,
     394        "link_margin_left" => 0,
     395        "link_margin_unit" => "px",
     396        "custom_css" => "",
     397    ];
     398   
     399    $default = apply_filters("dtoc_default_sticky_mobile_options_filter", $default );
     400    return $default;
    177401}
    178402function dtoc_default_incontent_options(){
     
    317541}
    318542function dtoc_default_incontent_mobile_options(){
    319         $default = dtoc_option_types('all',['incontent_mobile'],'default');
    320         $default = apply_filters("dtoc_default_incontent_mobile_options_filter", $default);
    321         return $default;   
    322 }
    323 function dtoc_default_incontent_tablet_options(){
    324         $default = dtoc_option_types('all',['incontent_tablet'],'default');
    325         $default = apply_filters("dtoc_default_incontent_tablet_options_filter", $default);
     543        $default = [
     544            "rendering_style" => "js",
     545            "display_title" => 1,
     546            "header_text" => "Table of Contents",
     547            "toggle_body" => 1,
     548            "toggle_initial" => "show",
     549            "header_icon" => "list_icon",
     550            "custom_icon_url" => "",
     551            "show_text" => "show",
     552            "hide_text" => "hide",
     553            "jump_links" => 1,
     554            "scroll_behavior" => "smooth",
     555            "alignment" => "left",
     556            "display_when" => 2,
     557            "display_position" => "top_of_the_content",
     558            "paragraph_number" => 1,
     559            "list_style_type" => "decimal",
     560            "headings_include" => [
     561                "1" => 1,
     562                "2" => 1,
     563                "3" => 1,
     564                "4" => 1,
     565                "5" => 1,
     566                "6" => 1,
     567            ],
     568            "hierarchy"          => 0,
     569            "combine_page_break" => 0,
     570            "accessibility"     => 1,
     571            "preserve_line_breaks" => 0,
     572            "exclude_headings"  => '',
     573            "placement" => [
     574                "post" => [
     575                    "is_enabled" => 1,
     576                    "taxonomy" => [
     577                        "post_tag" => [
     578                            "ope" => "OR",
     579                        ],
     580                    ],
     581                ],
     582            ],
     583            "bg_color" => "#f9f9f9",
     584            "container_width_mode" => "default",
     585            "container_width" => 0,
     586            "container_width_unit" => "px",
     587            "container_height_mode" => "default",
     588            "design_type" => "px",
     589            "container_margin_mode" => "default",
     590            "container_margin_top" => 0,
     591            "container_margin_right" => 0,
     592            "container_margin_bottom" => 0,
     593            "container_margin_left" => 0,
     594            "container_margin_unit" => "px",
     595            "container_padding_mode" => "default",
     596            "container_padding_top" => 0,
     597            "container_padding_right" => 0,
     598            "container_padding_bottom" => 0,
     599            "container_padding_left" => 0,
     600            "container_padding_unit" => "px",
     601            "border_type" => "solid",
     602            "border_color" => "#dddddd",
     603            "border_width_mode" => "custom",
     604            "border_width_top" => 1,
     605            "border_width_right" => 1,
     606            "border_width_bottom" => 1,
     607            "border_width_left" => 1,
     608            "border_width_unit" => "px",
     609            "border_radius_mode" => "default",
     610            "border_radius_top_left" => 0,
     611            "border_radius_top_right" => 0,
     612            "border_radius_bottom_left" => 0,
     613            "border_radius_bottom_right" => 0,
     614            "border_radius_unit" => "px",
     615            "title_bg_color" => "#eeeeee",
     616            "title_fg_color" => "#222222",
     617            "title_font_size_mode" => "default",
     618            "title_font_size" => 0,
     619            "title_font_size_unit" => "px",
     620            "title_font_weight_mode" => "default",
     621            "title_font_weight" => 0,
     622            "title_padding_mode" => "default",
     623            "title_padding_top" => 0,
     624            "title_padding_right" => 0,
     625            "title_padding_bottom" => 0,
     626            "title_padding_left" => 0,
     627            "title_padding_unit" => "px",
     628            "icon_bg_color" => "#e0e0e0",
     629            "icon_fg_color" => "#333333",
     630            "icon_size_mode" => "default",
     631            "icon_width" => 25,
     632            "icon_height" => 25,
     633            "icon_size_unit" => "px",
     634            "icon_border_type" => "default",
     635            "icon_border_color" => "#D5E0EB",
     636            "icon_border_width_mode" => "default",
     637            "icon_border_width_top" => 0,
     638            "icon_border_width_right" => 0,
     639            "icon_border_width_bottom" => 0,
     640            "icon_border_width_left" => 0,
     641            "icon_border_width_unit" => "px",
     642            "icon_border_radius_mode" => "default",
     643            "icon_border_radius_top_left" => 0,
     644            "icon_border_radius_top_right" => 0,
     645            "icon_border_radius_bottom_left" => 0,
     646            "icon_border_radius_bottom_right" => 0,
     647            "icon_border_radius_unit" => "px",
     648            "icon_padding_mode" => "default",
     649            "icon_padding_top" => 0,
     650            "icon_padding_right" => 0,
     651            "icon_padding_bottom" => 0,
     652            "icon_padding_left" => 0,
     653            "icon_padding_unit" => "px",
     654            "icon_margin_mode" => "default",
     655            "icon_margin_top" => 0,
     656            "icon_margin_right" => 0,
     657            "icon_margin_bottom" => 0,
     658            "icon_margin_left" => 0,
     659            "icon_margin_unit" => "px",
     660            "link_color" => "#1a73e8",
     661            "link_hover_color" => "#0c47a1",
     662            "link_visited_color" => "#5f6368",
     663            "link_padding_mode" => "default",
     664            "link_padding_top" => 0,
     665            "link_padding_right" => 0,
     666            "link_padding_bottom" => 0,
     667            "link_padding_left" => 0,
     668            "link_padding_unit" => "px",
     669            "link_margin_mode" => "default",
     670            "link_margin_top" => 0,
     671            "link_margin_right" => 0,
     672            "link_margin_bottom" => 0,
     673            "link_margin_left" => 0,
     674            "link_margin_unit" => "px",
     675            "custom_css" => "",
     676        ];
     677       
     678        $default = apply_filters("dtoc_default_incontent_options_filter", $default);
    326679        return $default;   
    327680}
     
    343696
    344697        $default = [
    345              'delete_plugin_data'  => false,   
     698             'delete_plugin_data'           => false,   
    346699             'modules' => [
    347                 'incontent'        => true,
    348                 'incontent_mobile' => false,
    349                 'incontent_tablet' => false,
    350                 'sliding_sticky'           => false,
    351                 'sticky_mobile'    => false,
    352                 'sticky_tablet'    => false,
    353                 'floating'         => false,
    354                 'floating_mobile'  => false,
    355                 'floating_tablet'  => false,
    356                 'shortcode'        => false,
    357                 'shortcode_mobile' => false,
    358                 'shortcode_tablet' => false,                     
     700                'incontent'                 => true,
     701                'incontent_mobile'          => false,               
     702                'sliding_sticky'            => false,
     703                'sliding_sticky_mobile'     => false,                               
     704                'floating'                  => false,               
     705                'shortcode'                 => false               
    359706             ] 
    360707        ];
     
    496843}
    497844
    498 function dtoc_default_shortcode_mobile_options(){
    499         $default = dtoc_option_types('all',['shortcode_mobile'],'default');
    500         $default = apply_filters("dtoc_default_shortcode_mobile_options_filter", $default);
    501         return $default;   
    502 }
    503 function dtoc_default_shortcode_tablet_options(){
    504         $default = dtoc_option_types('all',['shortcode_tablet'],'default');
    505         $default = apply_filters("dtoc_default_shortcode_tablet_options_filter", $default);
    506         return $default;   
    507 }
    508845function dtoc_allowed_html_tags() {
    509846   
  • digital-table-of-contents/trunk/uninstall.php

    r3338299 r3365361  
    11<?php
    2 // exit if accessed directly
    3 if (!defined('WP_UNINSTALL_PLUGIN')) {
    4     die;
     2/**
     3 * Uninstall script for Digital TOC Plugin.
     4 *
     5 * Fired when the plugin is deleted from WordPress.
     6 *
     7 * @package DigitalTOC
     8 */
     9
     10if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
     11    exit;
    512}
    613
    7 echo 'comming soon';
     14/**
     15 * Delete plugin options (site-level + network-level).
     16 */
     17function dtoc_delete_plugin_data() {
     18   
     19    $dtoc_dashboard          = get_option( 'dtoc_dashboard' , false ); 
     20
     21    if ( empty( $dtoc_dashboard['delete_plugin_data'] ) ) {
     22        // User did not enable data removal → exit without deleting.
     23        return;
     24    }
     25
     26    // List of site-level options.
     27    $site_options = [
     28        'dtoc_dashboard',
     29        'dtoc_incontent',
     30        'dtoc_incontent_mobile',
     31        'dtoc_shortcode',
     32        'dtoc_sliding_sticky',
     33        'dtoc_sliding_sticky_mobile',
     34        'dtoc_floating',
     35        'dtoc_compatibility',
     36    ]; 
     37
     38    if ( ! is_multisite() ) {
     39        // Single site cleanup.
     40        foreach ( $site_options as $option ) {
     41            delete_option( $option );
     42        }
     43    } else {
     44        // Multisite: loop through all sites.
     45        $sites = get_sites( [ 'fields' => 'ids' ] );
     46
     47        foreach ( $sites as $site_id ) {
     48            switch_to_blog( $site_id );
     49
     50            foreach ( $site_options as $option ) {
     51                delete_option( $option );
     52            }
     53
     54            restore_current_blog();
     55        }       
     56    }
     57}
     58
     59dtoc_delete_plugin_data();
Note: See TracChangeset for help on using the changeset viewer.