Changeset 715343
- Timestamp:
- 05/19/2013 08:49:22 PM (13 years ago)
- Location:
- wp-glossary/trunk
- Files:
-
- 3 edited
-
class/wpg-shortcode-glossary.class.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-glossary.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-glossary/trunk/class/wpg-shortcode-glossary.class.php
r714426 r715343 16 16 */ 17 17 public function save_post_check_for_glossary_usage( $post_id, $post ){ 18 $glossary_options = get_option( 'wp_glossary' ); 19 $termusage = isset($glossary_options['termusage'] ) ? $glossary_options['termusage'] : 'on'; 20 21 if( $termusage != 'on' ) 22 return $post_id; 23 18 24 if( !wp_is_post_revision($post_id) ): 19 25 if( strpos($post->post_content,'[glossary ') !== false): … … 66 72 /** */ 67 73 public function glossary( $atts, $content='' ){ 68 global $wpdb, $tcb_wpg_scripts, $wpg_glossary_count, $post ;74 global $wpdb, $tcb_wpg_scripts, $wpg_glossary_count, $post, $wpg_doing_shortcode; 69 75 70 76 $wpg_glossary_count++; … … 89 95 $qtipstyle = isset($glossary_options['qtipstyle']) ? $glossary_options['qtipstyle'] : 'cream'; 90 96 $linkopt = isset($glossary_options['termlinkopt']) ? $glossary_options['termlinkopt'] : 'standard'; 97 $termusage = isset($glossary_options['termusage'] ) ? $glossary_options['termusage'] : 'on'; 91 98 92 99 extract( shortcode_atts( array( … … 113 120 endif; 114 121 $slug = strtolower($slug); 115 $sqlstring = "SELECT ID FROM {$wpdb->posts} WHERE post_name='%s' AND post_type='glossary' LIMIT 1";116 $id = $wpdb->get_var( $wpdb->prepare( $sqlstring, $slug) );122 $sqlstring = "SELECT ID FROM {$wpdb->posts} WHERE post_name='%s' AND post_type='glossary' AND post_status='publish' LIMIT 1"; 123 $id = $wpdb->get_var( $wpdb->prepare($sqlstring, $slug) ); 117 124 if( $id ): 118 125 $glossary = get_post( $id ); … … 121 128 if( empty($glossary) ) return $text; // No glossary term found. Return the original text. 122 129 123 if( get_post_meta( $post->ID, 'wpg_update_term_usage') ): 124 // Note this post against the glossary 125 add_post_meta( $glossary->ID, 'wpg_term_used', $post->ID ); 126 // Note this post/page has glossary terms 127 update_post_meta( $post->ID, 'wpg_has_terms', current_time('mysql') ); 128 endif; 129 130 setup_postdata( $glossary ); 130 if( $termusage && $termusage == 'on' ): 131 if( get_post_meta( $post->ID, 'wpg_update_term_usage') ): 132 if( !in_array($post->ID, get_post_meta($glossary->ID, 'wpg_term_used')) ): 133 // Note this post against the glossary 134 add_post_meta( $glossary->ID, 'wpg_term_used', $post->ID ); 135 // Note this post/page has glossary terms 136 update_post_meta( $post->ID, 'wpg_has_terms', current_time('mysql') ); 137 endif; 138 endif; 139 endif; 140 141 //setup_postdata( $glossary ); 131 142 $title = get_the_title( $glossary->ID ); 132 143 … … 138 149 switch( $tooltip_option ): 139 150 case 'full': 140 $tooltip = ($qtipstyle=='off') ? strip_tags(get_the_content()) : apply_filters('the_content', get_the_content()); 151 if( !$wpg_doing_shortcode ): 152 $wpg_doing_shortcode = true; 153 //$tooltip = ($qtipstyle=='off') ? strip_tags($glossary->post_content) : wpautop( do_shortcode($glossary->post_content) ); 154 $tooltip = ($qtipstyle=='off') ? strip_tags(get_the_content()) : apply_filters('the_content', get_the_content()); 155 $wpg_doing_shortcode = false; 156 endif; 141 157 break; 142 158 case 'excerpt': … … 153 169 154 170 $link = '<a class="' . $class . '" '.$target.' '.$href.' title="' . esc_attr($tooltip) . '" '.implode(' ',$jsdata).'>' . $text . '</a>'; 155 wp_reset_postdata();171 //wp_reset_postdata(); 156 172 return '<span class="wp-glossary">' . $link . '</span>'; 157 173 } -
wp-glossary/trunk/readme.txt
r714729 r715343 6 6 Requires at least: 3.0 7 7 Tested up to: 3.6 8 Stable tag: 2.3. 1.18 Stable tag: 2.3.2 9 9 License: GPLv2 or later 10 10 … … 73 73 74 74 == Changelog == 75 76 = 2.3.2 = 77 * FIX Recursive loop-referencing glossary terms 75 78 76 79 = 2.3.1 = -
wp-glossary/trunk/wp-glossary.php
r714729 r715343 5 5 * Description: Build a glossary of terms and link your post content to it. 6 6 * Author: TCBarrett 7 * Version: 2.3. 1.17 * Version: 2.3.2 8 8 * Author URI: http://www.tcbarrett.com/ 9 9 * Text Domain: wp-glossary … … 12 12 define( 'WPG_TEXTDOMAIN', 'wp-glossary' ); 13 13 14 global $wpg_glossary_count ;14 global $wpg_glossary_count, $wpg_doing_shortcode; 15 15 $wpg_glossary_count = 0; 16 16 … … 23 23 new WPG_Admin(); 24 24 25 add_action( 'admin_init', 'tcb_wpg_test' ); 26 //endif; 25 // add_action( 'admin_init', 'tcb_wpg_test' ); 27 26 function tcb_wpg_test(){ 28 27 if( $prefix = $_GET['populate'] ): 29 for( $i = 1; $i < 30; $i++ ):28 for( $i = 1; $i < 99; $i++ ): 30 29 wp_insert_post( array('post_type'=>'glossary', 'post_title'=>$prefix . '-' . $i, 'post_status'=>'publish') ); 31 30 endfor;
Note: See TracChangeset
for help on using the changeset viewer.