Plugin Directory

Changeset 2350080


Ignore:
Timestamp:
07/31/2020 10:18:55 PM (5 years ago)
Author:
todoapuestas
Message:

1.2.5

  • Fixed php warnings detected
Location:
alink-tap/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • alink-tap/trunk/README.txt

    r2344117 r2350080  
    55Requires at least: 3.5.1
    66Tested up to: 5.4.2
    7 Stable tag: 1.2.4
     7Stable tag: 1.2.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9393== Changelog ==
    9494
     95= 1.2.5 =
     96* Fixed php warnings detected
     97
    9598= 1.2.4 =
    9699* Added some improvements
  • alink-tap/trunk/alink-tap.php

    r2344117 r2350080  
    1212 * Plugin URI:          https://wordpress.org/plugins/alink-tap/
    1313 * 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.4
     14 * Version:             1.2.5
    1515 * Author:              Alain Sanchez <[email protected]>
    1616 * Author URI:          http://www.linkedin.com/in/mrbrazzi/
     
    3434//  OPTIONAL SETTINGS
    3535
    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     'á' => '&#225;',
    43 
    44     'Á' => '&#193;',
    45 
    46     'é' => '&#233;',
    47 
    48     'É' => '&#201;',
    49 
    50     'í' => '&#237;',
    51 
    52     'Í' => '&#205;',
    53 
    54     'ó' => '&#243;',
    55 
    56     'Ó' => '&#211;',
    57 
    58     'ú' => '&#250;',
    59 
    60     'Ú' => '&#218;',
    61 
    62     'ñ' => '&#241;',
    63 
    64     'Ñ' => '&#209;'
    65 
    66 );
    67 
    6836/*  would you like to add title="" tags to the links with the keyword in them? true or false. */
    6937
     
    7341
    7442    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' => ' &raquo;',  // default: '$raquo;' (an arrow pointing to the right)
    81 
    82 );
    8343
    8444require_once( plugin_dir_path( __FILE__ ) . 'public/class-alink-tap.php' );
  • alink-tap/trunk/public/class-alink-tap.php

    r2344117 r2350080  
    2626     *
    2727     * @since   1.1.12
    28      * @updated 1.2.4
     28     * @updated 1.2.5
    2929     *
    3030     * @var     string
    3131     */
    32     const VERSION = '1.2.4';
     32    const VERSION = '1.2.5';
    3333
    3434    /**
     
    5858    private $default_options;
    5959
     60    private $alink_tap_title_text;
     61    private $alink_tap_special_chars;
     62
     63
    6064    /**
    6165     * Initialize the plugin by setting localization and loading public scripts
     
    6569     */
    6670    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' => ' &raquo;',  // 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            'á' => '&#225;',
     84            'Á' => '&#193;',
     85            'é' => '&#233;',
     86            'É' => '&#201;',
     87            'í' => '&#237;',
     88            'Í' => '&#205;',
     89            'ó' => '&#243;',
     90            'Ó' => '&#211;',
     91            'ú' => '&#250;',
     92            'Ú' => '&#218;',
     93            'ñ' => '&#241;',
     94            'Ñ' => '&#209;'
     95        );
    6796
    6897        // Load plugin text domain
     
    348377     */
    349378    public function execute_linker($content, $simple = false) {
    350         global $alink_tap_special_chars, $alink_tap_title_text, $post;
     379        global $post;
    351380        $pairs = $text = $plurals = $licencias = null;
    352381
     
    367396
    368397            // 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) {
    371400                    $content = str_replace($code, $char, $content);
    372401                }
     
    386415            foreach ($list_site_links as $house) {
    387416                $keyword = '';
    388                 if (isset($house['nombre']))
     417                if (isset($house) && in_array('nombre', $house) && isset($house['nombre'])){
    389418                    $keyword = $house['nombre'];
     419                }
    390420
    391421                // Compruebo si es un usuario de Spain. Si lo es, compruebo si la key es con licencia_esp, si no, paso al siguiente
    392422
    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;
    396427                } 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;
    398433                }
    399434
     
    406441//                }
    407442
    408                 if ($url == $currentUrl) { // don't link a page to itself
     443                if (!is_null($url) && strcmp($url, $currentUrl) === 0) { // don't link a page to itself
    409444                    $usedUrls[] = $url;
    410445                    continue;
     
    455490
    456491                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'] . '"';
    458493
    459494                // 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.