Plugin Directory

Changeset 1643034


Ignore:
Timestamp:
04/22/2017 04:21:39 PM (9 years ago)
Author:
Tsjuder
Message:

Release version 1.3.0

Location:
tea-page-content/trunk
Files:
103 added
6 deleted
9 edited
11 moved

Legend:

Unmodified
Added
Removed
  • tea-page-content/trunk/README.md

    r1392502 r1643034  
    8686
    8787## Filters and actions
    88 Will be very soon...
    89 
    90 ## What's next?
    91 In next versions will be released these features:
    92 * Page-level variables
    93 * Waterfall template
    94 * Customize ordering
    95 * UI improvements
    96 * **And more!**
    97 
    98 ## Migration Guide
    99 ### From 1.0.x to 1.1.x
    100 Since 1.1.x, nothing was deleted. But some options was marked as deprecated. We recommend do these steps:
    101 1. If you're using **default padded** template, change it on **default** with layout what you prefer.
    102 2. If you're using shortcodes, replace parameter `id` to `posts`.
    103 3. If you're using widgets with **turned off** thumbnail option, re-save each of it.
     88See documentation.
  • tea-page-content/trunk/app/Main/ShortcodeGenerator.php

    r1643033 r1643034  
    11<?php
    2 /**
    3  * @package Tea Page Content
    4  * @version 1.2.3
    5  */
    62
    7 class TeaPageContent {
    8     private $_helper;
    9     private $_config;
     3namespace TeaPageContent\App\Main;
    104
    11     /**
    12      * Constructor
    13      *
    14      * @return void
    15      */
    16     public function __construct() {}
     5use TeaPageContent\App\Config;
     6use TeaPageContent\App\TemplateVariables;
     7use TeaPageContent\App\PageVariables;
    178
    18     /**
    19      * Run this plugin, load textdomain, adds filters & actions
    20      *
    21      * @return void
    22      */
    23     public function initialize() {
    24         // Load textdomain
    25         load_plugin_textdomain('tea-page-content', false, TEA_PAGE_CONTENT_FOLDER . '/languages/');
     9class ShortcodeGenerator {
     10    private $Config = null;
     11    private $TemplateVariablesRepository = null;
     12    private $PageVariablesDecoder = null;
    2613
    27         // Adds filters, actions, etc.
    28         add_action('init', array($this, 'registerShortcodes'));
    29         add_action('widgets_init', array($this, 'registerWidgets'));
     14    public function __construct(Config\Repository $Config, TemplateVariables\Repository $TemplateVariablesRepository, PageVariables\Decoder $PageVariablesDecoder) {
     15        $this->Config = $Config;
     16        $this->TemplateVariablesRepository = $TemplateVariablesRepository;
     17        $this->PageVariablesDecoder = $PageVariablesDecoder;
     18    }
    3019
    31         add_action('init', array($this, 'updateSettings'));
     20    public function generate() {
     21        $prepared_data = [];
    3222
    33         // Modify Admin page
    34         add_action('admin_footer-widgets.php', array($this, 'addPageVariablesModal'));
    35         add_action('admin_footer-edit.php', array($this, 'addPageVariablesModal'));
    36         add_action('admin_footer-post.php', array($this, 'addPageVariablesModal'));
    37         add_action('admin_footer-post-new.php', array($this, 'addPageVariablesModal'));
     23        $data = $_POST['data'];
     24        $data = explode('&', $data);
    3825
    39         add_action('admin_footer-edit.php', array($this, 'addInsertShortcodeModal'));
    40         add_action('admin_footer-post.php', array($this, 'addInsertShortcodeModal'));
    41         add_action('admin_footer-post-new.php', array($this, 'addInsertShortcodeModal'));
     26        foreach ($data as $index => $pair) {
     27            $pair = explode('=', $pair);
    4228
    43         // Includes all css, js, etc.
    44         add_action('wp_enqueue_scripts', array($this, 'includeAssets'), 100, 1);
    45         add_action('admin_enqueue_scripts', array($this, 'includeAdminAssets'), 100, 1);
     29            if(!trim($pair[1])) {
     30                continue;
     31            }
    4632
    47         // Set Callbacks for ajax actions
    48         add_action('wp_ajax_get_template_variables', array($this, 'getTemplateVariablesCallback'));
    49         add_action('wp_ajax_generate_shortcode', array($this, 'generateShortcode'));
     33            $keys = preg_split('/[\[\]]+/', urldecode($pair[0]), -1, PREG_SPLIT_NO_EMPTY);
     34           
     35            // $keys[0] is property name (order, page_variables, etc.)
     36            // $keys[1] is a page id (as usual)
     37            // So, if we haven't property in prepared data, set it up
     38            if(!array_key_exists($keys[0], $prepared_data)) {
     39               
     40                if(isset($keys[1])) {
     41                    // page variables, set it
     42                    $prepared_data[$keys[0]] = array(
     43                        $keys[1] => $pair[1]
     44                    );
     45                } else {
     46                    // just post id, set it too
     47                    $prepared_data[$keys[0]] = array(
     48                        $pair[1]
     49                    );
     50                }
    5051
    51         add_action('wp_ajax_set_notice_seen', array($this, 'setNoticeSeenCallback'));
     52            // But, if we have it already and post_id is not in $prepared_data, it means, we set up page variables
     53            } elseif(isset($keys[1]) && !array_key_exists($keys[1], $prepared_data[$keys[0]])) {
    5254
    53         add_action('media_buttons', array($this, 'add_my_media_button'), 1000);
     55                // page variables in raw format stored in $pair array
     56                $prepared_data[$keys[0]][$keys[1]] = $pair[1];
    5457
    55         add_action('admin_menu', array($this, 'addMenu'), 100);
     58            // And finally, if we haven't property and $keys[1] isn't set...
     59            } else {
    5660
    57         add_filter('plugin_row_meta', array($this, 'addPluginMetaLinks'), 100, 2);
     61                // ...it means, this is just post id that we need set separately
     62                // $pair[1] in these times can be just post_id integer
     63                // so $keys[0] now is `posts`
     64                $prepared_data[$keys[0]][] = $pair[1];
     65               
     66            }
     67        }
    5868
     69        $template = $this->Config->get('defaults.templates.client.default-template');
     70        if(isset($prepared_data['template'])) {
     71            $template = $prepared_data['template'][0];
     72        }
    5973
    60         // Create new helper instance
    61         $this->_helper = new TeaPageContent_Helper;
     74        $shortcodes = [
     75            'main' => [],
     76        ];
    6277
    63         // Gets instance of the config class
    64         $this->_config = TeaPageContent_Config::getInstance();
     78        $shortcode_defaults = $this->Config->get('defaults.shortcode');
     79        $page_variables = $this->Config->get('defaults.page-variables');
     80        $template_variables = $this->TemplateVariablesRepository->get($template);
    6581
    66         // At first time notice user about possible migration
    67         if
    68             (
    69                 ($last_version = get_option('tpc_deprecated_notice'))
    70                 &&
    71                 $last_version !== $this->_config->get('system.versions.plugin')
    72             )
    73         {
    74             add_action('admin_notices', array($this, 'displayDeprecatedNotice'));
    75         }
    76     }
     82        if(isset($prepared_data['page_variables']) && isset($prepared_data['posts'])) {
    7783
    78     /**
    79      * Add meta-link in plugin description on plugin list page.
    80      *
    81      * @param array $links
    82      * @param string $file
    83      * @return array
    84      */
    85     public function addPluginMetaLinks($links, $file) {
    86         if($file == plugin_basename(TEA_PAGE_CONTENT_FILE)) {
    87             $links[] = '<a href="options-general.php?page=tea-page-content">' . __('Settings', 'tea-page-content') . '</a>';
    88         }
     84            $last_id = null;
    8985
    90         return $links;
    91     }
     86            foreach ($prepared_data['posts'] as $post_id) {
     87                if(isset($prepared_data['page_variables'][$post_id])) {
     88                    $current_page_variables = $this->PageVariablesDecoder->decode_page_variables(urldecode($prepared_data['page_variables'][$post_id]), $post_id, false);
    9289
    93     /**
    94      * Add button for inserting shortcode above text editor on admin pages.
    95      *
    96      * @return void
    97      */
    98     public function add_my_media_button() {
    99         $mask = '<a href="#" id="tpc-insert-shortcode" data-modal="tpc-call-shortcode-modal" data-button="insert" class="button tpc-button tpc-call-modal-button">%s</a>';
    100         echo sprintf($mask, __('Tea Page Content Shortcode', 'tea-page-content'));
    101     }
     90                    $shortcodes[$post_id] = array_merge(array(
     91                        'posts' => $post_id,
     92                    ), $current_page_variables);
    10293
    103     /**
    104      * Add sub-menu for Options level.
    105      *
    106      * @return void
    107      */
    108     public function addMenu() {
    109         add_submenu_page('options-general.php', __('Tea Page Content - Settings', 'tea-page-content'), __('Tea Page Content', 'tea-page-content'), 'edit_dashboard', 'tea-page-content', array($this, 'renderSettingsPage'));
    110     }
     94                    $last_id = null;
     95                } else {
     96                    if(is_null($last_id)) {
     97                        $last_id = $post_id;
     98                    }
    11199
    112     /**
    113      * Register Tea Page Content widget
    114      *
    115      * @return void
    116      */
    117     public function registerWidgets() {
    118         register_widget('TeaPageContent_Widget');
    119     }
     100                    if(isset($shortcodes[$last_id]['posts'])) {
     101                        $shortcodes[$last_id]['posts'] .= ', ' . $post_id;
     102                    } else {
     103                        $shortcodes[$last_id]['posts'] = $post_id;
     104                    }
     105                }
     106            }
    120107
    121     /**
    122      * Register Tea Page Content shortcode
    123      *
    124      * @return void
    125      */
    126     public function registerShortcodes() {
    127         add_shortcode('tea_page_content', array('TeaPageContent_Shortcode', 'tea_page_content'));
    128     }
     108            unset($prepared_data['posts']);
     109            unset($prepared_data['page_variables']);
     110            unset($last_id);
     111        }
    129112
    130     /**
    131      * Adds all scripts, styles and media
    132      * into an admin page.
    133      *
    134      * @param string $hook Current page of admin side
    135      * @return void
    136      */
    137     public function includeAdminAssets($hook) {
    138         $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
     113        foreach ($prepared_data as $param => $value) {
     114            if($param === 'posts') {
     115                $shortcodes['main'][$param] = implode(',', $value);
     116            } else {
     117                $shortcodes['main'][$param] = $value;
     118            }
     119        }
    139120
    140         if($hook === 'post.php' || $hook === 'post-new.php' || $hook === 'edit.php' || $hook === 'settings_page_tea-page-content') {
    141            
    142             wp_enqueue_script(
    143                 'tea-page-content-js-api',
    144                 $url . '/js/tea-page-content-api.js',
    145                 array('jquery', 'jquery-ui-dialog', 'jquery-ui-spinner'),
    146                 $this->_config->get('system.versions.scripts'),
    147                 true
    148             );
     121        // Build shortcodes up
     122        $output = array();
     123        $is_main_open = false;
     124        foreach ($shortcodes as $key => $attrs) {
     125            if($key === 'main') { // main shortcode
    149126
    150             wp_enqueue_script(
    151                 'tea-page-content-js',
    152                 $url . '/js/tea-page-content-admin.js',
    153                 array('jquery', 'jquery-ui-dialog', 'jquery-ui-spinner'),
    154                 $this->_config->get('system.versions.scripts'),
    155                 true
    156             );
     127                $output[] = '[tea_page_content';
    157128
    158             wp_enqueue_style(
    159                 'tea-page-content-css',
    160                 $url . '/css/tea-page-content-admin.css',
    161                 array(),
    162                 $this->_config->get('system.versions.styles'),
    163                 'all'
    164             );
     129                foreach ($attrs as $attr_name => $attr_value) {
     130                    if(is_array($attr_value)) {
     131                        $attr_value = implode(',', $attr_value);
     132                    }
    165133
    166         } elseif($hook === 'widgets.php') {
    167             wp_enqueue_media();
     134                    $output[] = ' '. $attr_name . '="'. urldecode(htmlspecialchars($attr_value)).'"';
     135                }
    168136
    169             wp_enqueue_script(
    170                 'tea-page-content-js-api',
    171                 $url . '/js/tea-page-content-api.js',
    172                 array('jquery', 'jquery-ui-dialog', 'jquery-ui-spinner'),
    173                 $this->_config->get('system.versions.scripts'),
    174                 true
    175             );
     137                if(count($shortcodes) > 1) {   
     138                    $is_main_open = true;
     139                } else {
     140                    $output[] = "/";
     141                }
    176142
    177             wp_enqueue_script(
    178                 'tea-page-content-js',
    179                 $url . '/js/tea-page-content-admin.js',
    180                 array('jquery', 'jquery-ui-dialog', 'jquery-ui-spinner'),
    181                 $this->_config->get('system.versions.scripts'),
    182                 true
    183             );
    184        
    185             wp_enqueue_style(
    186                 'tea-page-content-css',
    187                 $url . '/css/tea-page-content-admin.css',
    188                 array(),
    189                 $this->_config->get('system.versions.styles'),
    190                 'all'
    191             );
    192         }
     143                $output[] = "]\r\n";
    193144
    194         if
    195             (
    196                 ($last_version = get_option('tpc_deprecated_notice'))
    197                 &&
    198                 $last_version !== $this->_config->get('system.versions.plugin')
    199             )
    200         {
    201             wp_enqueue_script(
    202                 'tea-page-content-notices-js',
    203                 $url . '/js/tea-page-content-admin-notices.js',
    204                 array('jquery'),
    205                 $this->_config->get('system.versions.scripts'),
    206                 true
    207             );
    208         }
    209     }
     145            } else { // key is post_id, inner shortcode
    210146
    211     /**
    212      * Adds all scripts, styles and media
    213      * into a frontend part of site
    214      *
    215      * @return void
    216      */
    217     public function includeAssets() {
    218         $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
    219    
    220         if($this->_config->get_current('system.settings.include-css')) {
    221             wp_enqueue_style(
    222                 'tea-page-content',
    223                 $url . '/css/tea-page-content-main.css',
    224                 array(),
    225                 $this->_config->get('system.versions.styles'),
    226                 'all'
    227             );
    228         }
    229     }
     147                $output[] = '[tea_page_content';
    230148
    231     /**
    232      * Callback for AJAX-action. Generates and echoes shortcode for editor.
    233      *
    234      * @return void
    235      */
    236     public function generateShortcode() {
    237         $prepared_data = array();
     149                foreach ($attrs as $attr_name => $attr_value) {
     150                    if(is_array($attr_value)) {
     151                        $attr_value = implode(',', $attr_value);
     152                    }
    238153
    239         $data = $_POST['data'];
    240         $data = explode('&', $data);
     154                    $output[] = ' '. $attr_name . '="'.urldecode(htmlspecialchars($attr_value)).'"';
     155                }
    241156
    242         foreach ($data as $index => $pair) {
    243             $pair = explode('=', $pair);
     157                $output[] = "/]\r\n";
    244158
    245             if(!trim($pair[1])) {
    246                 continue;
    247             }
     159            }
     160        }
    248161
    249             $keys = preg_split('/[\[\]]+/', urldecode($pair[0]), -1, PREG_SPLIT_NO_EMPTY);
    250            
    251             // $keys[0] is property name (order, page_variables, etc.)
    252             // $keys[1] is a page id (as usual)
    253             // So, if we haven't property in prepared data, set it up
    254             if(!array_key_exists($keys[0], $prepared_data)) {
    255                
    256                 if(isset($keys[1])) {
    257                     // page variables, set it
    258                     $prepared_data[$keys[0]] = array(
    259                         $keys[1] => $pair[1]
    260                     );
    261                 } else {
    262                     // just post id, set it too
    263                     $prepared_data[$keys[0]] = array(
    264                         $pair[1]
    265                     );
    266                 }
     162        if($is_main_open) {
     163            $output[] = "[/tea_page_content]";
     164        }
    267165
    268             // But, if we have it already and post_id is not in $prepared_data, it means, we set up page variables
    269             } elseif(isset($keys[1]) && !array_key_exists($keys[1], $prepared_data[$keys[0]])) {
    270 
    271                 // page variables in raw format stored in $pair array
    272                 $prepared_data[$keys[0]][$keys[1]] = $pair[1];
    273 
    274             // And finally, if we haven't property and $keys[1] isn't set...
    275             } else {
    276 
    277                 // ...it means, this is just post id that we need set separately
    278                 // $pair[1] in these times can be just post_id integer
    279                 // so $keys[0] now is `posts`
    280                 $prepared_data[$keys[0]][] = $pair[1];
    281                
    282             }
    283         }
    284 
    285         $template = 'default'; // @todo через конфиг
    286         if(isset($prepared_data['template'])) {
    287             $template = $prepared_data['template'][0];
    288         }
    289 
    290         $shortcodes = array(
    291             'main' => array(),
    292         );
    293 
    294         $shortcode_defaults = $this->_config->get('defaults.shortcode');
    295         $page_variables = $this->_config->get('defaults.page-variables');
    296         $template_variables = $this->_helper->getVariables($template);
    297 
    298         // @todo make dis shit dry {1}
    299         if(isset($prepared_data['page_variables']) && isset($prepared_data['posts'])) {
    300 
    301             $last_id = null;
    302 
    303             foreach ($prepared_data['posts'] as $post_id) {
    304                 if(isset($prepared_data['page_variables'][$post_id])) {
    305                     $current_page_variables = $this->_helper->decodePageVariables(urldecode($prepared_data['page_variables'][$post_id]), $post_id, false);
    306 
    307                     $shortcodes[$post_id] = array_merge(array(
    308                         'posts' => $post_id,
    309                     ), $current_page_variables);
    310 
    311                     $last_id = null;
    312                 } else {
    313                     if(is_null($last_id)) {
    314                         $last_id = $post_id;
    315                     }
    316 
    317                     if(isset($shortcodes[$last_id]['posts'])) {
    318                         $shortcodes[$last_id]['posts'] .= ', ' . $post_id;
    319                     } else {
    320                         $shortcodes[$last_id]['posts'] = $post_id;
    321                     }
    322                 }
    323             }
    324 
    325             unset($prepared_data['posts']);
    326             unset($prepared_data['page_variables']);
    327             unset($last_id);
    328         }
    329 
    330         foreach ($prepared_data as $param => $value) {
    331             if($param === 'posts') {
    332                 $shortcodes['main'][$param] = implode(',', $value);
    333             } else {
    334                 $shortcodes['main'][$param] = $value;
    335             }
    336         }
    337 
    338         // Build shortcodes up
    339         $output = array();
    340         $is_main_open = false;
    341         foreach ($shortcodes as $key => $attrs) {
    342             if($key === 'main') { // main shortcode
    343 
    344                 $output[] = '[tea_page_content';
    345 
    346                 foreach ($attrs as $attr_name => $attr_value) {
    347                     if(is_array($attr_value)) {
    348                         $attr_value = implode(',', $attr_value);
    349                     }
    350 
    351                     $output[] = ' '. $attr_name . '="'. urldecode(htmlspecialchars($attr_value)).'"';
    352                 }
    353 
    354                 if(count($shortcodes) > 1) {   
    355                     $is_main_open = true;
    356                 } else {
    357                     $output[] = "/";
    358                 }
    359 
    360                 $output[] = "]\r\n";
    361 
    362             } else { // key is post_id, inner shortcode
    363 
    364                 $output[] = '[tea_page_content';
    365 
    366                 foreach ($attrs as $attr_name => $attr_value) {
    367                     if(is_array($attr_value)) {
    368                         $attr_value = implode(',', $attr_value);
    369                     }
    370 
    371                     $output[] = ' '. $attr_name . '="'.urldecode(htmlspecialchars($attr_value)).'"';
    372                 }
    373 
    374                 $output[] = "/]\r\n";
    375 
    376             }
    377         }
    378 
    379         if($is_main_open) {
    380             $output[] = "[/tea_page_content]";
    381         }
    382 
    383         echo implode('', $output);
    384 
    385         wp_die();
    386     }
    387 
    388     /**
    389      * Callback for AJAX-action. Gets and returns template variables
    390      * by passed template and mask. Mask is unique name of current instance of widget.
    391      * This function can be used only in ajax, in other cases it returns nothing.
    392      *
    393      * @return void
    394      */
    395     public function getTemplateVariablesCallback() {
    396         $template = $_POST['template'];
    397         $mask = $_POST['mask']; // @todo прекратить передавать это в ajax, вынести в конфиг
    398         // также потребуется поправить шаблоны (убрать этот параметр)
    399 
    400         $layout = 'default-widget-admin-variables-area'; // @todo вынести в конфиг
    401 
    402         $layoutPath = $this->_helper->getTemplatePath($layout);
    403         $variables = $this->_helper->getVariables($template);
    404 
    405         echo $this->_helper->renderTemplate(array(
    406             'template_variables' => $variables,
    407             'mask' => $mask
    408         ), $layoutPath);
    409 
    410         wp_die();
    411     }
    412 
    413     /**
    414      * Callback for AJAX-action. Fires when user closes deprecated notice.
    415      * Set up unique option with current version of this plugin.
    416      *
    417      * This option will be deleted after uninstall.
    418      *
    419      * @return void
    420      */
    421     public function setNoticeSeenCallback() {
    422         $this->_helper->updateDeprecatedNoticeOption();
    423     }
    424 
    425     /**
    426      * Created and print deprecated notice. Ugly, but simple.
    427      * Will be recommend check out changelog at wordpress.org
    428      *
    429      * @todo do something with html in my php
    430      *
    431      * @return void
    432      */
    433     public function displayDeprecatedNotice() {
    434         $message = __('Thanks for update! We recommend you check out the <a href="https://wordpress.org/plugins/tea-page-content/changelog/">changelog</a>. <b>This notice disappear after closing.</b>');
    435         $content = '<div id="tpc-deprecated-notice" class="error notice tpc-deprecated-notice is-dismissible"><p>' . $message . '</p></div>';
    436 
    437         echo $content;
    438     }
    439 
    440     /**
    441      * Render settings page.
    442      *
    443      * @return void
    444      */
    445     public function renderSettingsPage() {
    446         $params = array(
    447             'settings' => $this->_helper->getMappedSettings(),
    448         );
    449 
    450         $template = 'default-settings-page'; // @todo via config
    451 
    452         $templatePath = $this->_helper->getTemplatePath($template);
    453 
    454         echo $this->_helper->renderTemplate($params, $templatePath);
    455     }
    456 
    457     /**
    458      * Render and display empty modal wrapper for JQuery UI Dialog.
    459      * This wrapper will be used, mainly, in page level options.
    460      *
    461      * @return void
    462      */
    463     public function addPageVariablesModal() {
    464         $template = 'default-widget-admin-dialog-page-variables'; // @todo через конфиг
    465 
    466         $params = array(
    467             'page_variables' => $this->_config->get('defaults.page-variables')
    468         );
    469 
    470         if($templatePath = $this->_helper->getTemplatePath($template)) {
    471             $content = $this->_helper->renderTemplate($params, $templatePath);
    472 
    473             echo $content;
    474         }
    475     }
    476 
    477     /**
    478      * Print in footer modal window html for inserting shortcode
    479      *
    480      * @return void
    481      */
    482     public function addInsertShortcodeModal() {
    483         $template = 'default-widget-admin-dialog-insert-shortcode'; // @todo через конфиг
    484 
    485         $template = apply_filters('tpc_get_admin_template_path', $template);
    486 
    487         // Gets a path to the template
    488         $templatePath = $this->_helper->getTemplatePath($template);
    489 
    490         // Specify a params for template
    491         $params = array(
    492             'instance' => $this->_config->get('defaults.shortcode', 'caller'), // @todo add deprecated `id` to exclude
    493             'entries' => $this->_helper->getPosts(),
    494             'templates' => $this->_helper->getTemplates(),
    495             'template_variables' => $this->_helper->getVariables('default'), // @todo через конфиг
    496             'page_variables' => array(),
    497             'partials' => array(),
    498             'mask' => '{mask}', // @todo вынести в конфиг
    499         );
    500 
    501         // Build up partials. Partials - small layouts of widget form,
    502         // that can be loaded or overriden dynamically, f.e. by ajax.
    503         // At this moment only one partial can be used.
    504         $layout = 'default-widget-admin-variables-area'; // @todo вынести в конфиг
    505         $layoutPath = $this->_helper->getTemplatePath($layout);
    506 
    507         $params['partials']['template_variables'] = $this->_helper->renderTemplate($params, $layoutPath);
    508 
    509         // Here you can filter params
    510         $params = apply_filters('tpc_get_admin_params', $params);
    511 
    512         $content = $this->_helper->renderTemplate($params, $templatePath);
    513 
    514         echo $content;
    515     }
    516 
    517     /**
    518      * Update settings if POST is not empty
    519      *
    520      * @return void
    521      */
    522     public function updateSettings() {
    523         if(!is_admin() || empty($_POST) || !isset($_POST['tpc_settings_update'])) {
    524             return;
    525         }
    526 
    527         unset($_POST['tpc_settings_update']);
    528 
    529         foreach ($_POST as $setting_name => $setting_value) {
    530             if
    531                 (
    532                     strpos($setting_name, 'tpc_') === false // @todo make dis shit dry {4}
    533                     ||
    534                     preg_match('/[^\w-]/', $setting_name)
    535                     ||
    536                     !is_scalar($setting_value)
    537                 )
    538             {
    539                 continue;
    540             }
    541 
    542             $config_path = $this->_helper->convertSettingToConfigPath($setting_name);
    543 
    544             $initial = $this->_config->get_default($config_path);
    545 
    546             if(is_null(get_option($setting_name, null))) {
    547                 add_option($setting_name, $setting_value, '', 'no');
    548             } elseif($initial == $setting_value) {
    549                 delete_option($setting_name);
    550             } else {
    551                 update_option($setting_name, $setting_value, 'no');
    552             }
    553         }
    554     }
     166        echo implode('', $output);
     167    }
    555168}
  • tea-page-content/trunk/assets/css/tea-page-content-admin.css

    r1560974 r1643034  
    11.tpc-note {
    2     background-color: #fafafa;
    3     margin-bottom: 10px;
    4 
    5     padding: 10px 15px;
    6 
    7     margin-left: -15px;
    8     margin-right: -15px;
     2    background-color: #fafafa;
     3    margin-bottom: 10px;
     4
     5    padding: 10px 15px;
     6
     7    margin-left: -15px;
     8    margin-right: -15px;
    99}
    1010
    1111.tpc-columns-wrapper,
    1212.tpc-columns-group {
    13     display: flex;
    14     flex-direction: row;
    15     flex-wrap: wrap;
     13    display: flex;
     14    flex-direction: row;
     15    flex-wrap: wrap;
    1616}
    1717.tpc-columns-wrapper {
    18     margin-bottom: 15px;
     18    margin-bottom: 15px;
    1919}
    2020.tpc-column {
    21     width: 50%;
    22 
    23     box-sizing: border-box;
     21    width: 50%;
     22
     23    box-sizing: border-box;
    2424}
    2525.tpc-column-label {
    26     line-height: 1.5;
     26    line-height: 1.5;
    2727}
    2828
    2929.tpc-columns-group .tpc-column:not(:last-child) {
    30     padding-right: 10px;
     30    padding-right: 10px;
    3131}
    3232.tpc-columns-group .tpc-column:not(:first-child) {
    33     padding-left: 10px;
     33    padding-left: 10px;
    3434}
    3535.tpc-columns-group .tpc-column p:first-child {
    36     margin-top: 0;
     36    margin-top: 0;
    3737}
    3838
    3939.tpc-column.tpc-full-width {
    40     width: 100%;
     40    width: 100%;
    4141}
    4242
    4343.tpc-posts-list {
    44     margin-top: 10px;
     44    margin-top: 10px;
    4545}
    4646.tpc-posts-list label {
    47     display: block;
    48     float: left;
    49     clear: both;
    50     width: 100%;
     47    display: block;
     48    float: left;
     49    clear: both;
     50    width: 100%;
    5151}
    5252.tpc-posts-list .tpc-item-title {
    53     display: block;
    54     white-space: nowrap;
     53    display: block;
     54    white-space: nowrap;
    5555    overflow: hidden;
    5656
     
    5858}
    5959.tpc-posts-list label input[type=checkbox] {
    60     float: left;
    61     margin-top: 2px;
     60    float: left;
     61    margin-top: 2px;
    6262}
    6363
    6464.tpc-accordeon {
    65     border: 1px solid #e5e5e5;
    66     margin-bottom: 10px;
     65    border: 1px solid #e5e5e5;
     66    margin-bottom: 10px;
    6767}
    6868.tpc-accordeon-top {
    69     position: relative;
    70     background-color: #fafafa;
    71     border: 1px solid #e5e5e5;
    72     cursor: pointer;
     69    position: relative;
     70    background-color: #fafafa;
     71    border: 1px solid #e5e5e5;
     72    cursor: pointer;
    7373}
    7474
    7575.tpc-accordeon-top h4 {
    76     overflow: hidden;
    77     text-overflow: ellipsis;
    78     padding: 10px;
    79     padding-right: 50px;
    80     margin: 0;
    81     text-transform: capitalize;
     76    overflow: hidden;
     77    text-overflow: ellipsis;
     78    padding: 10px;
     79    padding-right: 50px;
     80    margin: 0;
     81    text-transform: capitalize;
    8282}
    8383.tpc-accordeon-top:hover {
    84     border-color: #999;
     84    border-color: #999;
    8585}
    8686.tpc-accordeon-top:hover:after {
    87     color: #444;
     87    color: #444;
    8888}
    8989.tpc-accordeon-top:after {
    90     content: '\f140';
    91     color: #a0a5aa;
    92     display: block;
    93     padding: 8px;
    94     font: 400 20px/1 dashicons;
    95     position: absolute;
    96     top: 0;
    97     bottom: 0;
    98     right: 0;
     90    content: '\f140';
     91    color: #a0a5aa;
     92    display: block;
     93    padding: 8px;
     94    font: 400 20px/1 dashicons;
     95    position: absolute;
     96    top: 0;
     97    bottom: 0;
     98    right: 0;
    9999}
    100100.tpc-accordeon-top.opened:after {
    101     content: '\f142';
     101    content: '\f142';
    102102}
    103103.tpc-accordeon-body {
    104     padding: 10px;
    105     max-height: 120px;
    106     overflow-x: auto;
    107     display: none;
     104    padding: 10px;
     105    max-height: 120px;
     106    overflow-x: auto;
     107    display: none;
    108108}
    109109.tpc-accordeon-body:before,
    110110.tpc-accordeon-body:after {
    111     content: "";
    112     clear: both;
     111    content: "";
     112    clear: both;
    113113}
    114114.tpc-accordeon-body:after {
    115     display: table;
     115    display: table;
    116116}
    117117
    118118.tpc-template-params-inner {
    119     margin-left: -15px;
    120     margin-right: -15px;
    121 
    122     padding: 10px 15px;
    123 
    124     background-color: #fafafa;
     119    margin-left: -15px;
     120    margin-right: -15px;
     121
     122    padding: 10px 15px;
     123
     124    background-color: #fafafa;
    125125}
    126126
    127127.action-links > * {
    128     display: inline-block;
    129     vertical-align: middle;
    130     line-height: 28px;
     128    display: inline-block;
     129    vertical-align: middle;
     130    line-height: 28px;
    131131}
    132132.action-links > * + * {
    133     margin-left: 10px;
     133    margin-left: 10px;
    134134}
    135135
    136136.tpc-template-params {}
    137137.tpc-template-params h4 {
    138     margin-top: 0;
     138    margin-top: 0;
    139139}
    140140.tpc-template-params hr {
    141     margin: 0;
     141    margin: 0;
    142142}
    143143
    144144.tpc-preloader {
    145     position: relative;
     145    position: relative;
    146146}
    147147.tpc-preloader:before {
    148     content: "";
    149     display: block;
    150     position: absolute;
    151 
    152     top: 0;
    153     left: 0;
    154     right: 0;
    155     bottom: 0;
    156 
    157     opacity: 0;
    158 
    159     transition: opacity 500ms ease;
    160     -webkit-transition: opacity 500ms ease;
    161     -moz-transition: opacity 500ms ease;
    162     -ms-transition: opacity 500ms ease;
    163     -o-transition: opacity 500ms ease;
    164 
    165     z-index: 1000;
    166 
    167     background-image: url(/wp-admin/images/spinner-2x.gif);
    168     background-color: rgba(255,255,255,0.4);
    169     background-position: center center;
    170     background-repeat: no-repeat;
     148    content: "";
     149    display: block;
     150    position: absolute;
     151
     152    top: 0;
     153    left: 0;
     154    right: 0;
     155    bottom: 0;
     156
     157    opacity: 0;
     158
     159    transition: opacity 500ms ease;
     160    -webkit-transition: opacity 500ms ease;
     161    -moz-transition: opacity 500ms ease;
     162    -ms-transition: opacity 500ms ease;
     163    -o-transition: opacity 500ms ease;
     164
     165    z-index: 1000;
     166
     167    background-image: url(/wp-admin/images/spinner-2x.gif);
     168    background-color: rgba(255,255,255,0.4);
     169    background-position: center center;
     170    background-repeat: no-repeat;
    171171}
    172172.tpc-preloader.is-loading {}
    173173.tpc-preloader.is-hidden:before {
    174     z-index: -1000;
     174    z-index: -1000;
    175175}
    176176.tpc-preloader.is-loading:before {
    177     opacity: 1;
     177    opacity: 1;
    178178}
    179179
    180180.tpc-accordeon-body .dashicons {
    181     float: left;
    182     display: inline-block;
    183     padding: 0;
    184     margin-right: 2px;
    185     color: #ccc;
    186     border: 0 none;
    187 
    188     background: none;
    189 
    190     cursor: pointer;
    191 
    192     transition: color 250ms ease;
    193     -webkit-transition: color 250ms ease;
    194     -moz-transition: color 250ms ease;
    195     -ms-transition: color 250ms ease;
    196     -o-transition: color 250ms ease;
     181    float: left;
     182    display: inline-block;
     183    padding: 0;
     184    margin-right: 2px;
     185    color: #ccc;
     186    border: 0 none;
     187
     188    background: none;
     189
     190    cursor: pointer;
     191
     192    transition: color 250ms ease;
     193    -webkit-transition: color 250ms ease;
     194    -moz-transition: color 250ms ease;
     195    -ms-transition: color 250ms ease;
     196    -o-transition: color 250ms ease;
    197197}
    198198.tpc-accordeon-body .dashicons:focus {
    199     box-shadow: none;
    200     outline: none;
     199    box-shadow: none;
     200    outline: none;
    201201}
    202202.tpc-accordeon-body .configured-item .dashicons {
    203     color: #333;
     203    color: #333;
    204204}
    205205.tpc-accordeon-body .unsaved-item .dashicons {
    206     color: #999;
     206    color: #999;
    207207}
    208208.tpc-accordeon-body .tpc-accordeon-item .dashicons:hover {
    209     color: #000;
     209    color: #000;
    210210}
    211211
    212212/* Modals */
    213213.ui-dialog {
    214     min-width: 30vw;
    215     max-width: 600px;
    216 
    217     width: 90vw;
    218 
    219     margin: 0 auto;
    220 
    221     background-color: #fff;
    222     border: 2px solid #f5f5f5;
    223     border-radius: 2px;
    224 
    225     box-sizing: border-box;
    226 
    227     z-index: 9999;
     214    min-width: 30vw;
     215    max-width: 600px;
     216
     217    width: 90vw;
     218
     219    margin: 0 auto;
     220
     221    background-color: #fff;
     222    border: 2px solid #f5f5f5;
     223    border-radius: 2px;
     224
     225    box-sizing: border-box;
     226
     227    z-index: 9999;
    228228}
    229229.ui-widget-overlay {
    230     background-color: rgba(0, 0, 0, 0.2);
    231     z-index: 9990;
    232     position: fixed;
    233     top: 0;
    234     bottom: 0;
    235     left: 0;
    236     right: 0;
    237     cursor: pointer;
     230    background-color: rgba(0, 0, 0, 0.2);
     231    z-index: 9990;
     232    position: fixed;
     233    top: 0;
     234    bottom: 0;
     235    left: 0;
     236    right: 0;
     237    cursor: pointer;
    238238}
    239239.ui-dialog-titlebar,
    240240.ui-dialog-buttonpane {
    241     padding: 15px;
     241    padding: 15px;
    242242}
    243243.ui-dialog-titlebar {
    244     border-bottom: 2px solid #f5f5f5;
    245     background-color: #fafafa;
    246     padding-right: 30px;
    247     position: relative;
     244    border-bottom: 2px solid #f5f5f5;
     245    background-color: #fafafa;
     246    padding-right: 30px;
     247    position: relative;
    248248}
    249249.ui-dialog-title {
    250     font-weight: bold;
    251     font-size: 1em;
     250    font-weight: bold;
     251    font-size: 1em;
    252252}
    253253
    254254.tpc-dialog {
    255     padding: 15px;
     255    padding: 15px;
    256256}
    257257.tpc-dialog-ui-wrapper {
    258     display: block;
     258    display: block;
    259259}
    260260.tpc-dialog-ui-wrapper + .tpc-dialog-ui-wrapper {
    261     margin-top: 10px;
     261    margin-top: 10px;
    262262}
    263263.tpc-modal-ui-element {
    264     display: block;
    265     min-width: 100%;
    266     max-width: 100%;
     264    display: block;
     265    min-width: 100%;
     266    max-width: 100%;
    267267}
    268268textarea.tpc-modal-ui-element {
    269     min-height: 50px;
    270     max-width: 50vw;
    271     max-height: 300px;
    272     resize: both;
     269    min-height: 50px;
     270    max-width: 50vw;
     271    max-height: 300px;
     272    resize: both;
    273273}
    274274
    275275.tpc-modal-media-element .tpc-modal-ui-preview {
    276     width: 100%;
    277     max-width: 100%;
    278     height: 100px;
    279 
    280     background-size: cover;
    281     background-repeat: no-repeat;
    282     background-position: center;
     276    width: 100%;
     277    max-width: 100%;
     278    height: 100px;
     279
     280    background-size: cover;
     281    background-repeat: no-repeat;
     282    background-position: center;
    283283}
    284284.tpc-modal-media-element.is-empty .tpc-button-group {
    285     padding-right: 0;
     285    padding-right: 0;
    286286}
    287287.tpc-modal-media-element.is-empty .tpc-button-group .button:not(.button-primary),
    288288.tpc-modal-media-element.is-empty .tpc-modal-ui-preview,
    289289.tpc-modal-media-element.is-empty .tpc-delete-button {
    290     display: none;
     290    display: none;
    291291}
    292292.tpc-modal-param-title {
    293     display: inline-block;
    294     margin-bottom: 5px;
     293    display: inline-block;
     294    margin-bottom: 5px;
    295295}
    296296.tpc-modal-ui-preview {
    297     margin-bottom: 5px;
     297    margin-bottom: 5px;
    298298}
    299299.tpc-dialog-insert-shortcode {}
    300300
    301301.ui-button {
    302     background: none;
    303     border: 0 none;
    304     padding: 0;
    305 
    306     display: inline-block;
     302    background: none;
     303    border: 0 none;
     304    padding: 0;
     305
     306    display: inline-block;
    307307}
    308308.ui-dialog-titlebar-close {
    309     cursor: pointer;
    310     position: absolute;
    311     right: 15px;
    312     top: 15px;
     309    cursor: pointer;
     310    position: absolute;
     311    right: 15px;
     312    top: 15px;
    313313}
    314314.ui-dialog-titlebar-close:before {
    315     font-size: 20px;
     315    font-size: 20px;
    316316    line-height: 1;
    317317    font-family: dashicons;
    318318    font-weight: 400;
    319     content: "\f335";
    320     display: inline-block;
    321     color: inherit;
     319    content: "\f335";
     320    display: inline-block;
     321    color: inherit;
    322322}
    323323.ui-dialog-titlebar-close .ui-button-text {
    324     display: none;
     324    display: none;
    325325}
    326326.ui-dialog-titlebar-close:hover {
    327     opacity: 0.7;
     327    opacity: 0.7;
    328328}
    329329
    330330.ui-dialog-buttonpane {
    331     clear: both;
     331    clear: both;
    332332}
    333333.ui-dialog-buttonpane .ui-button + .ui-button {
    334     margin-left: 15px;
     334    margin-left: 15px;
    335335}
    336336
    337337/* Buttons */
    338338.tpc-button-group {
    339     position: relative;
    340     padding-right: 40px;
     339    position: relative;
     340    padding-right: 40px;
    341341}
    342342.tpc-button-group:before,
    343343.tpc-button-group:after {
    344     content: "";
    345     display: table;
    346     clear: both;
     344    content: "";
     345    display: table;
     346    clear: both;
    347347}
    348348.tpc-button-group > * {
    349     float: left;
     349    float: left;
    350350}
    351351.tpc-button-group > *:first-child {
    352     border-top-right-radius: 0px;
    353     border-bottom-right-radius: 0px;
     352    border-top-right-radius: 0px;
     353    border-bottom-right-radius: 0px;
    354354}
    355355.tpc-button-group > *:last-child {
    356     border-top-left-radius: 0px;
    357     border-bottom-left-radius: 0px;
     356    border-top-left-radius: 0px;
     357    border-bottom-left-radius: 0px;
    358358}
    359359.tpc-button-group .button-primary {
    360     width: 100%;
     360    width: 100%;
    361361}
    362362.tpc-button-group .button:not(.button-primary) {
    363     position: absolute;
    364     width: 40px;
    365     min-width: 40px;
    366 
    367     top: 0;
    368     bottom: 0;
    369     right: 0;
     363    position: absolute;
     364    width: 40px;
     365    min-width: 40px;
     366
     367    top: 0;
     368    bottom: 0;
     369    right: 0;
    370370}
    371371.tpc-button-group.tpc-top-stacked > *:first-child {
    372     border-top-left-radius: 0px;
     372    border-top-left-radius: 0px;
    373373}
    374374.tpc-button-group.tpc-top-stacked > *:last-child {
    375     border-top-right-radius: 0px;
     375    border-top-right-radius: 0px;
    376376}
    377377
    378378/* Spinner */
    379379.tpc-columns-wrapper label + .ui-spinner {
    380     display: block;
     380    display: block;
    381381}
    382382.tpc-columns-wrapper .ui-spinner {
    383     display: inline-block;
    384     position: relative;
     383    display: inline-block;
     384    position: relative;
    385385}
    386386.tpc-columns-wrapper .ui-spinner .ui-spinner-button {
    387     position: absolute;
    388     cursor: pointer;
    389 
    390     user-select: none;
    391 
    392     right: 3px;
     387    position: absolute;
     388    cursor: pointer;
     389
     390    user-select: none;
     391
     392    right: 3px;
    393393}
    394394.tpc-columns-wrapper .ui-spinner .ui-spinner-up {
    395     top: -3px;
    396     z-index: 10;
     395    top: -3px;
     396    z-index: 10;
    397397}
    398398.tpc-columns-wrapper .ui-spinner .ui-spinner-down {
    399     bottom: -3px;
     399    bottom: -3px;
    400400}
    401401.tpc-columns-wrapper .ui-spinner-input {
    402     padding-right: 14px;
     402    padding-right: 14px;
    403403}
    404404
     
    406406/* TPC Dashicons */
    407407.tpc-dashicons-middled {
    408     vertical-align: middle;
     408    vertical-align: middle;
    409409}
    410410
     
    413413}
    414414.tpc-settings-page h2 {
    415     margin-bottom: 30px !important;
     415    margin-bottom: 30px !important;
    416416}
    417417.tpc-form-group {
    418     display: block;
    419     margin-top: 10px;
     418    display: block;
     419    margin-top: 10px;
    420420}
    421421.tpc-form-group:first-child {
    422     margin-top: 0;
     422    margin-top: 0;
    423423}
    424424
    425425.tpc-form-group {
    426     font-size: 1.2em;
     426    font-size: 1.2em;
    427427}
    428428
    429429.tpc-form-group span {
    430     margin: 10px 0;
     430    margin: 10px 0;
    431431}
    432432.tpc-form-group small {
     
    434434.tpc-form-group input,
    435435.tpc-form-group select {
    436     margin-top: 10px;
    437     min-width: 250px;
    438 }
     436    margin-top: 10px;
     437    min-width: 250px;
     438}
  • tea-page-content/trunk/assets/css/tea-page-content-main.css

    r1560974 r1643034  
    11.tpc-shortcode-main-title {
    2     margin-bottom: 1.5em;
    3     color: inherit;
    4     font-size: 2em;
     2    margin-bottom: 1.5em;
     3    color: inherit;
     4    font-size: 2em;
    55}
    66
    77.tpc-block {
    8     margin: 1em auto;
    9     font-size: inherit;
     8    margin: 1em auto;
     9    font-size: inherit;
    1010}
    1111
    1212.tpc-body .tpc-title {
    13     margin-bottom: 0.5em;
     13    margin-bottom: 0.5em;
    1414}
    1515.tpc-body .tpc-title:first-child {
    16     margin-top: 0;
     16    margin-top: 0;
    1717}
    1818.tpc-body .tpc-title:last-child {
    19     margin-bottom: 0;
     19    margin-bottom: 0;
    2020}
    2121
    2222.tpc-thumbnail {
    23     font-size: 0; /* Need for fix spaces between inline-block elements */
    24     padding-bottom: 0.5em;
     23    padding-bottom: 0.5em;
    2524}
    2625.tpc-thumbnail:last-child {
    27     padding-bottom: 0;
     26    padding-bottom: 0;
    2827}
    2928
    3029/* Need cascade here */
    3130.tpc-thumbnail .tpc-thumbnail-link {
    32     display: inline-block;
    33     text-decoration: none;
    34     border-bottom: 0 none;
     31    display: inline-block;
     32    text-decoration: none;
     33    border-bottom: 0 none;
    3534}
    3635.tpc-thumbnail .tpc-thumbnail-link:hover {
    37     opacity: 0.85;
     36    opacity: 0.85;
    3837}
    3938
    4039.tpc-entry-block {}
    4140.tpc-entry-block {
    42     padding-bottom: 1.5em;
     41    padding-bottom: 1.5em;
    4342}
    4443
    4544
    4645.tpc-widget-title {
    47     padding: 0.5em 0;
     46    padding: 0.5em 0;
    4847}
    4948
     
    5150
    5251.tpc-widget-title h3 {
    53     font-size: 1.5em;
    54     font-weight: bold;
     52    font-size: 1.5em;
     53    font-weight: bold;
    5554}
    5655
    5756/* Styles for blocks that embed in page */
    5857.entry-content .tpc-title {
    59     margin-top: 0;
     58    margin-top: 0;
    6059}
    6160.entry-content .tpc-entry-block + .tpc-entry-block {
    62     margin-top: 1em;
     61    margin-top: 1em;
    6362}
    6463.entry-content .tpc-body {
    65     padding-right: 0;
    66     padding-left: 0;
     64    padding-right: 0;
     65    padding-left: 0;
    6766}
    6867
    6968/* Default Template */
    7069.tpc-default + .tpc-default {
    71     margin-top: 1.5em;
     70    margin-top: 1.5em;
    7271}
    7372
     
    7574.tpc-default-padded .tpc-body,
    7675.tpc-default-padded .tpc-thumbnail {
    77     padding-left: 1em;
    78     padding-right: 1em;
     76    padding-left: 1em;
     77    padding-right: 1em;
    7978}
    8079.tpc-default-padded .tpc-thumbnail {
    81     padding-bottom: 0.5em;
     80    padding-bottom: 0.5em;
    8281}
    8382
    8483/* Bootstrap Template */
    8584.tpc-bootstrap .tpc-entry-block {
    86     margin-bottom: 30px; /* default bootstrap gutter width */
     85    margin-bottom: 30px; /* default bootstrap gutter width */
    8786}
    8887.tpc-bootstrap .row:last-child .tpc-entry-block:last-child {
    89     margin-bottom: 0;
     88    margin-bottom: 0;
    9089}
    9190
     
    101100}
    102101.tpc-waterfall-col {
    103     float: left;
     102    float: left;
    104103
    105     padding: 0.5em 1em;
     104    padding: 0.5em 1em;
    106105
    107     display: block;
    108     box-sizing: border-box;
     106    display: block;
     107    box-sizing: border-box;
    109108
    110     max-width: 100%;
     109    max-width: 100%;
    111110}
    112111.tpc-waterfall .tpc-entry-block {
    113     width: 100%;
     112    width: 100%;
    114113}
    115114.tpc-waterfall .tpc-entry-block:last-child {
    116     margin-bottom: 0;
     115    margin-bottom: 0;
    117116}
  • tea-page-content/trunk/assets/js/tea-page-content-api.js

    r1560974 r1643034  
    173173                }
    174174
    175                 // Spinners set {1} make dis shit dry
    176175                TeaPageContent_API.handlers.widgets.spinners_init($variablesArea.find('.tpc-spinner'));
    177176
  • tea-page-content/trunk/config.php

    r1560974 r1643034  
    11<?php
    2 /**
    3  * @package Tea Page Content
    4  * @version 1.2.3
    5  */
    62
    73return array(
    8     // Predefined default values, e.g. default parameters
    9     'defaults' => array(
    10         'widget' => array(
    11             'title' => '',
    12             'posts' => '',
    13             'show_page_thumbnail' => true,
    14             'show_page_content' => true,
    15             'show_page_title' => true,
    16             'linked_page_title' => false,
    17             'linked_page_thumbnail' => false,
    18             'template' => 'default',
    19             'order' => 'desc',
    20             'per-page' => -1,
     4    // Predefined default values, e.g. default parameters
     5    'defaults' => array(
     6        'widget' => array(
     7            'title' => '',
     8            'posts' => '',
     9            'show_page_thumbnail' => true,
     10            'show_page_content' => true,
     11            'show_page_title' => true,
     12            'linked_page_title' => false,
     13            'linked_page_thumbnail' => false,
     14            'template' => 'default',
    2115
    22             'caller' => 'widget',
    23         ),
    24         'shortcode' => array(
    25             'title' => '',
    26             'posts' => '',
    27             'id' => '', // @deprecated since 1.1
    28             'template' => 'default',
    29             'show_page_thumbnail' => true,
    30             'show_page_content' => true,
    31             'show_page_title' => true,
    32             'linked_page_title' => false,
    33             'linked_page_thumbnail' => false,
    34             'order' => 'desc',
     16            'order' => 'desc',
     17            'orderby' => 'date',
    3518
    36             'caller' => 'shortcode',
    37         ),
    38         'post-types' => array(
    39             'public' => true,
    40         ),
    41         'posts' => array(
    42             'post_status' => 'publish', // may be an array too
    43             'has_password' => false,
    44         ),
    45         'template-variables' => array(
    46             'type' => 'text',
    47             'defaults' => '',
    48         ),
    49         'page-variables' => array(
    50             'page_title' => array( // @todo include {prefix} placeholder for DRY
    51                 'type' => 'text',
    52                 'title' => __('Title', 'tea-page-content')
    53             ),
    54             'page_content' => array(
    55                 'type' => 'textarea',
    56                 'title' => __('Content', 'tea-page-content')
    57             ),
    58             'page_thumbnail' => array(
    59                 'type' => 'media',
    60                 'title' => __('Thumbnail', 'tea-page-content')
    61             )
    62         )
    63     ),
     19            'caller' => 'widget',
     20        ),
    6421
    65     // Predefined system values, e.g. logical operators, needly constants or system paths
    66     'system' => array(
    67         'posts' => array(
    68             'types-operator' => 'or',
    69         ),
    70         'predefined-templates' => array(
    71             // @deprecated default-padded template, since 1.1
    72             'default', 'default-padded', 'bootstrap-3', 'bootstrap-4', 'waterfall'
    73         ),
    74         'template-variables' => array(
    75             'mask' => array(
    76                 'name', 'type', 'defaults'
    77             ),
    78         ),
    79         'page-variables' => array(
    80             'prefix' => 'page_'
    81         ),
    82         'template-directories' => array(
    83             'plugin' => TEA_PAGE_CONTENT_PATH . '/templates/',
    84             'theme' => get_stylesheet_directory() . '/templates/'
    85         ),
    86         'versions' => array(
    87             'plugin' => '1.2.3',
    88             'scripts' => '1.2.3',
    89             'styles' => '1.2.3'
    90         ),
     22        'shortcode' => array(
     23            'title' => '',
     24            'posts' => '',
     25            'template' => 'default',
     26            'show_page_thumbnail' => true,
     27            'show_page_content' => true,
     28            'show_page_title' => true,
     29            'linked_page_title' => false,
     30            'linked_page_thumbnail' => false,
    9131
    92         'settings' => array(
    93             'include-css' => true,
    94         ),
    95     )
     32            'order' => 'desc',
     33            'orderby' => 'date',
     34
     35            'caller' => 'shortcode',
     36        ),
     37
     38        'post-types' => array(
     39            'public' => true,
     40        ),
     41
     42        'posts' => array(
     43            'post_status' => 'publish', // may be an array too
     44            'has_password' => false,
     45            'posts_per_page' => -1,
     46            'order' => 'desc',
     47            'orderby' => 'date',
     48            'post__in' => [],
     49        ),
     50
     51        'template-variables' => array(
     52            'type' => 'text',
     53            'defaults' => '',
     54        ),
     55        'page-variables' => array(
     56            'page_title' => array(
     57                'type' => 'text',
     58                'title' => __('Title', 'tea-page-content')
     59            ),
     60            'page_content' => array(
     61                'type' => 'textarea',
     62                'title' => __('Content', 'tea-page-content')
     63            ),
     64            'page_thumbnail' => array(
     65                'type' => 'media',
     66                'title' => __('Thumbnail', 'tea-page-content')
     67            ),
     68        ),
     69
     70        'thumbnails' => [
     71            'size' => 'post-thumbnail',
     72        ],
     73
     74        'templates' => [
     75            'admin' => [
     76                'partials' => [
     77                    'template-variables' => [
     78                        'name' => 'template-variables',
     79                        'path' => '{admin}/partials/',
     80                    ],
     81                ],
     82                'modals' => [
     83                    'page-variables' => [
     84                        'name' => 'page-variables',
     85                        'path' => '{admin}/modals/',
     86                    ],
     87                    'insert-shortcode' => [
     88                        'name' => 'insert-shortcode',
     89                        'path' => '{admin}/modals/',
     90                    ],
     91                ],
     92                'pages' => [
     93                    'settings' => [
     94                        'name' => 'settings',
     95                        'path' => '{admin}/pages/',
     96                    ]
     97                ],
     98                'modules' => [
     99                    'widget' => [
     100                        'name' => 'widget',
     101                        'path' => '{admin}/modules/',
     102                    ]
     103                ],
     104            ],
     105
     106            'client' => [
     107                'default-template' => 'default',
     108                'widget' => [
     109                    'name' => 'widget',
     110                    'path' => '{client}/modules/',
     111                ],
     112            ],
     113        ],
     114    ),
     115
     116    // Predefined system values, e.g. logical operators, needly constants or system paths
     117    'system' => array(
     118        'posts' => array(
     119            'types-operator' => 'or',
     120        ),
     121        'predefined-templates' => array(
     122            'default', 'bootstrap-3', 'bootstrap-4', 'waterfall'
     123        ),
     124        'template-variables' => array(
     125            'mask' => [
     126                'structure' => [
     127                    'name', 'type', 'defaults'
     128                ],
     129                'placeholder' => '{mask}'
     130            ]
     131        ),
     132        'page-variables' => array(
     133            'prefix' => 'page_'
     134        ),
     135        'template-directories' => array(
     136            'plugin' => [
     137                'placeholder' => '{plugin}',
     138                'path' => \TeaPageContent\PLUGIN_PATH,
     139            ],
     140
     141            'admin' => [
     142                'placeholder' => '{admin}',
     143                'path' => \TeaPageContent\PLUGIN_PATH . '/templates/admin',
     144            ],
     145            'client' => [
     146                'placeholder' => '{client}',
     147                'path' => \TeaPageContent\PLUGIN_PATH . '/templates/client',
     148            ],
     149            'layouts' => [
     150                'placeholder' => '{layouts}',
     151                'path' => \TeaPageContent\PLUGIN_PATH . '/templates/client/layouts',
     152            ],
     153
     154            'theme' => [
     155                'placeholder' => '{theme}',
     156                'path' => get_stylesheet_directory() . '/templates',
     157            ],
     158        ),
     159        'versions' => array(
     160            'plugin' => '1.3.0',
     161            'scripts' => '1.2.3',
     162            'styles' => '1.2.3',
     163        ),
     164
     165        'settings' => array(
     166            'include-css' => true,
     167        ),
     168    )
    96169);
  • tea-page-content/trunk/readme.ru_RU.txt

    r1560974 r1643034  
    22Contributors: Tsjuder
    33Tags: plugin, widget, shortcode, posts, post, pages, page, content, template, templates
    4 Requires at least: 4.0, PHP 5.3
     4Requires at least: 4.0, PHP 5.6
    55Tested up to: 4.7
    6 Stable tag: 1.2.3
     6Stable tag: 1.3.0
    77Author URI: https://github.com/Tsjuder
    88Plugin URI: http://tsjuder.github.io/tea-page-content/
     
    6464
    6565== Changelog ==
     66= 1.3.0 =
     67* \! **минимально совместимая версия PHP - PHP 5.6**
     68* \+ устранен баг с неработающим фильтром `tpc_config_array`
     69* \+ добавлена возможность выбирать поле, по которому сортируем
     70* \+ изменение в поведении: проверка количества постов в клиентском шаблоне производится нативным образом
     71* \+  шаблоны bootstrap x.x внесена возможность выбирать, на основе какого breakpoint будет производиться вычисление стартовых элементов в строке
     72* \- удалены все deprecated (default-padded, id параметр у шорткода, thumbnail параметр)
     73* \* совместимость с PHP7
     74* \* повышена производительность
     75* \* исправлен баг с некорректной обработкой некоторых имен переменных уровня шаблона
     76* \* global refactoring
     77
    6678= 1.2.3 =
    6779* \+ New template "Waterfall" added
    6880* \+ New template "Bootstrap 4" added
    69 * \+ New type of page variables - jquery ui spinner
    70 * \+ Added filters for changing column count in "Bootstrap X" templates
    71 * \* Template "Bootstrap 3" was improved
    7281* \* Checked for Wordpress 4.7 support
    7382
  • tea-page-content/trunk/readme.txt

    r1560974 r1643034  
    22Contributors: Tsjuder
    33Tags: plugin, widget, shortcode, posts, post, pages, page, content, template, templates
    4 Requires at least: 4.0, PHP 5.3
     4Requires at least: WP 4.0, PHP 5.6
    55Tested up to: 4.7
    6 Stable tag: 1.2.3
     6Stable tag: 1.3.0
    77Author URI: https://github.com/Tsjuder
    88Plugin URI: http://tsjuder.github.io/tea-page-content/
     
    1414== Description ==
    1515
    16 Tea Page Content is a powerful plugin that allows create blocks with content of any page, post, etc, and customize look of blocks via template system. You can select one or more entries, choose template (or create your own) and display it by widget or shortcode. Templates presents very flexible system for appearance control of created blocks. At this moment there is a two built-in templates: default and bootstrap 3.x.
     16Tea Page Content is a powerful plugin that allows create widget or shortcode with content of any page, post, etc, and customize look of blocks via template system. You can select one or more entries, choose template (or create your own) and display it by widget or shortcode. Templates presents very flexible system for appearance control.
    1717
    1818= Key features =
     
    6060
    6161== Changelog ==
     62= 1.3.0 =
     63* \! **Bump minimal required PHP version to PHP 5.6**
     64* \+ Now you can select `sortby` natively
     65* \+ Added native validation of entries count. No more checks in templates!
     66* \+ In Bootstrap templates added possibility to choose base breakpoint
     67* \- Removed support of all deprecated features (`default-padded` template, `id` shortcode param, `thumbnail` param)
     68* \* Full compatibility with PHP7
     69* \* Improved performance
     70* \* Fix bug with "dead" filter `tpc_config_array`
     71* \* Fix bug with incorrect handling names of template-level variables in some cases
     72* \* Global code refactoring. Clean and shiny!
     73
    6274= 1.2.3 =
    6375* \+ New template "Waterfall" added
    6476* \+ New template "Bootstrap 4" added
    65 * \+ New type of page variables - jquery ui spinner
    66 * \+ Added filters for changing column count in "Bootstrap X" templates
    67 * \* Template "Bootstrap 3" was improved
    6877* \* Checked for Wordpress 4.7 support
    6978
  • tea-page-content/trunk/tea-page-content.php

    r1560974 r1643034  
    44Plugin URI: http://tsjuder.github.io/tea-page-content
    55Description: This plugin allows create blocks with content of any post, and customize look of blocks via templates. Widget, shortcode, all post types is supported.
    6 Version: 1.2.3
     6Version: 1.3.0
    77Text Domain: tea-page-content
    88Domain Path: /languages/
     
    3434*/
    3535
    36 // Necessary constants
    37 define('TEA_PAGE_CONTENT_FILE', __FILE__);
    38 define('TEA_PAGE_CONTENT_PATH', dirname(__FILE__));
    39 define('TEA_PAGE_CONTENT_FOLDER', basename(TEA_PAGE_CONTENT_PATH));
     36namespace TeaPageContent;
    4037
    41 // Includes a core
    42 require_once(TEA_PAGE_CONTENT_PATH . '/tea-page-content.class.php');
     38use TeaPageContent\App\DependencyInjector;
     39use TeaPageContent\App\Main;
    4340
    44 // Includes a classes
    45 require_once(TEA_PAGE_CONTENT_PATH . '/classes/config.class.php');
    46 require_once(TEA_PAGE_CONTENT_PATH . '/classes/helper.class.php');
     41define(__NAMESPACE__ . '\\MIN_PHP_REQUIRED', 5.6);
     42define(__NAMESPACE__ . '\\PLUGIN_FILE', __FILE__);
     43define(__NAMESPACE__ . '\\PLUGIN_PATH', dirname(PLUGIN_FILE));
     44define(__NAMESPACE__ . '\\PLUGIN_FOLDER', basename(PLUGIN_PATH));
    4745
    48 // Includes a modules
    49 require_once(TEA_PAGE_CONTENT_PATH . '/modules/shortcode.php');
    50 require_once(TEA_PAGE_CONTENT_PATH . '/modules/widget.php');
     46// Functions
     47function get_major_php_version() {
     48    $php_version = explode('.', PHP_VERSION);
     49    $php_version = (float)implode('.', array_splice($php_version, 0, 2));
    5150
    52 // Gets an instance
    53 $tpcEngine = new TeaPageContent;
     51    return $php_version;
     52}
    5453
    55 add_action('plugins_loaded', array($tpcEngine, 'initialize'));
     54function run() {
     55    spl_autoload_register(__NAMESPACE__ . '\\autoload');
     56
     57    $DependencyInjector = new DependencyInjector;
     58    $Main = new Main($DependencyInjector);
     59
     60    spl_autoload_unregister(__NAMESPACE__ . '\\autoload');
     61
     62    add_action('plugins_loaded', array($Main, 'init'));
     63}
     64
     65function autoload($class_name) {
     66    $parsed_class_name = explode('\\', $class_name);
     67
     68    if($parsed_class_name[0] === __NAMESPACE__) {
     69        unset($parsed_class_name[0]);
     70    }
     71
     72    include PLUGIN_PATH . '/' . implode('/', $parsed_class_name) . '.php';
     73}
     74
     75// Check minimal PHP installed
     76if(get_major_php_version() < MIN_PHP_REQUIRED) {
     77    if(is_admin()) {
     78        add_action('admin_notices', function() {
     79            $message = __('<b>Important!</b> Your version of PHP is less than <b>%s</b>! Tea Page Content plugin will <b>NOT</b> run. Upgrade your PHP to version <b>%s</b> or higher. This is a minimal technical requirements.');
     80            $content = '<div class="error notice"><p>' . $message . '</p></div>';
     81
     82            echo sprintf($content, MIN_PHP_REQUIRED, MIN_PHP_REQUIRED);
     83        });
     84    }
     85
     86    return;
     87}
     88
     89// Impossible to load via autoload
     90require_once(PLUGIN_PATH . '/App/Modules/Widget.php');
     91
     92// Start the app
     93run();
  • tea-page-content/trunk/templates/admin/modals/insert-shortcode.php

    r1643033 r1643034  
    11<form id="tpc-call-shortcode-modal" class="tpc-dialog tpc-dialog-insert-shortcode hidden tpc-preloader is-hidden" autocomplete="off">
    2     <div class="tpc-columns-wrapper">
    3         <div class="tpc-column tpc-full-width">
    4             <p>
    5                 <label for="tpc-title">
    6                     <?php _e('Title', 'tea-page-content'); ?>:
    7                 </label>
    8                 <input class="widefat" type="text" id="tpc-title" name="title" value="" />
    9             </p>
    10         </div>
     2    <div class="tpc-columns-wrapper">
     3        <div class="tpc-column tpc-full-width">
     4            <p>
     5                <label for="tpc-title">
     6                    <?php _e('Title', 'tea-page-content'); ?>:
     7                </label>
     8                <input class="widefat" type="text" id="tpc-title" name="title" value="" />
     9            </p>
     10        </div>
    1111
    12         <div class="tpc-columns-group">
    13             <div class="tpc-column">
    14                 <?php if(is_array($entries) && count($entries)) : ?>
    15                     <span class="tpc-column-label">
    16                         <?php _e('Please, select one or more posts from lists below:', 'tea-page-content') ?>
    17                     </span>
     12        <div class="tpc-columns-group">
     13            <div class="tpc-column">
     14                <?php if(is_array($entries) && count($entries)) : ?>
     15                    <span class="tpc-column-label">
     16                        <?php _e('Please, select one or more posts from lists below:', 'tea-page-content') ?>
     17                    </span>
    1818
    19                     <div class="tpc-posts-list">
    20                         <?php foreach ($entries as $postType => $postsByType) : ?>
    21                         <div class="tpc-post-type-block tpc-accordeon">
    22                        
    23                             <div class="tpc-accordeon-top">
    24                                 <h4><?php echo $postType ?></h4>
    25                             </div>
     19                    <div class="tpc-posts-list">
     20                        <?php foreach ($entries as $postType => $postsByType) : ?>
     21                        <div class="tpc-post-type-block tpc-accordeon">
     22                       
     23                            <div class="tpc-accordeon-top">
     24                                <h4><?php echo $postType ?></h4>
     25                            </div>
    2626
    27                             <div class="tpc-accordeon-body">
    28                             <?php foreach ($postsByType as $postKey => $postData) : ?>
     27                            <div class="tpc-accordeon-body">
     28                            <?php foreach ($postsByType as $postKey => $postData) : ?>
    2929
    30                                 <label for="tpc-posts-<?php echo $postData['id'] ?>" class="tpc-accordeon-item" id="tpc-item-<?php echo $postData['id'] ?>">
    31                                     <a href="#" data-item="tpc-item-<?php echo $postData['id'] ?>" data-title="<?php echo $postData['title'] ?>" data-id="<?php echo $postData['id'] ?>" data-modal="tpc-call-item-options-modal" data-target="tpc-page_variables-<?php echo $postData['id'] ?>" class="tpc-call-modal-button tpc-call-item-options-modal dashicons dashicons-admin-generic" title="<?php _e('Open page level options', 'tea-page-content') ?>"></a>
     30                                <label for="tpc-posts-<?php echo $postData['id'] ?>" class="tpc-accordeon-item" id="tpc-item-<?php echo $postData['id'] ?>">
     31                                    <a href="#" data-item="tpc-item-<?php echo $postData['id'] ?>" data-title="<?php echo $postData['title'] ?>" data-id="<?php echo $postData['id'] ?>" data-modal="tpc-call-item-options-modal" data-target="tpc-page_variables-<?php echo $postData['id'] ?>" class="tpc-call-modal-button tpc-call-item-options-modal dashicons dashicons-admin-generic" title="<?php _e('Open page level options', 'tea-page-content') ?>"></a>
    3232
    33                                     <input type="checkbox" name="posts[]" id="tpc-posts-<?php echo $postData['id'] ?>" value="<?php echo $postData['id'] ?>" />
     33                                    <input type="checkbox" name="posts[]" id="tpc-posts-<?php echo $postData['id'] ?>" value="<?php echo $postData['id'] ?>" />
    3434
    35                                     <input type="hidden" name="page_variables[<?php echo $postData['id'] ?>]" id="tpc-page_variables-<?php echo $postData['id'] ?>" value="" data-thumbnail-url="" autocomplete="off" />
     35                                    <input type="hidden" name="page_variables[<?php echo $postData['id'] ?>]" id="tpc-page_variables-<?php echo $postData['id'] ?>" value="" data-thumbnail-url="" autocomplete="off" />
    3636
    37                                     <span class="tpc-item-title" title="<?php echo $postData['title'] ?>"><?php echo $postData['title'] ?></span>
    38                                 </label>
    39                             <?php endforeach; ?>
    40                             </div>
     37                                    <span class="tpc-item-title" title="<?php echo $postData['title'] ?>"><?php echo $postData['title'] ?></span>
     38                                </label>
     39                            <?php endforeach; ?>
     40                            </div>
    4141
    42                         </div>
    43                         <?php endforeach; ?>
    44                     </div>
    45                 <?php endif; ?>
    46             </div>
     42                        </div>
     43                        <?php endforeach; ?>
     44                    </div>
     45                <?php endif; ?>
     46            </div>
    4747
    48             <div class="tpc-column">
    49                 <p>
    50                     <label for="tpc-order">
    51                         <?php _e('Order (by date)', 'tea-page-content'); ?>:
    52                     </label>
    53                     <select class="widefat" id="tpc-order" name="order">
    54                         <option value="desc">
    55                             <?php _e('Descending', 'tea-page-content') ?>
    56                         </option>
    57                         <option value="asc">
    58                             <?php _e('Ascending', 'tea-page-content') ?>
    59                         </option>
    60                     </select>
    61                 </p>
     48            <div class="tpc-column">
     49                <p>
     50                    <label for="tpc-order">
     51                        <?php _e('Order', 'tea-page-content'); ?>:
     52                    </label>
     53                    <select class="widefat" id="tpc-order" name="order">
     54                        <option value="desc">
     55                            <?php _e('Descending', 'tea-page-content') ?>
     56                        </option>
     57                        <option value="asc">
     58                            <?php _e('Ascending', 'tea-page-content') ?>
     59                        </option>
     60                    </select>
     61                </p>
    6262
    63                 <p>
    64                     <label for="tpc-show_page_thumbnail">
    65                         <?php $checked = (isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail']) ? 'checked' : '';  ?>
     63                <p>
     64                    <label for="tpc-orderby">
     65                        <?php _e('Order by', 'tea-page-content'); ?>:
     66                    </label>
     67                    <select class="widefat" name="orderby">
     68                        <option value="date">
     69                            <?php _e('Date', 'tea-page-content') ?>
     70                        </option>
     71                        <option value="title">
     72                            <?php _e('Original title', 'tea-page-content') ?>
     73                        </option>
     74                        <option value="type">
     75                            <?php _e('Post type', 'tea-page-content') ?>
     76                        </option>
     77                        <option value="comment_count">
     78                            <?php _e('Comment count', 'tea-page-content') ?>
     79                        </option>
     80                        <option value="relevance">
     81                            <?php _e('Relevance', 'tea-page-content') ?>
     82                        </option>
     83                        <option value="rand">
     84                            <?php _e('Random', 'tea-page-content') ?>
     85                        </option>
     86                        <option value="post__in">
     87                            <?php _e('As Is (as typed)', 'tea-page-content') ?>
     88                        </option>
     89                    </select>
     90                </p>
    6691
    67                         <input class="widefat" type="checkbox" id="tpc-show_page_thumbnail" name="show_page_thumbnail" value="1" <?php echo $checked ?> />
    68                         <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
    69                     </label>
     92                <p>
     93                    <label for="tpc-show_page_thumbnail">
     94                        <?php $checked = (isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail']) ? 'checked' : '';  ?>
    7095
    71                     <br />
     96                        <input class="widefat" type="checkbox" id="tpc-show_page_thumbnail" name="show_page_thumbnail" value="1" <?php echo $checked ?> />
     97                        <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
     98                    </label>
    7299
    73                     <label for="tpc-show_page_title">
    74                         <?php $checked = (isset($instance['show_page_title']) && $instance['show_page_title']) ? 'checked' : '';  ?>
     100                    <br />
    75101
    76                         <input class="widefat" type="checkbox" id="tpc-show_page_title" name="show_page_title" value="1" <?php echo $checked ?> />
    77                         <span><?php _e('Show page title', 'tea-page-content'); ?></span>
    78                     </label>
     102                    <label for="tpc-show_page_title">
     103                        <?php $checked = (isset($instance['show_page_title']) && $instance['show_page_title']) ? 'checked' : '';  ?>
    79104
    80                     <br />
     105                        <input class="widefat" type="checkbox" id="tpc-show_page_title" name="show_page_title" value="1" <?php echo $checked ?> />
     106                        <span><?php _e('Show page title', 'tea-page-content'); ?></span>
     107                    </label>
    81108
    82                     <label for="tpc-show_page_content">
    83                         <?php $checked = (isset($instance['show_page_content']) && $instance['show_page_content']) ? 'checked' : '';  ?>
     109                    <br />
    84110
    85                         <input class="widefat" type="checkbox" id="tpc-show_page_content" name="show_page_content" value="1" <?php echo $checked ?> />
    86                         <span><?php _e('Show page content', 'tea-page-content'); ?></span>
    87                     </label>
     111                    <label for="tpc-show_page_content">
     112                        <?php $checked = (isset($instance['show_page_content']) && $instance['show_page_content']) ? 'checked' : '';  ?>
    88113
    89                     <br />
     114                        <input class="widefat" type="checkbox" id="tpc-show_page_content" name="show_page_content" value="1" <?php echo $checked ?> />
     115                        <span><?php _e('Show page content', 'tea-page-content'); ?></span>
     116                    </label>
    90117
    91                     <label for="tpc-linked_page_title">
    92                         <?php $checked = (isset($instance['linked_page_title']) && $instance['linked_page_title']) ? 'checked' : '';  ?>
     118                    <br />
    93119
    94                         <input class="widefat" type="checkbox" id="tpc-linked_page_title" name="linked_page_title" value="1" <?php echo $checked ?> />
    95                         <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
    96                     </label>
     120                    <label for="tpc-linked_page_title">
     121                        <?php $checked = (isset($instance['linked_page_title']) && $instance['linked_page_title']) ? 'checked' : '';  ?>
    97122
    98                     <br />
     123                        <input class="widefat" type="checkbox" id="tpc-linked_page_title" name="linked_page_title" value="1" <?php echo $checked ?> />
     124                        <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
     125                    </label>
    99126
    100                     <label for="tpc-linked_page_thumbnail">
    101                         <?php $checked = (isset($instance['linked_page_thumbnail']) && $instance['linked_page_thumbnail']) ? 'checked' : '';  ?>
    102                        
    103                         <input class="widefat" type="checkbox" id="tpc-linked_page_thumbnail" name="linked_page_thumbnail" value="1" <?php echo $checked ?> />
    104                         <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
    105                     </label>
    106                 </p>
    107             </div>
    108         </div>
     127                    <br />
    109128
    110         <div class="tpc-column tpc-full-width">
     129                    <label for="tpc-linked_page_thumbnail">
     130                        <?php $checked = (isset($instance['linked_page_thumbnail']) && $instance['linked_page_thumbnail']) ? 'checked' : '';  ?>
     131                       
     132                        <input class="widefat" type="checkbox" id="tpc-linked_page_thumbnail" name="linked_page_thumbnail" value="1" <?php echo $checked ?> />
     133                        <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
     134                    </label>
     135                </p>
     136            </div>
     137        </div>
    111138
    112             <p class="tpc-preloader is-hidden">
    113                 <label for="tpc-template">
    114                     <?php _e('Template', 'tea-page-content'); ?>:
    115                 </label>
    116                 <select class="widefat tpc-template-list" data-variables-area="tpc-template-variables-wrapper" id="tpc-template" name="template" autocomplete="off">
    117                     <?php foreach ($templates as $alias) : ?>
    118                         <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
    119                         <option value="<?php echo $alias ?>" <?php echo $selected ?>>
    120                             <?php echo ucwords(str_replace(array('.php', 'tpc-', '-'), ' ', $alias)) ?>
    121                         </option>
    122                     <?php endforeach; ?>
    123                 </select>
    124             </p>
     139        <div class="tpc-column tpc-full-width">
    125140
    126             <div class="tpc-template-params" id="tpc-template-variables-wrapper" data-mask-name="{mask}">
    127                 <?php echo $partials['template_variables'] ?>
    128             </div>
    129         </div>
    130     </div>
     141            <p class="tpc-preloader is-hidden">
     142                <label for="tpc-template">
     143                    <?php _e('Template', 'tea-page-content'); ?>:
     144                </label>
     145                <select class="widefat tpc-template-list" data-variables-area="tpc-template-variables-wrapper" id="tpc-template" name="template" autocomplete="off">
     146                    <?php foreach ($templates as $alias) : ?>
     147                        <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
     148                        <option value="<?php echo $alias ?>" <?php echo $selected ?>>
     149                            <?php echo ucwords(str_replace(array('.php', 'tpc-', '-'), ' ', $alias)) ?>
     150                        </option>
     151                    <?php endforeach; ?>
     152                </select>
     153            </p>
     154
     155            <div class="tpc-template-params" id="tpc-template-variables-wrapper" data-mask-name="{mask}">
     156                <?php echo $partials['template_variables'] ?>
     157            </div>
     158        </div>
     159    </div>
    131160</form>
  • tea-page-content/trunk/templates/admin/modules/widget.php

    r1643033 r1643034  
    11<div class="tpc-columns-wrapper">
    2     <div class="tpc-column tpc-full-width">
    3         <p>
    4             <label for="<?php echo $bind->get_field_id('title') ?>">
    5                 <?php _e('Title', 'tea-page-content'); ?>:
    6             </label>
    7             <input class="widefat" type="text" id="<?php echo $bind->get_field_id('title') ?>" name="<?php echo $bind->get_field_name('title') ?>" value="<?php echo $instance['title'] ?>" />
    8         </p>
    9     </div>
     2    <div class="tpc-column tpc-full-width">
     3        <p>
     4            <label for="<?php echo $bind->get_field_id('title') ?>">
     5                <?php _e('Title', 'tea-page-content'); ?>:
     6            </label>
     7            <input class="widefat" type="text" id="<?php echo $bind->get_field_id('title') ?>" name="<?php echo $bind->get_field_name('title') ?>" value="<?php echo $instance['title'] ?>" />
     8        </p>
     9    </div>
    1010
    11     <div class="tpc-columns-group">
    12         <div class="tpc-column">
    13             <?php if(is_array($entries) && count($entries)) : ?>
    14                 <?php $instance['posts'] = unserialize($instance['posts']) ? unserialize($instance['posts']) : array(); ?>
     11    <div class="tpc-columns-group">
     12        <div class="tpc-column">
     13            <?php if(is_array($entries) && count($entries)) : ?>
     14                <?php $instance['posts'] = unserialize($instance['posts']) ? unserialize($instance['posts']) : array(); ?>
    1515
    16                 <span class="tpc-column-label">
    17                     <?php _e('Please, select one or more posts from lists below:', 'tea-page-content') ?>
    18                 </span>
     16                <span class="tpc-column-label">
     17                    <?php _e('Please, select one or more posts from lists below:', 'tea-page-content') ?>
     18                </span>
    1919
    20                 <div class="tpc-posts-list">
    21                     <?php foreach ($entries as $postType => $postsByType) : ?>
    22                     <div class="tpc-post-type-block tpc-accordeon">
    23                    
    24                         <div class="tpc-accordeon-top">
    25                             <h4><?php echo $postType ?></h4>
    26                         </div>
     20                <div class="tpc-posts-list">
     21                    <?php foreach ($entries as $postType => $postsByType) : ?>
     22                    <div class="tpc-post-type-block tpc-accordeon">
     23                   
     24                        <div class="tpc-accordeon-top">
     25                            <h4><?php echo $postType ?></h4>
     26                        </div>
    2727
    28                         <div class="tpc-accordeon-body">
    29                         <?php foreach ($postsByType as $postKey => $postData) : ?>
    30                             <?php $checked = in_array($postData['id'], $instance['posts']) ? 'checked' : ''; ?>
    31                             <?php $raw_page_variables = isset($instance['page_variables'][$postData['id']]) ? $instance['page_variables'][$postData['id']] : '' ; ?>
    32                             <?php $item_class = trim($raw_page_variables) ? 'configured-item' : 'empty-item'; ?>
    33                             <?php $data_thumbnail_url = isset($page_variables[$postData['id']]['page_thumbnail']) ? $page_variables[$postData['id']]['page_thumbnail'] : ''; ?>
     28                        <div class="tpc-accordeon-body">
     29                        <?php foreach ($postsByType as $postKey => $postData) : ?>
     30                            <?php $checked = in_array($postData['id'], $instance['posts']) ? 'checked' : ''; ?>
     31                            <?php $raw_page_variables = isset($instance['page_variables'][$postData['id']]) ? $instance['page_variables'][$postData['id']] : '' ; ?>
     32                            <?php $item_class = trim($raw_page_variables) ? 'configured-item' : 'empty-item'; ?>
     33                            <?php $data_thumbnail_url = isset($page_variables[$postData['id']]['page_thumbnail']) ? $page_variables[$postData['id']]['page_thumbnail'] : ''; ?>
    3434
    35                             <label for="<?php echo $bind->get_field_id('posts') . '-' . $postData['id'] ?>" class="tpc-accordeon-item <?php echo $item_class ?>" id="<?php echo $bind->get_field_id('item') . '-' . $postData['id'] ?>">
    36                                 <a href="#" data-item="<?php echo $bind->get_field_id('item') . '-' . $postData['id'] ?>" data-title="<?php echo $postData['title'] ?>" data-id="<?php echo $postData['id'] ?>"
    37                                 data-modal="tpc-call-item-options-modal" data-target="<?php echo $bind->get_field_id('page_variables') . '-' . $postData['id'] ?>" class="tpc-call-modal-button tpc-call-item-options-modal dashicons dashicons-admin-generic" title="<?php _e('Open page level options', 'tea-page-content') ?>"></a>
     35                            <label for="<?php echo $bind->get_field_id('posts') . '-' . $postData['id'] ?>" class="tpc-accordeon-item <?php echo $item_class ?>" id="<?php echo $bind->get_field_id('item') . '-' . $postData['id'] ?>">
     36                                <a href="#" data-item="<?php echo $bind->get_field_id('item') . '-' . $postData['id'] ?>" data-title="<?php echo $postData['title'] ?>" data-id="<?php echo $postData['id'] ?>"
     37                                data-modal="tpc-call-item-options-modal" data-target="<?php echo $bind->get_field_id('page_variables') . '-' . $postData['id'] ?>" class="tpc-call-modal-button tpc-call-item-options-modal dashicons dashicons-admin-generic" title="<?php _e('Open page level options', 'tea-page-content') ?>"></a>
    3838
    39                                 <input type="checkbox" name="<?php echo $bind->get_field_name('posts') ?>[]" id="<?php echo $bind->get_field_id('posts') . '-' . $postData['id'] ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
     39                                <input type="checkbox" name="<?php echo $bind->get_field_name('posts') ?>[]" id="<?php echo $bind->get_field_id('posts') . '-' . $postData['id'] ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
    4040
    41                                 <input type="hidden" name="<?php echo $bind->get_field_name('page_variables') ?>[<?php echo $postData['id'] ?>]" id="<?php echo $bind->get_field_id('page_variables') . '-' . $postData['id'] ?>" value="<?php echo $raw_page_variables ?>" data-thumbnail-url="<?php echo $data_thumbnail_url ?>" autocomplete="off" />
     41                                <input type="hidden" name="<?php echo $bind->get_field_name('page_variables') ?>[<?php echo $postData['id'] ?>]" id="<?php echo $bind->get_field_id('page_variables') . '-' . $postData['id'] ?>" value="<?php echo $raw_page_variables ?>" data-thumbnail-url="<?php echo $data_thumbnail_url ?>" autocomplete="off" />
    4242
    43                                 <span class="tpc-item-title" title="<?php echo $postData['title'] ?>"><?php echo $postData['title'] ?></span>
    44                             </label>
    45                         <?php endforeach; ?>
    46                         </div>
     43                                <span class="tpc-item-title" title="<?php echo $postData['title'] ?>"><?php echo $postData['title'] ?></span>
     44                            </label>
     45                        <?php endforeach; ?>
     46                        </div>
    4747
    48                     </div>
    49                     <?php endforeach; ?>
    50                 </div>
    51             <?php endif; ?>
    52         </div>
     48                    </div>
     49                    <?php endforeach; ?>
     50                </div>
     51            <?php endif; ?>
     52        </div>
    5353
    54         <div class="tpc-column">
    55             <p>
    56                 <label for="<?php echo $bind->get_field_id('order') ?>">
    57                     <?php _e('Order (by date)', 'tea-page-content'); ?>:
    58                 </label>
    59                 <select class="widefat" id="<?php echo $bind->get_field_id('order') ?>" name="<?php echo $bind->get_field_name('order') ?>">
    60                     <option value="desc" <?php if($instance['order'] == 'desc') : echo 'selected'; endif; ?>>
    61                         <?php _e('Descending', 'tea-page-content') ?>
    62                     </option>
    63                     <option value="asc" <?php if($instance['order'] == 'asc') : echo 'selected'; endif; ?>>
    64                         <?php _e('Ascending', 'tea-page-content') ?>
    65                     </option>
    66                 </select>
    67             </p>
     54        <div class="tpc-column">
     55            <p>
     56                <label for="<?php echo $bind->get_field_id('order') ?>">
     57                    <?php _e('Order', 'tea-page-content'); ?>:
     58                </label>
     59                <select class="widefat" id="<?php echo $bind->get_field_id('order') ?>" name="<?php echo $bind->get_field_name('order') ?>">
     60                    <option value="desc" <?php if($instance['order'] == 'desc') : echo 'selected'; endif; ?>>
     61                        <?php _e('Descending', 'tea-page-content') ?>
     62                    </option>
     63                    <option value="asc" <?php if($instance['order'] == 'asc') : echo 'selected'; endif; ?>>
     64                        <?php _e('Ascending', 'tea-page-content') ?>
     65                    </option>
     66                </select>
     67            </p>
    6868
    69             <p>
    70                 <label for="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>">
    71                     <?php
    72                     $checked = $instance['show_page_thumbnail'] ? 'checked' : '';
     69            <p>
     70                <label for="<?php echo $bind->get_field_id('orderby') ?>">
     71                    <?php _e('Order By', 'tea-page-content'); ?>:
     72                </label>
     73                <select class="widefat" id="<?php echo $bind->get_field_id('orderby') ?>" name="<?php echo $bind->get_field_name('orderby') ?>">
     74                    <option value="date" <?php if($instance['orderby'] === 'date') : echo 'selected'; endif; ?>>
     75                        <?php _e('Date', 'tea-page-content') ?>
     76                    </option>
     77                    <option value="title" <?php if($instance['orderby'] === 'title') : echo 'selected'; endif; ?>>
     78                        <?php _e('Title', 'tea-page-content') ?>
     79                    </option>
     80                    <option value="type" <?php if($instance['orderby'] === 'type') : echo 'selected'; endif; ?>>
     81                        <?php _e('Type', 'tea-page-content') ?>
     82                    </option>
     83                    <option value="comment_count" <?php if($instance['orderby'] === 'comment_count') : echo 'selected'; endif; ?>>
     84                        <?php _e('Comment count', 'tea-page-content') ?>
     85                    </option>
     86                    <option value="relevance" <?php if($instance['orderby'] === 'relevance') : echo 'selected'; endif; ?>>
     87                        <?php _e('Relevance', 'tea-page-content') ?>
     88                    </option>
     89                    <option value="rand" <?php if($instance['orderby'] === 'rand') : echo 'selected'; endif; ?>>
     90                        <?php _e('Random', 'tea-page-content') ?>
     91                    </option>
     92                    <option value="post__in" <?php if($instance['orderby'] === 'post__in') : echo 'selected'; endif; ?>>
     93                        <?php _e('As presented', 'tea-page-content') ?>
     94                    </option>
     95                </select>
     96            </p>
    7397
    74                     // @deprecated since 1.1
    75                     if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) $checked = '';
    76                     ?>
    77                     <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>" name="<?php echo $bind->get_field_name('show_page_thumbnail'); ?>" value="1" <?php echo $checked ?> />
    78                     <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
    79                 </label>
     98            <p>
     99                <label for="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>">
     100                    <?php $checked = $instance['show_page_thumbnail'] ? 'checked' : ''; ?>
     101                    <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>" name="<?php echo $bind->get_field_name('show_page_thumbnail'); ?>" value="1" <?php echo $checked ?> />
     102                    <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
     103                </label>
    80104
    81                 <br />
     105                <br />
    82106
    83                 <label for="<?php echo $bind->get_field_id('show_page_title'); ?>">
    84                     <?php $checked = $instance['show_page_title'] ? 'checked' : ''; ?>
    85                     <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_title'); ?>" name="<?php echo $bind->get_field_name('show_page_title'); ?>" value="1" <?php echo $checked ?> />
    86                     <span><?php _e('Show page title', 'tea-page-content'); ?></span>
    87                 </label>
     107                <label for="<?php echo $bind->get_field_id('show_page_title'); ?>">
     108                    <?php $checked = $instance['show_page_title'] ? 'checked' : ''; ?>
     109                    <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_title'); ?>" name="<?php echo $bind->get_field_name('show_page_title'); ?>" value="1" <?php echo $checked ?> />
     110                    <span><?php _e('Show page title', 'tea-page-content'); ?></span>
     111                </label>
    88112
    89                 <br />
     113                <br />
    90114
    91                 <label for="<?php echo $bind->get_field_id('show_page_content'); ?>">
    92                     <?php $checked = $instance['show_page_content'] ? 'checked' : ''; ?>
    93                     <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_content'); ?>" name="<?php echo $bind->get_field_name('show_page_content'); ?>" value="1" <?php echo $checked ?> />
    94                     <span><?php _e('Show page content', 'tea-page-content'); ?></span>
    95                 </label>
     115                <label for="<?php echo $bind->get_field_id('show_page_content'); ?>">
     116                    <?php $checked = $instance['show_page_content'] ? 'checked' : ''; ?>
     117                    <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('show_page_content'); ?>" name="<?php echo $bind->get_field_name('show_page_content'); ?>" value="1" <?php echo $checked ?> />
     118                    <span><?php _e('Show page content', 'tea-page-content'); ?></span>
     119                </label>
    96120
    97                 <br />
     121                <br />
    98122
    99                 <label for="<?php echo $bind->get_field_id('linked_page_title'); ?>">
    100                     <?php $checked = $instance['linked_page_title'] ? 'checked' : ''; ?>
    101                     <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('linked_page_title'); ?>" name="<?php echo $bind->get_field_name('linked_page_title'); ?>" value="1" <?php echo $checked ?> />
    102                     <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
    103                 </label>
     123                <label for="<?php echo $bind->get_field_id('linked_page_title'); ?>">
     124                    <?php $checked = $instance['linked_page_title'] ? 'checked' : ''; ?>
     125                    <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('linked_page_title'); ?>" name="<?php echo $bind->get_field_name('linked_page_title'); ?>" value="1" <?php echo $checked ?> />
     126                    <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
     127                </label>
    104128
    105                 <br />
     129                <br />
    106130
    107                 <label for="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>">
    108                     <?php $checked = $instance['linked_page_thumbnail'] ? 'checked' : ''; ?>
    109                     <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>" name="<?php echo $bind->get_field_name('linked_page_thumbnail'); ?>" value="1" <?php echo $checked ?> />
    110                     <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
    111                 </label>
    112             </p>
    113         </div>
    114     </div>
     131                <label for="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>">
     132                    <?php $checked = $instance['linked_page_thumbnail'] ? 'checked' : ''; ?>
     133                    <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>" name="<?php echo $bind->get_field_name('linked_page_thumbnail'); ?>" value="1" <?php echo $checked ?> />
     134                    <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
     135                </label>
     136            </p>
     137        </div>
     138    </div>
    115139
    116     <div class="tpc-column tpc-full-width">
     140    <div class="tpc-column tpc-full-width">
     141        <p class="tpc-preloader is-hidden">
     142            <label for="<?php echo $bind->get_field_id('template') ?>">
     143                <?php _e('Template', 'tea-page-content'); ?>:
     144            </label>
     145            <select class="widefat tpc-template-list" data-variables-area="tpc-<?php echo $bind->get_field_id('template-variables') ?>-wrapper" id="<?php echo $bind->get_field_id('template') ?>" name="<?php echo $bind->get_field_name('template') ?>" autocomplete="off">
     146                <?php foreach ($templates as $alias) : ?>
     147                    <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
     148                    <option value="<?php echo $alias ?>" <?php echo $selected ?>>
     149                        <?php echo ucwords(str_replace(array('.php', 'tpc-', '-'), ' ', $alias)) ?>
     150                    </option>
     151                <?php endforeach; ?>
     152            </select>
     153        </p>
    117154
    118         <p class="tpc-preloader is-hidden">
    119             <label for="<?php echo $bind->get_field_id('template') ?>">
    120                 <?php _e('Template', 'tea-page-content'); ?>:
    121             </label>
    122             <select class="widefat tpc-template-list" data-variables-area="tpc-<?php echo $bind->get_field_id('template-variables') ?>-wrapper" id="<?php echo $bind->get_field_id('template') ?>" name="<?php echo $bind->get_field_name('template') ?>" autocomplete="off">
    123                 <?php foreach ($templates as $alias) : ?>
    124                     <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
    125                     <option value="<?php echo $alias ?>" <?php echo $selected ?>>
    126                         <?php echo ucwords(str_replace(array('.php', 'tpc-', '-'), ' ', $alias)) ?>
    127                     </option>
    128                 <?php endforeach; ?>
    129             </select>
    130         </p>
    131 
    132         <div class="tpc-template-params" id="tpc-<?php echo $bind->get_field_id('template-variables') ?>-wrapper" data-mask-name="<?php echo $bind->get_field_name('{mask}') ?>">
    133             <?php echo $partials['template_variables'] ?>
    134         </div>
    135     </div>
    136    
     155        <div class="tpc-template-params" id="tpc-<?php echo $bind->get_field_id('template-variables') ?>-wrapper" data-mask-name="<?php echo $bind->get_field_name('{mask}') ?>">
     156            <?php echo $partials['template_variables'] ?>
     157        </div>
     158    </div>
     159   
    137160</div>
  • tea-page-content/trunk/templates/admin/pages/settings.php

    r1643033 r1643034  
    11<div class="wrap tpc-settings-page">
    2     <h2>Tea Page Content - <?php _e('Settings', 'tea-page-content') ?></h2>
     2    <h2>Tea Page Content - <?php _e('Settings', 'tea-page-content') ?></h2>
    33
    4     <form method="post" novalidate="novalidate" autocomplete="off">
     4    <form method="post" novalidate="novalidate" autocomplete="off">
    55
    6         <?php foreach ($settings as $setting_alias => $setting_params) : ?>
    7             <div class="tpc-form-group">
    8                 <?php $default = $setting_params['default']; ?>
    9                 <label>
    10                     <span><?php echo $setting_params['label'] ?></span>
    11                     <br />
    12                     <small><?php echo $setting_params['description'] ?></small>
    13                     <br />
     6        <?php foreach ($settings as $setting_alias => $setting_params) : ?>
     7            <div class="tpc-form-group">
     8                <?php $default = $setting_params['default']; ?>
     9                <label>
     10                    <span><?php echo $setting_params['label'] ?></span>
     11                    <br />
     12                    <small><?php echo $setting_params['description'] ?></small>
     13                    <br />
    1414
    15                     <?php switch ($setting_params['structure']) {
    16                         case 'select': ?>
    17                            
    18                         <select name="<?php echo $setting_alias ?>">
    19                             <?php switch ($setting_params['type']) {
    20                                 case 'switch':
     15                    <?php switch ($setting_params['structure']) {
     16                        case 'select': ?>
     17                           
     18                        <select name="<?php echo $setting_alias ?>">
     19                            <?php switch ($setting_params['type']) {
     20                                case 'switch':
    2121
    22                                 $attributes = array();
    23                                 if(!$default) {
    24                                     $attributes[] = 'selected';
    25                                 } ?>
    26                                
    27                                 <option value="1"><?php _e('Yes', 'tea-page-content') ?></option>
    28                                 <option value="0" <?php echo implode(' ', $attributes) ?>><?php _e('No', 'tea-page-content') ?></option>
     22                                $attributes = array();
     23                                if(!$default) {
     24                                    $attributes[] = 'selected';
     25                                } ?>
     26                               
     27                                <option value="1"><?php _e('Yes', 'tea-page-content') ?></option>
     28                                <option value="0" <?php echo implode(' ', $attributes) ?>><?php _e('No', 'tea-page-content') ?></option>
    2929
    30                                 <?php break;
     30                                <?php break;
    3131
    32                                 default:  ?>
     32                                default:  ?>
    3333
    3434
    3535
    36                                 <?php break;
    37                                
    38                             } ?>
    39                         </select>
     36                                <?php break;
     37                               
     38                            } ?>
     39                        </select>
    4040
    41                         <?php break;
    42                        
    43                     } ?>
    44                 </label>
    45             </div>
    46         <?php endforeach; ?>
     41                        <?php break;
     42                       
     43                    } ?>
     44                </label>
     45            </div>
     46        <?php endforeach; ?>
    4747
    48         <input type="hidden" name="tpc_settings_update" value="Y" />
     48        <input type="hidden" name="tpc_settings_update" value="Y" />
    4949
    50         <p class="submit tpc-submit-group">
    51             <input name="submit" id="submit" class="button button-primary" value="<?php _e('Submit', 'tea-page-content') ?>" type="submit">
    52         </p>
    53     </form>
     50        <p class="submit tpc-submit-group">
     51            <input name="submit" id="submit" class="button button-primary" value="<?php _e('Submit', 'tea-page-content') ?>" type="submit">
     52        </p>
     53    </form>
    5454</div>
  • tea-page-content/trunk/templates/admin/partials/template-variables.php

    r1643033 r1643034  
    22
    33<div class="tpc-template-params-inner">
    4     <h4><?php _e('Template Variables', 'tea-page-content') ?></h4>
    5     <?php foreach ($template_variables as $variable) : ?>
    6         <?php if(isset($mask)) : ?>
    7             <?php $variableID = str_replace('{mask}', $variable['name'], $mask); ?>
    8             <?php $variableName = str_replace('{mask}', $variable['name'], $mask); ?>
    9         <?php elseif(isset($bind)) : ?>
    10             <?php $variableID = $bind->get_field_id($variable['name']); ?>
    11             <?php $variableName = $bind->get_field_name($variable['name']); ?>
    12         <?php else : continue; endif; ?>
    13        
    14         <?php $variableValue = ''; $isDefault = false; $isExists = false;
    15         if(isset($instance) && isset($instance['template_variables']) && array_key_exists($variable['name'], $instance['template_variables'])) {
    16             $isExists = true;
    17             $variableValue = $instance['template_variables'][$variable['name']];
    18         } else {
    19             $isDefault = true;
    20             $variableValue = reset($variable['defaults']);
    21         }?>
    22        
    23         <p>
    24             <?php if($variable['type'] !== 'caption') : ?>
    25                 <label for="<?php echo $variableID ?>">
    26                     <?php echo ucwords(str_replace(array('-','_'), ' ', $variable['name'])) ?>:
    27                 </label>
    28             <?php endif; ?>
    29            
    30             <?php switch ($variable['type']) : default: break; ?>
    31                 <?php case 'caption': ?>
    32                     <span class="tpc-template-caption">
    33                         <?php echo trim($variableValue, '"') ?>
    34                     </span>
    35                 <?php break; ?>
     4    <h4><?php _e('Template Variables', 'tea-page-content') ?></h4>
     5    <?php foreach ($template_variables as $variable) : ?>
     6        <?php if(isset($mask)) : ?>
     7            <?php $variableID = str_replace('{mask}', $variable['name'], $mask); ?>
     8            <?php $variableName = str_replace('{mask}', $variable['name'], $mask); ?>
     9        <?php elseif(isset($bind)) : ?>
     10            <?php $variableID = $bind->get_field_id($variable['name']); ?>
     11            <?php $variableName = $bind->get_field_name($variable['name']); ?>
     12        <?php else : continue; endif; ?>
     13       
     14        <?php $variableValue = ''; $isDefault = false; $isExists = false;
     15        if(isset($instance) && isset($instance['template_variables']) && array_key_exists($variable['name'], $instance['template_variables'])) {
     16            $isExists = true;
     17            $variableValue = $instance['template_variables'][$variable['name']];
     18        } else {
     19            $isDefault = true;
     20            $variableValue = reset($variable['defaults']);
     21        }?>
     22       
     23        <p>
     24            <?php if($variable['type'] !== 'caption') : ?>
     25                <label for="<?php echo $variableID ?>">
     26                    <?php echo ucwords(str_replace(array('-','_'), ' ', $variable['name'])) ?>:
     27                </label>
     28            <?php endif; ?>
     29           
     30            <?php switch ($variable['type']) : default: break; ?>
     31                <?php case 'caption': ?>
     32                    <span class="tpc-template-caption">
     33                        <?php echo trim($variableValue, '"') ?>
     34                    </span>
     35                <?php break; ?>
    3636
    37                 <?php case 'text': ?>
    38                     <input type="text" class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variableValue ?>" />
    39                 <?php break; ?>
     37                <?php case 'text': ?>
     38                    <input type="text" class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variableValue ?>" />
     39                <?php break; ?>
    4040
    41                 <?php case 'textarea': ?>
    42                     <textarea class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>"><?php echo $variableValue ?></textarea>
    43                 <?php break; ?>
     41                <?php case 'textarea': ?>
     42                    <textarea class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>"><?php echo $variableValue ?></textarea>
     43                <?php break; ?>
    4444
    45                 <?php case 'checkbox': ?>
    46                     <?php $checked = '';
    47                     if
    48                         (
    49                             (isset($instance['template_variables'][$variable['name']]) && !empty($variableValue))
    50                             OR
    51                             ($variableValue && $isDefault && !$isExists)
    52                         )
    53                     {
    54                         $checked = 'checked';
    55                     } ?>
     45                <?php case 'checkbox': ?>
     46                    <?php $checked = '';
     47                    if
     48                        (
     49                            (isset($instance['template_variables'][$variable['name']]) && !empty($variableValue))
     50                            OR
     51                            ($variableValue && $isDefault && !$isExists)
     52                        )
     53                    {
     54                        $checked = 'checked';
     55                    } ?>
    5656
    57                     <input type="checkbox" class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variable['name'] ?>" <?php echo $checked ?> />
    58                 <?php break; ?>
     57                    <input type="checkbox" class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variable['name'] ?>" <?php echo $checked ?> />
     58                <?php break; ?>
    5959
    60                 <?php case 'select': ?>
    61                     <select class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>">
    62                     <?php foreach ($variable['defaults'] as $value) : ?>
    63                         <?php $selected = ($variableValue == $value) ? 'selected="selected"' : ''; ?>
    64                         <option value="<?php echo $value ?>" <?php echo $selected ?>>
    65                             <?php echo $value ?>
    66                         </option>
    67                     <?php endforeach; ?>
    68                     </select>
    69                 <?php break; ?>
     60                <?php case 'select': ?>
     61                    <select class="widefat" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>">
     62                    <?php foreach ($variable['defaults'] as $value) : ?>
     63                        <?php $selected = ($variableValue == $value) ? 'selected="selected"' : ''; ?>
     64                        <option value="<?php echo $value ?>" <?php echo $selected ?>>
     65                            <?php echo $value ?>
     66                        </option>
     67                    <?php endforeach; ?>
     68                    </select>
     69                <?php break; ?>
    7070
    71                 <?php case 'jqueryui:spinner': ?>
    72                     <?php if(!trim($variableValue)) $variableValue = 0; ?>
    73                    
    74                     <input type="text" class="widefat tpc-spinner" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variableValue ?>" data-spinner-min="<?php echo reset($variable['defaults']) ?>" data-spinner-max="<?php echo end($variable['defaults']) ?>" />
    75                 <?php break; ?>
     71                <?php case 'jqueryui:spinner': ?>
     72                    <?php if(!trim($variableValue)) $variableValue = 0; ?>
     73                   
     74                    <input type="text" class="widefat tpc-spinner" id="<?php echo $variableID ?>" name="<?php echo $variableName ?>" value="<?php echo $variableValue ?>" data-spinner-min="<?php echo reset($variable['defaults']) ?>" data-spinner-max="<?php echo end($variable['defaults']) ?>" />
     75                <?php break; ?>
    7676
    77             <?php endswitch; ?>
    78         </p>
     77            <?php endswitch; ?>
     78        </p>
    7979
    80     <?php endforeach; ?>
     80    <?php endforeach; ?>
    8181</div>
    8282
  • tea-page-content/trunk/templates/client/layouts/bootstrap-3.php

    r1643033 r1643034  
    1212 * @param column-count-small jqueryui:spinner 1-24
    1313 * @param column-count-extra-small jqueryui:spinner 1-24
     14 *
     15 * @param items-per-row-based-on select column-count-large|column-count-medium|column-count-small|column-count-extra-small
    1416 */
    15 
    16 if(!$count) return; // @todo check for empty entries in backend
    1717
    1818// Template Logic
     
    2121
    2222$columns = array(
    23     'lg' => 'col-lg-' . $maxColumns / $template_variables['column-count-large'],
    24     'md' => 'col-md-' . $maxColumns / $template_variables['column-count-medium'],
    25     'sm' => 'col-sm-' . $maxColumns / $template_variables['column-count-small'],
    26     'xs' => 'col-xs-' . $maxColumns / $template_variables['column-count-extra-small'],
     23    'lg' => 'col-lg-' . $maxColumns / $template_variables['column-count-large'],
     24    'md' => 'col-md-' . $maxColumns / $template_variables['column-count-medium'],
     25    'sm' => 'col-sm-' . $maxColumns / $template_variables['column-count-small'],
     26    'xs' => 'col-xs-' . $maxColumns / $template_variables['column-count-extra-small'],
    2727);
    2828
    29 $itemsPerRow = $template_variables['column-count-large']; // by default, @todo make it configurable
     29$itemsPerRowBase = $template_variables['items-per-row-based-on'];
     30$itemsPerRow = $template_variables[$itemsPerRowBase];
    3031$itemsCount = count($entries);
    3132
     
    3435// Logic for transposed layout
    3536if($template_variables['ordering-type'] === 'transposed') {
    36     $itemsPerCol = ceil($itemsCount / $itemsPerRow);
     37    $itemsPerCol = ceil($itemsCount / $itemsPerRow);
    3738
    38     // Count of empty cols
    39     $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);
     39    // Count of empty cols
     40    $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);
    4041}
    4142?>
    4243
    4344<?php if(isset($instance['title']) && $caller === 'shortcode') : ?>
    44     <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
     45    <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
    4546<?php endif; ?>
    4647
    47 <?php if($itemsCount) : ?>
    4848<section class="tpc-block tpc-bootstrap <?php echo $template_variables['container-type'] ?>">
    49     <div class="row">
     49    <div class="row">
    5050
    51     <?php if($template_variables['ordering-type'] === 'horizontal') : ?>
    52         <?php foreach ($entries as $key => $entry) : ?>
     51    <?php if($template_variables['ordering-type'] === 'horizontal') : ?>
     52        <?php foreach ($entries as $key => $entry) : ?>
    5353
    54             <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
     54            <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
    5555
    56                 <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    57                     <div class="tpc-thumbnail">
    58                         <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    59                             <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    60                         <?php else : ?>
    61                             <?php echo $entry['thumbnail'] ?>
    62                         <?php endif; ?>
    63                     </div>
    64                 <?php endif; ?>
     56                <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     57                    <div class="tpc-thumbnail">
     58                        <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     59                            <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     60                        <?php else : ?>
     61                            <?php echo $entry['thumbnail'] ?>
     62                        <?php endif; ?>
     63                    </div>
     64                <?php endif; ?>
    6565
    66                 <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    67                 <div class="tpc-body">
    68                     <?php if($instance['show_page_title']) : ?>
    69                         <h3 class="tpc-title">
    70                         <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    71                             <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    72                         <?php else : ?>
    73                             <?php echo $entry['title'] ?>
    74                         <?php endif; ?>
    75                         </h3>
    76                     <?php endif; ?>
     66                <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     67                <div class="tpc-body">
     68                    <?php if($instance['show_page_title']) : ?>
     69                        <h3 class="tpc-title">
     70                        <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     71                            <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     72                        <?php else : ?>
     73                            <?php echo $entry['title'] ?>
     74                        <?php endif; ?>
     75                        </h3>
     76                    <?php endif; ?>
    7777
    78                     <?php if($instance['show_page_content']) : ?>
    79                         <div class="tpc-content post-content">
    80                             <?php echo $entry['content'] ?>
    81                         </div>
    82                     <?php endif; ?>
    83                 </div>
    84                 <?php endif; ?>
     78                    <?php if($instance['show_page_content']) : ?>
     79                        <div class="tpc-content post-content">
     80                            <?php echo $entry['content'] ?>
     81                        </div>
     82                    <?php endif; ?>
     83                </div>
     84                <?php endif; ?>
    8585
    86             </article>
     86            </article>
    8787
    88             <?php
    89             $counter++;
    90             if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :
    91                 $counter = 0;
    92                 // here optionally clear row
     88            <?php
     89            $counter++;
     90            if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :
     91                $counter = 0;
     92                // here optionally clear row
    9393
    94                 echo '</div><div class="row">';
     94                echo '</div><div class="row">';
    9595
    96             endif; ?>
    97         <?php endforeach; ?>
     96            endif; ?>
     97        <?php endforeach; ?>
    9898
    99     <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>
    100        
    101         <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix
    102             $incrementor = 0;
    103             $decrementor = 1;
     99    <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>
     100       
     101        <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix
     102            $incrementor = 0;
     103            $decrementor = 1;
    104104
    105             for($cols = 0; $cols < $itemsPerRow; $cols++) :
    106                 $index = $rows + 1;
     105            for($cols = 0; $cols < $itemsPerRow; $cols++) :
     106                $index = $rows + 1;
    107107
    108                 if($cols > 0) $index += $incrementor;
     108                if($cols > 0) $index += $incrementor;
    109109
    110                 if($empties && $cols > ($itemsPerRow - $empties)) {
    111                     $index -= $decrementor;
    112                     $decrementor++;
    113                 }
     110                if($empties && $cols > ($itemsPerRow - $empties)) {
     111                    $index -= $decrementor;
     112                    $decrementor++;
     113                }
    114114
    115                 $entry = $entries[$index - 1];
    116                 ?>
     115                $entry = $entries[$index - 1];
     116                ?>
    117117
    118                 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
     118                <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
    119119
    120                     <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    121                         <div class="tpc-thumbnail">
    122                             <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    123                                 <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    124                             <?php else : ?>
    125                                 <?php echo $entry['thumbnail'] ?>
    126                             <?php endif; ?>
    127                         </div>
    128                     <?php endif; ?>
     120                    <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     121                        <div class="tpc-thumbnail">
     122                            <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     123                                <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     124                            <?php else : ?>
     125                                <?php echo $entry['thumbnail'] ?>
     126                            <?php endif; ?>
     127                        </div>
     128                    <?php endif; ?>
    129129
    130                     <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    131                     <div class="tpc-body">
    132                         <?php if($instance['show_page_title']) : ?>
    133                             <h3 class="tpc-title">
    134                             <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    135                                 <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    136                             <?php else : ?>
    137                                 <?php echo $entry['title'] ?>
    138                             <?php endif; ?>
    139                             </h3>
    140                         <?php endif; ?>
     130                    <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     131                    <div class="tpc-body">
     132                        <?php if($instance['show_page_title']) : ?>
     133                            <h3 class="tpc-title">
     134                            <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     135                                <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     136                            <?php else : ?>
     137                                <?php echo $entry['title'] ?>
     138                            <?php endif; ?>
     139                            </h3>
     140                        <?php endif; ?>
    141141
    142                         <?php if($instance['show_page_content']) : ?>
    143                             <div class="tpc-content post-content">
    144                                 <?php echo $entry['content'] ?>
    145                             </div>
    146                         <?php endif; ?>
    147                     </div>
    148                     <?php endif; ?>
     142                        <?php if($instance['show_page_content']) : ?>
     143                            <div class="tpc-content post-content">
     144                                <?php echo $entry['content'] ?>
     145                            </div>
     146                        <?php endif; ?>
     147                    </div>
     148                    <?php endif; ?>
    149149
    150                 </article>
     150                </article>
    151151
    152                 <?php $incrementor += $itemsPerCol;
     152                <?php $incrementor += $itemsPerCol;
    153153
    154                 $counter++;
     154                $counter++;
    155155
    156                 if($counter >= $itemsCount) break;
     156                if($counter >= $itemsCount) break;
    157157
    158             endfor;
     158            endfor;
    159159
    160             if($counter < $itemsCount && $template_variables['use-rows']) {
    161                 echo '</div><div class="row">';
    162             }
     160            if($counter < $itemsCount && $template_variables['use-rows']) {
     161                echo '</div><div class="row">';
     162            }
    163163
    164         endfor;
    165         ?>
    166     <?php endif; ?>
     164        endfor;
     165        ?>
     166    <?php endif; ?>
    167167
    168     </div>
     168    </div>
    169169</section>
    170 <?php endif;
  • tea-page-content/trunk/templates/client/layouts/bootstrap-4.php

    r1643033 r1643034  
    1313 * @param column-count-small jqueryui:spinner 1-24
    1414 * @param column-count-extra-small jqueryui:spinner 1-24
     15 *
     16 * @param items-per-row-based-on select column-count-extra-large|column-count-large|column-count-medium|column-count-small|column-count-extra-small
    1517 */
    16 
    17 if(!$count) return; // @todo check for empty entries in backend
    1818
    1919// Template Logic
     
    2222
    2323$columns = array(
    24     'xl' => 'col-xl-' . $maxColumns / $template_variables['column-count-extra-large'],
    25     'lg' => 'col-lg-' . $maxColumns / $template_variables['column-count-large'],
    26     'md' => 'col-md-' . $maxColumns / $template_variables['column-count-medium'],
    27     'sm' => 'col-sm-' . $maxColumns / $template_variables['column-count-small'],
    28     'xs' => 'col-xs-' . $maxColumns / $template_variables['column-count-extra-small'],
     24    'xl' => 'col-xl-' . $maxColumns / $template_variables['column-count-extra-large'],
     25    'lg' => 'col-lg-' . $maxColumns / $template_variables['column-count-large'],
     26    'md' => 'col-md-' . $maxColumns / $template_variables['column-count-medium'],
     27    'sm' => 'col-sm-' . $maxColumns / $template_variables['column-count-small'],
     28    'xs' => 'col-xs-' . $maxColumns / $template_variables['column-count-extra-small'],
    2929);
    3030
    31 $itemsPerRow = $template_variables['column-count-extra-large']; // by default, @todo make it configurable
     31$itemsPerRowBase = $template_variables['items-per-row-based-on'];
     32$itemsPerRow = $template_variables[$itemsPerRowBase];
    3233$itemsCount = count($entries);
    3334
     
    3637// Logic for transposed layout
    3738if($template_variables['ordering-type'] === 'transposed') {
    38     $itemsPerCol = ceil($itemsCount / $itemsPerRow);
     39    $itemsPerCol = ceil($itemsCount / $itemsPerRow);
    3940
    40     // Count of empty cols
    41     $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);
     41    // Count of empty cols
     42    $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);
    4243}
    4344?>
    4445
    4546<?php if(isset($instance['title']) && $caller === 'shortcode') : ?>
    46     <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
     47    <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
    4748<?php endif; ?>
    4849
    49 <?php if($itemsCount) : ?>
    5050<section class="tpc-block tpc-bootstrap <?php echo $template_variables['container-type'] ?>">
    51     <div class="row">
     51    <div class="row">
    5252
    53     <?php if($template_variables['ordering-type'] === 'horizontal') : ?>
    54         <?php foreach ($entries as $key => $entry) : ?>
     53    <?php if($template_variables['ordering-type'] === 'horizontal') : ?>
     54        <?php foreach ($entries as $key => $entry) : ?>
    5555
    56             <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
     56            <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
    5757
    58                 <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    59                     <div class="tpc-thumbnail">
    60                         <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    61                             <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    62                         <?php else : ?>
    63                             <?php echo $entry['thumbnail'] ?>
    64                         <?php endif; ?>
    65                     </div>
    66                 <?php endif; ?>
     58                <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     59                    <div class="tpc-thumbnail">
     60                        <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     61                            <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     62                        <?php else : ?>
     63                            <?php echo $entry['thumbnail'] ?>
     64                        <?php endif; ?>
     65                    </div>
     66                <?php endif; ?>
    6767
    68                 <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    69                 <div class="tpc-body">
    70                     <?php if($instance['show_page_title']) : ?>
    71                         <h3 class="tpc-title">
    72                         <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    73                             <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    74                         <?php else : ?>
    75                             <?php echo $entry['title'] ?>
    76                         <?php endif; ?>
    77                         </h3>
    78                     <?php endif; ?>
     68                <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     69                <div class="tpc-body">
     70                    <?php if($instance['show_page_title']) : ?>
     71                        <h3 class="tpc-title">
     72                        <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     73                            <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     74                        <?php else : ?>
     75                            <?php echo $entry['title'] ?>
     76                        <?php endif; ?>
     77                        </h3>
     78                    <?php endif; ?>
    7979
    80                     <?php if($instance['show_page_content']) : ?>
    81                         <div class="tpc-content post-content">
    82                             <?php echo $entry['content'] ?>
    83                         </div>
    84                     <?php endif; ?>
    85                 </div>
    86                 <?php endif; ?>
     80                    <?php if($instance['show_page_content']) : ?>
     81                        <div class="tpc-content post-content">
     82                            <?php echo $entry['content'] ?>
     83                        </div>
     84                    <?php endif; ?>
     85                </div>
     86                <?php endif; ?>
    8787
    88             </article>
     88            </article>
    8989
    90             <?php
    91             $counter++;
    92             if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :
    93                 $counter = 0;
    94                 // here optionally clear row
     90            <?php
     91            $counter++;
     92            if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :
     93                $counter = 0;
     94                // here optionally clear row
    9595
    96                 echo '</div><div class="row">';
     96                echo '</div><div class="row">';
    9797
    98             endif; ?>
    99         <?php endforeach; ?>
     98            endif; ?>
     99        <?php endforeach; ?>
    100100
    101     <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>
    102        
    103         <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix
    104             $incrementor = 0;
    105             $decrementor = 1;
     101    <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>
     102       
     103        <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix
     104            $incrementor = 0;
     105            $decrementor = 1;
    106106
    107             for($cols = 0; $cols < $itemsPerRow; $cols++) :
    108                 $index = $rows + 1;
     107            for($cols = 0; $cols < $itemsPerRow; $cols++) :
     108                $index = $rows + 1;
    109109
    110                 if($cols > 0) $index += $incrementor;
     110                if($cols > 0) $index += $incrementor;
    111111
    112                 if($empties && $cols > ($itemsPerRow - $empties)) {
    113                     $index -= $decrementor;
    114                     $decrementor++;
    115                 }
     112                if($empties && $cols > ($itemsPerRow - $empties)) {
     113                    $index -= $decrementor;
     114                    $decrementor++;
     115                }
    116116
    117                 $entry = $entries[$index - 1];
    118                 ?>
     117                $entry = $entries[$index - 1];
     118                ?>
    119119
    120                 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
     120                <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">
    121121
    122                     <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    123                         <div class="tpc-thumbnail">
    124                             <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    125                                 <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    126                             <?php else : ?>
    127                                 <?php echo $entry['thumbnail'] ?>
    128                             <?php endif; ?>
    129                         </div>
    130                     <?php endif; ?>
     122                    <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     123                        <div class="tpc-thumbnail">
     124                            <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     125                                <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     126                            <?php else : ?>
     127                                <?php echo $entry['thumbnail'] ?>
     128                            <?php endif; ?>
     129                        </div>
     130                    <?php endif; ?>
    131131
    132                     <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    133                     <div class="tpc-body">
    134                         <?php if($instance['show_page_title']) : ?>
    135                             <h3 class="tpc-title">
    136                             <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    137                                 <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    138                             <?php else : ?>
    139                                 <?php echo $entry['title'] ?>
    140                             <?php endif; ?>
    141                             </h3>
    142                         <?php endif; ?>
     132                    <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     133                    <div class="tpc-body">
     134                        <?php if($instance['show_page_title']) : ?>
     135                            <h3 class="tpc-title">
     136                            <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     137                                <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     138                            <?php else : ?>
     139                                <?php echo $entry['title'] ?>
     140                            <?php endif; ?>
     141                            </h3>
     142                        <?php endif; ?>
    143143
    144                         <?php if($instance['show_page_content']) : ?>
    145                             <div class="tpc-content post-content">
    146                                 <?php echo $entry['content'] ?>
    147                             </div>
    148                         <?php endif; ?>
    149                     </div>
    150                     <?php endif; ?>
     144                        <?php if($instance['show_page_content']) : ?>
     145                            <div class="tpc-content post-content">
     146                                <?php echo $entry['content'] ?>
     147                            </div>
     148                        <?php endif; ?>
     149                    </div>
     150                    <?php endif; ?>
    151151
    152                 </article>
     152                </article>
    153153
    154                 <?php $incrementor += $itemsPerCol;
     154                <?php $incrementor += $itemsPerCol;
    155155
    156                 $counter++;
     156                $counter++;
    157157
    158                 if($counter >= $itemsCount) break;
     158                if($counter >= $itemsCount) break;
    159159
    160             endfor;
     160            endfor;
    161161
    162             if($counter < $itemsCount && $template_variables['use-rows']) {
    163                 echo '</div><div class="row">';
    164             }
     162            if($counter < $itemsCount && $template_variables['use-rows']) {
     163                echo '</div><div class="row">';
     164            }
    165165
    166         endfor;
    167         ?>
    168     <?php endif; ?>
     166        endfor;
     167        ?>
     168    <?php endif; ?>
    169169
    170     </div>
     170    </div>
    171171</section>
    172 <?php endif;
  • tea-page-content/trunk/templates/client/layouts/default.php

    r1643033 r1643034  
    44 */
    55
    6 // prevention for old version of this plugin, @deprecated since 1.1
    76$isPadded = false;
    87if(isset($template_variables['is-padded']) && $template_variables['is-padded']) {
    9     $isPadded = true;
     8    $isPadded = true;
    109}?>
    1110
    1211<?php if(isset($instance['title']) && $caller === 'shortcode') : ?>
    13     <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
     12    <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
    1413<?php endif; ?>
    1514
    16 <?php if(isset($entries) && $count) : ?>
     15<section class="tpc-block tpc-default<?php if($isPadded) echo '-padded'; ?>">
     16    <?php foreach ($entries as $key => $entry) : ?>
    1717
    18 <section class="tpc-block tpc-default<?php if($isPadded) echo '-padded'; ?>">
    19     <?php foreach ($entries as $key => $entry) : ?>
     18        <article class="tpc-entry-block">
     19            <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     20                <div class="tpc-thumbnail">
     21                    <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     22                        <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     23                    <?php else : ?>
     24                        <?php echo $entry['thumbnail'] ?>
     25                    <?php endif; ?>
     26                </div>
     27            <?php endif; ?>
    2028
    21         <article class="tpc-entry-block">
    22             <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    23             <?php if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) :
    24                 // @deprecated thumbnail param since 1.1
    25             else : ?>
    26                 <div class="tpc-thumbnail">
    27                     <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    28                         <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    29                     <?php else : ?>
    30                         <?php echo $entry['thumbnail'] ?>
    31                     <?php endif; ?>
    32                 </div>
    33             <?php endif; ?>
    34             <?php endif; ?>
     29            <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     30            <div class="tpc-body">
     31                <?php if($instance['show_page_title']) : ?>
     32                    <h3 class="tpc-title">
     33                    <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     34                        <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     35                    <?php else : ?>
     36                        <?php echo $entry['title'] ?>
     37                    <?php endif; ?>
     38                    </h3>
     39                <?php endif; ?>
    3540
    36             <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    37             <div class="tpc-body">
    38                 <?php if($instance['show_page_title']) : ?>
    39                     <h3 class="tpc-title">
    40                     <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    41                         <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    42                     <?php else : ?>
    43                         <?php echo $entry['title'] ?>
    44                     <?php endif; ?>
    45                     </h3>
    46                 <?php endif; ?>
    47 
    48                 <?php if($instance['show_page_content']) : ?>
    49                     <div class="tpc-content post-content">
    50                         <?php echo $entry['content'] ?>
    51                     </div>
    52                 <?php endif; ?>
    53             </div>
    54             <?php endif; ?>
    55            
    56         </article>
    57     <?php endforeach; ?>
     41                <?php if($instance['show_page_content']) : ?>
     42                    <div class="tpc-content post-content">
     43                        <?php echo $entry['content'] ?>
     44                    </div>
     45                <?php endif; ?>
     46            </div>
     47            <?php endif; ?>
     48           
     49        </article>
     50    <?php endforeach; ?>
    5851</section>
    59 
    60 <?php endif;
  • tea-page-content/trunk/templates/client/layouts/waterfall.php

    r1643033 r1643034  
    77 */
    88
    9 if(isset($entries) && $count) :
     9$column_count = (int)$template_variables['column-count'];
    1010
    11     $column_count = (int)$template_variables['column-count'];
     11$items_per_col = floor($count / $column_count);
     12$remainder = $count - ($items_per_col * $column_count);
    1213
    13     $items_per_col = floor($count / $column_count);
    14     $remainder = $count - ($items_per_col * $column_count);
     14$width = 100 / $column_count; // 100% divided on column count
    1515
    16     $width = 100 / $column_count; // 100% divided on column count
     16$counter = 0; ?>
    1717
    18     $counter = 0; ?>
     18<?php if(isset($instance['title']) && $caller === 'shortcode') : ?>
     19    <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
     20<?php endif; ?>
    1921
    20     <?php if(isset($instance['title']) && $caller === 'shortcode') : ?>
    21         <h2 class="tpc-shortcode-main-title"><?php echo $instance['title']; ?></h2>
    22     <?php endif; ?>
     22<section class="tpc-block tpc-waterfall tpc-waterfall-<?php echo $column_count ?>">
    2323
    24     <section class="tpc-block tpc-waterfall tpc-waterfall-<?php echo $column_count ?>">
     24<?php if($template_variables['ordering-type'] === 'horizontal') :
    2525
    26     <?php if($template_variables['ordering-type'] === 'horizontal') :
     26    for ($i = 0; $i < $column_count; $i++) : ?>
    2727
    28         for ($i = 0; $i < $column_count; $i++) : ?>
     28    <div class="tpc-waterfall-col" style="width: <?php echo $width?>%">
     29        <?php
     30        $incol_limit = $items_per_col;
     31        if($remainder) {
     32            $incol_limit++;
     33            $remainder--;
     34        }
    2935
    30         <div class="tpc-waterfall-col" style="width: <?php echo $width?>%">
    31             <?php
    32             $incol_limit = $items_per_col;
    33             if($remainder) {
    34                 $incol_limit++;
    35                 $remainder--;
    36             }
     36        for ($y = 0; $y < $incol_limit; $y++) :
    3737
    38            
     38            $entry = $entries[$counter];
     39         ?>
     40            <article class="tpc-entry-block">
     41                <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     42                    <div class="tpc-thumbnail">
     43                        <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     44                            <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     45                        <?php else : ?>
     46                            <?php echo $entry['thumbnail'] ?>
     47                        <?php endif; ?>
     48                    </div>
     49                <?php endif; ?>
    3950
    40             for ($y = 0; $y < $incol_limit; $y++) :
     51                <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     52                <div class="tpc-body">
     53                    <?php if($instance['show_page_title']) : ?>
     54                        <h3 class="tpc-title">
     55                        <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     56                            <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     57                        <?php else : ?>
     58                            <?php echo $entry['title'] ?>
     59                        <?php endif; ?>
     60                        </h3>
     61                    <?php endif; ?>
    4162
    42                 $entry = $entries[$counter];
    43              ?>
    44                 <article class="tpc-entry-block">
    45                     <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    46                         <div class="tpc-thumbnail">
    47                             <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    48                                 <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    49                             <?php else : ?>
    50                                 <?php echo $entry['thumbnail'] ?>
    51                             <?php endif; ?>
    52                         </div>
    53                     <?php endif; ?>
     63                    <?php if($instance['show_page_content']) : ?>
     64                        <div class="tpc-content post-content">
     65                            <?php echo $entry['content'] ?>
     66                        </div>
     67                    <?php endif; ?>
     68                </div>
     69                <?php endif; ?>
     70            </article>
     71        <?php $counter++; endfor; ?>
     72    </div>
    5473
    55                     <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    56                     <div class="tpc-body">
    57                         <?php if($instance['show_page_title']) : ?>
    58                             <h3 class="tpc-title">
    59                             <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    60                                 <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    61                             <?php else : ?>
    62                                 <?php echo $entry['title'] ?>
    63                             <?php endif; ?>
    64                             </h3>
    65                         <?php endif; ?>
     74    <?php endfor; ?>
    6675
    67                         <?php if($instance['show_page_content']) : ?>
    68                             <div class="tpc-content post-content">
    69                                 <?php echo $entry['content'] ?>
    70                             </div>
    71                         <?php endif; ?>
    72                     </div>
    73                     <?php endif; ?>
    74                 </article>
    75             <?php $counter++; endfor; ?>
    76         </div>
     76<?php elseif($template_variables['ordering-type'] === 'vertical') :
    7777
    78         <?php endfor; ?>
     78    for ($cols = 0; $cols < $column_count; $cols++) :
    7979
    80     <?php elseif($template_variables['ordering-type'] === 'vertical') :
     80        $incrementor = 0;
     81        $decrementor = 1;
     82        ?>
    8183
    82         for ($cols = 0; $cols < $column_count; $cols++) :
     84    <div class="tpc-waterfall-col" style="width: <?php echo $width?>%">
     85        <?php
     86        $incol_limit = $items_per_col;
    8387
    84             $incrementor = 0;
    85             $decrementor = 1;
    86             ?>
     88        if($remainder) {
     89            $incol_limit++;
     90            $remainder--;
     91        }
    8792
    88         <div class="tpc-waterfall-col" style="width: <?php echo $width?>%">
    89             <?php
    90             $incol_limit = $items_per_col;
     93        for ($rows = 0; $rows < $incol_limit; $rows++) :
     94            $index = $cols + 1;
     95            if($rows > 0) {
     96                $index += $incrementor;
     97            }
    9198
    92             if($remainder) {
    93                 $incol_limit++;
    94                 $remainder--;
    95             }
     99            $entry = $entries[$index - 1];
     100         ?>
     101            <article class="tpc-entry-block">
     102                <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     103                    <div class="tpc-thumbnail">
     104                        <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     105                            <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     106                        <?php else : ?>
     107                            <?php echo $entry['thumbnail'] ?>
     108                        <?php endif; ?>
     109                    </div>
     110                <?php endif; ?>
    96111
    97             for ($rows = 0; $rows < $incol_limit; $rows++) :
    98                 $index = $cols + 1;
    99                 if($rows > 0) {
    100                     $index += $incrementor;
    101                 }
     112                <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
     113                <div class="tpc-body">
     114                    <?php if($instance['show_page_title']) : ?>
     115                        <h3 class="tpc-title">
     116                        <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     117                            <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     118                        <?php else : ?>
     119                            <?php echo $entry['title'] ?>
     120                        <?php endif; ?>
     121                        </h3>
     122                    <?php endif; ?>
    102123
    103                 $entry = $entries[$index - 1];
    104              ?>
    105                 <article class="tpc-entry-block">
    106                     <?php var_dump($index); ?>
    107                     <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
    108                         <div class="tpc-thumbnail">
    109                             <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
    110                                 <a class="tpc-thumbnail-link" href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
    111                             <?php else : ?>
    112                                 <?php echo $entry['thumbnail'] ?>
    113                             <?php endif; ?>
    114                         </div>
    115                     <?php endif; ?>
     124                    <?php if($instance['show_page_content']) : ?>
     125                        <div class="tpc-content post-content">
     126                            <?php echo $entry['content'] ?>
     127                        </div>
     128                    <?php endif; ?>
     129                </div>
     130                <?php endif; ?>
     131            </article>
     132        <?php
    116133
    117                     <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    118                     <div class="tpc-body">
    119                         <?php if($instance['show_page_title']) : ?>
    120                             <h3 class="tpc-title">
    121                             <?php if($instance['linked_page_title'] && $entry['link']) : ?>
    122                                 <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
    123                             <?php else : ?>
    124                                 <?php echo $entry['title'] ?>
    125                             <?php endif; ?>
    126                             </h3>
    127                         <?php endif; ?>
     134        $incrementor += $column_count;
    128135
    129                         <?php if($instance['show_page_content']) : ?>
    130                             <div class="tpc-content post-content">
    131                                 <?php echo $entry['content'] ?>
    132                             </div>
    133                         <?php endif; ?>
    134                     </div>
    135                     <?php endif; ?>
    136                 </article>
    137             <?php
     136        endfor; ?>
    138137
    139             $incrementor += $column_count;
     138    </div>
    140139
    141             endfor; ?>
     140    <?php
     141    endfor;
    142142
    143         </div>
     143endif; ?>
    144144
    145         <?php
    146         endfor;
    147 
    148     endif; ?>
    149 
    150     </section>
    151 
    152 <?php endif;
     145</section>
  • tea-page-content/trunk/templates/client/modules/widget.php

    r1643033 r1643034  
    33
    44if($widget['title']) {
    5     echo $widget['before_title'] . $widget['title'] . $widget['after_title'];
     5    echo $widget['before_title'] . $widget['title'] . $widget['after_title'];
    66}
    77
  • tea-page-content/trunk/uninstall.php

    r1560974 r1643034  
    11<?php
    2 /**
    3  * @package Tea Page Content
    4  * @version 1.2.3
    5  */
    62
    7 if (!defined('WP_UNINSTALL_PLUGIN')) {
     3if(!defined('WP_UNINSTALL_PLUGIN')) {
    84    exit();
    95}
     
    128
    139if(is_array($settings_map) && !empty($settings_map)) {
    14     foreach ($settings_map as $setting_name => $setting_params) {
    15         $option = 'tpc_' . str_replace('.', '__', $setting_name);
     10    foreach ($settings_map as $setting_name => $setting_params) {
     11        $option = 'tpc_' . str_replace('.', '__', $setting_name);
    1612
    17         if(!is_null(get_option($option, null))) {
    18             delete_option($option);
    19         }
    20     }
     13        if(!is_null(get_option($option, null))) {
     14            delete_option($option);
     15        }
     16    }
    2117}
    2218
Note: See TracChangeset for help on using the changeset viewer.