Changeset 1531405
- Timestamp:
- 11/10/2016 05:59:31 AM (9 years ago)
- Location:
- surly/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (1 diff)
-
surly-behaviour.php (modified) (1 diff)
-
surly.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
surly/trunk/readme.txt
r1513288 r1531405 29 29 30 30 == Changelog == 31 32 = 2.4.1 = 33 34 * Option of replace all 31 35 32 36 = 2.4.0 = -
surly/trunk/surly-behaviour.php
r1513288 r1531405 36 36 <p class="description"> 37 37 If it's not selected, the links will be replaced in Comments only. 38 </p> 39 </fieldset> 40 </td> 41 </tr> 42 <tr valign="top"> 43 <th scope="row">Replace all outbound URLs</th> 44 <td> 45 <fieldset> 46 <legend class="screen-reader-text"> 47 <span>Replace all outbound URLs</span> 48 </legend> 49 <label for="replace_all"> 50 <input id="replace_all" type="checkbox" value="1" name="surly_replace_all"<?php if (get_option('surly_replace_all') == 1) {echo ' checked';}?>> 51 </label> 52 <p class="description"> 53 Sur.ly will process all outbound links on your website <b>(beta)</b>. 38 54 </p> 39 55 </fieldset> -
surly/trunk/surly.php
r1513288 r1531405 20 20 * Plugin URI: http://sur.ly 21 21 * Description: Sur.ly enables you to control and analyze any outbound links published by your site visitors in user-generated content as well as to protect and retain users that follow such links. 22 * Version: 2.4. 022 * Version: 2.4.1 23 23 * Author: Sur.ly 24 24 */ … … 116 116 delete_option('surly_users'); 117 117 delete_option('surly_replace_in_posts'); 118 delete_option('surly_replace_all'); 118 119 delete_option('surly_shorten_urls'); 119 120 delete_option('surly_panel_settings'); … … 222 223 } 223 224 224 function surly_replace($content, $userId )225 function surly_replace($content, $userId = null) 225 226 { 226 227 $surly = _surly_get_sdk(); 227 228 228 return $surly->isWhitelistedUser($userId) ? $content : $surly->process($content);229 return ($userId && $surly->isWhitelistedUser($userId)) ? $content : $surly->process($content); 229 230 } 230 231 … … 254 255 255 256 return $surly; 257 } 258 259 function surly_replace_all() 260 { 261 if ( !is_admin() ) { 262 ob_start('surly_replace'); 263 } 256 264 } 257 265 … … 384 392 $shorten_urls = isset($_POST['surly_shorten_urls']) ? 1 : 0; 385 393 $replace_in_posts = isset($_POST['surly_replace_in_posts']) ? 1 : 0; 394 $replace_all = isset($_POST['surly_replace_all']) ? 1 : 0; 386 395 $trusted_users = isset($_POST['trusted_users']) ? $_POST['trusted_users'] : array(); 387 396 $url_processing = isset($_POST['surly_url_processing']) ? 1 : 0; … … 426 435 update_option('surly_shorten_urls', $shorten_urls); 427 436 update_option('surly_replace_in_posts', $replace_in_posts); 437 update_option('surly_replace_all', $replace_all); 428 438 update_option('surly_url_processing', $url_processing); 429 439 update_option('surly_subdomain', $subdomain); … … 452 462 453 463 if (get_option('surly_url_processing') == 1) { 454 if (get_option('surly_replace_in_posts') == 1) { 455 add_filter('the_content', 'surly_replace_in_content', 9999); 456 add_filter('the_excerpt', 'surly_replace_in_content', 9999); 457 } 458 459 add_filter('comment_text', 'surly_replace_in_comment', 9999); 460 add_filter('comment_excerpt', 'surly_replace_in_comment', 9999); 461 add_filter('get_comment_author_link', 'surly_replace_in_comment', 9999); 464 if (get_option('surly_replace_all') == 1) { 465 add_action('wp_loaded', 'surly_replace_all', 9999); 466 } else { 467 if (get_option('surly_replace_in_posts') == 1) { 468 add_filter('the_content', 'surly_replace_in_content', 9999); 469 add_filter('the_excerpt', 'surly_replace_in_content', 9999); 470 } 471 472 add_filter('comment_text', 'surly_replace_in_comment', 9999); 473 add_filter('comment_excerpt', 'surly_replace_in_comment', 9999); 474 add_filter('get_comment_author_link', 'surly_replace_in_comment', 9999); 475 } 462 476 } 463 477
Note: See TracChangeset
for help on using the changeset viewer.