Plugin Directory

Changeset 952981


Ignore:
Timestamp:
07/22/2014 06:29:37 PM (12 years ago)
Author:
grglaz
Message:

version 1.8.0

Location:
modal-links
Files:
106 added
6 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • modal-links/trunk/admin/modal-links-admin.php

    r947849 r952981  
    2424define('MODALLINKSADMIN', 'Modal Links Admin');
    2525
     26require_once 'modal-links-fields.php';
    2627require_once 'modal-links-sections.php';
    2728require_once 'modal-links-settings.php';
     29require_once 'maintenance/modal-links-maintenance.php';
     30require_once 'validation/modal-links-validation.php';
    2831
    2932if (class_exists('ModalLinksAdmin') === false) {
     
    157160                            }
    158161                        }//end if
     162                        unset($shortcodes);
    159163                    }//end foreach
    160164                }//end if
  • modal-links/trunk/admin/modal-links-settings.php

    r947849 r952981  
    1818 */
    1919
    20 if (defined('MODALLINKS') === false) {
     20if (defined('MODALLINKSADMIN') === false) {
    2121    exit;
    2222}
     23
     24//require_once 'modal-links-fields.php';
    2325
    2426if (class_exists('ModalLinksSettings') === false) {
     
    3537    class ModalLinksSettings
    3638    {
    37         private $_modalTFOptions        = array(
    38                                            'true',
    39                                            'false',
    40                                           );
    41         private $_modalWidth            = '';
    42         private $_modalWidthType        = '';
    43         private $_responsiveWidth       = '';
    44         private $_modalHeight           = '';
    45         private $_modalHeightType       = '';
    46         private $_modalMaxHeight        = '';
    47         private $_modalMaxHeightType    = '';
    48         private $_modalResponsiveHeight = '';
    49         private $_modalDraggable        = '';
    50         private $_modalResizable        = '';
    51         private $_modalTitle            = '';
    52         private $_modalDate             = '';
    53         private $_modalAuthor           = '';
    54         private $_modalShow          = '';
    55         private $_modalHide          = '';
    56         private $_modalType          = '';
    57         private $_modalCloseIcon     = '';
    58         private $_modalCloseEsc      = '';
    59         private $_loadingGif         = '';
    60         private $_modalClass         = '';
    61         private $_modalPosition      = '';
    62         private $_responsivePosition = '';
    63         private $_metaWidget         = '';
    64         private $_readMore           = '';
     39
     40
     41        private $_modalLinksFields;
     42        private $_modalLinksOptions;
    6543
    6644
     
    7250            add_action('admin_init', array($this, 'settings'));
    7351
    74             $this->_modalWidth            = get_option('modalLinksModalWidth');
    75             $this->_modalWidthType        = get_option('modalLinksModalWidthType');
    76             $this->_responsiveWidth       = get_option('modalLinksModalResponsiveWidth');
    77             $this->_modalHeight           = get_option('modalLinksModalHeight');
    78             $this->_modalHeightType       = get_option('modalLinksModalHeightType');
    79             $this->_modalMaxHeight        = get_option('modalLinksModalMaxHeight');
    80             $this->_modalMaxHeightType    = get_option('modalLinksModalMaxHeightType');
    81             $this->_modalResponsiveHeight = get_option('modalLinksModalResponsiveHeight');
    82             $this->_modalDraggable        = get_option('modalLinksModalDraggable');
    83             $this->_modalResizable        = get_option('modalLinksModalResizable');
    84             $this->_modalTitle            = get_option('modalLinksModalTitle');
    85             $this->_modalDate             = get_option('modalLinksModalDate');
    86             $this->_modalAuthor           = get_option('modalLinksModalAuthor');
    87             $this->_modalShow          = get_option('modalLinksModalShow');
    88             $this->_modalHide          = get_option('modalLinksModalHide');
    89             $this->_modalType          = get_option('modalLinksModalType');
    90             $this->_modalCloseIcon     = get_option('modalLinksModalCloseIcon');
    91             $this->_modalCloseEsc      = get_option('modalLinksModalCloseEsc');
    92             $this->_loadingGif         = get_option('modalLinksModalLoadingGif');
    93             $this->_modalClass         = get_option('modalLinksModalClass');
    94             $this->_modalPosition      = get_option('modalLinksModalPosition');
    95             $this->_responsivePosition = get_option('modalLinksModalResponsivePosition');
    96             $this->_metaWidget         = get_option('modalLinksMetaWidget');
    97             $this->_readMore           = get_option('modalLinksReadMore');
     52            $this->_modalLinksFields = new ModalLinksFields();
    9853
    9954        }//end __construct()
     55
    10056
    10157        /**
     
    10662        public function settings()
    10763        {
    108             $options = array(
    109                         array(
    110                          'Width',
    111                          'modalWidth',
    112                          'settingsSection',
    113                          'modalLinksModalWidth',
    114                          '',
    115                         ),
    116                         array(
    117                          'Width Type',
    118                          'modalWidthType',
    119                          'settingsSection',
    120                          'modalLinksModalWidthType',
    121                          '',
    122                         ),
    123                         array(
    124                          'Responsive Width',
    125                          'modalResponsiveWidth',
    126                          'settingsSection',
    127                          'modalLinksModalResponsiveWidth',
    128                          '',
    129                         ),
    130                         array(
    131                          'Height',
    132                          'modalHeight',
    133                          'settingsSection',
    134                          'modalLinksModalHeight',
    135                          '',
    136                         ),
    137                         array(
    138                          'Height Type',
    139                          'modalHeightType',
    140                          'settingsSection',
    141                          'modalLinksModalHeightType',
    142                          '',
    143                         ),
    144                         array(
    145                          'Max Height',
    146                          'modalMaxHeight',
    147                          'settingsSection',
    148                          'modalLinksModalMaxHeight',
    149                          '',
    150                         ),
    151                         array(
    152                          'Max Height Type',
    153                          'modalMaxHeightType',
    154                          'settingsSection',
    155                          'modalLinksModalMaxHeightType',
    156                          '',
    157                         ),
    158                         array(
    159                          'Responsive Height',
    160                          'modalResponsiveHeight',
    161                          'settingsSection',
    162                          'modalLinksModalResponsiveHeight',
    163                          '',
    164                         ),
    165                         array(
    166                          'Draggable',
    167                          'modalDraggable',
    168                          'settingsSection',
    169                          'modalLinksModalDraggable',
    170                          '',
    171                         ),
    172                         array(
    173                          'Resizable',
    174                          'modalResizable',
    175                          'settingsSection',
    176                          'modalLinksModalResizable',
    177                          '',
    178                         ),
    179                         array(
    180                          'Show Title',
    181                          'modalTitle',
    182                          'settingsSection',
    183                          'modalLinksModalTitle',
    184                          '',
    185                         ),
    186                         array(
    187                          'Show Date',
    188                          'modalDate',
    189                          'settingsSection',
    190                          'modalLinksModalDate',
    191                          '',
    192                         ),
    193                         array(
    194                          'Show Author',
    195                          'modalAuthor',
    196                          'settingsSection',
    197                          'modalLinksModalAuthor',
    198                          '',
    199                         ),
    200                         array(
    201                          'Animate on Show',
    202                          'modalShow',
    203                          'settingsSection',
    204                          'modalLinksModalShow',
    205                          '',
    206                         ),
    207                         array(
    208                          'Animate on Hide',
    209                          'modalHide',
    210                          'settingsSection',
    211                          'modalLinksModalHide',
    212                          '',
    213                         ),
    214                         array(
    215                          'Dialog is Modal',
    216                          'modalType',
    217                          'settingsSection',
    218                          'modalLinksModalType',
    219                          '',
    220                         ),
    221                         array(
    222                          'Close Icon',
    223                          'modalCloseIcon',
    224                          'settingsSection',
    225                          'modalLinksModalCloseIcon',
    226                          '',
    227                         ),
    228                         array(
    229                          'Close on Escape',
    230                          'modalCloseEsc',
    231                          'settingsSection',
    232                          'modalLinksModalCloseEsc',
    233                          '',
    234                         ),
    235                         array(
    236                          'Loading Image',
    237                          'modalLoadingGif',
    238                          'settingsSection',
    239                          'modalLinksModalLoadingGif',
    240                          '',
    241                         ),
    242                         array(
    243                          'CSS Class',
    244                          'modalClass',
    245                          'settingsSection',
    246                          'modalLinksModalClass',
    247                          '',
    248                         ),
    249                         array(
    250                          'Position',
    251                          'modalPosition',
    252                          'settingsSection',
    253                          'modalLinksModalPosition',
    254                          '',
    255                         ),
    256                         array(
    257                          'Responsive Position',
    258                          'modalResponsivePosition',
    259                          'settingsSection',
    260                          'modalLinksModalResponsivePosition',
    261                          '',
    262                         ),
    263                         array(
    264                          'Meta Widget Links',
    265                          'metaWidget',
    266                          'extraSettingsSection',
    267                          'modalLinksMetaWidget',
    268                          '',
    269                         ),
    270                         array(
    271                          'Read More Links',
    272                          'readMore',
    273                          'extraSettingsSection',
    274                          'modalLinksReadMore',
    275                          '',
    276                         ),
    277                        );
     64            $fields = $this->_modalLinksFields->returnFields();
    27865
    279             foreach ($options as $option) {
     66            foreach ($fields as $field) {
    28067                add_settings_field(
    281                     $option[1],
    282                     __($option[0], 'modal_links'),
    283                     array(
    284                      $this,
    285                      $option[1].'Callback',
    286                     ),
     68                    $field['code'],
     69                    __($field['title'], 'modal_links'),
     70                    $field['function'],
    28771                    'modal_links',
    288                     $option[2],
    289                     array('label_for' => $option[1])
     72                    $field['section'],
     73                    array('label_for' => $field['code'])
    29074                );
    291                 register_setting('modal_links', $option[3], $option[4]);
     75                register_setting('modal_links', $field['code'], $field['validation']);
    29276            }
    29377
     
    29579
    29680
    297         /**
    298          * Add the settings width field callback.
    299          *
    300          * @return width settings
    301          */
    302         public function modalWidthCallback()
    303         {
    304             $this->echoInput(
    305                 'modalLinksModalWidth',
    306                 'modalWidth',
    307                 $this->_modalWidth,
    308                 'leave it empty or \'0\' for \'auto\''
    309             );
    310 
    311         }//end modalWidthCallback()
    312 
    313 
    314         /**
    315          * Add the settings width type field callback.
    316          *
    317          * @return width type settings
    318          */
    319         public function modalWidthTypeCallback()
    320         {
    321             echo '<select name="modalLinksModalWidthType"
    322             id="modalWidthType" title="'.
    323             __('fixed = px, fluid = %', 'modal_links').
    324             '">';
    325 
    326             if ($this->_modalWidthType === 'px') {
    327                 echo '<option value="px" selected="selected">'.
    328                 __('fixed', 'modalLinks').
    329                 '</option>';
    330             } else {
    331                 echo '<option value="px">'.__('fixed', 'modalLinks').'</option>';
    332             }
    333 
    334             if ($this->_modalWidthType === '%') {
    335                 echo '<option value="%" selected="selected">'.
    336                 __('fluid', 'modalLinks').
    337                 '</option>';
    338             } else {
    339                 echo '<option value="%">'.__('fluid', 'modalLinks').'</option>';
    340             }
    341 
    342             echo '</select>';
    343 
    344         }//end modalWidthTypeCallback()
    345 
    346 
    347         /**
    348          * Add the settings responsive width field callback.
    349          *
    350          * @return responsive width settings
    351          */
    352         public function modalResponsiveWidthCallback()
    353         {
    354             $this->echoSelect(
    355                 'modalLinksModalResponsiveWidth',
    356                 'modalResponsiveWidth',
    357                 $this->_modalTFOptions,
    358                 $this->_responsiveWidth,
    359                 'will work only for fluid width type'
    360             );
    361 
    362         }//end modalResponsiveWidthCallback()
    363 
    364 
    365         /**
    366          * Add the settings height field callback.
    367          *
    368          * @return height settings
    369          */
    370         public function modalHeightCallback()
    371         {
    372             $this->echoInput(
    373                 'modalLinksModalHeight',
    374                 'modalHeight',
    375                 $this->_modalHeight,
    376                 'leave it empty or \'0\' for \'auto\'. NOTICE! The actual
    377                 height may be a bit different because of jQuery\'s calculations'
    378             );
    379 
    380         }//end modalHeightCallback()
    381 
    382 
    383         /**
    384          * Add the settings height type field callback.
    385          *
    386          * @return height type settings
    387          */
    388         public function modalHeightTypeCallback()
    389         {
    390             echo '<select name="modalLinksModalHeightType"
    391             id="modalHeightType" title="'.
    392             __('fixed = px, fluid = %', 'modal_links').
    393             '">';
    394 
    395             if ($this->_modalHeightType === 'px') {
    396                 echo '<option value="px" selected="selected">'.
    397                 __('fixed', 'modalLinks').
    398                 '</option>';
    399             } else {
    400                 echo '<option value="px">'.__('fixed', 'modalLinks').'</option>';
    401             }
    402 
    403             if ($this->_modalHeightType === '%') {
    404                 echo '<option value="%" selected="selected">'.
    405                 __('fluid', 'modalLinks').
    406                 '</option>';
    407             } else {
    408                 echo '<option value="%">'.__('fluid', 'modalLinks').'</option>';
    409             }
    410 
    411             echo '</select>';
    412 
    413         }//end modalHeightTypeCallback()
    414 
    415 
    416         /**
    417          * Add the settings max height field callback.
    418          *
    419          * @return max height settings
    420          */
    421         public function modalMaxHeightCallback()
    422         {
    423             $this->echoInput(
    424                 'modalLinksModalMaxHeight',
    425                 'modalMaxHeight',
    426                 $this->_modalMaxHeight,
    427                 'leave it empty or \'0\' for \'auto\'. NOTICE! The actual
    428                 height may be a bit different because of jQuery\'s calculations'
    429             );
    430 
    431         }//end modalMaxHeightCallback()
    432 
    433 
    434         /**
    435          * Add the settings max height type field callback.
    436          *
    437          * @return max height type settings
    438          */
    439         public function modalMaxHeightTypeCallback()
    440         {
    441             echo '<select name="modalLinksModalMaxHeightType"
    442             id="modalMaxHeightType" title="'.
    443             __('fixed = px, fluid = %', 'modal_links').
    444             '">';
    445             if ($this->_modalMaxHeightType === 'px') {
    446                 echo '<option value="px" selected="selected">'.
    447                 __('fixed', 'modalLinks').
    448                 '</option>';
    449             } else {
    450                 echo '<option value="px">'.__('fixed', 'modalLinks').'</option>';
    451             }
    452             if ($this->_modalMaxHeightType === '%') {
    453                 echo '<option value="%" selected="selected">'.
    454                 __('fluid', 'modalLinks').
    455                 '</option>';
    456             } else {
    457                 echo '<option value="%">'.__('fluid', 'modalLinks').'</option>';
    458             }
    459             echo '</select>';
    460 
    461         }//end modalMaxHeightTypeCallback()
    462 
    463 
    464         /**
    465          * Add the settings responsive height field callback.
    466          *
    467          * @return responsive height settings
    468          */
    469         public function modalResponsiveHeightCallback()
    470         {
    471             $this->echoSelect(
    472                 'modalLinksModalResponsiveHeight',
    473                 'modalResponsiveHeight',
    474                 $this->_modalTFOptions,
    475                 $this->_modalResponsiveHeight,
    476                 'will work only for fluid width type'
    477             );
    478 
    479         }//end modalResponsiveHeightCallback()
    480 
    481 
    482         /**
    483          * Add the settings draggable field callback.
    484          *
    485          * @return draggable settings
    486          */
    487         public function modalDraggableCallback()
    488         {
    489             $this->echoSelect(
    490                 'modalLinksModalDraggable',
    491                 'modalDraggable',
    492                 $this->_modalTFOptions,
    493                 $this->_modalDraggable,
    494                 ''
    495             );
    496 
    497         }//end modalDraggableCallback()
    498 
    499 
    500         /**
    501          * Add the settings resizable field callback.
    502          *
    503          * @return resizable settings
    504          */
    505         public function modalResizableCallback()
    506         {
    507             $this->echoSelect(
    508                 'modalLinksModalResizable',
    509                 'modalResizable',
    510                 $this->_modalTFOptions,
    511                 $this->_modalResizable,
    512                 ''
    513             );
    514 
    515         }//end modalResizableCallback()
    516 
    517 
    518         /**
    519          * Add the settings title field callback.
    520          *
    521          * @return title settings
    522          */
    523         public function modalTitleCallback()
    524         {
    525             $modalTitleOptions = array(
    526                                   'default',
    527                                   'true',
    528                                   'false',
    529                                  );
    530 
    531             $this->echoSelect(
    532                 'modalLinksModalTitle',
    533                 'modalTitle',
    534                 $modalTitleOptions,
    535                 $this->_modalTitle,
    536                 ''
    537             );
    538 
    539         }//end modalTitleCallback()
    540 
    541 
    542         /**
    543          * Add the settings date field callback.
    544          *
    545          * @return date settings
    546          */
    547         public function modalDateCallback()
    548         {
    549             $this->echoSelect(
    550                 'modalLinksModalDate',
    551                 'modalDate',
    552                 $this->_modalTFOptions,
    553                 $this->_modalDate,
    554                 ''
    555             );
    556 
    557         }//end modalDateCallback()
    558 
    559 
    560         /**
    561          * Add the settings author field callback.
    562          *
    563          * @return author settings
    564          */
    565         public function modalAuthorCallback()
    566         {
    567             $this->echoSelect(
    568                 'modalLinksModalAuthor',
    569                 'modalAuthor',
    570                 $this->_modalTFOptions,
    571                 $this->_modalAuthor,
    572                 ''
    573             );
    574 
    575         }//end modalAuthorCallback()
    576 
    577 
    578         /**
    579          * Add the settings animate show field callback.
    580          *
    581          * @return show settings
    582          */
    583         public function modalShowCallback()
    584         {
    585             $this->echoSelect(
    586                 'modalLinksModalShow',
    587                 'modalmodalShowTitle',
    588                 $this->_modalTFOptions,
    589                 $this->_modalShow,
    590                 ''
    591             );
    592 
    593         }//end modalShowCallback()
    594 
    595 
    596         /**
    597          * Add the settings animate hide field callback.
    598          *
    599          * @return animate hide settings
    600          */
    601         public function modalHideCallback()
    602         {
    603             $this->echoSelect(
    604                 'modalLinksModalHide',
    605                 'modalHide',
    606                 $this->_modalTFOptions,
    607                 $this->_modalHide,
    608                 ''
    609             );
    610 
    611         }//end modalHideCallback()
    612 
    613 
    614         /**
    615          * Add the settings modal type field callback.
    616          *
    617          * @return modal type settings
    618          */
    619         public function modalTypeCallback()
    620         {
    621             $this->echoSelect(
    622                 'modalLinksModalType',
    623                 'modalType',
    624                 $this->_modalTFOptions,
    625                 $this->_modalType,
    626                 ''
    627             );
    628 
    629         }//end modalTypeCallback()
    630 
    631 
    632         /**
    633          * Add the settings close icon field callback.
    634          *
    635          * @return escape settings
    636          */
    637         public function modalCloseIconCallback()
    638         {
    639             $this->echoSelect(
    640                 'modalLinksModalCloseIcon',
    641                 'modalCloseIcon',
    642                 $this->_modalTFOptions,
    643                 $this->_modalCloseIcon,
    644                 ''
    645             );
    646 
    647         }//end modalCloseIconCallback()
    648 
    649 
    650         /**
    651          * Add the settings escape field callback.
    652          *
    653          * @return escape settings
    654          */
    655         public function modalCloseEscCallback()
    656         {
    657             $this->echoSelect(
    658                 'modalLinksModalCloseEsc',
    659                 'modalCloseEsc',
    660                 $this->_modalTFOptions,
    661                 $this->_modalCloseEsc,
    662                 ''
    663             );
    664 
    665         }//end modalCloseEscCallback()
    666 
    667 
    668         /**
    669          * Add the settings escape field callback.
    670          *
    671          * @return escape settings
    672          */
    673         public function modalLoadingGifCallback()
    674         {
    675             $loadingGifOptions = array(
    676                                   ''          => 'off',
    677                                   'gray32'    => 'gray 32X32',
    678                                   'gray48'    => 'gray 48X48',
    679                                   'gray64'    => 'gray 64X64',
    680                                   'gray128'   => 'gray 128X128',
    681                                   'gray256'   => 'gray 256X256',
    682                                   'gray350'   => 'gray 350X350',
    683                                   'gray512'   => 'gray 512X512',
    684                                   'blue32'    => 'blue 32X32',
    685                                   'blue48'    => 'blue 48X48',
    686                                   'blue64'    => 'blue 64X64',
    687                                   'blue128'   => 'blue 128X128',
    688                                   'blue256'   => 'blue 256X256',
    689                                   'blue350'   => 'blue 350X350',
    690                                   'blue512'   => 'blue 512X512',
    691                                   'green32'   => 'green 32X32',
    692                                   'green48'   => 'green 48X48',
    693                                   'green64'   => 'green 64X64',
    694                                   'green128'  => 'green 128X128',
    695                                   'green256'  => 'green 256X256',
    696                                   'green350'  => 'green 350X350',
    697                                   'green512'  => 'green 512X512',
    698                                   'orange32'  => 'orange 32X32',
    699                                   'orange48'  => 'orange 48X48',
    700                                   'orange64'  => 'orange 64X64',
    701                                   'orange128' => 'orange 128X128',
    702                                   'orange256' => 'orange 256X256',
    703                                   'orange350' => 'orange 350X350',
    704                                   'orange512' => 'orange 512X512',
    705                                   'red32'     => 'red 32X32',
    706                                   'red48'     => 'red 48X48',
    707                                   'red64'     => 'red 64X64',
    708                                   'red128'    => 'red 128X128',
    709                                   'red256'    => 'red 256X256',
    710                                   'red350'    => 'red 350X350',
    711                                   'red512'    => 'red 512X512',
    712                                  );
    713 
    714             echo '<select name="modalLinksModalLoadingGif"
    715             id="modalLoadingGif">';
    716 
    717             foreach ($loadingGifOptions as $key => $value) {
    718                 if ($key == $this->_loadingGif) {
    719                     echo '<option value="'.
    720                     $key.
    721                     '" selected="selected">'.
    722                     $value.
    723                     '</option>';
    724                 } else {
    725                     echo '<option value="'.
    726                     $key.
    727                     '">'.
    728                     $value.
    729                     '</option>';
    730                 }
    731             }
    732 
    733             echo '</select>';
    734 
    735         }//end modalLoadingGifCallback()
    736 
    737 
    738         /**
    739          * Add the settings class field callback.
    740          *
    741          * @return class settings
    742          */
    743         public function modalClassCallback()
    744         {
    745             $this->echoInput(
    746                 'modalLinksModalClass',
    747                 'modalClass',
    748                 $this->_modalClass,
    749                 'this specified class name(s) will be added to the modal for
    750                 additional theming'
    751             );
    752 
    753         }//end modalClassCallback()
    754 
    755 
    756         /**
    757          * Add the settings position callback.
    758          *
    759          * @return position settings
    760          */
    761         public function modalPositionCallback()
    762         {
    763             $modalPositionOptions = array(
    764                                      'left_top'      => 'left top',
    765                                      'center_top'    => 'center top',
    766                                      'right_top'     => 'right top',
    767                                      'left_center'   => 'left center',
    768                                      'center_center' => 'center center',
    769                                      'right_center'  => 'right center',
    770                                      'left_bottom'   => 'left botton',
    771                                      'center_bottom' => 'center botton',
    772                                      'right_bottom'  => 'right botton',
    773                                     );
    774 
    775             echo '<select name="modalLinksModalPosition"
    776             id="modalPosition">';
    777 
    778             foreach ($modalPositionOptions as $key => $value) {
    779                 if ($key == $this->_modalPosition) {
    780                     echo '<option value="'.
    781                     $key.
    782                     '" selected="selected">'.
    783                     $value.
    784                     '</option>';
    785                 } else {
    786                     echo '<option value="'.
    787                     $key.
    788                     '">'.
    789                     $value.
    790                     '</option>';
    791                 }
    792             }
    793 
    794             echo '</select>';
    795 
    796         }//end modalPositionCallback()
    797 
    798 
    799         /**
    800          * Add the settings responsive position field callback.
    801          *
    802          * @return responsive position settings
    803          */
    804         public function modalResponsivePositionCallback()
    805         {
    806             $this->echoSelect(
    807                 'modalLinksModalResponsivePosition',
    808                 'modalResponsivePosition',
    809                 $this->_modalTFOptions,
    810                 $this->_responsivePosition,
    811                 ''
    812             );
    813 
    814         }//end modalResponsivePositionCallback()
    815 
    816 
    817         /**
    818          * Add the settings meta widget field callback.
    819          *
    820          * @return meta widget settings
    821          */
    822         public function metaWidgetCallback()
    823         {
    824             $this->echoSelect(
    825                 'modalLinksMetaWidget',
    826                 'metaWidget',
    827                 $this->_modalTFOptions,
    828                 $this->_metaWidget,
    829                 ''
    830             );
    831 
    832         }//end metaWidgetCallback()
    833 
    834 
    835         /**
    836          * Add the settings read more field callback.
    837          *
    838          * @return read more settings
    839          */
    840         public function readMoreCallback()
    841         {
    842             $this->echoSelect(
    843                 'modalLinksReadMore',
    844                 'readMore',
    845                 $this->_modalTFOptions,
    846                 $this->_readMore,
    847                 ''
    848             );
    849 
    850         }//end readMoreCallback()
    851 
    852 
    853         /**
    854          * Echoes the input options
    855          *
    856          * @param string $name    comment
    857          * @param string $id      comment
    858          * @param string $value   comment
    859          * @param string $tooltip comment
    860          *
    861          * @return nothing
    862          */
    863         public function echoInput($name, $id, $value, $tooltip)
    864         {
    865             echo '<input name="'.
    866             $name.
    867             '" id="'.
    868             $id.
    869             '" type="text" value="'.
    870             $value.
    871             '" title="'.
    872             __(
    873                 $tooltip,
    874                 'modal_links'
    875             ).
    876             '" />';
    877         }//end echoInput()
    878 
    879 
    880         /**
    881          * Echoes the select options
    882          *
    883          * @param string $name    comment
    884          * @param string $id      comment
    885          * @param array  $options comment
    886          * @param string $equal   comment
    887          * @param string $tooltip comment
    888          *
    889          * @return nothing
    890          */
    891         public function echoSelect($name, $id, $options, $equal, $tooltip)
    892         {
    893             echo '<select name="'.
    894             $name.
    895             '" id="'.
    896             $id.
    897             '" title="'.
    898             __($tooltip, 'modal_links').
    899             '">';
    900 
    901             foreach ($options as $value) {
    902                 if ($value == $equal) {
    903                     echo '<option value="'.
    904                     $value.
    905                     '" selected="selected">'.
    906                     $value.
    907                     '</option>';
    908                 } else {
    909                     echo '<option value="'.
    910                     $value.
    911                     '">'.
    912                     $value.
    913                     '</option>';
    914                 }
    915             }
    916 
    917             echo '</select>';
    918 
    919         }//end echoSelect()
    920 
    92181    }//end class
    92282}//end if
  • modal-links/trunk/modal-links.php

    r951637 r952981  
    55 * Plugin URI: https://wordpress.org/plugins/modal-links
    66 * Description: This is NOT just another modal plugin. Its much more. With this plugin you add modal functionalities to your wordpress.
    7  * Version: 1.7.9
     7 * Version: 1.8.0
    88 * Author: George Lazarou
    99 * Author URI: http://georgelazarou.info
     
    5050require_once 'admin/modal-links-admin.php';
    5151
    52 // Load the ajax callback functions.
    53 require_once 'include/modal-links-callbacks.php';
    54 
    55 // Load the ajax call functions.
    56 require_once 'include/modal-links-calls.php';
    57 
    58 // Load functions.
    59 require_once 'include/modal-links-functions.php';
    60 
    61 // Load the js functions.
    62 require_once 'include/modal-links-js.php';
    63 
    64 // Load the scripts.
    65 require_once 'include/modal-links-scripts.php';
    66 
    67 // Load the shortcode function.
    68 require_once 'include/modal-links-shortcode.php';
     52// Load the classes.
     53require_once 'includes/modal-links-includes.php';
    6954
    7055if (class_exists('ModalLinks') === false) {
     
    8974        {
    9075            add_action('init', array($this, 'loadTextdomain'));
    91             register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
    92             register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
    93             register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
    94             if (is_admin() === true) {
    95                 add_filter('plugin_action_links', array($this, 'settingsLink'), 10, 2);
    96             }
     76            add_filter('plugin_action_links', array($this, 'settingsLink'), 10, 2);
    9777            add_action('init', array($this, 'register_session'));
    9878            add_action('wp_footer', array($this, 'modalMarkup'));
     
    125105         */
    126106        public function register_session(){
    127             if(session_id() == false) {
     107            if (session_id() == false) {
    128108                session_start();
    129109            }
    130110
    131111        }
    132 
    133 
    134         /**
    135          * On activation
    136          *
    137          * @return nothing
    138          */
    139         public static function activate()
    140         {
    141             // If Modals category not exists create it.
    142             $modalCategoryExists = term_exists('Modals', 'category');
    143             if (($modalCategoryExists == 0) || ($modalCategoryExists == null)) {
    144                 wp_create_category('Modals');
    145             }
    146 
    147             // For Single site.
    148             if (is_multisite() === false) {
    149                 add_option('modalLinksModalWidth', '0');
    150                 add_option('modalLinksModalWidthType', 'px');
    151                 add_option('modalLinksModalResponsiveWidth', 'true');
    152                 add_option('modalLinksModalHeight', '0');
    153                 add_option('modalLinksModalHeightType', 'px');
    154                 add_option('modalLinksModalMaxHeight', '0');
    155                 add_option('modalLinksModalMaxHeightType', 'px');
    156                 add_option('modalLinksModalResponsiveHeight', 'true');
    157                 add_option('modalLinksModalDraggable', 'false');
    158                 add_option('modalLinksModalResizable', 'false');
    159                 add_option('modalLinksModalTitle', 'default');
    160                 add_option('modalLinksModalDate', 'false');
    161                 add_option('modalLinksModalAuthor', 'false');
    162                 add_option('modalLinksModalShow', 'false');
    163                 add_option('modalLinksModalHide', 'false');
    164                 add_option('modalLinksModalType', 'true');
    165                 add_option('modalLinksModalCloseIcon', 'true');
    166                 add_option('modalLinksModalCloseEsc', 'true');
    167                 add_option('modalLinksModalLoadingGif', 'gray32');
    168                 add_option('modalLinksModalClass', '');
    169                 add_option('modalLinksModalPosition', 'center_center');
    170                 add_option('modalLinksModalResponsivePosition', 'true');
    171                 add_option('modalLinksMetaWidget', 'true');
    172                 add_option('modalLinksReadMore', 'true');
    173             } else {
    174                 // For Multisite.
    175                 global $wpdb;
    176                 $blogIds        = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
    177                 $originalBlogId = get_current_blog_id();
    178                 foreach ($blogIds as $blogId) {
    179                     switch_to_blog($blogId);
    180                     add_option('modalLinksModalWidth', 0);
    181                     add_option('modalLinksModalWidthType', 'px');
    182                     add_option('modalLinksModalResponsiveWidth', 'true');
    183                     add_option('modalLinksModalHeight', 0);
    184                     add_option('modalLinksModalHeightType', 'px');
    185                     add_option('modalLinksModalMaxHeight', 0);
    186                     add_option('modalLinksModalMaxHeightType', 'px');
    187                     add_option('modalLinksModalResponsiveHeight', 'true');
    188                     add_option('modalLinksModalDraggable', 'false');
    189                     add_option('modalLinksModalResizable', 'false');
    190                     add_option('modalLinksModalTitle', 'default');
    191                     add_option('modalLinksModalDate', 'false');
    192                     add_option('modalLinksModalAuthor', 'false');
    193                     add_option('modalLinksModalShow', 'false');
    194                     add_option('modalLinksModalHide', 'false');
    195                     add_option('modalLinksModalType', 'true');
    196                     add_option('modalLinksModalCloseIcon', 'true');
    197                     add_option('modalLinksModalCloseEsc', 'true');
    198                     add_option('modalLinksModalLoadingGif', 'gray32');
    199                     add_option('modalLinksModalClass', '');
    200                     add_option('modalLinksModalPosition', 'center_center');
    201                     add_option('modalLinksModalResponsivePosition', 'true');
    202                     add_option('modalLinksMetaWidget', 'true');
    203                     add_option('modalLinksReadMore', 'true');
    204                 }//end foreach
    205 
    206                 switch_to_blog($originalBlogId);
    207 
    208                 add_site_option('modalLinksModalWidth', 0);
    209                 add_site_option('modalLinksModalWidthType', 'px');
    210                 add_site_option('modalLinksModalResponsiveWidth', 'true');
    211                 add_site_option('modalLinksModalHeight', 0);
    212                 add_site_option('modalLinksModalHeightType', 'px');
    213                 add_site_option('modalLinksModalMaxHeight', 0);
    214                 add_site_option('modalLinksModalMaxHeightType', 'px');
    215                 add_site_option('modalLinksModalResponsiveHeight', 'true');
    216                 add_site_option('modalLinksModalDraggable', 'false');
    217                 add_site_option('modalLinksModalResizable', 'false');
    218                 add_site_option('modalLinksModalTitle', 'default');
    219                 add_site_option('modalLinksModalDate', 'false');
    220                 add_site_option('modalLinksModalAuthor', 'false');
    221                 add_site_option('modalLinksModalShow', 'false');
    222                 add_site_option('modalLinksModalHide', 'false');
    223                 add_site_option('modalLinksModalType', 'true');
    224                 add_site_option('modalLinksModalCloseIcon', 'true');
    225                 add_site_option('modalLinksModalCloseEsc', 'true');
    226                 add_site_option('modalLinksModalLoadingGif', 'gray32');
    227                 add_site_option('modalLinksModalClass', '');
    228                 add_site_option('modalLinksModalPosition', 'center_center');
    229                 add_site_option('modalLinksModalResponsivePosition', 'true');
    230                 add_site_option('modalLinksMetaWidget', 'true');
    231                 add_site_option('modalLinksReadMore', 'true');
    232             }//end if
    233 
    234         }//end activate()
    235 
    236 
    237         /**
    238          * On deactivation
    239          *
    240          * @return nothing
    241          */
    242         public static function deactivate()
    243         {
    244 
    245         }//end deactivate()
    246 
    247 
    248         /**
    249          * On uninstallation
    250          *
    251          * @return nothing
    252          */
    253         public static function uninstall()
    254         {
    255             // For Single site.
    256             if (is_multisite() === false) {
    257                 delete_option('modalLinksModalWidth');
    258                 delete_option('modalLinksModalWidthType');
    259                 delete_option('modalLinksModalResponsiveWidth');
    260                 delete_option('modalLinksModalHeight');
    261                 delete_option('modalLinksModalHeightType');
    262                 delete_option('modalLinksModalMaxHeight');
    263                 delete_option('modalLinksModalMaxHeightType');
    264                 delete_option('modalLinksModalResponsiveHeight');
    265                 delete_option('modalLinksModalDraggable');
    266                 delete_option('modalLinksModalResizable');
    267                 delete_option('modalLinksModalTitle');
    268                 delete_option('modalLinksModalDate');
    269                 delete_option('modalLinksModalAuthor');
    270                 delete_option('modalLinksModalShow');
    271                 delete_option('modalLinksModalHide');
    272                 delete_option('modalLinksModalType');
    273                 delete_option('modalLinksModalCloseIcon');
    274                 delete_option('modalLinksModalCloseEsc');
    275                 delete_option('modalLinksModalLoadingGif');
    276                 delete_option('modalLinksModalClass');
    277                 delete_option('modalLinksModalPosition');
    278                 delete_option('modalLinksModalResponsivePosition');
    279                 delete_option('modalLinksMetaWidget');
    280                 delete_option('modalLinksReadMore');
    281             } else {
    282                 // For Multisite.
    283                 global $wpdb;
    284                 $blogIds        = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
    285                 $originalBlogId = get_current_blog_id();
    286                 foreach ($blogIds as $blogId) {
    287                     switch_to_blog($blogId);
    288                     delete_option('modalLinksModalWidth');
    289                     delete_option('modalLinksModalWidthType');
    290                     delete_option('modalLinksModalResponsiveWidth');
    291                     delete_option('modalLinksModalHeight');
    292                     delete_option('modalLinksModalHeightType');
    293                     delete_option('modalLinksModalMaxHeight');
    294                     delete_option('modalLinksModalMaxHeightType');
    295                     delete_option('modalLinksModalResponsiveHeight');
    296                     delete_option('modalLinksModalDraggable');
    297                     delete_option('modalLinksModalResizable');
    298                     delete_option('modalLinksModalTitle');
    299                     delete_option('modalLinksModalDate');
    300                     delete_option('modalLinksModalAuthor');
    301                     delete_option('modalLinksModalShow');
    302                     delete_option('modalLinksModalHide');
    303                     delete_option('modalLinksModalType');
    304                     delete_option('modalLinksModalCloseIcon');
    305                     delete_option('modalLinksModalCloseEsc');
    306                     delete_option('modalLinksModalLoadingGif');
    307                     delete_option('modalLinksModalClass');
    308                     delete_option('modalLinksModalPosition');
    309                     delete_option('modalLinksModalResponsivePosition');
    310                     delete_option('modalLinksMetaWidget');
    311                     delete_option('modalLinksReadMore');
    312                 }//end foreach
    313 
    314                 switch_to_blog($originalBlogId);
    315 
    316                 delete_site_option('modalLinksModalWidth');
    317                 delete_site_option('modalLinksModalWidthType');
    318                 delete_site_option('modalLinksModalResponsiveWidth');
    319                 delete_site_option('modalLinksModalHeight');
    320                 delete_site_option('modalLinksModalHeightType');
    321                 delete_site_option('modalLinksModalMaxHeight');
    322                 delete_site_option('modalLinksModalMaxHeightType');
    323                 delete_site_option('modalLinksModalResponsiveHeight');
    324                 delete_site_option('modalLinksModalDraggable');
    325                 delete_site_option('modalLinksModalResizable');
    326                 delete_site_option('modalLinksModalTitle');
    327                 delete_site_option('modalLinksModalDate');
    328                 delete_site_option('modalLinksModalAuthor');
    329                 delete_site_option('modalLinksModalShow');
    330                 delete_site_option('modalLinksModalHide');
    331                 delete_site_option('modalLinksModalType');
    332                 delete_site_option('modalLinksModalCloseIcon');
    333                 delete_site_option('modalLinksModalCloseEsc');
    334                 delete_site_option('modalLinksModalLoadingGif');
    335                 delete_site_option('modalLinksModalClass');
    336                 delete_site_option('modalLinksModalPosition');
    337                 delete_site_option('modalLinksModalResponsivePosition');
    338                 delete_site_option('modalLinksMetaWidget');
    339                 delete_site_option('modalLinksReadMore');
    340             }//end if
    341 
    342         }//end uninstall()
    343112
    344113
  • modal-links/trunk/readme.txt

    r951637 r952981  
    66Requires at least: 3.0.1
    77Tested up to: 3.9
    8 Stable tag: 1.7.9
     8Stable tag: 1.8.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3131<strong>News:</strong>
    3232
    33 * Two new options added. (Show Date, Show Author)
     33* NEW options added in version 1.8.0...
     34* Shortcode validation system is now fixed...
    3435* All donatable extensions have new version uploaded. We have added a "New Version Notice" system on them, so from now and on you will be notified in the admin panel if new version found. Please all owners download the new versions from the plugin's url using your existing credentials. Thank you
    3536* The free extensions Read More, Meta Widget Login Register and Shortcode Validation now have been merged into the basic plugin.
     
    262263== Changelog ==
    263264
     265= 1.8.0 =
     266New Options added. Bugs fixed.
     267
    264268= 1.7.9 =
    265269Bug fixed.
     
    363367== Upgrade Notice ==
    364368
     369= 1.8.0 =
     370New Options added. Bugs fixed.
     371
    365372= 1.7.9 =
    366373Bug fixed.
Note: See TracChangeset for help on using the changeset viewer.