@@ -82,7 +82,7 @@ private function __construct() {
8282 'taxonomies ' => array ( 'glossary-cat ' ),
8383 'map_meta_cap ' => true ,
8484 'menu_icon ' => 'dashicons-book-alt ' ,
85- 'supports ' => array ( 'thumbnail ' , 'editor ' , 'title ' , 'genesis-seo ' , 'genesis-layouts ' , 'genesis-cpt-archive-settings ' )
85+ 'supports ' => array ( 'thumbnail ' , 'editor ' , 'title ' , 'genesis-seo ' , 'genesis-layouts ' , 'genesis-cpt-archive-settings ' )
8686 )
8787 );
8888
@@ -224,10 +224,10 @@ public function glossary_auto_link( $text ) {
224224 $ link = get_the_permalink ();
225225 $ internal = true ;
226226 }
227- if ( !empty ( $ link ) && !empty ( $ target )) {
227+ if ( !empty ( $ link ) && !empty ( $ target ) ) {
228228 $ target = ' target="_blank" ' ;
229229 }
230- if ( !empty ( $ link ) && !empty ( $ nofollow )) {
230+ if ( !empty ( $ link ) && !empty ( $ nofollow ) ) {
231231 $ nofollow = ' rel="nofollow" ' ;
232232 }
233233
@@ -236,7 +236,7 @@ public function glossary_auto_link( $text ) {
236236 global $ post ;
237237 $ links [] = $ this ->tooltip_html ( $ link , get_the_title (), $ post , $ target , $ nofollow , $ internal );
238238 } else {
239- $ links [] = '<a href=" ' . $ link . '" ' . $ target . $ nofollow .'> ' . get_the_title () . '</a> ' ;
239+ $ links [] = '<a href=" ' . $ link . '" ' . $ target . $ nofollow . '> ' . get_the_title () . '</a> ' ;
240240 }
241241 $ related = $ this ->related_post_meta ( get_post_meta ( get_the_ID (), $ this ->get_plugin_slug () . '_tag ' , true ) );
242242 if ( is_array ( $ related ) ) {
@@ -245,15 +245,17 @@ public function glossary_auto_link( $text ) {
245245 if ( isset ( $ this ->settings [ 'tooltip ' ] ) ) {
246246 $ links [] = $ this ->tooltip_html ( $ link , $ value , $ post , $ target , $ nofollow , $ internal );
247247 } else {
248- $ links [] = '<a href=" ' . $ link . '" ' . $ target . $ nofollow .'> ' . $ value . '</a> ' ;
248+ $ links [] = '<a href=" ' . $ link . '" ' . $ target . $ nofollow . '> ' . $ value . '</a> ' ;
249249 }
250250 }
251251 }
252252 endwhile ;
253- if ( isset ( $ this ->settings [ 'first_occurence ' ] ) ) {
254- $ text = preg_replace ( $ words , $ links , $ text , 1 );
255- } else {
256- $ text = preg_replace ( $ words , $ links , $ text );
253+ if ( !empty ( $ words ) ) {
254+ if ( isset ( $ this ->settings [ 'first_occurence ' ] ) ) {
255+ $ text = preg_replace ( $ words , $ links , $ text , 1 );
256+ } else {
257+ $ text = preg_replace ( $ words , $ links , $ text );
258+ }
257259 }
258260 wp_reset_postdata ();
259261 }
@@ -287,7 +289,6 @@ public function g_is_home() {
287289 }
288290 }
289291
290-
291292 /**
292293 * Check the settings and if is a category page
293294 *
@@ -301,7 +302,6 @@ public function g_is_category() {
301302 }
302303 }
303304
304-
305305 /**
306306 * Check the settings and if is tag
307307 *
@@ -315,7 +315,6 @@ public function g_is_tag() {
315315 }
316316 }
317317
318-
319318 /**
320319 * Check the settings and if is an archive glossary
321320 *
@@ -375,9 +374,9 @@ public function search_string( $title ) {
375374 */
376375 public function get_the_excerpt ( $ post ) {
377376 if ( empty ( $ post ->post_excerpt ) ) {
378- return substr ( wp_strip_all_tags ($ post ->post_content ), 0 , intval ( $ this ->settings [ 'excerpt_limit ' ] ) );
377+ return substr ( wp_strip_all_tags ( $ post ->post_content ), 0 , intval ( $ this ->settings [ 'excerpt_limit ' ] ) );
379378 } else {
380- return substr ( wp_strip_all_tags ($ post ->post_excerpt ), 0 , intval ( $ this ->settings [ 'excerpt_limit ' ] ) );
379+ return substr ( wp_strip_all_tags ( $ post ->post_excerpt ), 0 , intval ( $ this ->settings [ 'excerpt_limit ' ] ) );
381380 }
382381 }
383382
@@ -395,22 +394,22 @@ public function get_the_excerpt( $post ) {
395394 public function tooltip_html ( $ link , $ title , $ post , $ target , $ nofollow , $ internal ) {
396395 $ link_tooltip = '<span class="tooltip"> '
397396 . "\n" . '<span class="tooltip-item"> '
398- . "\n" . '<a href=" ' . $ link . '" ' . $ target . $ nofollow .'> ' . $ title . '</a> '
397+ . "\n" . '<a href=" ' . $ link . '" ' . $ target . $ nofollow . '> ' . $ title . '</a> '
399398 . "\n" . '</span> '
400399 . "\n" . '<span class="tooltip-content clearfix"> ' ;
401400 $ photo = get_the_post_thumbnail ( $ post ->ID , 'thumbnail ' );
402- if ( !empty ( $ photo ) && !empty ( $ this ->settings [ 't_image ' ] )) {
401+ if ( !empty ( $ photo ) && !empty ( $ this ->settings [ 't_image ' ] ) ) {
403402 $ link_tooltip .= $ photo ;
404403 }
405- if ( empty ( $ internal )) {
404+ if ( empty ( $ internal ) ) {
406405 $ readmore = ' <a href=" ' . get_the_permalink () . '"> ' . __ ( 'More ' ) . '</a> ' ;
407406 }
408- $ link_tooltip .= "\n" . '<span class="tooltip-text"> ' . $ this ->get_the_excerpt ( $ post ) . ' ... ' . $ readmore .'</span> '
407+ $ link_tooltip .= "\n" . '<span class="tooltip-text"> ' . $ this ->get_the_excerpt ( $ post ) . ' ... ' . $ readmore . '</span> '
409408 . "\n" . '</span> '
410409 . "\n" . '</span> ' ;
411410 return $ link_tooltip ;
412411 }
413-
412+
414413 /**
415414 * Genesis hack to add the support for the archive content page
416415 *
@@ -424,10 +423,11 @@ public function genesis_content() {
424423 // Only display excerpt if not a teaser
425424 if ( !in_array ( 'teaser ' , get_post_class () ) ) {
426425 remove_filter ( 'the_content ' , array ( $ this , 'glossary_auto_link ' ) );
427- remove_filter ( 'the_excerpt ' , array ( $ this , 'glossary_auto_link ' ) );
428- $ excerpt = wp_strip_all_tags (get_the_excerpt ( ) );
426+ remove_filter ( 'the_excerpt ' , array ( $ this , 'glossary_auto_link ' ) );
427+ $ excerpt = wp_strip_all_tags ( get_the_excerpt () );
429428 echo '<p> ' . $ this ->glossary_auto_link ( $ excerpt ) . ' <a href=" ' . get_the_permalink () . '"> ' . __ ( 'Read More ' ) . '</a></p> ' ;
430429 remove_action ( 'genesis_entry_content ' , 'genesis_do_post_content ' );
431430 }
432431 }
433- }
432+
433+ }
0 commit comments