Changeset 747733
- Timestamp:
- 07/29/2013 10:20:53 AM (13 years ago)
- Files:
-
- 1 added
- 3 edited
-
hide-favorite-button/trunk/.project (added)
-
wpmu-automatic-links/trunk/readme.txt (modified) (1 diff)
-
wpmu-prefill-post/trunk/readme.txt (modified) (2 diffs)
-
wpmu-prefill-post/trunk/wpmu-prefill-post.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpmu-automatic-links/trunk/readme.txt
r747729 r747733 4 4 donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4RR68K6J9GBR8 5 5 Requires at least: 3.0 6 Tested up to: 3.5 6 Tested up to: 3.5.2 7 7 Stable tag: trunk 8 8 -
wpmu-prefill-post/trunk/readme.txt
r375634 r747733 4 4 donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4RR68K6J9GBR8 5 5 Requires at least: 3.0 6 Tested up to: 3. 16 Tested up to: 3.5.2 7 7 Stable tag: trunk 8 8 … … 14 14 15 15 Add the ability to create post template. 16 You can manage templates and use them to prefill a post. 16 You can manage templates and use them to prefill a post. 17 17 Also prefill the post title. 18 18 19 19 20 Work with wordpress and wordpress mu. 21 Works with qtranslate. 20 Work with wordpress and wordpress mu. 21 Works with qtranslate. 22 22 23 23 Inspirated from "Article Templates" -
wpmu-prefill-post/trunk/wpmu-prefill-post.php
r375634 r747733 16 16 public function WPMUPrefillPost(){ 17 17 $this->plugin_name = plugin_basename(__FILE__); 18 19 18 if ( is_admin() ) { 20 19 // Start this plugin once all other plugins are fully loaded … … 96 95 } 97 96 public function add_admin_menu(){ 97 self::activate(); 98 98 if (function_exists('add_options_page')) { 99 99 add_options_page(__('WPMU Prefil Post Templates',self::DOMAIN), __('WPMU Prefil Post Templates',self::DOMAIN), self::ADMINISTRATOR, self::DOMAIN, array (&$this, 'showAdminMenu')); … … 144 144 public function updateTemplate($id,$post_title,$post_content,$post_excerpt){ 145 145 global $wpdb; 146 if(get_magic_quotes_gpc()) {146 /*if(get_magic_quotes_gpc()) { 147 147 $post_title = stripslashes($post_title); 148 148 $post_content = stripslashes($post_content); 149 149 $post_excerpt = stripslashes($post_excerpt); 150 } 151 $table_name= $wpdb->prefix.self::DOMAIN; 152 return $wpdb->update($table_name, array('post_title' => addslashes($post_title),153 'post_content' => addslashes($post_content),154 'post_excerpt' => addslashes($post_excerpt)150 }*/ 151 $table_name= $wpdb->prefix.self::DOMAIN; 152 return $wpdb->update($table_name, array('post_title' => /*addslashes*/($post_title), 153 'post_content' => /*addslashes*/($post_content), 154 'post_excerpt' => /*addslashes*/($post_excerpt) 155 155 ), array('ID' => $id),array('%s','%s','%s'), '%d'); 156 156 … … 158 158 public function addTemplate($post_title,$post_content,$post_excerpt){ 159 159 global $wpdb, $user_ID; 160 if(get_magic_quotes_gpc()) {160 /*if(get_magic_quotes_gpc()) { 161 161 $post_title = stripslashes($post_title); 162 162 $post_content = stripslashes($post_content); 163 163 $post_excerpt = stripslashes($post_excerpt); 164 } 164 }*/ 165 165 if ( is_multisite() ) { 166 166 switch_to_blog(self::MASTERBLOG); 167 167 $table_name= $wpdb->prefix.self::DOMAIN; 168 168 restore_current_blog(); 169 if($wpdb->get_var( 'select id from $table_name where post_title ="'.addslashes($post_title).'"')) { 169 echo 'select id from '.$table_name.' where post_title ="'./*addslashes*/($post_title).'"'; 170 if($wpdb->get_var( 'select id from '.$table_name.' where post_title ="'./*addslashes*/($post_title).'"')) { 170 171 return false; 171 172 } … … 173 174 $table_name= $wpdb->prefix.self::DOMAIN; 174 175 175 return $wpdb->insert($table_name, array('post_title' => addslashes($post_title),176 'post_content' => addslashes($post_content),177 'post_excerpt' => addslashes($post_excerpt),176 return $wpdb->insert($table_name, array('post_title' => /*addslashes*/($post_title), 177 'post_content' => /*addslashes*/($post_content), 178 'post_excerpt' => /*addslashes*/($post_excerpt), 178 179 'post_author' => $user_ID 179 180 ), array('%s','%s','%s','%d')); … … 190 191 if (is_multisite() && $current_blog != self::MASTERBLOG) { 191 192 $masterElements = $this->getElements('ID','desc', true); 192 $this->showMetaBoxOption($masterElements, &$exclude, self::MASTERBLOG);193 $this->showMetaBoxOption($masterElements, $exclude, self::MASTERBLOG); 193 194 194 195 foreach($masterElements as $element){ … … 198 199 } 199 200 } 200 $this->showMetaBoxOption($elements, &$exclude, $current_blog);201 $this->showMetaBoxOption($elements, $exclude, $current_blog); 201 202 foreach($elements as $element){ 202 203 $templates[$current_blog.'-'.$element->ID]=stripslashes($element->post_content); … … 261 262 texcerpt.value=<?php echo self::DOMAIN;?>Excerpt[select.value]; 262 263 } 263 264 264 265 //if qtrans is enabled 265 266 if(typeof qtrans_get_active_language == "function"){ … … 275 276 qtrans_integrate_title(); 276 277 } 277 278 278 279 279 280 } 280 281 function hasContent(){ … … 286 287 <?php 287 288 } 288 public function showMetaBoxOption($elements, $exclude, $blog_id){289 public function showMetaBoxOption($elements, &$exclude, $blog_id){ 289 290 foreach($elements as $element){ 290 291 if(in_array($element->post_title,$exclude)) continue; … … 358 359 if (is_multisite() && $current_blog != self::MASTERBLOG) { 359 360 $masterElements = $this->getElements($_GET['orderBy'], $_GET['order'], true); 360 $this->showTemplates($masterElements, false, __('Templates on master blog',WPMUPrefillPost::DOMAIN), &$exclude);361 $this->showTemplates($masterElements, false, __('Templates on master blog',WPMUPrefillPost::DOMAIN), $exclude); 361 362 } 362 $this->showTemplates($elements, true, __('Templates',WPMUPrefillPost::DOMAIN), &$exclude);363 $this->showTemplates($elements, true, __('Templates',WPMUPrefillPost::DOMAIN), $exclude); 363 364 364 365 … … 381 382 <?php 382 383 } 383 public function showTemplates($elements, $editable = false, $title, $exclude = array()){?>384 public function showTemplates($elements, $editable = false, $title, &$exclude = array()){?> 384 385 <h3><?php echo $title; ?></h3> 385 386 <table class="widefat">
Note: See TracChangeset
for help on using the changeset viewer.