Changeset 3110799
- Timestamp:
- 07/02/2024 03:26:03 AM (4 weeks ago)
- Location:
- list-of-contents/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
list-of-contents/trunk/assets/css/style.css
r3105705 r3110799 9 9 .loc-toc ol { 10 10 list-style: none; 11 padding-left: 0;11 padding-left: ; 12 12 } 13 13 … … 31 31 } 32 32 33 /* Design 2 */34 .loc-toc.design2 {35 border-color: #ff6f61;36 background: #fff5f3;37 }38 33 39 .loc-toc.design2 a {40 color: #ff6f61;41 text-decoration: none;42 }43 34 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 5 5 6 6 public function __construct() { 7 8 9 10 7 11 add_action('admin_menu', array($this, 'add_admin_menu')); 8 12 add_action('admin_init', array($this, 'settings_init')); 13 14 15 16 17 18 19 20 21 22 23 24 9 25 } 10 26 … … 56 72 57 73 public function enable_posts_render() { 58 $options = get_option('locp_options');74 $options = ); 59 75 ?> 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> 61 80 <?php 62 81 } 63 82 64 83 public function enable_pages_render() { 65 $options = get_option('locp_options');84 $options = ); 66 85 ?> 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'> --> 68 91 <?php 69 92 } 70 93 71 94 public function toc_design_render() { 72 $options = get_option('locp_options');95 $options = ); 73 96 ?> 74 97 <select name='locp_options[locp_loc_design]'> … … 77 100 <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> 78 101 <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 79 103 </select> 80 104 <?php 81 105 } 82 106 107 108 109 110 111 112 83 113 84 114 public function options_page() { … … 99 129 if (is_admin()) { 100 130 $locp_settings = new LOCP_Settings(); 131 101 132 } -
list-of-contents/trunk/includes/class-loc.php
r3105705 r3110799 3 3 4 4 class LOCP_Plugin { 5 6 7 5 8 6 public function __construct() {7 9 // Add initialization actions and filters here. 8 10 add_action('init', array($this, 'load_textdomain')); … … 20 22 21 23 public function enqueue_scripts() { 24 25 26 22 27 wp_enqueue_style('locp-style', LOCP_PLUGIN_URL . 'assets/css/style.css', array(), LOCP_PLUGIN_VESION); 28 29 30 23 31 wp_enqueue_script('locp-script', LOCP_PLUGIN_URL . 'assets/js/script.js', array(), LOCP_PLUGIN_VESION, true); 24 32 } … … 26 34 public function insert_loc($content) { 27 35 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 } 33 44 } 34 45 return $content; … … 36 47 37 48 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'); 39 51 $design_class = isset($options['locp_loc_design']) ? $options['locp_loc_design'] : 'design1'; 40 52 -
list-of-contents/trunk/list-of-contents.php
r3107762 r3110799 3 3 * Plugin Name: List of Contents (LOCP) 4 4 * 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. 05 * Version: 1.0. 6 6 * Author: CodeInitiator 7 7 * Text Domain: list-of-contents … … 18 18 define('LOCP_PLUGIN_PATH', plugin_dir_path(__FILE__)); 19 19 define('LOCP_PLUGIN_URL', plugin_dir_url(__FILE__)); 20 define('LOCP_PLUGIN_VESION', '1.0. 0');20 define('LOCP_PLUGIN_VESION', '1.0.'); 21 21 22 22 // Include the main class. -
list-of-contents/trunk/readme.md
r3107762 r3110799 7 7 Requires PHP: 7.0 8 8 Tested up to: 6.5.5 9 Stable tag: 1.0. 09 Stable tag: 1.0. 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 71 71 72 72 == Upgrade Notice == 73 74 75 73 76 74 77 = 1.0.0 = -
list-of-contents/trunk/readme.txt
r3107762 r3110799 7 7 Requires PHP: 7.0 8 8 Tested up to: 6.5.5 9 Stable tag: 1.0. 09 Stable tag: 1.0. 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 66 66 67 67 == Changelog == 68 69 70 68 71 69 72 = 1.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.