Changeset 1840367
- Timestamp:
- 03/14/2018 10:58:03 PM (8 years ago)
- Location:
- tpg-get-posts/trunk
- Files:
-
- 3 added
- 6 edited
-
ext/class-tpg-gp-process-ext.php (added)
-
ext/class-tpg-show-ids.php (added)
-
ext/user-get-posts-custom-functions.php (added)
-
inc/class-tpg-get-posts.php (modified) (1 diff)
-
inc/class-tpg-gp-factory.php (modified) (2 diffs)
-
inc/class-tpg-gp-process.php (modified) (12 diffs)
-
inc/doc-text.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
tpg-get-posts.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tpg-get-posts/trunk/inc/class-tpg-get-posts.php
r771200 r1840367 34 34 "freeze"=>false, 35 35 "active-in-backend"=>false, 36 "updt-sec"=> 360,36 "updt-sec"=>99999999, 37 37 ); 38 38 -
tpg-get-posts/trunk/inc/class-tpg-gp-factory.php
r1081975 r1840367 27 27 */ 28 28 public static function create_process($_opts,$_paths) { 29 29 30 require_once("class-tpg-gp-process.php"); 30 31 if ($_opts['valid-lic'] && file_exists($_paths['dir']."ext/class-tpg-gp-process-ext.php")){ 31 //if (file_exists($_paths['dir']."inc/class-tpg-gp-process-ext.php")){32 require_once("class-tpg-gp-process.php");33 32 require_once($_paths['ext']."class-tpg-gp-process-ext.php"); 34 33 $obj = new tpg_gp_process_ext($_opts,$_paths); 35 34 }else { 36 require_once("class-tpg-gp-process.php");37 35 $obj = new tpg_gp_process($_opts,$_paths); 38 36 } … … 74 72 */ 75 73 public static function create_lic_validation($_opts,$_paths,$module_data) { 76 require_once("class-tpg-lic-validation.php"); 74 if (!class_exists("tpg_lic_validation")) { 75 require_once("class-tpg-lic-validation.php"); 76 } 77 77 $obj = new tpg_lic_validation($_opts,$_paths,$module_data); 78 78 return $obj; -
tpg-get-posts/trunk/inc/class-tpg-gp-process.php
r1359321 r1840367 38 38 'show_fi_error' => 'false', 39 39 'more_link_text' => '(read more...)', 40 'filter_title' => '', 41 'filter_byline' => '', 42 'filter_content' => '', 43 'filter_metadata' => '', 44 'filter_thumbnail' => '', 40 45 'fields' => 'title, byline, content, metadata', 41 46 'field_classes' => '', … … 271 276 272 277 /** 278 * register filters 279 * 280 * @package WordPress 281 * @subpackage tpg_get_posts 282 * @since 3.5 283 * 284 * if a filter function name has been passed in the parameters 285 * then register the filter for the shortcode 286 * 287 * all filters have 2 parms: string & post obj 288 * 289 * @param void 290 * @return void 291 * 292 */ 293 public function register_filters() { 294 // register title filter 295 if ($this->r['filter_title'] != '') { 296 add_filter ( 'tgp_filter_title', $this->r['filter_title'], 15, 2 ); 297 } 298 299 // register byine filter 300 if ($this->r['filter_byline'] != '') { 301 add_filter ( 'tgp_filter_byline', $this->r['filter_byline'], 15, 2 ); 302 } 303 304 // register content filter 305 if ($this->r['filter_content'] != '') { 306 add_filter ( 'tgp_filter_content', $this->r['filter_content'], 15, 2 ); 307 } 308 309 // register metadata filter 310 if ($this->r['filter_metadata'] != '') { 311 add_filter ( 'tgp_filter_metadata', $this->r['filter_metadata'], 15, 2 ); 312 } 313 314 // register thumbnail filter 315 if ($this->r['filter_thumbnail'] != '') { 316 add_filter ( 'tgp_filter_thumbnail', $this->r['filter_thumbnail'], 15, 2 ); 317 } 318 } 319 320 /** 321 * remove filters 322 * 323 * @package WordPress 324 * @subpackage tpg_get_posts 325 * @since 3.5 326 * 327 * if a filter function name has been passed in the parameters 328 * then remove the filter when shortcode terminates 329 * 330 * all filters have 2 parms: string & post obj 331 * 332 * @param void 333 * @return void 334 * 335 */ 336 public function remove_filters() { 337 // register title filter 338 if ($this->r['filter_title'] != '') { 339 remove_filter ( 'tgp_filter_title', $this->r['filter_title'], 15 ); 340 } 341 342 // register byine filter 343 if ($this->r['filter_byline'] != '') { 344 remove_filter ( 'tgp_filter_byline', $this->r['filter_byline'], 15 ); 345 } 346 347 // register content filter 348 if ($this->r['filter_content'] != '') { 349 remove_filter ( 'tgp_filter_content', $this->r['filter_content'], 15 ); 350 } 351 352 // register metadata filter 353 if ($this->r['filter_metadata'] != '') { 354 remove_filter ( 'tgp_filter_metadata', $this->r['filter_metadata'], 15 ); 355 } 356 357 // register thumbnail filter 358 if ($this->r['filter_thumbnail'] != '') { 359 remove_filter ( 'tgp_filter_thumbnail', $this->r['filter_thumbnail'], 15 ); 360 } 361 } 362 363 /** 273 364 * get the posts 274 365 * … … 342 433 } 343 434 } 435 436 // register filter functions if set 437 $this->register_filters(); 344 438 345 439 //setup parms for query … … 443 537 444 538 $post = $tmp_post; //restore current page/post settings 539 $this->remove_filters(); //remove the shortcode filters 445 540 return $content; 446 541 … … 463 558 case "title": 464 559 $wkcontent = $this->fmt_post_title($post); 465 $wkcontent = $this->filter_post_title($wkcontent );560 $wkcontent = $this->filter_post_title($wkcontent,$post); 466 561 break; 467 562 case "byline": 468 563 $wkcontent = $this->fmt_post_byline($post); 469 $wkcontent = $this->filter_post_byline($wkcontent );564 $wkcontent = $this->filter_post_byline($wkcontent,$post); 470 565 break; 471 566 case "content": … … 476 571 } 477 572 //wrap content in div tag 478 $wkcontent = $this->filter_post_content($wkcontent );573 $wkcontent = $this->filter_post_content($wkcontent,$post); 479 574 break; 480 575 case "metadata": 481 576 $wkcontent = $this->fmt_post_metadata($post); 482 $wkcontent = $this->filter_post_metadata($wkcontent );577 $wkcontent = $this->filter_post_metadata($wkcontent,$post); 483 578 break; 484 579 } … … 555 650 } 556 651 } 652 $t_content = apply_filters('tgp_filter_thumbnail',$t_content,$post); 557 653 return $t_content; 558 654 } … … 693 789 * @return string $wkcontent 694 790 */ 695 function filter_post_title($wkcontent ) {791 function filter_post_title($wkcontent,$post) { 696 792 //apply custom filter 697 793 if (method_exists($this,'pst_title_filter') && $this->cf_t ) { 698 794 $wkcontent = $this->pst_title_filter($wkcontent,$this->cfp); 699 } 795 } 796 $wkcontent = apply_filters('tgp_filter_title',$wkcontent,$post); 700 797 return $wkcontent; 701 798 } … … 710 807 * @return string $wkcontent 711 808 */ 712 function filter_post_byline($wkcontent ) {809 function filter_post_byline($wkcontent,$post) { 713 810 //apply custom filter 714 811 if (method_exists($this,'pst_byline_filter') && $this->cf_b ) { 715 812 $wkcontent = $this->pst_byline_filter($wkcontent,$this->cfp); 716 } 813 } 814 $wkcontent = apply_filters('tgp_filter_byline',$wkcontent,$post); 717 815 return $wkcontent; 718 816 } … … 727 825 * @return string $wkcontent 728 826 */ 729 function filter_post_content($wkcontent ) {827 function filter_post_content($wkcontent,$post) { 730 828 if (strlen($wkcontent) > 0) { 731 829 $wkcontent = '<div class="'.$this->classes_arr['post_content'].'">'.$wkcontent.'</div>'; … … 737 835 if (method_exists($this,'pst_content_filter') && $this->cf_c ) { 738 836 $wkcontent = $this->pst_content_filter($wkcontent,$this->cfp); 739 } 837 } 838 $wkcontent = apply_filters('tgp_filter_content',$wkcontent,$post); 740 839 return $wkcontent; 741 840 } … … 749 848 * @return string $wkcontent 750 849 */ 751 function filter_post_metadata($wkcontent ) {850 function filter_post_metadata($wkcontent,$post) { 752 851 //apply custom filter 753 852 if (method_exists($this,'pst_metadata_filter') && $this->cf_m ) { 754 853 $wkcontent = $this->pst_metadata_filter($wkcontent,$this->cfp); 755 } 854 } 855 $wkcontent = apply_filters('tgp_filter_metadata',$wkcontent,$post); 756 856 return $wkcontent; 757 857 } -
tpg-get-posts/trunk/inc/doc-text.php
r1590381 r1840367 11 11 <li><a href="#gp-options"><? _e('Options','tpg-get-posts')?></a></li> 12 12 <li><a href="#gp-styling"><? _e('Styling','tpg-get-posts')?></a></li> 13 <li><a href="#gp-filters"><? _e('Filters','tpg-get-posts')?></a></li> 13 14 <li><a href="#gp-examples"><? _e('Examples','tpg-get-posts')?></a></li> 14 15 <li><a href="#gp-settings"><? _e('Settings','tpg-get-posts')?></a></li> … … 174 175 <dt>ul-class</dt><dd><? _e('This is the class assigned to the bullet list. When this class is provided, the output is returned as an unordered list.','tpg-get-posts')?></dd> 175 176 176 <dt class="tpg-prem">cf</dt><dd><? _e("Invoke the user Custom Functions by passing the codes for each exit to be invoked, ie cf='ppre,ppst,pre,pst,t,b,c,m'. The model function php file is provided in the /ext files folder and instructions are in the comments.",'tpg-get-posts')?> 177 ppre => <? _e('before the invoking of the plugin','tpg-get-posts')?> 178 ppst => <? _e('upon completion of plugin, just before returning results','tpg-get-posts')?> 179 pre => <? _e('before each post','tpg-get-posts')?> 180 pst => <? _e('after each post','tpg-get-posts')?> 181 t,b,c,m => <? _e('after title,byline,content,metadata -- this allows final editing 182 ','tpg-get-posts')?></dd> 183 <dt class="tpg-prem">cfp</dt><dd><? _e('Custom functions parameters. This is an optional string that is passed to the custom functions routine. It must be parsed by the custom function and is defined by the user.','tpg-get-posts')?></dd> 177 <p><? _e('To exclude posts, see examples.','tpg-get-posts')?></p> 178 179 <div class="deprecated" style="background:yellow;"> 180 <h4 ><? _e('Deprecated - use filters','tpg-get-posts')?></h4> 181 <dt class="tpg-prem">cf</dt><dd><? _e("Invoke the user Custom Functions by passing the codes for each exit to be invoked, ie cf='ppre,ppst,pre,pst,t,b,c,m'. The model function php file is provided in the /ext files folder and instructions are in the comments.",'tpg-get-posts')?> 182 ppre => <? _e('before the invoking of the plugin','tpg-get-posts')?> 183 ppst => <? _e('upon completion of plugin, just before returning results','tpg-get-posts')?> 184 pre => <? _e('before each post','tpg-get-posts')?> 185 pst => <? _e('after each post','tpg-get-posts')?> 186 t,b,c,m => <? _e('after title,byline,content,metadata -- this allows final editing 187 ','tpg-get-posts')?></dd> 188 <dt class="tpg-prem">cfp</dt><dd><? _e('Custom functions parameters. This is an optional string that is passed to the custom functions routine. It must be parsed by the custom function and is defined by the user.','tpg-get-posts')?></dd> 189 </div> 190 184 191 </dl> 185 192 186 <p><? _e('To exclude posts, see examples.','tpg-get-posts')?></p>187 193 188 194 </div> … … 241 247 242 248 </div> 243 <div id="gp-examples"> 249 <div id="gp-filters"> 250 <h3><?php _e('Filters:','tpg-get-posts')?></h3> 251 <p><?php _e('The filter process allows for the filters to be implemented in 2 ways:','tpg-get-posts') ?></p> 252 <p><ol><?php _e(' 253 <li>Globally as a standard filter</li> 254 <li>Individual call in tpg_get_posts</li> 255 </ol>','tpg-get-posts') ?></p> 256 <p><?php _e('The global filter is given a priority value of 10 and the call through the short-code is given a priority value of 15. This allows the short-code call to override the global call, it that it is called after the global call.','tpg-get-posts') ?></p> 257 <h4><?php _e('Example code','tpg-get-posts') ?></h4> 258 <p><?php _e('Create a custom function. This can be placed in the theme functions file or it can be put in a file named <br /><b>"user-get-posts-custom-functions"</b> which is placed in the root of the theme.','tpg-get-posts') ?></p> 259 <p><pre><code>function my_custom_title_filter( $title, $post) { 260 $title = "Custom Title Filter Works"; 261 return $title; 262 }</code></pre></p> 263 <p>To set the function to process on all titles (global title filter) use the following code and add below the function definition: <br /><code>'add_filter( "tgp_filter_title", "my_custom_title_filter", 10, 2 );</code></p> 264 <p>To run the filter for a specific call of tpg_get_posts add the filter parameter to the short-code: <br /><code>[tpg_get_posts filter_title="my_custom_title_filter"]></code></p> 265 266 <p><?php _e('The available filters are:<br /> (replace <function_name> with your custom function name)','tpg-get-posts') ?></p> 267 <ul> 268 <dt class="tpg-prem">filter_title</dt><dd><?php _e('filter_title="<function_name>"','tpg-get-posts')?></dd> 269 <dt class="tpg-prem">filter_byline</dt><dd><?php _e('filter_byline="<function_name>"','tpg-get-posts')?></dd> 270 <dt class="tpg-prem">filter_content</dt><dd><?php _e('filter_content="<function_name>"','tpg-get-posts')?></dd> 271 <dt class="tpg-prem">filter_metadata</dt><dd><?php _e('filter_metadata="<function_name>"','tpg-get-posts')?></dd> 272 <dt class="tpg-prem">filter_thumbnail</dt><dd><?php _e('filter_thumbnail="<function_name>"','tpg-get-posts')?></dd> 273 </ul> 274 </div> 275 276 <div id="gp-examples"> 244 277 <h3><? _e('Examples:','tpg-get-posts')?></h3> 245 278 … … 301 334 <li><? _e('Select the Keep Options on uninstall checkbox','tpg-get-posts')?></li> 302 335 <li><? _e('Click the Update Options to save the options','tpg-get-posts')?></li> 303 <li><? _e('Click the Validate Lic to register and receive new update notices','tpg-get-posts')?></li> 304 <br /> 305 </ol> 306 <ol><? _e('To manually load the extension:','tpg-get-posts')?> 307 <li><? _e('Click the download link in the email','tpg-get-posts')?></li> 308 <li><? _e('FTP the contents of the /ext folder to your site','tpg-get-posts')?></li> 309 <li><? _e('Activate by following instructions above ','tpg-get-posts')?></li> 310 </ol> 311 312 313 </div> 336 <li><? _e('Click the Validate Lic to register. You should see a message "The license opts have been validated - thank you." below the License email box. If not, verify you have the correct key & email.','tpg-get-posts')?></li> 337 <p><?php _e('That should be it.','tpg-get-posts')?></p> 338 339 340 </div> 314 341 </div> 315 342 </div> -
tpg-get-posts/trunk/readme.txt
r1835772 r1840367 5 5 Requires at least: 2.8 6 6 Tested up to: 4.9 7 Stable tag: 3. 4.37 Stable tag: 3.5.1 8 8 License: GPLv2 or later 9 9 … … 133 133 134 134 == Changelog == 135 = 3.5.1 + 136 * add filter processing for title, byline, content, metadata & image 137 * change download procedure for premium version 138 135 139 = 3.4.3 = 136 140 * updated documentation -
tpg-get-posts/trunk/tpg-get-posts.php
r1590381 r1840367 4 4 Plugin URI: http://www.tpginc.net/wordpress-plugins/ 5 5 Description: Adds a shortcode tag to display posts on static page. 6 Version: 3. 4.36 Version: 3.5.1 7 7 Author: Criss Swaim 8 8 Author URI: http://www.tpginc.net/
Note: See TracChangeset
for help on using the changeset viewer.