Skip to content

Commit

Permalink
Allow to edit title for autolinks / Issue TaxoPress#6
Browse files Browse the repository at this point in the history
  • Loading branch information
herewithme committed Nov 8, 2014
1 parent c1475c4 commit 281e30f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions inc/class.client.autolinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static function _replace_by_links_dom(&$content, $search = '', $replace

$xpath = new DOMXPath($dom);
foreach ($xpath->query('//text()[not(ancestor::a)]') as $node) {
$substitute = '<a href="' . $replace . '" class="st_tag internal_tag" ' . $rel . ' title="' . esc_attr(sprintf(__('Posts tagged with %s', 'simpletags'), $search)) . "\">$search</a>";
$substitute = '<a href="' . $replace . '" class="st_tag internal_tag" ' . $rel . ' title="' . esc_attr(sprintf(SimpleTags_Plugin::get_option_value('auto_link_title'), $search)) . "\">$search</a>";

if ( $case == 'i' ) {
$replaced = str_ireplace($search, $substitute, $node->wholeText);
Expand Down Expand Up @@ -236,7 +236,7 @@ private static function _replace_by_links_regexp(&$content, $search = '', $repla
$filtered = ''; // will filter text token by token

$match = '/(\PL|\A)(' . preg_quote($search, "/") . ')(\PL|\Z)/u' . $case;
$substitute = '$1<a href="' . $replace . '" class="st_tag internal_tag" ' . $rel . ' title="' . esc_attr(sprintf(__('Posts tagged with %s', 'simpletags'), $search)) . "\">$2</a>$3";
$substitute = '$1<a href="' . $replace . '" class="st_tag internal_tag" ' . $rel . ' title="' . esc_attr(sprintf(SimpleTags_Plugin::get_option_value('auto_link_title'), $search)) . "\">$2</a>$3";

//$match = "/\b" . preg_quote($search, "/") . "\b/".$case;
//$substitute = '<a href="'.$replace.'" class="st_tag internal_tag" '.$rel.' title="'. esc_attr( sprintf( __('Posts tagged with %s', 'simpletags'), $search ) )."\">$0</a>";
Expand Down
2 changes: 1 addition & 1 deletion inc/helper.options.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
),
array('auto_link_dom', __('Try new engine replacement ?', 'simpletags'), 'checkbox', '1',
__('An engine replacement alternative uses DOMDocument PHP class and theoretically offers better performance. If your server does not offer the functionality, the plugin will use the usual engine.', 'simpletags')),
array('auto_link_title', __('Text to display into title attribute for links:', 'simpletags'), 'text', 'regular-text'),
),
'tagcloud' => array(
array('text_helper', 'text_helper', 'helper', '', __('Which difference between <strong>&#8216;Order tags selection&#8217;</strong> and <strong>&#8216;Order tags display&#8217;</strong> ?<br />', 'simpletags')
Expand Down
1 change: 1 addition & 0 deletions inc/helper.options.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'auto_link_priority' => 12,
'auto_link_views' => 'singular',
'auto_link_dom' => 0,
'auto_link_title' => __('Posts tagged with %s', 'simpletags'),

// Administration
'order_click_tags' => 'name-asc',
Expand Down

0 comments on commit 281e30f

Please sign in to comment.