Changeset 716063
- Timestamp:
- 05/21/2013 03:08:50 PM (13 years ago)
- Location:
- wp-glossary/trunk/class
- Files:
-
- 3 edited
-
wpg-admin.class.php (modified) (1 diff)
-
wpg-shortcode-glossary.class.php (modified) (2 diffs)
-
wpg.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-glossary/trunk/class/wpg-admin.class.php
r711415 r716063 4 4 */ 5 5 class WPG_Admin{ 6 static $base, $base_url; 7 6 8 public function __construct() { 7 add_action( 'admin_menu', array($this, 'options_submenu') ); 8 add_action( 'wp_ajax_wpg_update_options', array($this, 'update_options') ); 9 self::$base = $plugin_base . '/class'; 10 self::$base_url = plugins_url( '', dirname(__FILE__) ); 11 12 add_action( 'admin_menu', array(&$this, 'options_submenu') ); 13 add_action( 'wp_ajax_wpg_update_options', array(&$this, 'update_options') ); 14 add_action( 'admin_head', array(&$this, 'add_tinymce_dropdown_hooks') ); 15 add_action( 'admin_init', array(&$this, 'setup_localixed_dropdown_values') ); 9 16 } 17 18 static function base() { 19 return self::$base; 20 } 21 static function base_url() { 22 return self::$base_url; 23 } 24 25 public function add_tinymce_dropdown_hooks() { 26 add_filter( 'mce_external_plugins', array(&$this, 'tinymce_add_dropdown_plugin') ); 27 add_filter( 'mce_buttons', array(&$this, 'tinymce_add_dropdown_button') ); 28 } 29 public function tinymce_add_dropdown_plugin( $plugin_array ){ 30 $plugin_array['wpglossary'] = $this->base_url() . '/js/tinymce-wpglossary-dropdown.js'; 31 return $plugin_array; 32 } 33 public function tinymce_add_dropdown_button( $buttons ){ 34 array_push( $buttons, 'wpglossary' ); 35 return $buttons; 36 } 37 38 public function setup_localixed_dropdown_values(){ 39 $args = array( 40 'post_type' => 'glossary', 41 'numberposts' => -1, 42 'post_status' => 'publish', 43 'orderby' => 'title', 44 'order' => 'ASC', 45 ); 46 $glossaryposts = get_posts( $args ); 47 $glossaryterms = array(); 48 foreach( $glossaryposts as $glossary ): 49 $glossaryterms[$glossary->post_title] = "[glossary id='{$glossary->ID}' slug='{$glossary->post_name}' /]"; 50 endforeach; 51 52 wp_localize_script( 'jquery', 'WPG', array( 53 'tinymce_dropdown' => $glossaryterms, 54 ) ); 55 } 56 10 57 11 58 public function options_submenu(){ -
wp-glossary/trunk/class/wpg-shortcode-glossary.class.php
r715755 r716063 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';18 $glossary_options = get_option( 'wp_glossary' ); 19 $termusage = isset($glossary_options['termusage'] ) ? $glossary_options['termusage'] : 'on'; 20 20 21 21 if( $termusage != 'on' ) … … 23 23 24 24 if( !wp_is_post_revision($post_id) ): 25 if( strpos($post->post_content,'[glossary ') !== false ):25 if( strpos($post->post_content,'[glossary ') !== false || strpos($post->post_content,'[glossary]') !== false ): 26 26 update_post_meta( $post_id, 'wpg_update_term_usage', current_time('mysql') ); 27 27 else : -
wp-glossary/trunk/class/wpg.class.php
r714726 r716063 141 141 142 142 /** 143 * Translation support143 * Translation support 144 144 */ 145 145 public function wpg_term_link( $url ){
Note: See TracChangeset
for help on using the changeset viewer.