Plugin Directory

Changeset 1384553


Ignore:
Timestamp:
04/01/2016 08:38:05 PM (10 years ago)
Author:
Tsjuder
Message:

Released Tea Page Content 1.1.0
Plugin renamed to Tea Page Widget & Content

Location:
tea-page-content
Files:
40 added
8 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • tea-page-content/tags/1.1.0/assets/css/tea-page-content-admin.css

    r1319161 r1384553  
    8383    margin-left: 10px;
    8484}
    85 .iqbc-mods-list label {
     85
     86.tpc-template-params hr {
     87    margin: 0;
     88}
     89
     90.tpc-preloader {
     91    position: relative;
     92}
     93.tpc-preloader:before {
     94    content: "";
    8695    display: block;
    87     float: left;
    88     clear: both;
    89     width: 100%;
     96    position: absolute;
     97
     98    top: 0;
     99    left: 0;
     100    right: 0;
     101    bottom: 0;
     102
     103    opacity: 0;
     104
     105    transition: opacity 500ms ease;
     106    -webkit-transition: opacity 500ms ease;
     107    -moz-transition: opacity 500ms ease;
     108    -ms-transition: opacity 500ms ease;
     109    -o-transition: opacity 500ms ease;
     110
     111    z-index: 1000;
     112
     113    background-image: url(/wp-admin/images/spinner-2x.gif);
     114    background-color: rgba(255,255,255,0.4);
     115    background-position: center center;
     116    background-repeat: no-repeat;
    90117}
    91 .iqbc-mods-list label span {
    92     display: block;
    93     white-space: nowrap;
    94     overflow: hidden;
    95 
    96     text-overflow: ellipsis;
     118.tpc-preloader.is-loading {}
     119.tpc-preloader.is-hidden:before {
     120    z-index: -1000;
    97121}
    98 .iqbc-mods-list label input[type=checkbox] {
    99     float: left;
    100     margin-top: 2px;
     122.tpc-preloader.is-loading:before {
     123    opacity: 1;
    101124}
    102 .iqbc-mods-list .col {
    103     width: 20%;
    104     float: left;
    105 }
    106 .iqbc-mods-list .submit,
    107 .iqbc-mods-list > p {
    108     clear: both;
    109 }
  • tea-page-content/tags/1.1.0/assets/css/tea-page-content-main.css

    r1319161 r1384553  
    55
    66.tpc-body .tpc-title {
    7     margin-bottom: 1em;
     7    margin-bottom: 0.5em;
     8}
     9.tpc-body .tpc-title:first-child {
     10    margin-top: 0;
     11}
     12.tpc-body .tpc-title:last-child {
     13    margin-bottom: 0;
     14}
     15
     16.tpc-content,
     17.tpc-thumbnail {
     18    padding-bottom: 1em;
     19}
     20.tpc-thumbnail:last-child {
     21    padding-bottom: 0;
     22}
     23
     24.tpc-thumbnail > a:hover {
     25    opacity: 0.85;
    826}
    927
     
    1129.tpc-entry-block + .tpc-entry-block {}
    1230
    13 .tpc-body,
     31
    1432.tpc-widget-title {
    1533    padding: 1em 0;
    1634}
    17 .tpc-block .tpc-thumbnail {
    18     padding-bottom: 1em;
    19 }
    2035
    21 .tpc-widget-title + .tpc-entry-block .tpc-body {
    22     /* padding-top: 0; */
    23 }
     36.tpc-widget-title + .tpc-entry-block .tpc-body {}
    2437
    2538.tpc-widget-title h3 {
     
    4053}
    4154
    42 /* Padded template */
     55/* Default Template */
     56.tpc-default + .tpc-default {
     57    margin-top: 1.5em;
     58}
     59
     60/* Padded Template */
    4361.tpc-default-padded .tpc-body,
    4462.tpc-default-padded .tpc-thumbnail {
     
    4664    padding-right: 1em;
    4765}
     66.tpc-default-padded .tpc-thumbnail {
     67    padding-bottom: 1em;
     68}
     69
     70/* Bootstrap Template */
     71.tpc-bootstrap .tpc-entry-block {
     72    margin-bottom: 30px; // default bootstrap gutter width
     73}
     74.tpc-bootstrap .row:last-child .tpc-entry-block:last-child {
     75    margin-bottom: 0;
     76}
  • tea-page-content/tags/1.1.0/assets/js/tea-page-content-admin.js

    r1319161 r1384553  
    1515            $target.slideToggle('fast');
    1616        });
     17
     18        $('#widgets-right').on('change', '.tpc-template-list', function() {
     19            var $this = $(this);
     20            var $variablesArea = $('#' + $this.attr('data-variables-area'));
     21            var $preloader = $this.closest('.tpc-preloader');
     22
     23            $preloader.removeClass('is-hidden').addClass('is-loading');
     24
     25            if($.trim($variablesArea.html())) {
     26                $variablesArea.slideUp('fast');
     27            } else {
     28                $variablesArea.hide();
     29            }
     30
     31            var data = {
     32                'action': 'get_template_variables',
     33                'template': $this.val(),
     34                'mask': $variablesArea.attr('data-mask-name')
     35            };
     36
     37            jQuery.post(ajaxurl, data, function(response) {
     38                if($.trim(response)) {
     39                    $variablesArea.html(response).slideDown('fast');   
     40                }
     41               
     42                $preloader.removeClass('is-loading');
     43
     44                setTimeout(function() {
     45                    $preloader.addClass('is-hidden');
     46                }, 500);
     47            });
     48        });
    1749    });
    1850
  • tea-page-content/tags/1.1.0/languages/tea-page-content-ru_RU.po

    r1319161 r1384553  
    66"Project-Id-Version: tea-page-content\n"
    77"Report-Msgid-Bugs-To: Translator Name <[email protected]>\n"
    8 "POT-Creation-Date: 2015-12-26 10:51+0400\n"
     8"POT-Creation-Date: 2016-04-01 14:34+0400\n"
    99"PO-Revision-Date: \n"
    1010"Last-Translator: \n"
     
    1919"X-Poedit-SourceCharset: UTF-8\n"
    2020"X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
    21 "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;"
    22 "_nx_noop:4c,1,2;_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;"
    23 "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
     21"esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
     22"_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,"
     23"_nc:4c,1,2\n"
    2424"X-Poedit-Basepath: ..\n"
    2525"X-Generator: Poedit 1.8.5\n"
    2626"X-Poedit-SearchPath-0: .\n"
     27
     28#: modules/widget.php:27
     29msgid "Tea Page Content"
     30msgstr "Tea Page Content"
     31
     32#: modules/widget.php:29
     33msgid "Allows display any content of any page or post."
     34msgstr "Позволяет отображать любой контент любой записи."
     35
     36#: tea-page-content.class.php:170
     37msgid ""
     38"Warning! Since Tea Page Content 1.1 some parameters is <b>deprecated</b>, "
     39"and will be <b>deleted</b> in the next release. We strongly recommend you "
     40"check out the <a href=\"https://wordpress.org/plugins/tea-page-content/"
     41"changelog/\">changelog</a>. <b>This notice appears only once!</b>"
     42msgstr ""
     43"Внимание! Начиная с версии Tea Page Content 1.1, некоторые параметры "
     44"<b>устарели</b>, и будут <b>удалены</b> в одном из следующих релизов. Мы "
     45"рекомендуем ознакомиться с <a href=\"https://wordpress.org/plugins/tea-page-"
     46"content/changelog/\">логом изменений</a>. <b>Это уведомление появляется "
     47"только один раз!</b>"
     48
     49#: templates/default-widget-admin-variables-area.php:5
     50msgid "Template Variables"
     51msgstr "Переменные шаблона"
    2752
    2853#: templates/default-widget-admin.php:3
     
    3863msgstr "Шаблон"
    3964
    40 #: templates/default-widget-admin.php:54
     65#: templates/default-widget-admin.php:58
    4166msgid "Order (by date)"
    4267msgstr "Сортировка (по дате)"
    4368
    44 #: templates/default-widget-admin.php:58
     69#: templates/default-widget-admin.php:62
    4570msgid "Descending"
    4671msgstr "По убыванию"
    4772
    48 #: templates/default-widget-admin.php:61
     73#: templates/default-widget-admin.php:65
    4974msgid "Ascending"
    5075msgstr "По возрастанию"
    5176
    52 #: templates/default-widget-admin.php:70
    53 msgid "Thumbnail"
    54 msgstr "Миниатюра"
     77#: templates/default-widget-admin.php:79
     78msgid "Show page thumbnail"
     79msgstr "Показывать миниатюру"
    5580
    56 #: widgets/tea-page-content.php:24
    57 msgid "Tea Page Content"
    58 msgstr "Tea Page Content"
     81#: templates/default-widget-admin.php:87
     82msgid "Show page title"
     83msgstr "Показывать заголовок страниц"
    5984
    60 #: widgets/tea-page-content.php:26
    61 msgid "Allows display any content of any page or post."
    62 msgstr "Позволяет отображать любой контент любой записи."
     85#: templates/default-widget-admin.php:95
     86msgid "Show page content"
     87msgstr "Показывать контент страниц"
     88
     89#: templates/default-widget-admin.php:103
     90msgid "Linked page title (if possible)"
     91msgstr "Линковать заголовки (при возможности)"
     92
     93#: templates/default-widget-admin.php:111
     94msgid "Linked page thumbnail (if possible)"
     95msgstr "Линковать миниатюры (при возможности)"
     96
     97#~ msgid ""
     98#~ "Warning! Starts from Tea Page Content 1.1 some parameters is "
     99#~ "<b>deprecated</b>, and will be <b>deleted</b> in the next release. We "
     100#~ "strongly recommend you check out the <a href=\"https://wordpress.org/"
     101#~ "plugins/tea-page-content/changelog/\">changelog</a>. <b>This notice "
     102#~ "appears only once!</b>"
     103#~ msgstr "Внимание!"
     104
     105#~ msgid "Thumbnail"
     106#~ msgstr "Миниатюра"
  • tea-page-content/tags/1.1.0/readme.txt

    r1319161 r1384553  
    1 === Tea Page Content ===
     1=== Tea Page Widget & Content ===
    22Contributors: Tsjuder
    33Tags: plugin, widget, shortcode, posts, post, pages, page, content
    44Requires at least: 4.0
    5 Tested up to: 4.4
    6 Stable tag: 1.0
     5Tested up to: 4.4.2
     6Stable tag: 1.1.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Powerful plugin that allows create blocks with content of any page, post, etc, and customize look of blocks via templates.
     10Plugin that allows create widget or shortcode with content of any post, and customize look of blocks via templates.
    1111
    1212== Description ==
    1313
    14 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 padded default.
     14Tea 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. Supported languages: English and Russian.
     15
     16= Key features =
     17* Very flexible template system
     18* Native support of all post types
     19* Possibility to create your own templates
     20* Developer and user friendly
     21* Easy to use
     22
     23= Migration Guides =
     24Stay tuned with new versions. For make updates safe and fast, check migration guide at <a href="https://wordpress.org/plugins/tea-page-content/other_notes/">Other Notes</a> tab.
     25
     26= Documentation =
     27You can find primary description at <a href="https://wordpress.org/plugins/tea-page-content/other_notes/">Other Notes</a> tab, and details at <a href="http://tsjuder.github.io/tea-page-content/">Github Page</a>.
    1528
    1629== Installation ==
     
    3346Yes. But every theme have unique css, and appearance of widget \ shortcode will be depend on theme styles.
    3447
     48= I don't have link to full post. How I can add it? =
     49
     50Links to full entry appears automatically - this feature depends of theme settings and Wordpress core. If you have more-tag in post content, or if content length long enough, "read more" link will be available. We don't override this behavior. Use native wordpress hooks for change it.
     51
     52= I found a bug or have a suggestion. What I can do? =
     53You can create new topic in forum at wordpress.org, or send me email (in my profile). I will answer you as soon as possible.
     54
    3555== Changelog ==
    3656
    37 = 1.0 =
     57= 1.1.0 =
     58* \+ Native support for all existed post types (and custom too)
     59* \+ Count of entries now passed in template
     60* \+ New feature - template-level variables
     61* \+ New template: Bootstrap 3.x
     62* \+ Added possibility hide title, content and link it. This feature depends of used template (all built-in templates except deprecated supports it)
     63* \- Default-Padded template, `thumbnail` widget and shortcode parameter, `id` shortcode parameter is **deprecated**. These features will be **deleted** in version 1.2. See docs for migration guide
     64* \* CSS for frontend part changed, improved paddings, adds hover effects
     65* \* Global code refactoring. We are friendly for developers!
     66* \* Bug fixes
     67
     68= 1.0.0 =
    3869* First release with basic functionality
    3970
    4071== Documentation ==
    4172
     73= Migration Guide =
     74** From 1.0.x to 1.1.x **
     75Since 1.1.x, nothing was deleted. But some options was marked as deprecated. We strongly recommend do these steps:
     761. If you're using **default padded** template, change it on **default** with layout what you prefer.
     772. If you're using shortcodes, replace parameter `id` to `posts`.
     783. If you're using widgets with **turned off** thumbnail option, re-save each of it.
     79
    4280= Shortcodes =
    43 There is just one shortcode `tea_page_content`. Below there is an example with all of possible parameters.
    44 `[tea_page_content template="default" order="asc" id="12,45,23" thumbnail="false"]`
     81There is just one shortcode `tea_page_content`. Below there is an example with basic parameters.
     82`[tea_page_content template="default" order="asc" posts="12,45,23"]`
     83You also can used template variables (see Templates section at documentation) and options.
    4584
    4685= Parameters =
    47 There is some built-in options. This is thumbnail, order and template. Let's take a closer look:
     86There is some built-in options. Let's take a closer look:
    4887
    49 * *Thumbnail* allows you enable or disable displaying thumbnail of entry. If you don't want see page thumbnail in widget or shortcode, just uncheck checkbox (for widget) or type `thumbnail="false"` (for shortcode).
    50 * *Order* allows you set entries order. All posts and pages will be sorted by date, and you can choose a direction - by ascending or by descending. Sorting by descending is a default behaviour.
     88* *order* allows you set entries order. All posts and pages will be sorted by date, and you can choose a direction - by ascending or by descending. Sorting by descending is a default behaviour.
    5189* *Template* allows you choose layout which will look as you want. In shortcode just type full name of your template without extension, for example `default` or `your-template-name`.
     90* *show_page_thumbnail* allows you enable or disable displaying thumbnail of entry. If you don't want see page thumbnail, type `show_page_thumbnail="false"`. Default - *true*.
     91* *show_page_content* allows you enable or disable displaying content of entry. Default - *true*.
     92* *show_page_title* allows you enable or disable displaying title of entry. Default - *true*.
     93* *linked_page_title* allows you enable or disable linking title of entry. In other words, title will be link to full article. Default - *false*.
     94* *linked_page_thumbnail* allows you enable or disable linking thumbnail of entry. In other words, thumbnail will be link to full article. Default - *false*.
    5295
    5396= Creating simplest custom template =
     
    78121    * **link** - Link of entry
    79122    * **id** - Entry ID
    80 * **$instance** - Array with user defined and default parameters
     123* **$count** - Count of all passed entries
     124* **$instance** - Array with user defined and default parameters. There is all list of options from self-titled section above.
  • tea-page-content/tags/1.1.0/tea-page-content.class.php

    r1319161 r1384553  
    22/**
    33 * @package Tea Page Content
    4  * @version 1.0.0
     4 * @version 1.1.0
    55 */
    66
    77class TeaPageContent {
    8     private static $_instance;
     8    private $_helper;
    99
    1010    /**
    11      * Private constructor
     11     * Constructor
    1212     *
    1313     * @return void
    1414     */
    15     private function __construct() {}
    16     private function __clone() {
    17         return self::$_instance;
    18     }
    19     private function __wakeup() {
    20         return self::$_instance;
    21     }
    22 
    23     /**
    24      * Enter point to the a singleton.
    25      *
    26      * @return object
    27      */
    28     public static function getInstance() {
    29         if(is_null(self::$_instance)) {
    30             self::$_instance = new self;
    31         }
    32 
    33         return self::$_instance;
    34     }
     15    public function __construct() {}
    3516
    3617    /**
     
    4021     */
    4122    public function initialize() {
    42         if(is_null(self::$_instance)) {
    43             self::getInstance();
    44         }
    45 
    46         // load textdomain
     23        // Load textdomain
    4724        load_plugin_textdomain('tea-page-content', false, TEA_PAGE_CONTENT_FOLDER . '/languages/');
    4825
    4926        // Adds filters, actions, etc.
    50         add_action('init', array(self::$_instance, 'registerShortcodes'));
    51         add_action('widgets_init', array(self::$_instance, 'registerWidgets'));
    52         add_filter('tpc_get_params', array(self::$_instance, 'flattenEntries'), 10, 1);
     27        add_action('init', array($this, 'registerShortcodes'));
     28        add_action('widgets_init', array($this, 'registerWidgets'));
     29
     30        // Tea Page Content filters
    5331
    5432        // Includes all css, js, etc.
    55         add_action('wp_enqueue_scripts', array(self::$_instance, 'includeAssets'), 100, 1);
    56         add_action('admin_enqueue_scripts', array(self::$_instance, 'includeAdminAssets'), 100, 1);
     33        add_action('wp_enqueue_scripts', array($this, 'includeAssets'), 100, 1);
     34        add_action('admin_enqueue_scripts', array($this, 'includeAdminAssets'), 100, 1);
     35
     36        add_action('wp_ajax_get_template_variables', array($this, 'getTemplateVariablesCallback'));
     37
     38        add_action('wp_ajax_set_notice_seen', array($this, 'setNoticeSeenCallback'));
     39
     40        // At first time notice user about possible migration
     41        if(!get_option('tpc_deprecated_notice')) {
     42            add_action('admin_notices', array($this, 'displayDeprecatedNotice'));
     43        }
     44
     45        $this->_helper = new TeaPageContent_Helper;
    5746    }
    5847
     
    6655    }
    6756
     57    /**
     58     * Register Tea Page Content shortcode
     59     *
     60     * @return void
     61     */
    6862    public function registerShortcodes() {
    69         add_shortcode('tea_page_content', array('TeaPageContent_Shortcodes', 'tea_page_content'));
     63        add_shortcode('tea_page_content', array('TeaPageContent_Shortcode', 'tea_page_content'));
    7064    }
    7165
     
    7872     */
    7973    public function includeAdminAssets($hook) {
     74        $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
     75
    8076        if($hook == 'widgets.php') {
    81             $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
    82 
    8377            wp_enqueue_script(
    8478                'tea-page-content-js',
    8579                $url . '/js/tea-page-content-admin.js',
    8680                array('jquery'),
    87                 '1.0.0',
     81                TeaPageContent_Config::get('system.versions.scripts'),
    8882                true
    8983            );
     
    9387                $url . '/css/tea-page-content-admin.css',
    9488                array(),
    95                 '1.0.0',
     89                TeaPageContent_Config::get('system.versions.styles'),
    9690                'all'
    9791            );
    9892        }
     93
     94        wp_enqueue_script(
     95            'tea-page-content-notices-js',
     96            $url . '/js/tea-page-content-admin-notices.js',
     97            array('jquery'),
     98            TeaPageContent_Config::get('system.versions.scripts'),
     99            true
     100        );
    99101    }
    100102
     
    107109    public function includeAssets() {
    108110        $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
    109 
    110         /*wp_enqueue_script(
    111             'tea-page-content-js',
    112             $url . '/js/tea-page-content-main.js',
    113             array('jquery'),
    114             '1.0.0',
    115             true
    116         );*/
    117111   
    118112        wp_enqueue_style(
     
    120114            $url . '/css/tea-page-content-main.css',
    121115            array(),
    122             '1.0.1',
     116            TeaPageContent_Config::get('system.versions.styles'),
    123117            'all'
    124118        );
     
    126120
    127121    /**
    128      * Filters entries from params of widget's frontend part
    129      * Binded to the tpc_get_params hook
     122     * Callback for AJAX-action. Gets and returns template variables
     123     * by passed template and mask. Mask is unique name of current instance of widget.
     124     * This function can be used only in ajax, in other cases it returns nothing.
    130125     *
    131      * Here, this function flattens two-dimensional
    132      * entries array into one-dimensional
     126     * @return void
     127     */
     128    public function getTemplateVariablesCallback() {
     129        $template = $_POST['template'];
     130        $mask = $_POST['mask'];
     131
     132        $layout = 'default-widget-admin-variables-area';
     133
     134        $layoutPath = $this->_helper->getTemplatePath($layout);
     135        $variables = $this->_helper->getVariables($template);
     136
     137        echo $this->_helper->renderTemplate(array(
     138            'variables' => $variables,
     139            'mask' => $mask
     140        ), $layoutPath);
     141
     142        wp_die();
     143    }
     144
     145    /**
     146     * Callback for AJAX-action. Fires when user closes deprecated notice.
     147     * Set up unique option with current version of this plugin.
    133148     *
    134      * @param array $params
    135      * @return array
     149     * This option will be deleted after uninstall.
     150     *
     151     * @return void
    136152     */
    137     public function flattenEntries($params) {
    138         if(isset($params['entries']) && count($params['entries'])) {
    139             $entries = &$params['entries'];
     153    public function setNoticeSeenCallback() {
     154        $version = $_POST['version']; // @todo get version from config
    140155
    141             $entries = call_user_func_array('array_merge', $entries);
     156        if(!get_option('tpc_deprecated_notice')) {
     157            add_option('tpc_deprecated_notice', $version, '', 'no');
    142158        }
     159    }
    143160
    144         return $params;
     161    /**
     162     * Created and print deprecated notice. Ugly, but simple.
     163     * Will be recommend check out changelog at wordpress.org
     164     *
     165     * @todo do something with html in my php
     166     *
     167     * @return void
     168     */
     169    public function displayDeprecatedNotice() {
     170        $message = __('Warning! Since Tea Page Content 1.1 some parameters is <b>deprecated</b>, and will be <b>deleted</b> in the next release. We strongly recommend you check out the <a href="https://wordpress.org/plugins/tea-page-content/changelog/">changelog</a>. <b>This notice appears only once!</b>');
     171        $content = '<div id="tpc-deprecated-notice" class="error notice tpc-deprecated-notice is-dismissible"><p>' . $message . '</p></div>';
     172
     173        echo $content;
    145174    }
    146175}
  • tea-page-content/tags/1.1.0/tea-page-content.php

    r1319161 r1384553  
    33Plugin Name: Tea Page Content
    44Plugin URI: http://tsjuder.github.io/tea-page-content
    5 Description: This plugin allows create most flexible blocks with any content of any page via widgets or shortcodes, and manage layouts of blocks with help of templates.
    6 Version: 1.0.0
     5Description: This plugin allows create blocks with content of any post, and customize look of blocks via templates. Widget, shortcode, all post types is supported.
     6Version: 1.1.0
    77Text Domain: tea-page-content
    88Domain Path: /languages/
     
    4141// Includes a core
    4242require_once(TEA_PAGE_CONTENT_PATH . '/tea-page-content.class.php');
    43 require_once(TEA_PAGE_CONTENT_PATH . '/helpers/helper.php');
    4443
    45 // Includes a widget interface
    46 require_once(TEA_PAGE_CONTENT_PATH . '/widgets/tea-page-content.php');
     44// Includes a classes
     45require_once(TEA_PAGE_CONTENT_PATH . '/classes/config.class.php');
     46require_once(TEA_PAGE_CONTENT_PATH . '/classes/helper.class.php');
    4747
    48 // Includes a shortcodes
    49 require_once(TEA_PAGE_CONTENT_PATH . '/shortcodes/tea-page-content.php');
     48// Includes a modules
     49require_once(TEA_PAGE_CONTENT_PATH . '/modules/shortcode.php');
     50require_once(TEA_PAGE_CONTENT_PATH . '/modules/widget.php');
    5051
    5152// Gets an instance
    52 $engine = TeaPageContent::getInstance();
     53$tpcEngine = new TeaPageContent;
    5354
    54 add_action('plugins_loaded', array($engine, 'initialize'));
     55add_action('plugins_loaded', array($tpcEngine, 'initialize'));
  • tea-page-content/tags/1.1.0/templates/default-padded.php

    r1319161 r1384553  
    44    <?php foreach ($entries as $key => $entry) : ?>
    55        <article class="tpc-entry-block">
    6             <?php if(isset($instance['thumbnail']) && $instance['thumbnail'] && $entry['thumbnail']) : ?>
     6            <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     7            <?php if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) :
     8                // @deprecated thumbnail param since 1.1
     9            else : ?>
    710                <div class="tpc-thumbnail">
    811                    <?php echo $entry['thumbnail'] ?>
    912                </div>
     13            <?php endif; ?>
    1014            <?php endif; ?>
    1115
  • tea-page-content/tags/1.1.0/templates/default-widget-admin.php

    r1319161 r1384553  
    11<p>
    2     <label for="<?php echo $bind->get_field_id('title'); ?>">
     2    <label for="<?php echo $bind->get_field_id('title') ?>">
    33        <?php _e('Title', 'tea-page-content'); ?>:
    44    </label>
    5     <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']; ?>" />
     5    <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'] ?>" />
    66</p>
    77
     
    2525                <?php $checked = in_array($postData['id'], $instance['posts']) ? 'checked' : ''; ?>
    2626                <label>
    27                     <input type="checkbox" name="<?php echo $bind->get_field_name('posts'); ?>[]" id="<?php echo $bind->get_field_id('posts'); ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
     27                    <input type="checkbox" name="<?php echo $bind->get_field_name('posts') ?>[]" id="<?php echo $bind->get_field_id('posts') ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
    2828                    <span><?php echo $postData['title'] ?></span>
    2929                </label>
     
    3636<?php endif; ?>
    3737
    38 <p>
    39     <label for="<?php echo $bind->get_field_id('template'); ?>">
     38<p class="tpc-preloader is-hidden">
     39    <label for="<?php echo $bind->get_field_id('template') ?>">
    4040        <?php _e('Template', 'tea-page-content'); ?>:
    4141    </label>
    42     <select class="widefat" id="<?php echo $bind->get_field_id('template'); ?>" name="<?php echo $bind->get_field_name('template'); ?>">
     42    <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">
    4343        <?php foreach ($templates as $alias) : ?>
    4444            <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
     
    5050</p>
    5151
     52<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}') ?>">
     53    <?php echo $partials['template_variables'] ?>
     54</div>
     55
    5256<p>
    53     <label for="<?php echo $bind->get_field_id('order'); ?>">
     57    <label for="<?php echo $bind->get_field_id('order') ?>">
    5458        <?php _e('Order (by date)', 'tea-page-content'); ?>:
    5559    </label>
    56     <select class="widefat" id="<?php echo $bind->get_field_id('order'); ?>" name="<?php echo $bind->get_field_name('order'); ?>">
     60    <select class="widefat" id="<?php echo $bind->get_field_id('order') ?>" name="<?php echo $bind->get_field_name('order') ?>">
    5761        <option value="desc" <?php if($instance['order'] == 'desc') : echo 'selected'; endif; ?>>
    5862            <?php _e('Descending', 'tea-page-content') ?>
     
    6569
    6670<p>
    67     <label for="<?php echo $bind->get_field_id('thumbnail'); ?>">
    68         <?php $checked = $instance['thumbnail'] ? 'checked' : ''; ?>
    69         <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('thumbnail'); ?>" name="<?php echo $bind->get_field_name('thumbnail'); ?>" value="1" <?php echo $checked ?> />
    70         <span><?php _e('Thumbnail', 'tea-page-content'); ?></span>
     71    <label for="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>">
     72        <?php
     73        $checked = $instance['show_page_thumbnail'] ? 'checked' : '';
     74
     75        // @deprecated since 1.1
     76        if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) $checked = '';
     77        ?>
     78        <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 ?> />
     79        <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
     80    </label>
     81
     82    <br />
     83
     84    <label for="<?php echo $bind->get_field_id('show_page_title'); ?>">
     85        <?php $checked = $instance['show_page_title'] ? 'checked' : ''; ?>
     86        <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 ?> />
     87        <span><?php _e('Show page title', 'tea-page-content'); ?></span>
     88    </label>
     89
     90    <br />
     91
     92    <label for="<?php echo $bind->get_field_id('show_page_content'); ?>">
     93        <?php $checked = $instance['show_page_content'] ? 'checked' : ''; ?>
     94        <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 ?> />
     95        <span><?php _e('Show page content', 'tea-page-content'); ?></span>
     96    </label>
     97
     98    <br />
     99
     100    <label for="<?php echo $bind->get_field_id('linked_page_title'); ?>">
     101        <?php $checked = $instance['linked_page_title'] ? 'checked' : ''; ?>
     102        <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 ?> />
     103        <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
     104    </label>
     105
     106    <br />
     107
     108    <label for="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>">
     109        <?php $checked = $instance['linked_page_thumbnail'] ? 'checked' : ''; ?>
     110        <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 ?> />
     111        <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
    71112    </label>
    72113</p>
  • tea-page-content/tags/1.1.0/templates/default.php

    r1319161 r1384553  
    1 <?php if(isset($entries) && count($entries)) :  ?>
     1<?php
     2/**
     3 * @param is-padded checkbox 0
     4 */
    25
    3 <section class="tpc-block tpc-default">
     6// prevention for old version of this plugin, @deprecated since 1.1
     7$isPadded = false;
     8if(isset($template_variables['is-padded']) && $template_variables['is-padded']) {
     9    $isPadded = true;
     10}
     11?>
     12<?php if(isset($entries) && $count) : ?>
     13
     14<section class="tpc-block tpc-default<?php if($isPadded) echo '-padded'; ?>">
    415    <?php foreach ($entries as $key => $entry) : ?>
    516        <article class="tpc-entry-block">
    6             <?php if(isset($instance['thumbnail']) && $instance['thumbnail'] !== 'false' && $entry['thumbnail']) : ?>
    7                 <?php echo $entry['thumbnail'] ?>
     17            <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     18            <?php if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) :
     19                // @deprecated thumbnail param since 1.1
     20            else : ?>
     21                <div class="tpc-thumbnail">
     22                    <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     23                        <a href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     24                    <?php else : ?>
     25                        <?php echo $entry['thumbnail'] ?>
     26                    <?php endif; ?>
     27                </div>
     28            <?php endif; ?>
    829            <?php endif; ?>
    930
     31            <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    1032            <div class="tpc-body">
    11                 <h3 class="tpc-title"><?php echo $entry['title'] ?></h3>
    12                 <div class="tpc-content post-content">
    13                     <?php echo $entry['content'] ?>
    14                 </div>
     33                <?php if($instance['show_page_title']) : ?>
     34                    <h3 class="tpc-title">
     35                    <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     36                        <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     37                    <?php else : ?>
     38                        <?php echo $entry['title'] ?>
     39                    <?php endif; ?>
     40                    </h3>
     41                <?php endif; ?>
     42
     43                <?php if($instance['show_page_content']) : ?>
     44                    <div class="tpc-content post-content">
     45                        <?php echo $entry['content'] ?>
     46                    </div>
     47                <?php endif; ?>
    1548            </div>
     49            <?php endif; ?>
    1650           
    1751        </article>
  • tea-page-content/trunk/assets/css/tea-page-content-admin.css

    r1319161 r1384553  
    8383    margin-left: 10px;
    8484}
    85 .iqbc-mods-list label {
     85
     86.tpc-template-params hr {
     87    margin: 0;
     88}
     89
     90.tpc-preloader {
     91    position: relative;
     92}
     93.tpc-preloader:before {
     94    content: "";
    8695    display: block;
    87     float: left;
    88     clear: both;
    89     width: 100%;
     96    position: absolute;
     97
     98    top: 0;
     99    left: 0;
     100    right: 0;
     101    bottom: 0;
     102
     103    opacity: 0;
     104
     105    transition: opacity 500ms ease;
     106    -webkit-transition: opacity 500ms ease;
     107    -moz-transition: opacity 500ms ease;
     108    -ms-transition: opacity 500ms ease;
     109    -o-transition: opacity 500ms ease;
     110
     111    z-index: 1000;
     112
     113    background-image: url(/wp-admin/images/spinner-2x.gif);
     114    background-color: rgba(255,255,255,0.4);
     115    background-position: center center;
     116    background-repeat: no-repeat;
    90117}
    91 .iqbc-mods-list label span {
    92     display: block;
    93     white-space: nowrap;
    94     overflow: hidden;
    95 
    96     text-overflow: ellipsis;
     118.tpc-preloader.is-loading {}
     119.tpc-preloader.is-hidden:before {
     120    z-index: -1000;
    97121}
    98 .iqbc-mods-list label input[type=checkbox] {
    99     float: left;
    100     margin-top: 2px;
     122.tpc-preloader.is-loading:before {
     123    opacity: 1;
    101124}
    102 .iqbc-mods-list .col {
    103     width: 20%;
    104     float: left;
    105 }
    106 .iqbc-mods-list .submit,
    107 .iqbc-mods-list > p {
    108     clear: both;
    109 }
  • tea-page-content/trunk/assets/css/tea-page-content-main.css

    r1319161 r1384553  
    55
    66.tpc-body .tpc-title {
    7     margin-bottom: 1em;
     7    margin-bottom: 0.5em;
     8}
     9.tpc-body .tpc-title:first-child {
     10    margin-top: 0;
     11}
     12.tpc-body .tpc-title:last-child {
     13    margin-bottom: 0;
     14}
     15
     16.tpc-content,
     17.tpc-thumbnail {
     18    padding-bottom: 1em;
     19}
     20.tpc-thumbnail:last-child {
     21    padding-bottom: 0;
     22}
     23
     24.tpc-thumbnail > a:hover {
     25    opacity: 0.85;
    826}
    927
     
    1129.tpc-entry-block + .tpc-entry-block {}
    1230
    13 .tpc-body,
     31
    1432.tpc-widget-title {
    1533    padding: 1em 0;
    1634}
    17 .tpc-block .tpc-thumbnail {
    18     padding-bottom: 1em;
    19 }
    2035
    21 .tpc-widget-title + .tpc-entry-block .tpc-body {
    22     /* padding-top: 0; */
    23 }
     36.tpc-widget-title + .tpc-entry-block .tpc-body {}
    2437
    2538.tpc-widget-title h3 {
     
    4053}
    4154
    42 /* Padded template */
     55/* Default Template */
     56.tpc-default + .tpc-default {
     57    margin-top: 1.5em;
     58}
     59
     60/* Padded Template */
    4361.tpc-default-padded .tpc-body,
    4462.tpc-default-padded .tpc-thumbnail {
     
    4664    padding-right: 1em;
    4765}
     66.tpc-default-padded .tpc-thumbnail {
     67    padding-bottom: 1em;
     68}
     69
     70/* Bootstrap Template */
     71.tpc-bootstrap .tpc-entry-block {
     72    margin-bottom: 30px; // default bootstrap gutter width
     73}
     74.tpc-bootstrap .row:last-child .tpc-entry-block:last-child {
     75    margin-bottom: 0;
     76}
  • tea-page-content/trunk/assets/js/tea-page-content-admin.js

    r1319161 r1384553  
    1515            $target.slideToggle('fast');
    1616        });
     17
     18        $('#widgets-right').on('change', '.tpc-template-list', function() {
     19            var $this = $(this);
     20            var $variablesArea = $('#' + $this.attr('data-variables-area'));
     21            var $preloader = $this.closest('.tpc-preloader');
     22
     23            $preloader.removeClass('is-hidden').addClass('is-loading');
     24
     25            if($.trim($variablesArea.html())) {
     26                $variablesArea.slideUp('fast');
     27            } else {
     28                $variablesArea.hide();
     29            }
     30
     31            var data = {
     32                'action': 'get_template_variables',
     33                'template': $this.val(),
     34                'mask': $variablesArea.attr('data-mask-name')
     35            };
     36
     37            jQuery.post(ajaxurl, data, function(response) {
     38                if($.trim(response)) {
     39                    $variablesArea.html(response).slideDown('fast');   
     40                }
     41               
     42                $preloader.removeClass('is-loading');
     43
     44                setTimeout(function() {
     45                    $preloader.addClass('is-hidden');
     46                }, 500);
     47            });
     48        });
    1749    });
    1850
  • tea-page-content/trunk/languages/tea-page-content-ru_RU.po

    r1319161 r1384553  
    66"Project-Id-Version: tea-page-content\n"
    77"Report-Msgid-Bugs-To: Translator Name <[email protected]>\n"
    8 "POT-Creation-Date: 2015-12-26 10:51+0400\n"
     8"POT-Creation-Date: 2016-04-01 14:34+0400\n"
    99"PO-Revision-Date: \n"
    1010"Last-Translator: \n"
     
    1919"X-Poedit-SourceCharset: UTF-8\n"
    2020"X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
    21 "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;"
    22 "_nx_noop:4c,1,2;_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;"
    23 "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
     21"esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
     22"_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,"
     23"_nc:4c,1,2\n"
    2424"X-Poedit-Basepath: ..\n"
    2525"X-Generator: Poedit 1.8.5\n"
    2626"X-Poedit-SearchPath-0: .\n"
     27
     28#: modules/widget.php:27
     29msgid "Tea Page Content"
     30msgstr "Tea Page Content"
     31
     32#: modules/widget.php:29
     33msgid "Allows display any content of any page or post."
     34msgstr "Позволяет отображать любой контент любой записи."
     35
     36#: tea-page-content.class.php:170
     37msgid ""
     38"Warning! Since Tea Page Content 1.1 some parameters is <b>deprecated</b>, "
     39"and will be <b>deleted</b> in the next release. We strongly recommend you "
     40"check out the <a href=\"https://wordpress.org/plugins/tea-page-content/"
     41"changelog/\">changelog</a>. <b>This notice appears only once!</b>"
     42msgstr ""
     43"Внимание! Начиная с версии Tea Page Content 1.1, некоторые параметры "
     44"<b>устарели</b>, и будут <b>удалены</b> в одном из следующих релизов. Мы "
     45"рекомендуем ознакомиться с <a href=\"https://wordpress.org/plugins/tea-page-"
     46"content/changelog/\">логом изменений</a>. <b>Это уведомление появляется "
     47"только один раз!</b>"
     48
     49#: templates/default-widget-admin-variables-area.php:5
     50msgid "Template Variables"
     51msgstr "Переменные шаблона"
    2752
    2853#: templates/default-widget-admin.php:3
     
    3863msgstr "Шаблон"
    3964
    40 #: templates/default-widget-admin.php:54
     65#: templates/default-widget-admin.php:58
    4166msgid "Order (by date)"
    4267msgstr "Сортировка (по дате)"
    4368
    44 #: templates/default-widget-admin.php:58
     69#: templates/default-widget-admin.php:62
    4570msgid "Descending"
    4671msgstr "По убыванию"
    4772
    48 #: templates/default-widget-admin.php:61
     73#: templates/default-widget-admin.php:65
    4974msgid "Ascending"
    5075msgstr "По возрастанию"
    5176
    52 #: templates/default-widget-admin.php:70
    53 msgid "Thumbnail"
    54 msgstr "Миниатюра"
     77#: templates/default-widget-admin.php:79
     78msgid "Show page thumbnail"
     79msgstr "Показывать миниатюру"
    5580
    56 #: widgets/tea-page-content.php:24
    57 msgid "Tea Page Content"
    58 msgstr "Tea Page Content"
     81#: templates/default-widget-admin.php:87
     82msgid "Show page title"
     83msgstr "Показывать заголовок страниц"
    5984
    60 #: widgets/tea-page-content.php:26
    61 msgid "Allows display any content of any page or post."
    62 msgstr "Позволяет отображать любой контент любой записи."
     85#: templates/default-widget-admin.php:95
     86msgid "Show page content"
     87msgstr "Показывать контент страниц"
     88
     89#: templates/default-widget-admin.php:103
     90msgid "Linked page title (if possible)"
     91msgstr "Линковать заголовки (при возможности)"
     92
     93#: templates/default-widget-admin.php:111
     94msgid "Linked page thumbnail (if possible)"
     95msgstr "Линковать миниатюры (при возможности)"
     96
     97#~ msgid ""
     98#~ "Warning! Starts from Tea Page Content 1.1 some parameters is "
     99#~ "<b>deprecated</b>, and will be <b>deleted</b> in the next release. We "
     100#~ "strongly recommend you check out the <a href=\"https://wordpress.org/"
     101#~ "plugins/tea-page-content/changelog/\">changelog</a>. <b>This notice "
     102#~ "appears only once!</b>"
     103#~ msgstr "Внимание!"
     104
     105#~ msgid "Thumbnail"
     106#~ msgstr "Миниатюра"
  • tea-page-content/trunk/readme.txt

    r1319161 r1384553  
    1 === Tea Page Content ===
     1=== Tea Page Widget & Content ===
    22Contributors: Tsjuder
    33Tags: plugin, widget, shortcode, posts, post, pages, page, content
    44Requires at least: 4.0
    5 Tested up to: 4.4
    6 Stable tag: 1.0
     5Tested up to: 4.4.2
     6Stable tag: 1.1.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Powerful plugin that allows create blocks with content of any page, post, etc, and customize look of blocks via templates.
     10Plugin that allows create widget or shortcode with content of any post, and customize look of blocks via templates.
    1111
    1212== Description ==
    1313
    14 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 padded default.
     14Tea 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. Supported languages: English and Russian.
     15
     16= Key features =
     17* Very flexible template system
     18* Native support of all post types
     19* Possibility to create your own templates
     20* Developer and user friendly
     21* Easy to use
     22
     23= Migration Guides =
     24Stay tuned with new versions. For make updates safe and fast, check migration guide at <a href="https://wordpress.org/plugins/tea-page-content/other_notes/">Other Notes</a> tab.
     25
     26= Documentation =
     27You can find primary description at <a href="https://wordpress.org/plugins/tea-page-content/other_notes/">Other Notes</a> tab, and details at <a href="http://tsjuder.github.io/tea-page-content/">Github Page</a>.
    1528
    1629== Installation ==
     
    3346Yes. But every theme have unique css, and appearance of widget \ shortcode will be depend on theme styles.
    3447
     48= I don't have link to full post. How I can add it? =
     49
     50Links to full entry appears automatically - this feature depends of theme settings and Wordpress core. If you have more-tag in post content, or if content length long enough, "read more" link will be available. We don't override this behavior. Use native wordpress hooks for change it.
     51
     52= I found a bug or have a suggestion. What I can do? =
     53You can create new topic in forum at wordpress.org, or send me email (in my profile). I will answer you as soon as possible.
     54
    3555== Changelog ==
    3656
    37 = 1.0 =
     57= 1.1.0 =
     58* \+ Native support for all existed post types (and custom too)
     59* \+ Count of entries now passed in template
     60* \+ New feature - template-level variables
     61* \+ New template: Bootstrap 3.x
     62* \+ Added possibility hide title, content and link it. This feature depends of used template (all built-in templates except deprecated supports it)
     63* \- Default-Padded template, `thumbnail` widget and shortcode parameter, `id` shortcode parameter is **deprecated**. These features will be **deleted** in version 1.2. See docs for migration guide
     64* \* CSS for frontend part changed, improved paddings, adds hover effects
     65* \* Global code refactoring. We are friendly for developers!
     66* \* Bug fixes
     67
     68= 1.0.0 =
    3869* First release with basic functionality
    3970
    4071== Documentation ==
    4172
     73= Migration Guide =
     74** From 1.0.x to 1.1.x **
     75Since 1.1.x, nothing was deleted. But some options was marked as deprecated. We strongly recommend do these steps:
     761. If you're using **default padded** template, change it on **default** with layout what you prefer.
     772. If you're using shortcodes, replace parameter `id` to `posts`.
     783. If you're using widgets with **turned off** thumbnail option, re-save each of it.
     79
    4280= Shortcodes =
    43 There is just one shortcode `tea_page_content`. Below there is an example with all of possible parameters.
    44 `[tea_page_content template="default" order="asc" id="12,45,23" thumbnail="false"]`
     81There is just one shortcode `tea_page_content`. Below there is an example with basic parameters.
     82`[tea_page_content template="default" order="asc" posts="12,45,23"]`
     83You also can used template variables (see Templates section at documentation) and options.
    4584
    4685= Parameters =
    47 There is some built-in options. This is thumbnail, order and template. Let's take a closer look:
     86There is some built-in options. Let's take a closer look:
    4887
    49 * *Thumbnail* allows you enable or disable displaying thumbnail of entry. If you don't want see page thumbnail in widget or shortcode, just uncheck checkbox (for widget) or type `thumbnail="false"` (for shortcode).
    50 * *Order* allows you set entries order. All posts and pages will be sorted by date, and you can choose a direction - by ascending or by descending. Sorting by descending is a default behaviour.
     88* *order* allows you set entries order. All posts and pages will be sorted by date, and you can choose a direction - by ascending or by descending. Sorting by descending is a default behaviour.
    5189* *Template* allows you choose layout which will look as you want. In shortcode just type full name of your template without extension, for example `default` or `your-template-name`.
     90* *show_page_thumbnail* allows you enable or disable displaying thumbnail of entry. If you don't want see page thumbnail, type `show_page_thumbnail="false"`. Default - *true*.
     91* *show_page_content* allows you enable or disable displaying content of entry. Default - *true*.
     92* *show_page_title* allows you enable or disable displaying title of entry. Default - *true*.
     93* *linked_page_title* allows you enable or disable linking title of entry. In other words, title will be link to full article. Default - *false*.
     94* *linked_page_thumbnail* allows you enable or disable linking thumbnail of entry. In other words, thumbnail will be link to full article. Default - *false*.
    5295
    5396= Creating simplest custom template =
     
    78121    * **link** - Link of entry
    79122    * **id** - Entry ID
    80 * **$instance** - Array with user defined and default parameters
     123* **$count** - Count of all passed entries
     124* **$instance** - Array with user defined and default parameters. There is all list of options from self-titled section above.
  • tea-page-content/trunk/tea-page-content.class.php

    r1319161 r1384553  
    22/**
    33 * @package Tea Page Content
    4  * @version 1.0.0
     4 * @version 1.1.0
    55 */
    66
    77class TeaPageContent {
    8     private static $_instance;
     8    private $_helper;
    99
    1010    /**
    11      * Private constructor
     11     * Constructor
    1212     *
    1313     * @return void
    1414     */
    15     private function __construct() {}
    16     private function __clone() {
    17         return self::$_instance;
    18     }
    19     private function __wakeup() {
    20         return self::$_instance;
    21     }
    22 
    23     /**
    24      * Enter point to the a singleton.
    25      *
    26      * @return object
    27      */
    28     public static function getInstance() {
    29         if(is_null(self::$_instance)) {
    30             self::$_instance = new self;
    31         }
    32 
    33         return self::$_instance;
    34     }
     15    public function __construct() {}
    3516
    3617    /**
     
    4021     */
    4122    public function initialize() {
    42         if(is_null(self::$_instance)) {
    43             self::getInstance();
    44         }
    45 
    46         // load textdomain
     23        // Load textdomain
    4724        load_plugin_textdomain('tea-page-content', false, TEA_PAGE_CONTENT_FOLDER . '/languages/');
    4825
    4926        // Adds filters, actions, etc.
    50         add_action('init', array(self::$_instance, 'registerShortcodes'));
    51         add_action('widgets_init', array(self::$_instance, 'registerWidgets'));
    52         add_filter('tpc_get_params', array(self::$_instance, 'flattenEntries'), 10, 1);
     27        add_action('init', array($this, 'registerShortcodes'));
     28        add_action('widgets_init', array($this, 'registerWidgets'));
     29
     30        // Tea Page Content filters
    5331
    5432        // Includes all css, js, etc.
    55         add_action('wp_enqueue_scripts', array(self::$_instance, 'includeAssets'), 100, 1);
    56         add_action('admin_enqueue_scripts', array(self::$_instance, 'includeAdminAssets'), 100, 1);
     33        add_action('wp_enqueue_scripts', array($this, 'includeAssets'), 100, 1);
     34        add_action('admin_enqueue_scripts', array($this, 'includeAdminAssets'), 100, 1);
     35
     36        add_action('wp_ajax_get_template_variables', array($this, 'getTemplateVariablesCallback'));
     37
     38        add_action('wp_ajax_set_notice_seen', array($this, 'setNoticeSeenCallback'));
     39
     40        // At first time notice user about possible migration
     41        if(!get_option('tpc_deprecated_notice')) {
     42            add_action('admin_notices', array($this, 'displayDeprecatedNotice'));
     43        }
     44
     45        $this->_helper = new TeaPageContent_Helper;
    5746    }
    5847
     
    6655    }
    6756
     57    /**
     58     * Register Tea Page Content shortcode
     59     *
     60     * @return void
     61     */
    6862    public function registerShortcodes() {
    69         add_shortcode('tea_page_content', array('TeaPageContent_Shortcodes', 'tea_page_content'));
     63        add_shortcode('tea_page_content', array('TeaPageContent_Shortcode', 'tea_page_content'));
    7064    }
    7165
     
    7872     */
    7973    public function includeAdminAssets($hook) {
     74        $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
     75
    8076        if($hook == 'widgets.php') {
    81             $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
    82 
    8377            wp_enqueue_script(
    8478                'tea-page-content-js',
    8579                $url . '/js/tea-page-content-admin.js',
    8680                array('jquery'),
    87                 '1.0.0',
     81                TeaPageContent_Config::get('system.versions.scripts'),
    8882                true
    8983            );
     
    9387                $url . '/css/tea-page-content-admin.css',
    9488                array(),
    95                 '1.0.0',
     89                TeaPageContent_Config::get('system.versions.styles'),
    9690                'all'
    9791            );
    9892        }
     93
     94        wp_enqueue_script(
     95            'tea-page-content-notices-js',
     96            $url . '/js/tea-page-content-admin-notices.js',
     97            array('jquery'),
     98            TeaPageContent_Config::get('system.versions.scripts'),
     99            true
     100        );
    99101    }
    100102
     
    107109    public function includeAssets() {
    108110        $url = plugins_url('/assets', TEA_PAGE_CONTENT_FILE);
    109 
    110         /*wp_enqueue_script(
    111             'tea-page-content-js',
    112             $url . '/js/tea-page-content-main.js',
    113             array('jquery'),
    114             '1.0.0',
    115             true
    116         );*/
    117111   
    118112        wp_enqueue_style(
     
    120114            $url . '/css/tea-page-content-main.css',
    121115            array(),
    122             '1.0.1',
     116            TeaPageContent_Config::get('system.versions.styles'),
    123117            'all'
    124118        );
     
    126120
    127121    /**
    128      * Filters entries from params of widget's frontend part
    129      * Binded to the tpc_get_params hook
     122     * Callback for AJAX-action. Gets and returns template variables
     123     * by passed template and mask. Mask is unique name of current instance of widget.
     124     * This function can be used only in ajax, in other cases it returns nothing.
    130125     *
    131      * Here, this function flattens two-dimensional
    132      * entries array into one-dimensional
     126     * @return void
     127     */
     128    public function getTemplateVariablesCallback() {
     129        $template = $_POST['template'];
     130        $mask = $_POST['mask'];
     131
     132        $layout = 'default-widget-admin-variables-area';
     133
     134        $layoutPath = $this->_helper->getTemplatePath($layout);
     135        $variables = $this->_helper->getVariables($template);
     136
     137        echo $this->_helper->renderTemplate(array(
     138            'variables' => $variables,
     139            'mask' => $mask
     140        ), $layoutPath);
     141
     142        wp_die();
     143    }
     144
     145    /**
     146     * Callback for AJAX-action. Fires when user closes deprecated notice.
     147     * Set up unique option with current version of this plugin.
    133148     *
    134      * @param array $params
    135      * @return array
     149     * This option will be deleted after uninstall.
     150     *
     151     * @return void
    136152     */
    137     public function flattenEntries($params) {
    138         if(isset($params['entries']) && count($params['entries'])) {
    139             $entries = &$params['entries'];
     153    public function setNoticeSeenCallback() {
     154        $version = $_POST['version']; // @todo get version from config
    140155
    141             $entries = call_user_func_array('array_merge', $entries);
     156        if(!get_option('tpc_deprecated_notice')) {
     157            add_option('tpc_deprecated_notice', $version, '', 'no');
    142158        }
     159    }
    143160
    144         return $params;
     161    /**
     162     * Created and print deprecated notice. Ugly, but simple.
     163     * Will be recommend check out changelog at wordpress.org
     164     *
     165     * @todo do something with html in my php
     166     *
     167     * @return void
     168     */
     169    public function displayDeprecatedNotice() {
     170        $message = __('Warning! Since Tea Page Content 1.1 some parameters is <b>deprecated</b>, and will be <b>deleted</b> in the next release. We strongly recommend you check out the <a href="https://wordpress.org/plugins/tea-page-content/changelog/">changelog</a>. <b>This notice appears only once!</b>');
     171        $content = '<div id="tpc-deprecated-notice" class="error notice tpc-deprecated-notice is-dismissible"><p>' . $message . '</p></div>';
     172
     173        echo $content;
    145174    }
    146175}
  • tea-page-content/trunk/tea-page-content.php

    r1319161 r1384553  
    33Plugin Name: Tea Page Content
    44Plugin URI: http://tsjuder.github.io/tea-page-content
    5 Description: This plugin allows create most flexible blocks with any content of any page via widgets or shortcodes, and manage layouts of blocks with help of templates.
    6 Version: 1.0.0
     5Description: This plugin allows create blocks with content of any post, and customize look of blocks via templates. Widget, shortcode, all post types is supported.
     6Version: 1.1.0
    77Text Domain: tea-page-content
    88Domain Path: /languages/
     
    4141// Includes a core
    4242require_once(TEA_PAGE_CONTENT_PATH . '/tea-page-content.class.php');
    43 require_once(TEA_PAGE_CONTENT_PATH . '/helpers/helper.php');
    4443
    45 // Includes a widget interface
    46 require_once(TEA_PAGE_CONTENT_PATH . '/widgets/tea-page-content.php');
     44// Includes a classes
     45require_once(TEA_PAGE_CONTENT_PATH . '/classes/config.class.php');
     46require_once(TEA_PAGE_CONTENT_PATH . '/classes/helper.class.php');
    4747
    48 // Includes a shortcodes
    49 require_once(TEA_PAGE_CONTENT_PATH . '/shortcodes/tea-page-content.php');
     48// Includes a modules
     49require_once(TEA_PAGE_CONTENT_PATH . '/modules/shortcode.php');
     50require_once(TEA_PAGE_CONTENT_PATH . '/modules/widget.php');
    5051
    5152// Gets an instance
    52 $engine = TeaPageContent::getInstance();
     53$tpcEngine = new TeaPageContent;
    5354
    54 add_action('plugins_loaded', array($engine, 'initialize'));
     55add_action('plugins_loaded', array($tpcEngine, 'initialize'));
  • tea-page-content/trunk/templates/default-padded.php

    r1319161 r1384553  
    44    <?php foreach ($entries as $key => $entry) : ?>
    55        <article class="tpc-entry-block">
    6             <?php if(isset($instance['thumbnail']) && $instance['thumbnail'] && $entry['thumbnail']) : ?>
     6            <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     7            <?php if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) :
     8                // @deprecated thumbnail param since 1.1
     9            else : ?>
    710                <div class="tpc-thumbnail">
    811                    <?php echo $entry['thumbnail'] ?>
    912                </div>
     13            <?php endif; ?>
    1014            <?php endif; ?>
    1115
  • tea-page-content/trunk/templates/default-widget-admin.php

    r1319161 r1384553  
    11<p>
    2     <label for="<?php echo $bind->get_field_id('title'); ?>">
     2    <label for="<?php echo $bind->get_field_id('title') ?>">
    33        <?php _e('Title', 'tea-page-content'); ?>:
    44    </label>
    5     <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']; ?>" />
     5    <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'] ?>" />
    66</p>
    77
     
    2525                <?php $checked = in_array($postData['id'], $instance['posts']) ? 'checked' : ''; ?>
    2626                <label>
    27                     <input type="checkbox" name="<?php echo $bind->get_field_name('posts'); ?>[]" id="<?php echo $bind->get_field_id('posts'); ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
     27                    <input type="checkbox" name="<?php echo $bind->get_field_name('posts') ?>[]" id="<?php echo $bind->get_field_id('posts') ?>" value="<?php echo $postData['id'] ?>" <?php echo $checked ?> />
    2828                    <span><?php echo $postData['title'] ?></span>
    2929                </label>
     
    3636<?php endif; ?>
    3737
    38 <p>
    39     <label for="<?php echo $bind->get_field_id('template'); ?>">
     38<p class="tpc-preloader is-hidden">
     39    <label for="<?php echo $bind->get_field_id('template') ?>">
    4040        <?php _e('Template', 'tea-page-content'); ?>:
    4141    </label>
    42     <select class="widefat" id="<?php echo $bind->get_field_id('template'); ?>" name="<?php echo $bind->get_field_name('template'); ?>">
     42    <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">
    4343        <?php foreach ($templates as $alias) : ?>
    4444            <?php $selected = $alias == $instance['template'] ? 'selected' : ''; ?>
     
    5050</p>
    5151
     52<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}') ?>">
     53    <?php echo $partials['template_variables'] ?>
     54</div>
     55
    5256<p>
    53     <label for="<?php echo $bind->get_field_id('order'); ?>">
     57    <label for="<?php echo $bind->get_field_id('order') ?>">
    5458        <?php _e('Order (by date)', 'tea-page-content'); ?>:
    5559    </label>
    56     <select class="widefat" id="<?php echo $bind->get_field_id('order'); ?>" name="<?php echo $bind->get_field_name('order'); ?>">
     60    <select class="widefat" id="<?php echo $bind->get_field_id('order') ?>" name="<?php echo $bind->get_field_name('order') ?>">
    5761        <option value="desc" <?php if($instance['order'] == 'desc') : echo 'selected'; endif; ?>>
    5862            <?php _e('Descending', 'tea-page-content') ?>
     
    6569
    6670<p>
    67     <label for="<?php echo $bind->get_field_id('thumbnail'); ?>">
    68         <?php $checked = $instance['thumbnail'] ? 'checked' : ''; ?>
    69         <input class="widefat" type="checkbox" id="<?php echo $bind->get_field_id('thumbnail'); ?>" name="<?php echo $bind->get_field_name('thumbnail'); ?>" value="1" <?php echo $checked ?> />
    70         <span><?php _e('Thumbnail', 'tea-page-content'); ?></span>
     71    <label for="<?php echo $bind->get_field_id('show_page_thumbnail'); ?>">
     72        <?php
     73        $checked = $instance['show_page_thumbnail'] ? 'checked' : '';
     74
     75        // @deprecated since 1.1
     76        if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) $checked = '';
     77        ?>
     78        <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 ?> />
     79        <span><?php _e('Show page thumbnail', 'tea-page-content'); ?></span>
     80    </label>
     81
     82    <br />
     83
     84    <label for="<?php echo $bind->get_field_id('show_page_title'); ?>">
     85        <?php $checked = $instance['show_page_title'] ? 'checked' : ''; ?>
     86        <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 ?> />
     87        <span><?php _e('Show page title', 'tea-page-content'); ?></span>
     88    </label>
     89
     90    <br />
     91
     92    <label for="<?php echo $bind->get_field_id('show_page_content'); ?>">
     93        <?php $checked = $instance['show_page_content'] ? 'checked' : ''; ?>
     94        <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 ?> />
     95        <span><?php _e('Show page content', 'tea-page-content'); ?></span>
     96    </label>
     97
     98    <br />
     99
     100    <label for="<?php echo $bind->get_field_id('linked_page_title'); ?>">
     101        <?php $checked = $instance['linked_page_title'] ? 'checked' : ''; ?>
     102        <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 ?> />
     103        <span><?php _e('Linked page title (if possible)', 'tea-page-content'); ?></span>
     104    </label>
     105
     106    <br />
     107
     108    <label for="<?php echo $bind->get_field_id('linked_page_thumbnail'); ?>">
     109        <?php $checked = $instance['linked_page_thumbnail'] ? 'checked' : ''; ?>
     110        <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 ?> />
     111        <span><?php _e('Linked page thumbnail (if possible)', 'tea-page-content'); ?></span>
    71112    </label>
    72113</p>
  • tea-page-content/trunk/templates/default.php

    r1319161 r1384553  
    1 <?php if(isset($entries) && count($entries)) :  ?>
     1<?php
     2/**
     3 * @param is-padded checkbox 0
     4 */
    25
    3 <section class="tpc-block tpc-default">
     6// prevention for old version of this plugin, @deprecated since 1.1
     7$isPadded = false;
     8if(isset($template_variables['is-padded']) && $template_variables['is-padded']) {
     9    $isPadded = true;
     10}
     11?>
     12<?php if(isset($entries) && $count) : ?>
     13
     14<section class="tpc-block tpc-default<?php if($isPadded) echo '-padded'; ?>">
    415    <?php foreach ($entries as $key => $entry) : ?>
    516        <article class="tpc-entry-block">
    6             <?php if(isset($instance['thumbnail']) && $instance['thumbnail'] !== 'false' && $entry['thumbnail']) : ?>
    7                 <?php echo $entry['thumbnail'] ?>
     17            <?php if(isset($instance['show_page_thumbnail']) && $instance['show_page_thumbnail'] && $entry['thumbnail']) : ?>
     18            <?php if(array_key_exists('thumbnail', $instance) && !$instance['thumbnail']) :
     19                // @deprecated thumbnail param since 1.1
     20            else : ?>
     21                <div class="tpc-thumbnail">
     22                    <?php if($instance['linked_page_thumbnail'] && $entry['link']) : ?>
     23                        <a href="<?php echo $entry['link'] ?>"><?php echo $entry['thumbnail'] ?></a>
     24                    <?php else : ?>
     25                        <?php echo $entry['thumbnail'] ?>
     26                    <?php endif; ?>
     27                </div>
     28            <?php endif; ?>
    829            <?php endif; ?>
    930
     31            <?php if($instance['show_page_title'] || $instance['show_page_content']) : ?>
    1032            <div class="tpc-body">
    11                 <h3 class="tpc-title"><?php echo $entry['title'] ?></h3>
    12                 <div class="tpc-content post-content">
    13                     <?php echo $entry['content'] ?>
    14                 </div>
     33                <?php if($instance['show_page_title']) : ?>
     34                    <h3 class="tpc-title">
     35                    <?php if($instance['linked_page_title'] && $entry['link']) : ?>
     36                        <a href="<?php echo $entry['link'] ?>"><?php echo $entry['title'] ?></a>
     37                    <?php else : ?>
     38                        <?php echo $entry['title'] ?>
     39                    <?php endif; ?>
     40                    </h3>
     41                <?php endif; ?>
     42
     43                <?php if($instance['show_page_content']) : ?>
     44                    <div class="tpc-content post-content">
     45                        <?php echo $entry['content'] ?>
     46                    </div>
     47                <?php endif; ?>
    1548            </div>
     49            <?php endif; ?>
    1650           
    1751        </article>
Note: See TracChangeset for help on using the changeset viewer.