Plugin Directory

Changeset 3110799

Timestamp:
07/02/2024 03:26:03 AM (4 weeks ago)
Author:
ajku99
Message:

Release 1.0.1

Location:
list-of-contents/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • list-of-contents/trunk/assets/css/style.css

    r3105705 r3110799  
    99.loc-toc ol {
    1010    list-style: none;
    11     padding-left: 0;
     11    padding-left: ;
    1212}
    1313
     
    3131}
    3232
    33 /* Design 2 */
    34 .loc-toc.design2 {
    35     border-color: #ff6f61;
    36     background: #fff5f3;
    37 }
    3833
    39 .loc-toc.design2 a {
    40     color: #ff6f61;
    41     text-decoration: none;
    42 }
    4334
    44 .loc-toc.design2 a:hover {
    45     text-decoration: underline;
    46 }
    47 
    48 /* Design 3 */
    49 .loc-toc.design3 {
    50     border-color: #28a745;
    51     background: #e9f7ef;
    52 }
    53 
    54 .loc-toc.design3 a {
    55     color: #28a745;
    56     text-decoration: none;
    57 }
    58 
    59 .loc-toc.design3 a:hover {
    60     text-decoration: underline;
    61 }
    62 
    63 /* Design 4: Two Columns */
    64 .loc-toc.design4 {
    65     border-color: #6c757d;
    66     background: #f8f9fa;
    67 }
    68 
    69 .loc-toc.design4 ol {
    70     column-count: 2;
    71     column-gap: 20px;
    72 }
    73 
    74 .loc-toc.design4 a {
    75     color: #6c757d;
    76     text-decoration: none;
    77 }
    78 
    79 .loc-toc.design4 a:hover {
    80     text-decoration: underline;
    81 }
  • list-of-contents/trunk/includes/class-loc-settings.php

    r3105705 r3110799  
    55
    66    public function __construct() {
     7
     8
     9
     10
    711        add_action('admin_menu', array($this, 'add_admin_menu'));
    812        add_action('admin_init', array($this, 'settings_init'));
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
    925    }
    1026
     
    5672
    5773    public function enable_posts_render() {
    58         $options = get_option('locp_options');
     74        $options = );
    5975        ?>
    60         <input type='checkbox' name='locp_options[locp_enable_posts]' <?php checked(@$options['locp_enable_posts'], 1); ?> value='1'>
     76        <label class="locp-switch">
     77            <input type="checkbox" name='locp_options[locp_enable_posts]' <?php checked(@$options['locp_enable_posts'], 1); ?>>
     78            <span class="locp-slider locp-round"></span>
     79        </label>
    6180        <?php
    6281    }
    6382
    6483    public function enable_pages_render() {
    65         $options = get_option('locp_options');
     84        $options = );
    6685        ?>
    67         <input type='checkbox' name='locp_options[locp_enable_pages]' <?php checked(@$options['locp_enable_pages'], 1); ?> value='1'>
     86        <label class="locp-switch">
     87            <input type="checkbox" name='locp_options[locp_enable_posts]' <?php checked(@$options['locp_enable_pages'], 1); ?>>
     88            <span class="locp-slider locp-round"></span>
     89        </label>
     90        <!-- <input type='checkbox' name='locp_options[locp_enable_pages]' <?php checked( $options['locp_enable_pages'], 1); ?> value='1'> -->
    6891        <?php
    6992    }
    7093   
    7194    public function toc_design_render() {
    72         $options = get_option('locp_options');
     95        $options = );
    7396        ?>
    7497        <select name='locp_options[locp_loc_design]'>
     
    77100            <option value='design3' <?php isset($options['locp_loc_design'])? selected($options['locp_loc_design'], 'design3') : ''; ?>><?php esc_html_e('Design 3', 'list-of-contents'); ?></option>
    78101            <option value='design4' <?php isset($options['locp_loc_design'])? selected($options['locp_loc_design'], 'design4'): ''; ?>><?php esc_html_e('Design 4 (Two Columns)', 'list-of-contents'); ?></option>
     102
    79103        </select>
    80104        <?php
    81105    }
    82106   
     107
     108
     109
     110
     111
     112
    83113
    84114    public function options_page() {
     
    99129if (is_admin()) {
    100130    $locp_settings = new LOCP_Settings();
     131
    101132}
  • list-of-contents/trunk/includes/class-loc.php

    r3105705 r3110799  
    33
    44class LOCP_Plugin {
     5
     6
     7
    58
    6     public function __construct() {
    79        // Add initialization actions and filters here.
    810        add_action('init', array($this, 'load_textdomain'));
     
    2022
    2123    public function enqueue_scripts() {
     24
     25
     26
    2227        wp_enqueue_style('locp-style', LOCP_PLUGIN_URL . 'assets/css/style.css', array(), LOCP_PLUGIN_VESION);
     28
     29
     30
    2331        wp_enqueue_script('locp-script', LOCP_PLUGIN_URL . 'assets/js/script.js', array(), LOCP_PLUGIN_VESION, true);
    2432    }
     
    2634    public function insert_loc($content) {
    2735        if (is_singular() && in_the_loop() && is_main_query()) {
    28             // Logic to generate and insert TOC goes here.
    29             $toc = $this->generate_locp($content);
    30            
    31             // Insert the TOC after the first paragraph
    32             $content = $this->insert_loc_after_first_paragraph($content, $toc);
     36            $options = $this->settings->get_options_with_defaults();
     37            if ((is_single() && $options['locp_enable_posts']) || (is_page() && $options['locp_enable_pages'])) {
     38                // Logic to generate and insert TOC goes here.
     39                $toc = $this->generate_locp($content);
     40               
     41                // Insert the TOC after the first paragraph
     42                $content = $this->insert_loc_after_first_paragraph($content, $toc);
     43            }
    3344        }
    3445        return $content;
     
    3647
    3748    private function generate_locp($content) {
    38         $options = get_option('locp_options');
     49        $options = $this->settings->get_options_with_defaults();
     50        // $options = get_option('locp_options');
    3951        $design_class = isset($options['locp_loc_design']) ? $options['locp_loc_design'] : 'design1';
    4052   
  • list-of-contents/trunk/list-of-contents.php

    r3107762 r3110799  
    33 * Plugin Name: List of Contents (LOCP)
    44 * Description: Automatically generate a table of contents for your posts, pages and custom post types by parsing its contents for headers.
    5  * Version: 1.0.0
     5 * Version: 1.0.
    66 * Author: CodeInitiator
    77 * Text Domain: list-of-contents
     
    1818define('LOCP_PLUGIN_PATH', plugin_dir_path(__FILE__));
    1919define('LOCP_PLUGIN_URL', plugin_dir_url(__FILE__));
    20 define('LOCP_PLUGIN_VESION', '1.0.0');
     20define('LOCP_PLUGIN_VESION', '1.0.');
    2121
    2222// Include the main class.
  • list-of-contents/trunk/readme.md

    r3107762 r3110799  
    77Requires PHP:      7.0
    88Tested up to:      6.5.5 
    9 Stable tag:        1.0.0 
     9Stable tag:        1.0. 
    1010License:           GPLv2 or later 
    1111License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
     
    7171
    7272== Upgrade Notice ==
     73
     74
     75
    7376
    7477= 1.0.0 =
  • list-of-contents/trunk/readme.txt

    r3107762 r3110799  
    77Requires PHP:      7.0
    88Tested up to:      6.5.5
    9 Stable tag:        1.0.0 
     9Stable tag:        1.0. 
    1010License:           GPLv2 or later 
    1111License URI:       https://www.gnu.org/licenses/gpl-2.0.html 
     
    6666
    6767== Changelog ==
     68
     69
     70
    6871
    6972= 1.0.0 =
Note: See TracChangeset for help on using the changeset viewer.