Plugin Directory

Changeset 2651894


Ignore:
Timestamp:
01/02/2022 07:41:36 PM (4 years ago)
Author:
marcusbs
Message:

PHP 8 Compatible

Location:
wp-mailing-group/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • wp-mailing-group/trunk/js/ColVis.js

    r2555398 r2651894  
    19871987     typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
    19881988
    1989      $.fn.dataTableExt.fnVersionCheck('2.0.1') )
     1989     $.fn.dataTableExt.fnVersionCheck('2.0.2') )
    19901990
    19911991{
  • wp-mailing-group/trunk/languages/mailing-group-module-en_US.po

    r2555398 r2651894  
    1010"Content-Transfer-Encoding: 8bit\n"
    1111"Language: en_US\n"
    12 "X-Generator: Poedit 2.0.1\n"
     12"X-Generator: Poedit 2.0.2\n"
    1313
    1414#: mg_mailinggrouplist.php:10 (this is a note line)
  • wp-mailing-group/trunk/languages/mailing-group-module-es_ES.po

    r2555398 r2651894  
    1717"Content-Transfer-Encoding: 8bit\n"
    1818"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    19 "X-Generator: Poedit 2.0.1\n"
     19"X-Generator: Poedit 2.0.2\n"
    2020"Language: es_ES\n"
    2121"X-Poedit-KeywordsList: _e;__\n"
  • wp-mailing-group/trunk/lib/vcard.php

    r1752047 r2651894  
    11<?php
    2 
    3 
    4 
    52/*
    6 
    73 * File:
    8 
    94 *      vcard.php
    10 
    11  *
    12 
     5 *
    136 * Project:
    14 
    157 *      vCard PHP <http://vcardphp.sourceforge.net>
    16 
    17  *
    18 
     8 *
    199 * Author:
    20 
    2110 *      Frank Hellwig <[email protected]>
    22 
    23  *
    24 
     11 *
    2512 * Usage:
    26 
    27  *      Use the following URL to display the help text:
    28 
    29  *
    30 
    31  *              http://host/path/vcard.php
    32 
     13 * Use the following URL to display the help text: *
     14 * http://host/path/vcard.php */
     15/**
     16 * The VCard class encapsulates a single vCard object by maintaining a map of
     17 * property names to one or more property values associated with that name.
     18 * A name is the unique property identifier such as N, ADR, and TEL.
    3319 */
    34 
    35 
     20class VCard {
     21    /**
     22     * An associative array where each key is the property name and each value
     23     * is a VCardProperty array of properties which share that property name.
     24     */
     25    var $_map;
     26    /**
     27     * Parses a vCard from one or more lines. Lines that are not property
     28     * lines, such as blank lines, are skipped. Returns false if there are
     29     * no more lines to be parsed.
     30     */
     31    function parse(&$lines) {
     32        $this->_map = null;
     33        $property = new VCardProperty();
     34        while ($property->parse($lines)) {
     35            if (is_null($this->_map)) {
     36                if ($property->name == 'BEGIN') {
     37                    $this->_map = array();
     38                }
     39            } else {
     40                if ($property->name == 'END') {
     41                    break;
     42                } else {
     43                    $this->_map[$property->name][] = $property;
     44                }
     45            }
     46            // MDH: Create new property to prevent overwriting previous one
     47            // (PHP5)
     48            $property = new VCardProperty();
     49        }
     50        return $this->_map != null;
     51    }
     52    /**
     53     * Returns the first property mapped to the specified name or null if
     54     * there are no properties with that name.
     55     */
     56    function getProperty($name) {
     57        return $this->_map[$name][0];
     58    }
     59    /**
     60     * Returns the properties mapped to the specified name or null if
     61     * there are no properties with that name.
     62     */
     63    function getProperties($name) {
     64        return $this->_map[$name];
     65    }
     66    /**
     67     * Returns an array of categories for this card or a one-element array with
     68     * the value 'Unfiled' if no CATEGORIES property is found.
     69     */
     70    function getCategories() {
     71        $property = $this->getProperty('CATEGORIES');
     72        /*  The Mac OS X Address Book application uses the CATEGORY property instead of the CATEGORIES property. */
     73        if (!$property) {
     74            $property = $this->getProperty('CATEGORY');
     75        }
     76        if ($property) {
     77            $result = $property->getComponents(',');
     78        } else {
     79            $result = array('Unfiled');
     80        }
     81        $result[] = "All"; /*  Each card is always a member of "All" */
     82        return $result;
     83    }
     84    /**
     85     * Returns true if the card belongs to at least one of the categories.
     86     */
     87    function inCategories(&$categories) {
     88        $our_categories = $this->getCategories();
     89        foreach ($categories as $category) {
     90            if (in_array_case($category, $our_categories)) {
     91                return true;
     92            }
     93        }
     94        return false;
     95    }
     96}
     97/**
     98 * The VCardProperty class encapsulates a single vCard property consisting
     99 * of a name, zero or more parameters, and a value.
     100 *
     101 * The parameters are stored as an associative array where each key is the
     102 * parameter name and each value is an array of parameter values.
     103 */
     104class VCardProperty {
     105    var $name; // string
     106    var $params; // params[PARAM_NAME] => value[,value...]
     107    var $value; // string
     108   
     109    /**
     110     * Parses a vCard property from one or more lines. Lines that are not
     111     * property lines, such as blank lines, are skipped. Returns false if
     112     * there are no more lines to be parsed.
     113     */
     114    function parse(&$lines) {
     115        while (list(, $line) = each($lines)) {
     116            $line = rtrim($line);
     117            $tmp = split_quoted_string(":", $line, 2);
     118            if (count($tmp) == 2) {
     119                $this->value = $tmp[1];
     120                $tmp = strtoupper($tmp[0]);
     121                $tmp = split_quoted_string(";", $tmp);
     122                $this->name = $tmp[0];
     123                $this->params = array();
     124                for ($i = 1;$i < count($tmp);$i++) {
     125                    $this->_parseParam($tmp[$i]);
     126                }
     127                if ($this->params['ENCODING'][0] == 'QUOTED-PRINTABLE') {
     128                    $this->_decodeQuotedPrintable($lines);
     129                }
     130                if ($this->params['CHARSET'][0] == 'UTF-8') {
     131                    $this->value = utf8_decode($this->value);
     132                }
     133                return true;
     134            }
     135        }
     136        return false;
     137    }
     138    /**
     139     * Splits the value on unescaped delimiter characters.
     140     */
     141    function getComponents($delim = ";") {
     142        $value = $this->value;
     143        // Save escaped delimiters.
     144        $value = str_replace("\\$delim", "\x00", $value);
     145        // Tag unescaped delimiters.
     146        $value = str_replace("$delim", "\x01", $value);
     147        // Restore the escaped delimiters.
     148        $value = str_replace("\x00", "$delim", $value);
     149        // Split the line on the delimiter tag.
     150        return explode("\x01", $value);
     151    }
     152    // ----- Private methods -----
     153   
     154    /**
     155     * Parses a parameter string where the parameter string is either in the
     156     * form "name=value[,value...]" such as "TYPE=WORK,CELL" or is a
     157     * vCard 2.1 parameter value such as "WORK" in which case the parameter
     158     * name is determined from the parameter value.
     159     */
     160    function _parseParam($param) {
     161        $tmp = split_quoted_string('=', $param, 2);
     162        if (count($tmp) == 1) {
     163            $value = $tmp[0];
     164            $name = $this->_paramName($value);
     165            $this->params[$name][] = $value;
     166        } else {
     167            $name = $tmp[0];
     168            $values = split_quoted_string(',', $tmp[1]);
     169            foreach ($values as $value) {
     170                $this->params[$name][] = $value;
     171            }
     172        }
     173    }
     174    /**
     175     * The vCard 2.1 specification allows parameter values without a name.
     176     * The parameter name is then determined from the unique parameter value.
     177     */
     178    function _paramName($value) {
     179        static $types = array('DOM', 'INTL', 'POSTAL', 'PARCEL', 'HOME', 'WORK', 'PREF', 'VOICE', 'FAX', 'MSG', 'CELL', 'PAGER', 'BBS', 'MODEM', 'CAR', 'ISDN', 'VIDEO', 'AOL', 'APPLELINK', 'ATTMAIL', 'CIS', 'EWORLD', 'INTERNET', 'IBMMAIL', 'MCIMAIL', 'POWERSHARE', 'PRODIGY', 'TLX', 'X400', 'GIF', 'CGM', 'WMF', 'BMP', 'MET', 'PMB', 'DIB', 'PICT', 'TIFF', 'PDF', 'PS', 'JPEG', 'QTIME', 'MPEG', 'MPEG2', 'AVI', 'WAVE', 'AIFF', 'PCM', 'X509', 'PGP');
     180        static $values = array('INLINE', 'URL', 'CID');
     181        static $encodings = array('7BIT', 'QUOTED-PRINTABLE', 'BASE64');
     182        $name = 'UNKNOWN';
     183        if (in_array($value, $types)) {
     184            $name = 'TYPE';
     185        } elseif (in_array($value, $values)) {
     186            $name = 'VALUE';
     187        } elseif (in_array($value, $encodings)) {
     188            $name = 'ENCODING';
     189        }
     190        return $name;
     191    }
     192    /**
     193     * Decodes a quoted printable value spanning multiple lines.
     194     */
     195    function _decodeQuotedPrintable(&$lines) {
     196        $value = & $this->value;
     197        while ($value[strlen($value) - 1] == "=") {
     198            $value = substr($value, 0, strlen($value) - 1);
     199            if (!(list(, $line) = each($lines))) {
     200                break;
     201            }
     202            $value.= rtrim($line);
     203        }
     204        $value = quoted_printable_decode($value);
     205    }
     206}
     207// ----- Utility Functions -----
    36208
    37209/**
    38 
    39  * The VCard class encapsulates a single vCard object by maintaining a map of
    40 
    41  * property names to one or more property values associated with that name.
    42 
    43  * A name is the unique property identifier such as N, ADR, and TEL.
    44 
     210 * Splits a string. Similar to the split function but uses a single character
     211 * delimiter and ignores delimiters in double quotes.
    45212 */
    46 
    47 class VCard
    48 
    49 {
    50 
    51     /**
    52 
    53      * An associative array where each key is the property name and each value
    54 
    55      * is a VCardProperty array of properties which share that property name.
    56 
    57      */
    58 
    59     var $_map;
    60 
    61 
    62 
    63     /**
    64 
    65      * Parses a vCard from one or more lines. Lines that are not property
    66 
    67      * lines, such as blank lines, are skipped. Returns false if there are
    68 
    69      * no more lines to be parsed.
    70 
    71      */
    72 
    73     function parse(&$lines)
    74 
    75     {
    76 
    77         $this->_map = null;
    78 
    79         $property = new VCardProperty();
    80 
    81         while ($property->parse($lines)) {
    82 
    83             if (is_null($this->_map)) {
    84 
    85                 if ($property->name == 'BEGIN') {
    86 
    87                     $this->_map = array();
    88 
    89                 }
    90 
    91             } else {
    92 
    93                 if ($property->name == 'END') {
    94 
    95                     break;
    96 
    97                 } else {
    98 
    99                     $this->_map[$property->name][] = $property;
    100 
    101                 }
    102 
    103             }
    104 
    105             // MDH: Create new property to prevent overwriting previous one
    106 
    107             // (PHP5)
    108 
    109             $property = new VCardProperty();
    110 
    111         }
    112 
    113         return $this->_map != null;
    114 
    115     }
    116 
    117 
    118 
    119     /**
    120 
    121      * Returns the first property mapped to the specified name or null if
    122 
    123      * there are no properties with that name.
    124 
    125      */
    126 
    127     function getProperty($name)
    128 
    129     {
    130 
    131         return $this->_map[$name][0];
    132 
    133     }
    134 
    135 
    136 
    137     /**
    138 
    139      * Returns the properties mapped to the specified name or null if
    140 
    141      * there are no properties with that name.
    142 
    143      */
    144 
    145     function getProperties($name)
    146 
    147     {
    148 
    149         return $this->_map[$name];
    150 
    151     }
    152 
    153 
    154 
    155     /**
    156 
    157      * Returns an array of categories for this card or a one-element array with
    158 
    159      * the value 'Unfiled' if no CATEGORIES property is found.
    160 
    161      */
    162 
    163     function getCategories()
    164 
    165     {
    166 
    167         $property = $this->getProperty('CATEGORIES');
    168 
    169         /*  The Mac OS X Address Book application uses the CATEGORY property
    170 
    171          instead of the CATEGORIES property. */
    172 
    173         if (!$property) {
    174 
    175             $property = $this->getProperty('CATEGORY');
    176 
    177         }
    178 
    179         if ($property) {
    180 
    181             $result = $property->getComponents(',');
    182 
    183         } else {
    184 
    185             $result = array('Unfiled');
    186 
    187         }
    188 
    189         $result[] = "All";      /*  Each card is always a member of "All" */
    190 
    191         return $result;
    192 
    193     }
    194 
    195 
    196 
    197     /**
    198 
    199      * Returns true if the card belongs to at least one of the categories.
    200 
    201      */
    202 
    203     function inCategories(&$categories)
    204 
    205     {
    206 
    207         $our_categories = $this->getCategories();
    208 
    209         foreach ($categories as $category) {
    210 
    211             if (in_array_case($category, $our_categories)) {
    212 
    213                 return true;
    214 
    215             }
    216 
    217         }
    218 
    219         return false;
    220 
    221     }
    222 
     213function split_quoted_string($d, $s, $n = 0) {
     214    $quote = false;
     215    $len = strlen($s);
     216    for ($i = 0;$i < $len && ($n == 0 || $n > 1);$i++) {
     217        $c = $s[$i]; # $c = $s{$i};
     218        if ($c == '"') {
     219            $quote = !$quote;
     220        } else if (!$quote && $c == $d) {
     221            $s[$i] = "\x00"; # $s{$i} = "\x00";
     222            if ($n > 0) {
     223                $n--;
     224            }
     225        }
     226    }
     227    return explode("\x00", $s);
    223228}
    224 
    225 
    226 
    227 /**
    228 
    229  * The VCardProperty class encapsulates a single vCard property consisting
    230 
    231  * of a name, zero or more parameters, and a value.
    232 
    233  *
    234 
    235  * The parameters are stored as an associative array where each key is the
    236 
    237  * parameter name and each value is an array of parameter values.
    238 
    239  */
    240 
    241 class VCardProperty
    242 
    243 {
    244 
    245     var $name;          // string
    246 
    247     var $params;        // params[PARAM_NAME] => value[,value...]
    248 
    249     var $value;         // string
    250 
    251 
    252 
    253     /**
    254 
    255      * Parses a vCard property from one or more lines. Lines that are not
    256 
    257      * property lines, such as blank lines, are skipped. Returns false if
    258 
    259      * there are no more lines to be parsed.
    260 
    261      */
    262 
    263     function parse(&$lines)
    264 
    265     {
    266 
    267         while (list(, $line) = each($lines)) {
    268 
    269             $line = rtrim($line);
    270 
    271             $tmp = split_quoted_string(":", $line, 2);
    272 
    273             if (count($tmp) == 2) {
    274 
    275                 $this->value = $tmp[1];
    276 
    277                 $tmp = strtoupper($tmp[0]);
    278 
    279                 $tmp = split_quoted_string(";", $tmp);
    280 
    281                 $this->name = $tmp[0];
    282 
    283                 $this->params = array();
    284 
    285                 for ($i = 1; $i < count($tmp); $i++) {
    286 
    287                     $this->_parseParam($tmp[$i]);
    288 
    289                 }
    290 
    291                 if ($this->params['ENCODING'][0] == 'QUOTED-PRINTABLE') {
    292 
    293                     $this->_decodeQuotedPrintable($lines);
    294 
    295                 }
    296 
    297                 if ($this->params['CHARSET'][0] == 'UTF-8') {
    298 
    299                     $this->value = utf8_decode($this->value);
    300 
    301                 }
    302 
    303                 return true;
    304 
    305             }
    306 
    307         }
    308 
    309         return false;
    310 
    311     }
    312 
    313 
    314 
    315     /**
    316 
    317      * Splits the value on unescaped delimiter characters.
    318 
    319      */
    320 
    321     function getComponents($delim = ";")
    322 
    323     {
    324 
    325         $value = $this->value;
    326 
    327         // Save escaped delimiters.
    328 
    329         $value = str_replace("\\$delim", "\x00", $value);
    330 
    331         // Tag unescaped delimiters.
    332 
    333         $value = str_replace("$delim", "\x01", $value);
    334 
    335         // Restore the escaped delimiters.
    336 
    337         $value = str_replace("\x00", "$delim", $value);
    338 
    339         // Split the line on the delimiter tag.
    340 
    341         return explode("\x01", $value);
    342 
    343     }
    344 
    345 
    346 
    347     // ----- Private methods -----
    348 
    349 
    350 
    351     /**
    352 
    353      * Parses a parameter string where the parameter string is either in the
    354 
    355      * form "name=value[,value...]" such as "TYPE=WORK,CELL" or is a
    356 
    357      * vCard 2.1 parameter value such as "WORK" in which case the parameter
    358 
    359      * name is determined from the parameter value.
    360 
    361      */
    362 
    363     function _parseParam($param)
    364 
    365     {
    366 
    367         $tmp = split_quoted_string('=', $param, 2);
    368 
    369         if (count($tmp) == 1) {
    370 
    371             $value = $tmp[0];
    372 
    373             $name = $this->_paramName($value);
    374 
    375             $this->params[$name][] = $value;
    376 
    377         } else {
    378 
    379             $name = $tmp[0];
    380 
    381             $values = split_quoted_string(',', $tmp[1]);
    382 
    383             foreach ($values as $value) {
    384 
    385                 $this->params[$name][] = $value;
    386 
    387             }
    388 
    389         }
    390 
    391     }
    392 
    393 
    394 
    395     /**
    396 
    397      * The vCard 2.1 specification allows parameter values without a name.
    398 
    399      * The parameter name is then determined from the unique parameter value.
    400 
    401      */
    402 
    403     function _paramName($value)
    404 
    405     {
    406 
    407         static $types = array (
    408 
    409                 'DOM', 'INTL', 'POSTAL', 'PARCEL','HOME', 'WORK',
    410 
    411                 'PREF', 'VOICE', 'FAX', 'MSG', 'CELL', 'PAGER',
    412 
    413                 'BBS', 'MODEM', 'CAR', 'ISDN', 'VIDEO',
    414 
    415                 'AOL', 'APPLELINK', 'ATTMAIL', 'CIS', 'EWORLD',
    416 
    417                 'INTERNET', 'IBMMAIL', 'MCIMAIL',
    418 
    419                 'POWERSHARE', 'PRODIGY', 'TLX', 'X400',
    420 
    421                 'GIF', 'CGM', 'WMF', 'BMP', 'MET', 'PMB', 'DIB',
    422 
    423                 'PICT', 'TIFF', 'PDF', 'PS', 'JPEG', 'QTIME',
    424 
    425                 'MPEG', 'MPEG2', 'AVI',
    426 
    427                 'WAVE', 'AIFF', 'PCM',
    428 
    429                 'X509', 'PGP');
    430 
    431         static $values = array (
    432 
    433                 'INLINE', 'URL', 'CID');
    434 
    435         static $encodings = array (
    436 
    437                 '7BIT', 'QUOTED-PRINTABLE', 'BASE64');
    438 
    439         $name = 'UNKNOWN';
    440 
    441         if (in_array($value, $types)) {
    442 
    443             $name = 'TYPE';
    444 
    445         } elseif (in_array($value, $values)) {
    446 
    447             $name = 'VALUE';
    448 
    449         } elseif (in_array($value, $encodings)) {
    450 
    451             $name = 'ENCODING';
    452 
    453         }
    454 
    455         return $name;
    456 
    457     }
    458 
    459 
    460 
    461     /**
    462 
    463      * Decodes a quoted printable value spanning multiple lines.
    464 
    465      */
    466 
    467     function _decodeQuotedPrintable(&$lines)
    468 
    469     {
    470 
    471         $value = &$this->value;
    472 
    473         while ($value[strlen($value) - 1] == "=") {
    474 
    475             $value = substr($value, 0, strlen($value) - 1);
    476 
    477             if (!(list(, $line) = each($lines))) {
    478 
    479                 break;
    480 
    481             }
    482 
    483             $value .= rtrim($line);
    484 
    485         }
    486 
    487         $value = quoted_printable_decode($value);
    488 
    489     }
    490 
    491 }
    492 
    493 
    494 
    495 // ----- Utility Functions -----
    496 
    497 
    498 
    499 /**
    500 
    501  * Splits a string. Similar to the split function but uses a single character
    502 
    503  * delimiter and ignores delimiters in double quotes.
    504 
    505  */
    506 
    507 function split_quoted_string($d, $s, $n = 0)
    508 
    509 {
    510 
    511     $quote = false;
    512 
    513     $len = strlen($s);
    514 
    515     for ($i = 0; $i < $len && ($n == 0 || $n > 1); $i++) {
    516 
    517         $c = $s{$i};
    518 
    519         if ($c == '"') {
    520 
    521             $quote = !$quote;
    522 
    523         } else if (!$quote && $c == $d) {
    524 
    525             $s{$i} = "\x00";
    526 
    527             if ($n > 0) {
    528 
    529                 $n--;
    530 
    531             }
    532 
    533         }
    534 
    535     }
    536 
    537     return explode("\x00", $s);
    538 
    539 }
    540 
    541 
    542 
    543229?>
    544 
  • wp-mailing-group/trunk/mailing-group-module.php

    r2645764 r2651894  
    11<?php /**
    22* @package Mailing_group_module
    3 * @version 2.0.1
     3* @version 2.0.2
    44*/
    55/*
     
    99Author: Yamna Tatheer
    1010Author URI: https://www.wpmailinggroup.com/
    11 Version: 2.0.1
     11Version: 2.0.2
    1212*/
    1313if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
     
    3737
    3838$WPMG_SETTINGS = get_option("WPMG_SETTINGS");
    39 $MG_VERSION_NO = '2.0.1';
     39$MG_VERSION_NO = '2.0.2';
    4040$WPMG_SETTINGS['MG_VERSION_NO']  = $MG_VERSION_NO;
    4141$WPMG_SETTINGS['MG_PLUGIN_TYPE'] = 'FREE';
  • wp-mailing-group/trunk/readme.txt

    r2621964 r2651894  
    33Donate link: https://www.wpmailinggroup.com
    44Tags: listserv, mailing group, listserve, email discussion, mailing list
    5 Requires at least: 3.0.1
    6 Tested up to: 5.8.1
     5Requires at least: 3.0.3
     6Tested up to: 5.8.2
    77Requires PHP: 5.2.4
    8 Stable tag: 2.0.1
     8Tested up to PHP: 8.0
     9Stable tag: 2.0.2
    910License: GPLv2 or later
    1011License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    132133== Changelog ==
    133134
     135=2.0.2 =
     136
     137*Compatible to PHP 8.
     138
    134139= 2.0.1 =
    135140* Tested with Wordpress 5.6.
Note: See TracChangeset for help on using the changeset viewer.