Changeset 3458311
- Timestamp:
- 02/10/2026 05:46:20 PM (7 weeks ago)
- Location:
- mi13-glossary/trunk
- Files:
-
- 2 edited
-
mi13-glossary.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mi13-glossary/trunk/mi13-glossary.php
r3135883 r3458311 4 4 Plugin URI: https://wordpress.org/plugins/mi13-glossary/ 5 5 Description: Glossary plugin for your site. 6 Version: 46 Version: 5 7 7 Author: mi13 8 Author URI: https://t.me/galaksy_king 8 9 License: GPL v2 or later 9 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 43 44 register_uninstall_hook( __FILE__, 'mi13_glossary_uninstall' ); 44 45 46 function mi13_glossary_valid($settings){ 47 $settings['ignore'] = wp_strip_all_tags( wp_specialchars_decode($settings['ignore'],ENT_QUOTES) ); 48 $settings['link_style'] = wp_strip_all_tags( $settings['link_style'] ); 49 $settings['publish_stop'] = isset($settings['publish_stop']) ? boolval($settings['publish_stop']) : 0; 50 $settings['pattern'] = isset($settings['pattern']) ? wp_strip_all_tags( $settings['pattern'] ) : '[а-я\x{0301}]{0,4}'; 51 return $settings; 52 } 53 45 54 add_action('init', 'mi13_glossary_init'); 46 55 function mi13_glossary_init(){ 47 function mi13_glossary_valid($settings){48 $settings['ignore'] = wp_strip_all_tags( wp_specialchars_decode($settings['ignore'],ENT_QUOTES) );49 $settings['link_style'] = wp_strip_all_tags( $settings['link_style'] );50 $settings['publish_stop'] = isset($settings['publish_stop']) ? boolval($settings['publish_stop']) : 0;51 $settings['pattern'] = isset($settings['pattern']) ? wp_strip_all_tags( $settings['pattern'] ) : '[а-я\x{0301}]{0,4}';52 return $settings;53 }54 56 register_setting( 'mi13_glossary', 'mi13_glossary', 'mi13_glossary_valid' ); 55 57 register_post_type('mi13_glossary', array( … … 127 129 } 128 130 129 function mi13_glossary_modal_ajax(){ // функция вызова модального окна 130 if(isset($_GET['id']) && isset($_GET['pos'])){ 131 $idstr = sanitize_text_field($_GET['id']); 132 $pos = sanitize_text_field($_GET['pos']); 133 $id = substr($idstr,3,4); 134 if( is_numeric($id) && is_numeric($pos) && $id>0 ){ 135 echo '<div class="mi13_glossary_content">'; 136 global $post; 137 $post = get_post($id); 138 if( $post && $post->post_type==='mi13_glossary' ) { 139 setup_postdata( $post ); 140 the_content(); 141 } else { 142 echo '<p style="color:red">Error: Data not found!</p>'; 143 } 144 wp_reset_postdata(); 145 echo '</div>'; 146 echo '<div class="mi13_glossary_close"><input type="button" onclick="window.scrollTo(0,' . esc_js($pos) . ');document.getElementById(\'mi13_glossary_block\').classList.remove(\'mi13_glossary_show\');document.getElementById(\'mi13_glossary\').style.visibility = \'hidden\';" value="ok"></div>'; 147 }; 148 } 131 function mi13_glossary_modal_ajax() { 132 if (!isset($_GET['id'], $_GET['pos'])) { 133 wp_die(); 134 } 135 $idstr = sanitize_text_field($_GET['id']); 136 $pos = sanitize_text_field($_GET['pos']); 137 $id = substr($idstr,3,4); 138 if( !is_numeric($id) || !is_numeric($pos) || $id <= 0 ) { 139 wp_die(); 140 } 141 echo '<div class="mi13_glossary_content">'; 142 global $post; 143 $post = get_post($id); 144 if( $post && $post->post_type==='mi13_glossary' ) { 145 setup_postdata( $post ); 146 the_content(); 147 } else { 148 echo '<p style="color:red">Error: Data not found!</p>'; 149 } 150 wp_reset_postdata(); 151 echo '</div>'; 152 echo '<div class="mi13_glossary_close"><input type="button" onclick="window.scrollTo(0,' . esc_js($pos) . ');document.getElementById(\'mi13_glossary_block\').classList.remove(\'mi13_glossary_show\');document.getElementById(\'mi13_glossary\').style.visibility = \'hidden\';" value="ok"></div>'; 149 153 wp_die(); 150 154 } … … 506 510 <tr> 507 511 <th style="padding-left:8px" scope="row">Игнорировать текст внутри тегов (через запятую):</th> 508 <td><input type="text" name="mi13_glossary[ignore]" value="<?php echo esc_textarea($settings['ignore']); ?>" size="100">512 <td><input type="text" placeholder="script,style,h1,h2,h3,h4,h5,h6,a,pre,code,span,mark" name="mi13_glossary[ignore]" value="<?php echo esc_textarea($settings['ignore']); ?>" size="100"> 509 513 <p class="description"><strong>default: script,style,h1,h2,h3,h4,h5,h6,a,pre,code,span,mark</strong></p></td> 510 514 </tr> … … 572 576 } 573 577 574 function mi13_glossary_pagination_ajax(){ // Аякс пагинация 575 $return = null; 576 $page = null; 577 $id = null; 578 $val = null; 579 $nonce = null; 580 if(isset($_POST['nonce'])) $nonce = sanitize_textarea_field($_POST['nonce']); 581 wp_verify_nonce( $nonce, 'mi13_glossary_admin' ); 582 if(isset($_POST['val'])) $val = sanitize_textarea_field($_POST['val']); 583 if(isset($_POST['id'])) $id = sanitize_textarea_field($_POST['id']); 584 if(isset($_POST['url'])){ 585 $str = wp_parse_url($_POST['url'], PHP_URL_QUERY); 586 if($str){ 587 wp_parse_str($str, $array); 588 $page = (isset($array['n_page']) && intval($array['n_page'])>1) ? intval($array['n_page']) : 1; //fix bug for 1 page 589 $id = 'mi13_glossary_test_posts'; 590 } 591 } 592 $return = mi13_glossary_page_table($id,$page,$val); 593 wp_send_json_success($return); 578 function mi13_glossary_pagination_ajax() { 579 // Проверка nonce 580 if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'mi13_glossary_admin')) { 581 wp_send_json_error('Security check failed'); 582 } 583 584 // Валидация данных 585 $val = isset($_POST['val']) ? sanitize_text_field($_POST['val']) : null; 586 $id = isset($_POST['id']) ? sanitize_text_field($_POST['id']) : null; 587 588 if (isset($_POST['url'])) { 589 $str = wp_parse_url($_POST['url'], PHP_URL_QUERY); 590 if ($str) { 591 wp_parse_str($str, $array); 592 $page = isset($array['n_page']) && intval($array['n_page']) > 1 593 ? intval($array['n_page']) : 1; 594 $id = 'mi13_glossary_test_posts'; 595 } 596 } 597 598 $return = mi13_glossary_page_table($id, $page, $val); 599 wp_send_json_success($return); 594 600 } 595 601 add_action( 'wp_ajax_mi13_glossary_pagination', 'mi13_glossary_pagination_ajax' ); 602 596 603 597 604 function mi13_glossary_list_for_page(){ // Код для вашей кастомной страницы глоссария -
mi13-glossary/trunk/readme.txt
r3135883 r3458311 3 3 Tags: glossary, modal keys 4 4 Requires at least: 4.7 5 Tested up to: 6. 6.16 Stable tag: 45 Tested up to: 6.9 6 Stable tag: 5 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 66 66 = 4 = 67 67 * update plugin. 68 = 5 = 69 * update plugin.
Note: See TracChangeset
for help on using the changeset viewer.