Changeset 1643034
- Timestamp:
- 04/22/2017 04:21:39 PM (9 years ago)
- Location:
- tea-page-content/trunk
- Files:
-
- 103 added
- 6 deleted
- 9 edited
- 11 moved
-
README.md (modified) (1 diff)
-
app (added)
-
app/Config (added)
-
app/Config/Combiner.php (added)
-
app/Config/Extractor.php (added)
-
app/Config/Filtrator.php (added)
-
app/Config/Loader.php (added)
-
app/Config/Map (added)
-
app/Config/Map/Loader.php (added)
-
app/Config/Map/Repository.php (added)
-
app/Config/Mapper.php (added)
-
app/Config/Repository.php (added)
-
app/Config/Sanitizer.php (added)
-
app/Contracts (added)
-
app/Contracts/IDelayedInjection.php (added)
-
app/DependencyInjector.php (added)
-
app/Directories (added)
-
app/Directories/Repository.php (added)
-
app/Entries (added)
-
app/Entries/Extractor.php (added)
-
app/Entries/Formatter.php (added)
-
app/Entries/Params.php (added)
-
app/Entries/Repository.php (added)
-
app/Main (added)
-
app/Main.php (added)
-
app/Main/AdminElements.php (added)
-
app/Main/AdminNotices.php (added)
-
app/Main/Assets.php (added)
-
app/Main/Callbacks.php (added)
-
app/Main/ConfigHandler.php (added)
-
app/Main/Modals.php (added)
-
app/Main/Registrator.php (added)
-
app/Main/Settings.php (added)
-
app/Main/ShortcodeGenerator.php (moved) (moved from tea-page-content/trunk/tea-page-content.class.php) (1 diff)
-
app/Modules (added)
-
app/Modules/Shortcode (added)
-
app/Modules/Shortcode.php (added)
-
app/Modules/Shortcode/Builder.php (added)
-
app/Modules/Shortcode/Combiner.php (added)
-
app/Modules/Shortcode/Extractor.php (added)
-
app/Modules/Shortcode/Filtrator.php (added)
-
app/Modules/Shortcode/Renderer.php (added)
-
app/Modules/Widget (added)
-
app/Modules/Widget.php (added)
-
app/Modules/Widget/Appender.php (added)
-
app/Modules/Widget/Combiner.php (added)
-
app/Modules/Widget/Extractor.php (added)
-
app/Modules/Widget/InstanceBuilder.php (added)
-
app/Modules/Widget/ParamsBuilder.php (added)
-
app/Modules/Widget/ParamsExtractor.php (added)
-
app/Modules/Widget/Renderer.php (added)
-
app/Modules/Widget/TemplatesExtractor.php (added)
-
app/Modules/Widget/VariablesExtractor.php (added)
-
app/Notices (added)
-
app/Notices/Manager.php (added)
-
app/PageVariables (added)
-
app/PageVariables/Builder.php (added)
-
app/PageVariables/Combiner.php (added)
-
app/PageVariables/Decoder.php (added)
-
app/PageVariables/Extractor.php (added)
-
app/PageVariables/Formatter.php (added)
-
app/PageVariables/Repository.php (added)
-
app/PageVariables/RulesActuator.php (added)
-
app/Params (added)
-
app/Params/Builder.php (added)
-
app/Params/Extractor.php (added)
-
app/Params/Repository.php (added)
-
app/PostTypes (added)
-
app/PostTypes/Repository.php (added)
-
app/TemplateVariables (added)
-
app/TemplateVariables/Extractor.php (added)
-
app/TemplateVariables/Filtrator.php (added)
-
app/TemplateVariables/Parser.php (added)
-
app/TemplateVariables/Repository.php (added)
-
app/Templates (added)
-
app/Templates/Combiner.php (added)
-
app/Templates/Extractor.php (added)
-
app/Templates/Filtrator.php (added)
-
app/Templates/Reader.php (added)
-
app/Templates/Renderer.php (added)
-
app/Templates/Repository.php (added)
-
app/Templates/Resolver.php (added)
-
app/Traits (added)
-
app/Traits/Predicates (added)
-
app/Traits/Predicates/Common.php (added)
-
app/Traits/Predicates/Config.php (added)
-
app/Traits/Predicates/PageVariables.php (added)
-
app/Traits/Predicates/Posts.php (added)
-
app/Traits/Predicates/Shortcode.php (added)
-
app/Traits/Predicates/TemplateVariables.php (added)
-
app/Traits/Utils (added)
-
app/Traits/Utils/Common.php (added)
-
app/Traits/Utils/Posts.php (added)
-
app/Traits/Utils/TemplateVariables.php (added)
-
assets/css/tea-page-content-admin.css (modified) (5 diffs)
-
assets/css/tea-page-content-main.css (modified) (4 diffs)
-
assets/js/tea-page-content-api.js (modified) (1 diff)
-
classes/config.class.php (deleted)
-
classes/helper.class.php (deleted)
-
config.map.php (deleted)
-
config.php (modified) (1 diff)
-
maps (added)
-
maps/config.map.php (added)
-
maps/dependencies.map.php (added)
-
modules/shortcode.php (deleted)
-
modules/widget.php (deleted)
-
readme.ru_RU.txt (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
tea-page-content.php (modified) (2 diffs)
-
templates/admin (added)
-
templates/admin/modals (added)
-
templates/admin/modals/insert-shortcode.php (moved) (moved from tea-page-content/trunk/templates/default-widget-admin-dialog-insert-shortcode.php) (1 diff)
-
templates/admin/modals/page-variables.php (moved) (moved from tea-page-content/trunk/templates/default-widget-admin-dialog-page-variables.php)
-
templates/admin/modules (added)
-
templates/admin/modules/widget.php (moved) (moved from tea-page-content/trunk/templates/default-widget-admin.php) (1 diff)
-
templates/admin/pages (added)
-
templates/admin/pages/settings.php (moved) (moved from tea-page-content/trunk/templates/default-settings-page.php) (1 diff)
-
templates/admin/partials (added)
-
templates/admin/partials/template-variables.php (moved) (moved from tea-page-content/trunk/templates/default-widget-admin-variables-area.php) (1 diff)
-
templates/client (added)
-
templates/client/layouts (added)
-
templates/client/layouts/bootstrap-3.php (moved) (moved from tea-page-content/trunk/templates/bootstrap-3.php) (3 diffs)
-
templates/client/layouts/bootstrap-4.php (moved) (moved from tea-page-content/trunk/templates/bootstrap-4.php) (3 diffs)
-
templates/client/layouts/default.php (moved) (moved from tea-page-content/trunk/templates/default.php) (1 diff)
-
templates/client/layouts/waterfall.php (moved) (moved from tea-page-content/trunk/templates/waterfall.php) (1 diff)
-
templates/client/modules (added)
-
templates/client/modules/widget.php (moved) (moved from tea-page-content/trunk/templates/default-widget-client.php) (1 diff)
-
templates/default-padded.php (deleted)
-
uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tea-page-content/trunk/README.md
r1392502 r1643034 86 86 87 87 ## 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. 88 See documentation. -
tea-page-content/trunk/app/Main/ShortcodeGenerator.php
r1643033 r1643034 1 1 <?php 2 /**3 * @package Tea Page Content4 * @version 1.2.35 */6 2 7 class TeaPageContent { 8 private $_helper; 9 private $_config; 3 namespace TeaPageContent\App\Main; 10 4 11 /** 12 * Constructor 13 * 14 * @return void 15 */ 16 public function __construct() {} 5 use TeaPageContent\App\Config; 6 use TeaPageContent\App\TemplateVariables; 7 use TeaPageContent\App\PageVariables; 17 8 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/'); 9 class ShortcodeGenerator { 10 private $Config = null; 11 private $TemplateVariablesRepository = null; 12 private $PageVariablesDecoder = null; 26 13 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 } 30 19 31 add_action('init', array($this, 'updateSettings')); 20 public function generate() { 21 $prepared_data = []; 32 22 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); 38 25 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); 42 28 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 } 46 32 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 } 50 51 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]])) { 52 54 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]; 54 57 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 { 56 60 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 } 58 68 69 $template = $this->Config->get('defaults.templates.client.default-template'); 70 if(isset($prepared_data['template'])) { 71 $template = $prepared_data['template'][0]; 72 } 59 73 60 // Create new helper instance 61 $this->_helper = new TeaPageContent_Helper; 74 $shortcodes = [ 75 'main' => [], 76 ]; 62 77 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); 65 81 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'])) { 77 83 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; 89 85 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); 92 89 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); 102 93 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 } 111 99 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 } 120 107 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 } 129 112 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 } 139 120 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 149 126 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'; 157 128 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 } 165 133 166 } elseif($hook === 'widgets.php') { 167 wp_enqueue_media(); 134 $output[] = ' '. $attr_name . '="'. urldecode(htmlspecialchars($attr_value)).'"'; 135 } 168 136 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 } 176 142 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"; 193 144 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 210 146 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'; 230 148 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 } 238 153 239 $data = $_POST['data'];240 $data = explode('&', $data); 154 $output[] = ' '. $attr_name . '="'.urldecode(htmlspecialchars($attr_value)).'"'; 155 } 241 156 242 foreach ($data as $index => $pair) { 243 $pair = explode('=', $pair); 157 $output[] = "/]\r\n"; 244 158 245 if(!trim($pair[1])) { 246 continue; 247 } 159 } 160 } 248 161 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 } 267 165 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 } 555 168 } -
tea-page-content/trunk/assets/css/tea-page-content-admin.css
r1560974 r1643034 1 1 .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; 9 9 } 10 10 11 11 .tpc-columns-wrapper, 12 12 .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; 16 16 } 17 17 .tpc-columns-wrapper { 18 margin-bottom: 15px;18 margin-bottom: 15px; 19 19 } 20 20 .tpc-column { 21 width: 50%;22 23 box-sizing: border-box;21 width: 50%; 22 23 box-sizing: border-box; 24 24 } 25 25 .tpc-column-label { 26 line-height: 1.5;26 line-height: 1.5; 27 27 } 28 28 29 29 .tpc-columns-group .tpc-column:not(:last-child) { 30 padding-right: 10px;30 padding-right: 10px; 31 31 } 32 32 .tpc-columns-group .tpc-column:not(:first-child) { 33 padding-left: 10px;33 padding-left: 10px; 34 34 } 35 35 .tpc-columns-group .tpc-column p:first-child { 36 margin-top: 0;36 margin-top: 0; 37 37 } 38 38 39 39 .tpc-column.tpc-full-width { 40 width: 100%;40 width: 100%; 41 41 } 42 42 43 43 .tpc-posts-list { 44 margin-top: 10px;44 margin-top: 10px; 45 45 } 46 46 .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%; 51 51 } 52 52 .tpc-posts-list .tpc-item-title { 53 display: block;54 white-space: nowrap;53 display: block; 54 white-space: nowrap; 55 55 overflow: hidden; 56 56 … … 58 58 } 59 59 .tpc-posts-list label input[type=checkbox] { 60 float: left;61 margin-top: 2px;60 float: left; 61 margin-top: 2px; 62 62 } 63 63 64 64 .tpc-accordeon { 65 border: 1px solid #e5e5e5;66 margin-bottom: 10px;65 border: 1px solid #e5e5e5; 66 margin-bottom: 10px; 67 67 } 68 68 .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; 73 73 } 74 74 75 75 .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; 82 82 } 83 83 .tpc-accordeon-top:hover { 84 border-color: #999;84 border-color: #999; 85 85 } 86 86 .tpc-accordeon-top:hover:after { 87 color: #444;87 color: #444; 88 88 } 89 89 .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; 99 99 } 100 100 .tpc-accordeon-top.opened:after { 101 content: '\f142';101 content: '\f142'; 102 102 } 103 103 .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; 108 108 } 109 109 .tpc-accordeon-body:before, 110 110 .tpc-accordeon-body:after { 111 content: "";112 clear: both;111 content: ""; 112 clear: both; 113 113 } 114 114 .tpc-accordeon-body:after { 115 display: table;115 display: table; 116 116 } 117 117 118 118 .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; 125 125 } 126 126 127 127 .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; 131 131 } 132 132 .action-links > * + * { 133 margin-left: 10px;133 margin-left: 10px; 134 134 } 135 135 136 136 .tpc-template-params {} 137 137 .tpc-template-params h4 { 138 margin-top: 0;138 margin-top: 0; 139 139 } 140 140 .tpc-template-params hr { 141 margin: 0;141 margin: 0; 142 142 } 143 143 144 144 .tpc-preloader { 145 position: relative;145 position: relative; 146 146 } 147 147 .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; 171 171 } 172 172 .tpc-preloader.is-loading {} 173 173 .tpc-preloader.is-hidden:before { 174 z-index: -1000;174 z-index: -1000; 175 175 } 176 176 .tpc-preloader.is-loading:before { 177 opacity: 1;177 opacity: 1; 178 178 } 179 179 180 180 .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; 197 197 } 198 198 .tpc-accordeon-body .dashicons:focus { 199 box-shadow: none;200 outline: none;199 box-shadow: none; 200 outline: none; 201 201 } 202 202 .tpc-accordeon-body .configured-item .dashicons { 203 color: #333;203 color: #333; 204 204 } 205 205 .tpc-accordeon-body .unsaved-item .dashicons { 206 color: #999;206 color: #999; 207 207 } 208 208 .tpc-accordeon-body .tpc-accordeon-item .dashicons:hover { 209 color: #000;209 color: #000; 210 210 } 211 211 212 212 /* Modals */ 213 213 .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; 228 228 } 229 229 .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; 238 238 } 239 239 .ui-dialog-titlebar, 240 240 .ui-dialog-buttonpane { 241 padding: 15px;241 padding: 15px; 242 242 } 243 243 .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; 248 248 } 249 249 .ui-dialog-title { 250 font-weight: bold;251 font-size: 1em;250 font-weight: bold; 251 font-size: 1em; 252 252 } 253 253 254 254 .tpc-dialog { 255 padding: 15px;255 padding: 15px; 256 256 } 257 257 .tpc-dialog-ui-wrapper { 258 display: block;258 display: block; 259 259 } 260 260 .tpc-dialog-ui-wrapper + .tpc-dialog-ui-wrapper { 261 margin-top: 10px;261 margin-top: 10px; 262 262 } 263 263 .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%; 267 267 } 268 268 textarea.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; 273 273 } 274 274 275 275 .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; 283 283 } 284 284 .tpc-modal-media-element.is-empty .tpc-button-group { 285 padding-right: 0;285 padding-right: 0; 286 286 } 287 287 .tpc-modal-media-element.is-empty .tpc-button-group .button:not(.button-primary), 288 288 .tpc-modal-media-element.is-empty .tpc-modal-ui-preview, 289 289 .tpc-modal-media-element.is-empty .tpc-delete-button { 290 display: none;290 display: none; 291 291 } 292 292 .tpc-modal-param-title { 293 display: inline-block;294 margin-bottom: 5px;293 display: inline-block; 294 margin-bottom: 5px; 295 295 } 296 296 .tpc-modal-ui-preview { 297 margin-bottom: 5px;297 margin-bottom: 5px; 298 298 } 299 299 .tpc-dialog-insert-shortcode {} 300 300 301 301 .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; 307 307 } 308 308 .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; 313 313 } 314 314 .ui-dialog-titlebar-close:before { 315 font-size: 20px;315 font-size: 20px; 316 316 line-height: 1; 317 317 font-family: dashicons; 318 318 font-weight: 400; 319 content: "\f335";320 display: inline-block;321 color: inherit;319 content: "\f335"; 320 display: inline-block; 321 color: inherit; 322 322 } 323 323 .ui-dialog-titlebar-close .ui-button-text { 324 display: none;324 display: none; 325 325 } 326 326 .ui-dialog-titlebar-close:hover { 327 opacity: 0.7;327 opacity: 0.7; 328 328 } 329 329 330 330 .ui-dialog-buttonpane { 331 clear: both;331 clear: both; 332 332 } 333 333 .ui-dialog-buttonpane .ui-button + .ui-button { 334 margin-left: 15px;334 margin-left: 15px; 335 335 } 336 336 337 337 /* Buttons */ 338 338 .tpc-button-group { 339 position: relative;340 padding-right: 40px;339 position: relative; 340 padding-right: 40px; 341 341 } 342 342 .tpc-button-group:before, 343 343 .tpc-button-group:after { 344 content: "";345 display: table;346 clear: both;344 content: ""; 345 display: table; 346 clear: both; 347 347 } 348 348 .tpc-button-group > * { 349 float: left;349 float: left; 350 350 } 351 351 .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; 354 354 } 355 355 .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; 358 358 } 359 359 .tpc-button-group .button-primary { 360 width: 100%;360 width: 100%; 361 361 } 362 362 .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; 370 370 } 371 371 .tpc-button-group.tpc-top-stacked > *:first-child { 372 border-top-left-radius: 0px;372 border-top-left-radius: 0px; 373 373 } 374 374 .tpc-button-group.tpc-top-stacked > *:last-child { 375 border-top-right-radius: 0px;375 border-top-right-radius: 0px; 376 376 } 377 377 378 378 /* Spinner */ 379 379 .tpc-columns-wrapper label + .ui-spinner { 380 display: block;380 display: block; 381 381 } 382 382 .tpc-columns-wrapper .ui-spinner { 383 display: inline-block;384 position: relative;383 display: inline-block; 384 position: relative; 385 385 } 386 386 .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; 393 393 } 394 394 .tpc-columns-wrapper .ui-spinner .ui-spinner-up { 395 top: -3px;396 z-index: 10;395 top: -3px; 396 z-index: 10; 397 397 } 398 398 .tpc-columns-wrapper .ui-spinner .ui-spinner-down { 399 bottom: -3px;399 bottom: -3px; 400 400 } 401 401 .tpc-columns-wrapper .ui-spinner-input { 402 padding-right: 14px;402 padding-right: 14px; 403 403 } 404 404 … … 406 406 /* TPC Dashicons */ 407 407 .tpc-dashicons-middled { 408 vertical-align: middle;408 vertical-align: middle; 409 409 } 410 410 … … 413 413 } 414 414 .tpc-settings-page h2 { 415 margin-bottom: 30px !important;415 margin-bottom: 30px !important; 416 416 } 417 417 .tpc-form-group { 418 display: block;419 margin-top: 10px;418 display: block; 419 margin-top: 10px; 420 420 } 421 421 .tpc-form-group:first-child { 422 margin-top: 0;422 margin-top: 0; 423 423 } 424 424 425 425 .tpc-form-group { 426 font-size: 1.2em;426 font-size: 1.2em; 427 427 } 428 428 429 429 .tpc-form-group span { 430 margin: 10px 0;430 margin: 10px 0; 431 431 } 432 432 .tpc-form-group small { … … 434 434 .tpc-form-group input, 435 435 .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 1 1 .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; 5 5 } 6 6 7 7 .tpc-block { 8 margin: 1em auto;9 font-size: inherit;8 margin: 1em auto; 9 font-size: inherit; 10 10 } 11 11 12 12 .tpc-body .tpc-title { 13 margin-bottom: 0.5em;13 margin-bottom: 0.5em; 14 14 } 15 15 .tpc-body .tpc-title:first-child { 16 margin-top: 0;16 margin-top: 0; 17 17 } 18 18 .tpc-body .tpc-title:last-child { 19 margin-bottom: 0;19 margin-bottom: 0; 20 20 } 21 21 22 22 .tpc-thumbnail { 23 font-size: 0; /* Need for fix spaces between inline-block elements */ 24 padding-bottom: 0.5em; 23 padding-bottom: 0.5em; 25 24 } 26 25 .tpc-thumbnail:last-child { 27 padding-bottom: 0;26 padding-bottom: 0; 28 27 } 29 28 30 29 /* Need cascade here */ 31 30 .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; 35 34 } 36 35 .tpc-thumbnail .tpc-thumbnail-link:hover { 37 opacity: 0.85;36 opacity: 0.85; 38 37 } 39 38 40 39 .tpc-entry-block {} 41 40 .tpc-entry-block { 42 padding-bottom: 1.5em;41 padding-bottom: 1.5em; 43 42 } 44 43 45 44 46 45 .tpc-widget-title { 47 padding: 0.5em 0;46 padding: 0.5em 0; 48 47 } 49 48 … … 51 50 52 51 .tpc-widget-title h3 { 53 font-size: 1.5em;54 font-weight: bold;52 font-size: 1.5em; 53 font-weight: bold; 55 54 } 56 55 57 56 /* Styles for blocks that embed in page */ 58 57 .entry-content .tpc-title { 59 margin-top: 0;58 margin-top: 0; 60 59 } 61 60 .entry-content .tpc-entry-block + .tpc-entry-block { 62 margin-top: 1em;61 margin-top: 1em; 63 62 } 64 63 .entry-content .tpc-body { 65 padding-right: 0;66 padding-left: 0;64 padding-right: 0; 65 padding-left: 0; 67 66 } 68 67 69 68 /* Default Template */ 70 69 .tpc-default + .tpc-default { 71 margin-top: 1.5em;70 margin-top: 1.5em; 72 71 } 73 72 … … 75 74 .tpc-default-padded .tpc-body, 76 75 .tpc-default-padded .tpc-thumbnail { 77 padding-left: 1em;78 padding-right: 1em;76 padding-left: 1em; 77 padding-right: 1em; 79 78 } 80 79 .tpc-default-padded .tpc-thumbnail { 81 padding-bottom: 0.5em;80 padding-bottom: 0.5em; 82 81 } 83 82 84 83 /* Bootstrap Template */ 85 84 .tpc-bootstrap .tpc-entry-block { 86 margin-bottom: 30px; /* default bootstrap gutter width */85 margin-bottom: 30px; /* default bootstrap gutter width */ 87 86 } 88 87 .tpc-bootstrap .row:last-child .tpc-entry-block:last-child { 89 margin-bottom: 0;88 margin-bottom: 0; 90 89 } 91 90 … … 101 100 } 102 101 .tpc-waterfall-col { 103 float: left;102 float: left; 104 103 105 padding: 0.5em 1em;104 padding: 0.5em 1em; 106 105 107 display: block;108 box-sizing: border-box;106 display: block; 107 box-sizing: border-box; 109 108 110 max-width: 100%;109 max-width: 100%; 111 110 } 112 111 .tpc-waterfall .tpc-entry-block { 113 width: 100%;112 width: 100%; 114 113 } 115 114 .tpc-waterfall .tpc-entry-block:last-child { 116 margin-bottom: 0;115 margin-bottom: 0; 117 116 } -
tea-page-content/trunk/assets/js/tea-page-content-api.js
r1560974 r1643034 173 173 } 174 174 175 // Spinners set {1} make dis shit dry176 175 TeaPageContent_API.handlers.widgets.spinners_init($variablesArea.find('.tpc-spinner')); 177 176 -
tea-page-content/trunk/config.php
r1560974 r1643034 1 1 <?php 2 /**3 * @package Tea Page Content4 * @version 1.2.35 */6 2 7 3 return 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', 21 15 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', 35 18 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 ), 64 21 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, 91 31 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 ) 96 169 ); -
tea-page-content/trunk/readme.ru_RU.txt
r1560974 r1643034 2 2 Contributors: Tsjuder 3 3 Tags: plugin, widget, shortcode, posts, post, pages, page, content, template, templates 4 Requires at least: 4.0, PHP 5. 34 Requires at least: 4.0, PHP 5.6 5 5 Tested up to: 4.7 6 Stable tag: 1. 2.36 Stable tag: 1.3.0 7 7 Author URI: https://github.com/Tsjuder 8 8 Plugin URI: http://tsjuder.github.io/tea-page-content/ … … 64 64 65 65 == 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 66 78 = 1.2.3 = 67 79 * \+ New template "Waterfall" added 68 80 * \+ New template "Bootstrap 4" added 69 * \+ New type of page variables - jquery ui spinner70 * \+ Added filters for changing column count in "Bootstrap X" templates71 * \* Template "Bootstrap 3" was improved72 81 * \* Checked for Wordpress 4.7 support 73 82 -
tea-page-content/trunk/readme.txt
r1560974 r1643034 2 2 Contributors: Tsjuder 3 3 Tags: plugin, widget, shortcode, posts, post, pages, page, content, template, templates 4 Requires at least: 4.0, PHP 5.34 Requires at least: WP 4.0, PHP 5.6 5 5 Tested up to: 4.7 6 Stable tag: 1. 2.36 Stable tag: 1.3.0 7 7 Author URI: https://github.com/Tsjuder 8 8 Plugin URI: http://tsjuder.github.io/tea-page-content/ … … 14 14 == Description == 15 15 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.16 Tea 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. 17 17 18 18 = Key features = … … 60 60 61 61 == 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 62 74 = 1.2.3 = 63 75 * \+ New template "Waterfall" added 64 76 * \+ New template "Bootstrap 4" added 65 * \+ New type of page variables - jquery ui spinner66 * \+ Added filters for changing column count in "Bootstrap X" templates67 * \* Template "Bootstrap 3" was improved68 77 * \* Checked for Wordpress 4.7 support 69 78 -
tea-page-content/trunk/tea-page-content.php
r1560974 r1643034 4 4 Plugin URI: http://tsjuder.github.io/tea-page-content 5 5 Description: 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.36 Version: 1.3.0 7 7 Text Domain: tea-page-content 8 8 Domain Path: /languages/ … … 34 34 */ 35 35 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)); 36 namespace TeaPageContent; 40 37 41 // Includes a core 42 require_once(TEA_PAGE_CONTENT_PATH . '/tea-page-content.class.php');38 use TeaPageContent\App\DependencyInjector; 39 use TeaPageContent\App\Main; 43 40 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'); 41 define(__NAMESPACE__ . '\\MIN_PHP_REQUIRED', 5.6); 42 define(__NAMESPACE__ . '\\PLUGIN_FILE', __FILE__); 43 define(__NAMESPACE__ . '\\PLUGIN_PATH', dirname(PLUGIN_FILE)); 44 define(__NAMESPACE__ . '\\PLUGIN_FOLDER', basename(PLUGIN_PATH)); 47 45 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 47 function get_major_php_version() { 48 $php_version = explode('.', PHP_VERSION); 49 $php_version = (float)implode('.', array_splice($php_version, 0, 2)); 51 50 52 // Gets an instance 53 $tpcEngine = new TeaPageContent; 51 return $php_version; 52 } 54 53 55 add_action('plugins_loaded', array($tpcEngine, 'initialize')); 54 function 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 65 function 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 76 if(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 90 require_once(PLUGIN_PATH . '/App/Modules/Widget.php'); 91 92 // Start the app 93 run(); -
tea-page-content/trunk/templates/admin/modals/insert-shortcode.php
r1643033 r1643034 1 1 <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> 11 11 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> 18 18 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> 26 26 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) : ?> 29 29 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> 32 32 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'] ?>" /> 34 34 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" /> 36 36 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> 41 41 42 </div>43 <?php endforeach; ?>44 </div>45 <?php endif; ?>46 </div>42 </div> 43 <?php endforeach; ?> 44 </div> 45 <?php endif; ?> 46 </div> 47 47 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> 62 62 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> 66 91 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' : ''; ?> 70 95 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> 72 99 73 <label for="tpc-show_page_title"> 74 <?php $checked = (isset($instance['show_page_title']) && $instance['show_page_title']) ? 'checked' : ''; ?> 100 <br /> 75 101 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' : ''; ?> 79 104 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> 81 108 82 <label for="tpc-show_page_content"> 83 <?php $checked = (isset($instance['show_page_content']) && $instance['show_page_content']) ? 'checked' : ''; ?> 109 <br /> 84 110 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' : ''; ?> 88 113 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> 90 117 91 <label for="tpc-linked_page_title"> 92 <?php $checked = (isset($instance['linked_page_title']) && $instance['linked_page_title']) ? 'checked' : ''; ?> 118 <br /> 93 119 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' : ''; ?> 97 122 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> 99 126 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 /> 109 128 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> 111 138 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"> 125 140 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> 131 160 </form> -
tea-page-content/trunk/templates/admin/modules/widget.php
r1643033 r1643034 1 1 <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> 10 10 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(); ?> 15 15 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> 19 19 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> 27 27 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'] : ''; ?> 34 34 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> 38 38 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 ?> /> 40 40 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" /> 42 42 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> 47 47 48 </div>49 <?php endforeach; ?>50 </div>51 <?php endif; ?>52 </div>48 </div> 49 <?php endforeach; ?> 50 </div> 51 <?php endif; ?> 52 </div> 53 53 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> 68 68 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> 73 97 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> 80 104 81 <br />105 <br /> 82 106 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> 88 112 89 <br />113 <br /> 90 114 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> 96 120 97 <br />121 <br /> 98 122 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> 104 128 105 <br />129 <br /> 106 130 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> 115 139 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> 117 154 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 137 160 </div> -
tea-page-content/trunk/templates/admin/pages/settings.php
r1643033 r1643034 1 1 <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> 3 3 4 <form method="post" novalidate="novalidate" autocomplete="off">4 <form method="post" novalidate="novalidate" autocomplete="off"> 5 5 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 /> 14 14 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': 21 21 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> 29 29 30 <?php break;30 <?php break; 31 31 32 default: ?>32 default: ?> 33 33 34 34 35 35 36 <?php break;37 38 } ?>39 </select>36 <?php break; 37 38 } ?> 39 </select> 40 40 41 <?php break;42 43 } ?>44 </label>45 </div>46 <?php endforeach; ?>41 <?php break; 42 43 } ?> 44 </label> 45 </div> 46 <?php endforeach; ?> 47 47 48 <input type="hidden" name="tpc_settings_update" value="Y" />48 <input type="hidden" name="tpc_settings_update" value="Y" /> 49 49 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> 54 54 </div> -
tea-page-content/trunk/templates/admin/partials/template-variables.php
r1643033 r1643034 2 2 3 3 <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; ?> 36 36 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; ?> 40 40 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; ?> 44 44 45 <?php case 'checkbox': ?>46 <?php $checked = '';47 if48 (49 (isset($instance['template_variables'][$variable['name']]) && !empty($variableValue))50 OR51 ($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 } ?> 56 56 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; ?> 59 59 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; ?> 70 70 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; ?> 76 76 77 <?php endswitch; ?>78 </p>77 <?php endswitch; ?> 78 </p> 79 79 80 <?php endforeach; ?>80 <?php endforeach; ?> 81 81 </div> 82 82 -
tea-page-content/trunk/templates/client/layouts/bootstrap-3.php
r1643033 r1643034 12 12 * @param column-count-small jqueryui:spinner 1-24 13 13 * @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 14 16 */ 15 16 if(!$count) return; // @todo check for empty entries in backend17 17 18 18 // Template Logic … … 21 21 22 22 $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'], 27 27 ); 28 28 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]; 30 31 $itemsCount = count($entries); 31 32 … … 34 35 // Logic for transposed layout 35 36 if($template_variables['ordering-type'] === 'transposed') { 36 $itemsPerCol = ceil($itemsCount / $itemsPerRow);37 $itemsPerCol = ceil($itemsCount / $itemsPerRow); 37 38 38 // Count of empty cols39 $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);39 // Count of empty cols 40 $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow); 40 41 } 41 42 ?> 42 43 43 44 <?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> 45 46 <?php endif; ?> 46 47 47 <?php if($itemsCount) : ?>48 48 <section class="tpc-block tpc-bootstrap <?php echo $template_variables['container-type'] ?>"> 49 <div class="row">49 <div class="row"> 50 50 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) : ?> 53 53 54 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">54 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>"> 55 55 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; ?> 65 65 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; ?> 77 77 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; ?> 85 85 86 </article>86 </article> 87 87 88 <?php89 $counter++;90 if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :91 $counter = 0;92 // here optionally clear row88 <?php 89 $counter++; 90 if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) : 91 $counter = 0; 92 // here optionally clear row 93 93 94 echo '</div><div class="row">';94 echo '</div><div class="row">'; 95 95 96 endif; ?>97 <?php endforeach; ?>96 endif; ?> 97 <?php endforeach; ?> 98 98 99 <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>100 101 <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix102 $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; 104 104 105 for($cols = 0; $cols < $itemsPerRow; $cols++) :106 $index = $rows + 1;105 for($cols = 0; $cols < $itemsPerRow; $cols++) : 106 $index = $rows + 1; 107 107 108 if($cols > 0) $index += $incrementor;108 if($cols > 0) $index += $incrementor; 109 109 110 if($empties && $cols > ($itemsPerRow - $empties)) {111 $index -= $decrementor;112 $decrementor++;113 }110 if($empties && $cols > ($itemsPerRow - $empties)) { 111 $index -= $decrementor; 112 $decrementor++; 113 } 114 114 115 $entry = $entries[$index - 1];116 ?>115 $entry = $entries[$index - 1]; 116 ?> 117 117 118 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">118 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>"> 119 119 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; ?> 129 129 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; ?> 141 141 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; ?> 149 149 150 </article>150 </article> 151 151 152 <?php $incrementor += $itemsPerCol;152 <?php $incrementor += $itemsPerCol; 153 153 154 $counter++;154 $counter++; 155 155 156 if($counter >= $itemsCount) break;156 if($counter >= $itemsCount) break; 157 157 158 endfor;158 endfor; 159 159 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 } 163 163 164 endfor;165 ?>166 <?php endif; ?>164 endfor; 165 ?> 166 <?php endif; ?> 167 167 168 </div>168 </div> 169 169 </section> 170 <?php endif; -
tea-page-content/trunk/templates/client/layouts/bootstrap-4.php
r1643033 r1643034 13 13 * @param column-count-small jqueryui:spinner 1-24 14 14 * @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 15 17 */ 16 17 if(!$count) return; // @todo check for empty entries in backend18 18 19 19 // Template Logic … … 22 22 23 23 $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'], 29 29 ); 30 30 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]; 32 33 $itemsCount = count($entries); 33 34 … … 36 37 // Logic for transposed layout 37 38 if($template_variables['ordering-type'] === 'transposed') { 38 $itemsPerCol = ceil($itemsCount / $itemsPerRow);39 $itemsPerCol = ceil($itemsCount / $itemsPerRow); 39 40 40 // Count of empty cols41 $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow);41 // Count of empty cols 42 $empties = ($itemsPerCol - $itemsCount / $itemsPerRow) / (1 / $itemsPerRow); 42 43 } 43 44 ?> 44 45 45 46 <?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> 47 48 <?php endif; ?> 48 49 49 <?php if($itemsCount) : ?>50 50 <section class="tpc-block tpc-bootstrap <?php echo $template_variables['container-type'] ?>"> 51 <div class="row">51 <div class="row"> 52 52 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) : ?> 55 55 56 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">56 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>"> 57 57 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; ?> 67 67 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; ?> 79 79 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; ?> 87 87 88 </article>88 </article> 89 89 90 <?php91 $counter++;92 if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) :93 $counter = 0;94 // here optionally clear row90 <?php 91 $counter++; 92 if($counter % $itemsPerRow === 0 && $template_variables['use-rows']) : 93 $counter = 0; 94 // here optionally clear row 95 95 96 echo '</div><div class="row">';96 echo '</div><div class="row">'; 97 97 98 endif; ?>99 <?php endforeach; ?>98 endif; ?> 99 <?php endforeach; ?> 100 100 101 <?php elseif($template_variables['ordering-type'] === 'transposed') : ?>102 103 <?php for($rows = 0; $rows < $itemsPerCol; $rows++) : // count of rows if matrix104 $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; 106 106 107 for($cols = 0; $cols < $itemsPerRow; $cols++) :108 $index = $rows + 1;107 for($cols = 0; $cols < $itemsPerRow; $cols++) : 108 $index = $rows + 1; 109 109 110 if($cols > 0) $index += $incrementor;110 if($cols > 0) $index += $incrementor; 111 111 112 if($empties && $cols > ($itemsPerRow - $empties)) {113 $index -= $decrementor;114 $decrementor++;115 }112 if($empties && $cols > ($itemsPerRow - $empties)) { 113 $index -= $decrementor; 114 $decrementor++; 115 } 116 116 117 $entry = $entries[$index - 1];118 ?>117 $entry = $entries[$index - 1]; 118 ?> 119 119 120 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>">120 <article class="tpc-entry-block <?php echo implode(' ', array_values($columns)) ?>"> 121 121 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; ?> 131 131 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; ?> 143 143 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; ?> 151 151 152 </article>152 </article> 153 153 154 <?php $incrementor += $itemsPerCol;154 <?php $incrementor += $itemsPerCol; 155 155 156 $counter++;156 $counter++; 157 157 158 if($counter >= $itemsCount) break;158 if($counter >= $itemsCount) break; 159 159 160 endfor;160 endfor; 161 161 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 } 165 165 166 endfor;167 ?>168 <?php endif; ?>166 endfor; 167 ?> 168 <?php endif; ?> 169 169 170 </div>170 </div> 171 171 </section> 172 <?php endif; -
tea-page-content/trunk/templates/client/layouts/default.php
r1643033 r1643034 4 4 */ 5 5 6 // prevention for old version of this plugin, @deprecated since 1.17 6 $isPadded = false; 8 7 if(isset($template_variables['is-padded']) && $template_variables['is-padded']) { 9 $isPadded = true;8 $isPadded = true; 10 9 }?> 11 10 12 11 <?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> 14 13 <?php endif; ?> 15 14 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) : ?> 17 17 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; ?> 20 28 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; ?> 35 40 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; ?> 58 51 </section> 59 60 <?php endif; -
tea-page-content/trunk/templates/client/layouts/waterfall.php
r1643033 r1643034 7 7 */ 8 8 9 if(isset($entries) && $count) : 9 $column_count = (int)$template_variables['column-count']; 10 10 11 $column_count = (int)$template_variables['column-count']; 11 $items_per_col = floor($count / $column_count); 12 $remainder = $count - ($items_per_col * $column_count); 12 13 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 15 15 16 $width = 100 / $column_count; // 100% divided on column count 16 $counter = 0; ?> 17 17 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; ?> 19 21 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 ?>"> 23 23 24 <section class="tpc-block tpc-waterfall tpc-waterfall-<?php echo $column_count ?>"> 24 <?php if($template_variables['ordering-type'] === 'horizontal') : 25 25 26 <?php if($template_variables['ordering-type'] === 'horizontal') : 26 for ($i = 0; $i < $column_count; $i++) : ?> 27 27 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 } 29 35 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++) : 37 37 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; ?> 39 50 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; ?> 41 62 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> 54 73 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; ?> 66 75 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') : 77 77 78 <?php endfor; ?> 78 for ($cols = 0; $cols < $column_count; $cols++) : 79 79 80 <?php elseif($template_variables['ordering-type'] === 'vertical') : 80 $incrementor = 0; 81 $decrementor = 1; 82 ?> 81 83 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; 83 87 84 $incrementor = 0; 85 $decrementor = 1; 86 ?> 88 if($remainder) { 89 $incol_limit++; 90 $remainder--; 91 } 87 92 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 } 91 98 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; ?> 96 111 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; ?> 102 123 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 116 133 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; 128 135 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; ?> 138 137 139 $incrementor += $column_count; 138 </div> 140 139 141 endfor; ?> 140 <?php 141 endfor; 142 142 143 </div>143 endif; ?> 144 144 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 3 3 4 4 if($widget['title']) { 5 echo $widget['before_title'] . $widget['title'] . $widget['after_title'];5 echo $widget['before_title'] . $widget['title'] . $widget['after_title']; 6 6 } 7 7 -
tea-page-content/trunk/uninstall.php
r1560974 r1643034 1 1 <?php 2 /**3 * @package Tea Page Content4 * @version 1.2.35 */6 2 7 if (!defined('WP_UNINSTALL_PLUGIN')) {3 if(!defined('WP_UNINSTALL_PLUGIN')) { 8 4 exit(); 9 5 } … … 12 8 13 9 if(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); 16 12 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 } 21 17 } 22 18
Note: See TracChangeset
for help on using the changeset viewer.