Changeset 2350080
- Timestamp:
- 07/31/2020 10:18:55 PM (5 years ago)
- Location:
- alink-tap/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
alink-tap.php (modified) (3 diffs)
-
public/class-alink-tap.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alink-tap/trunk/README.txt
r2344117 r2350080 5 5 Requires at least: 3.5.1 6 6 Tested up to: 5.4.2 7 Stable tag: 1.2. 47 Stable tag: 1.2.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 93 93 == Changelog == 94 94 95 = 1.2.5 = 96 * Fixed php warnings detected 97 95 98 = 1.2.4 = 96 99 * Added some improvements -
alink-tap/trunk/alink-tap.php
r2344117 r2350080 12 12 * Plugin URI: https://wordpress.org/plugins/alink-tap/ 13 13 * Description: This plugin is a customization of <strong>KB Linker vTAP</strong> by Adam R. Brown to <strong>TodoApuestas.org</strong>. Looks for user-defined phrases in posts and automatically links them. Example: Link every occurrence of "TodoApuestas" to todoapuestas.org. It execute syncronizations task with TodoApuestas.org Server. 14 * Version: 1.2. 414 * Version: 1.2.5 15 15 * Author: Alain Sanchez <[email protected]> 16 16 * Author URI: http://www.linkedin.com/in/mrbrazzi/ … … 34 34 // OPTIONAL SETTINGS 35 35 36 /*special characters for foreign languages. Add any you want to the array below. Char goes on left, HTML entity on right. The Spanish codes are here as examples.37 38 See http://www.w3schools.com/tags/ref_entities.asp for HTML entities. */39 40 $alink_tap_special_chars = array(41 42 'á' => 'á',43 44 'Á' => 'Á',45 46 'é' => 'é',47 48 'É' => 'É',49 50 'í' => 'í',51 52 'Í' => 'Í',53 54 'ó' => 'ó',55 56 'Ó' => 'Ó',57 58 'ú' => 'ú',59 60 'Ú' => 'Ú',61 62 'ñ' => 'ñ',63 64 'Ñ' => 'Ñ'65 66 );67 68 36 /* would you like to add title="" tags to the links with the keyword in them? true or false. */ 69 37 … … 73 41 74 42 then make before = 'More about ' (note the space) and after = '.' */ 75 76 $alink_tap_title_text = array(77 78 'before' => __('Hacer clic aqui para mas informacion', 'alink-tap').' ', // default: 'More about '79 80 'after' => ' »', // default: '$raquo;' (an arrow pointing to the right)81 82 );83 43 84 44 require_once( plugin_dir_path( __FILE__ ) . 'public/class-alink-tap.php' ); -
alink-tap/trunk/public/class-alink-tap.php
r2344117 r2350080 26 26 * 27 27 * @since 1.1.12 28 * @updated 1.2. 428 * @updated 1.2.5 29 29 * 30 30 * @var string 31 31 */ 32 const VERSION = '1.2. 4';32 const VERSION = '1.2.5'; 33 33 34 34 /** … … 58 58 private $default_options; 59 59 60 private $alink_tap_title_text; 61 private $alink_tap_special_chars; 62 63 60 64 /** 61 65 * Initialize the plugin by setting localization and loading public scripts … … 65 69 */ 66 70 private function __construct() { 71 72 $this->alink_tap_title_text = array( 73 'before' => __('Hacer clic aqui para mas informacion', 'alink-tap').' ', // default: 'More about ' 74 'after' => ' »', // default: '$raquo;' (an arrow pointing to the right) 75 ); 76 77 /* 78 * special characters for foreign languages. Add any you want to the array below. 79 * Char goes on left, HTML entity on right. The Spanish codes are here as examples. 80 * See http://www.w3schools.com/tags/ref_entities.asp for HTML entities. 81 */ 82 $this->alink_tap_special_chars = array( 83 'á' => 'á', 84 'Á' => 'Á', 85 'é' => 'é', 86 'É' => 'É', 87 'í' => 'í', 88 'Í' => 'Í', 89 'ó' => 'ó', 90 'Ó' => 'Ó', 91 'ú' => 'ú', 92 'Ú' => 'Ú', 93 'ñ' => 'ñ', 94 'Ñ' => 'Ñ' 95 ); 67 96 68 97 // Load plugin text domain … … 348 377 */ 349 378 public function execute_linker($content, $simple = false) { 350 global $ alink_tap_special_chars, $alink_tap_title_text, $post;379 global $post; 351 380 $pairs = $text = $plurals = $licencias = null; 352 381 … … 367 396 368 397 // let's make use of that special chars setting. 369 if (is_array($ alink_tap_special_chars)) {370 foreach ($ alink_tap_special_chars as $char => $code) {398 if (is_array($this->alink_tap_special_chars)) { 399 foreach ($this->alink_tap_special_chars as $char => $code) { 371 400 $content = str_replace($code, $char, $content); 372 401 } … … 386 415 foreach ($list_site_links as $house) { 387 416 $keyword = ''; 388 if (isset($house ['nombre']))417 if (isset($house) && in_array('nombre', $house) && isset($house['nombre'])){ 389 418 $keyword = $house['nombre']; 419 } 390 420 391 421 // Compruebo si es un usuario de Spain. Si lo es, compruebo si la key es con licencia_esp, si no, paso al siguiente 392 422 393 if (!empty($country) && strcmp($country, 'Spain') == 0 && !empty($house)) { 394 $url = $house['urles']; 395 if (!$house['licencia']) continue; 423 $url = null; 424 if (!empty($country) && strcmp($country, 'Spain') === 0 && isset($house)) { 425 $url = in_array('urles', $house) && isset($house['urles']) ? $house['urles'] : null; 426 if (!in_array('licencia', $house)) continue; 396 427 } else { 397 $url = $house['url']; 428 $url = in_array('url', $house) && isset($house['url']) ? $house['url'] : null; 429 } 430 431 if (is_null($url)) { 432 continue; 398 433 } 399 434 … … 406 441 // } 407 442 408 if ( $url == $currentUrl) { // don't link a page to itself443 if (!is_null($url) && strcmp($url, $currentUrl) === 0) { // don't link a page to itself 409 444 $usedUrls[] = $url; 410 445 continue; … … 455 490 456 491 if (ALINK_TAP_USE_TITLES) 457 $title = ' title="' . $ alink_tap_title_text['before'] . $alink_tap_title_text['after'] . '"';492 $title = ' title="' . $this->alink_tap_title_text['before'] . $this->alink_tap_title_text['after'] . '"'; 458 493 459 494 // now that we've taken the keyword out of any links it appears in, let's look for the keyword elsewhere.
Note: See TracChangeset
for help on using the changeset viewer.