Changeset 1538505
- Timestamp:
- 11/22/2016 04:25:31 PM (9 years ago)
- Location:
- aprils-call-posts/trunk
- Files:
-
- 2 edited
-
ahs_callposts.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
aprils-call-posts/trunk/ahs_callposts.php
r1533885 r1538505 4 4 Plugin URI: http://springthistle.com/wordpress/plugin_callposts 5 5 Description: Via shortcode, lets you call in a list of posts that are filtered, displayed and ordered based on criteria you provide. <a href="options-general.php?page=ahs_callposts_admin.php">Edit Settings</a>. 6 Version: 2.0.1 16 Version: 2.0.12 7 7 Author: Aaron Hodge Silver 8 8 Author URI: http://springthistle.com/ … … 196 196 $tmpl = str_replace('%%DATE%%',get_the_time($ahscpsett['dateformat'],$post->ID),$tmpl); 197 197 198 if (strpos( '/%%CONTENT/', $tmpl) !== FALSE) {198 if (strpos($tmpl, '%%CONTENT') !== FALSE) { 199 199 $content = get_the_content($ahscpsett['continue_text']); 200 200 $content = apply_filters('the_content', $content); … … 205 205 } 206 206 207 if (strpos( '/%%EXCERPT/', $tmpl) !== FALSE) {207 if (strpos($tmpl, '%%EXCERPT') !== FALSE) { 208 208 if (!empty($post->post_excerpt)) $excerpt = $post->post_excerpt; 209 else $excerpt = ahscp_excerpt($post->post_content);209 else $excerpt = get_the_excerpt($post); 210 210 $tmpl = str_replace('%%EXCERPT%%',$excerpt,$tmpl); 211 211 } … … 232 232 if (!empty($post->post_excerpt)) $excerpt = $post->post_excerpt; 233 233 // else $excerpt = get_the_excerpt(); 234 else $excerpt = ahscp_excerpt($post->post_content);234 else $excerpt = get_the_excerpt(); 235 235 $out .= '<p>'.$excerpt.' '.$ahscpsett['pre_continue_text'].'<a href="'.get_permalink($post->ID).'">'.$ahscpsett['continue_text'].'</a></p>'; 236 236 } else { … … 274 274 275 275 return $catids; 276 }277 278 /*279 * ahscp_excerpt()280 * returns a string that is an excerpt of the post content. replaces get_the_excerpt() which was causing problems281 * @param string post_content282 * @returns string excerpt283 */284 function ahscp_excerpt($text) {285 $text = strip_tags($text);286 $text = preg_replace('/\[([^[])+\]/','',$text);287 $text = preg_replace("/\n|\r/"," ",$text);288 $text = ahscp_substrws($text,450);289 return $text;290 }291 292 /* Thanks, Benny. http://www.php.net/manual/en/function.substr.php#90724 */293 /**294 * word-sensitive substring function with html tags awareness295 * @param text The text to cut296 * @param len The maximum length of the cut string297 * @returns string298 **/299 function ahscp_substrws( $text, $len=180 ) {300 301 if ( (strlen($text) > $len) ) {302 303 $whitespaceposition = strpos($text," ",$len)-1;304 305 if ($whitespaceposition > 0)306 $text = substr($text, 0, ($whitespaceposition+1));307 308 // close unclosed html tags309 if (preg_match_all("|<([a-zA-Z]+)>|",$text,$aBuffer) ) {310 if( !empty($aBuffer[1]) ) {311 preg_match_all("|</([a-zA-Z]+)>|",$text,$aBuffer2);312 if( count($aBuffer[1]) != count($aBuffer2[1]) ) {313 foreach( $aBuffer[1] as $index => $tag ) {314 if( empty($aBuffer2[1][$index]) || $aBuffer2[1][$index] != $tag)315 $text .= '</'.$tag.'>';316 }317 }318 }319 }320 }321 322 return $text;323 276 } 324 277 -
aprils-call-posts/trunk/readme.txt
r1533885 r1538505 4 4 Requires at least: 2.9.1 5 5 Tested up to: 4.6.1 6 Stable tag: 2.0.1 16 Stable tag: 2.0.12 7 7 8 8 Via shortcode, lets you call in a list of posts that are filtered, ordered, and displayed based on criteria you provide. … … 40 40 41 41 == Changelog == 42 43 = 2.0.12 = 44 * Replaced a custom expert-generator with WordPress's built-in one, to solve efficiency issues. 42 45 43 46 = 2.0.11 =
Note: See TracChangeset
for help on using the changeset viewer.