public function render() { $this->post_id = vc_request_param('post_id'); $this->shortcodes_string = stripslashes(vc_request_param('shortcodes_string', true)); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $grid_item->setIsEnd(false); $grid_item->setGridAttributes(array('element_width' => 4)); $grid_item->setTemplate($this->shortcodes_string, $this->post_id); $this->enqueue(); vc_include_template('params/vc_grid_item/preview.tpl.php', array('preview' => $this, 'grid_item' => $grid_item, 'shortcodes_string' => $this->shortcodes_string, 'post' => $this->mockingPost(), 'default_width_value' => apply_filters('vc_grid_item_preview_render_default_width_value', 4))); }
/** * Render preview for grid item * @since 4.4 */ function vc_grid_item_render_preview() { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $grid_item->mapShortcodes(); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-preview.php'); $vcGridPreview = new Vc_Grid_Item_Preview(); add_filter('vc_gitem_template_attribute_post_image_background_image_css_value', array($vcGridPreview, 'addCssBackgroundImage')); add_filter('vc_gitem_template_attribute_post_image_url_value', array($vcGridPreview, 'addImageUrl')); $vcGridPreview->render(); die; }
public function setItemsIfEmpty($items) { if (empty($items)) { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $grid_item->setGridAttributes($this->atts); $grid_item->shortcodes(); $item = '[vc_gitem]<img src="' . vc_asset_url('vc/vc_gitem_image.png') . '">[/vc_gitem]'; $grid_item->parseTemplate($item); $items = str_repeat($grid_item->renderItem(get_post((int) vc_request_param('vc_post_id'))), 3); } return $items; }
function vc_vc_grid_item_form_field($settings, $value) { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php'); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $output = '<div data-vc-grid-element="container">' . '<select data-vc-grid-element="value" type="hidden" name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . '_field" ' . '>'; $vc_grid_item_templates = Vc_Grid_Item::predefinedTemplates(); if (is_array($vc_grid_item_templates)) { foreach ($vc_grid_item_templates as $key => $data) { $output .= '<option data-vc-link="' . esc_url(admin_url('post-new.php?post_type=vc_grid_item&vc_gitem_template=' . $key)) . '" value="' . $key . '"' . ($key === $value ? ' selected="true"' : '') . '>' . esc_html($data['name']) . '</option>'; } } $grid_item_posts = get_posts(array('posts_per_page' => '-1', 'orderby' => 'post_title', 'post_type' => Vc_Grid_Item_Editor::postType())); foreach ($grid_item_posts as $post) { $output .= '<option data-vc-link="' . esc_url(get_edit_post_link($post->ID)) . '"value="' . $post->ID . '"' . ((string) $post->ID === $value ? ' selected="true"' : '') . '>' . esc_html($post->post_title) . '</option>'; } $output .= '</select></div>'; return $output; }
private function renderItems() { $output = $items = ''; $this->buildGridSettings(); $css_classes = 'vc_row vc_clearfix vc_grid' . esc_attr($this->atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $this->atts['gap'] . 'px' : ''); if (is_array($this->items) && !empty($this->items)) { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $grid_item->setGridAttributes($this->atts); $grid_item->setIsEnd(isset($this->is_end) && $this->is_end); $grid_item->setTemplateById($this->atts['item']); $output .= $grid_item->addShortcodesCustomCss(); ob_start(); wp_print_styles(); $output .= ob_get_clean(); $output .= vc_get_template('shortcodes/vc_basic_grid_filter.php', array('filter_terms' => $this->filter_terms, 'atts' => $this->atts)); while (have_posts()) { the_post(); $items .= $grid_item->renderItem(get_post()); } /* foreach ( $this->items as $post ) { $post->the_post(); $items .= $grid_item->renderItem( $post ); $items .= trim( vc_get_template( 'shortcodes/vc_grid_item.php', array( 'post' => $post, 'element_width' => $this->atts['element_width'], ) ) ); */ } $items = apply_filters($this->shortcode . '_items_list', $items); $output .= $this->renderPagination($this->atts['style'], $this->grid_settings, $items, $css_classes) . "\n"; return $output; }
function vc_gitem_content_shortcodes() { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $invalid_shortcodes = apply_filters('vc_gitem_zone_grid_item_not_content_shortcodes', array('vc_gitem', 'vc_gitem_animated_block', 'vc_gitem_zone', 'vc_gitem_zone_a', 'vc_gitem_zone_b', 'vc_gitem_zone_c', 'vc_gitem_row', 'vc_gitem_col')); return array_diff(array_keys($grid_item->shortcodes()), $invalid_shortcodes); }
/** * Get list of predefined templates. * * @return bool|mixed */ public static function predefinedTemplates() { if (false === self::$predefined_templates) { self::$predefined_templates = apply_filters('vc_grid_item_predefined_templates', include vc_path_dir('PARAMS_DIR', 'vc_grid_item/templates.php')); } return self::$predefined_templates; }
public function getGridTemplates() { $list = Vc_Grid_Item::predefinedTemplates(); return $list; }
<?php if (!defined('ABSPATH')) { die('-1'); } require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/popups/class-vc-add-element-box-grid-item.php'); $add_element_box = new Vc_Add_Element_Box_Grid_Item(); $add_element_box->render(); // Edit form for mapped shortcode. visual_composer()->editForm()->render(); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/popups/class-vc-templates-editor-grid-item.php'); $templates_editor = new Vc_Templates_Editor_Grid_Item(); $templates_editor->renderUITemplate(); $grid_item = new Vc_Grid_Item(); $shortcodes = $grid_item->shortcodes(); if (vc_user_access()->part('presets')->can()->get()) { require_once vc_path_dir('AUTOLOAD_DIR', 'class-vc-settings-presets.php'); $vc_settings_presets = Vc_Settings_Preset::listDefaultSettingsPresets(); $vc_vendor_settings_presets = Vc_Settings_Preset::listDefaultVendorSettingsPresets(); } else { $vc_settings_presets = array(); $vc_vendor_settings_presets = array(); } ?> <script type="text/javascript"> var vc_user_mapper = <?php echo json_encode(WpbMap_Grid_Item::getGitemUserShortCodes()); ?> , vc_mapper = <?php echo json_encode(WpbMap_Grid_Item::getShortCodes());
<input type="hidden" id="wpb_vc_js_status" name="wpb_vc_js_status" value="true"/> <input type="hidden" id="wpb_vc_loading" name="wpb_vc_loading" value="<?php _e('Loading, please wait...', 'js_composer'); ?> "/> <input type="hidden" id="wpb_vc_loading_row" name="wpb_vc_loading_row" value="<?php _e('Crunching...', 'js_composer'); ?> "/> <input type="hidden" name="vc_grid_item_editor" value="true"/> <script type="text/javascript"> <?php $vc_gitem_template = vc_request_param('vc_gitem_template'); if (strlen($vc_gitem_template) && false !== ($template = Vc_Grid_Item::predefinedTemplate($vc_gitem_template))) { echo "var vcDefaultGridItemContent = '" . $template['template'] . "';"; } else { ?> /** * Get content of grid item editor of current post. Data is used as models collection of shortcodes. * Data always wrapped with vc_gitem shortcode. * @return {*} */ var vcDefaultGridItemContent = '' + '[vc_gitem]' + '[vc_gitem_animated_block]' + '[vc_gitem_zone_a]' + '[vc_gitem_row position="top"]' + '[vc_gitem_col width="1/1"][/vc_gitem_col]' + '[/vc_gitem_row]' +
private function renderItems() { $output = $items = ''; $this->buildGridSettings(); $atts = $this->atts; $settings = $this->grid_settings; $filter_terms = $this->filter_terms; $is_end = isset($this->is_end) && $this->is_end; $css_classes = 'vc_grid vc_row' . esc_attr($atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $atts['gap'] . 'px' : ''); if (is_array($this->items) && !empty($this->items)) { require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php'); $grid_item = new Vc_Grid_Item(); $grid_item->setGridAttributes($atts); $grid_item->setIsEnd($is_end); $grid_item->setTemplateById($atts['item']); $output .= $grid_item->addShortcodesCustomCss(); ob_start(); wp_print_styles(); $output .= ob_get_clean(); $attributes = array('filter_terms' => $filter_terms, 'atts' => $atts, 'grid_item', $grid_item); $output .= apply_filters('vc_basic_grid_template_filter', vc_get_template('shortcodes/vc_basic_grid_filter.php', $attributes), $attributes); while (have_posts()) { the_post(); $items .= $grid_item->renderItem(get_post()); } wp_reset_postdata(); } $items = apply_filters($this->shortcode . '_items_list', $items); $output .= $this->renderPagination($atts['style'], $settings, $items, $css_classes); return $output; }
<?php require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/popups/class-vc-add-element-box-grid-item.php'); $add_element_box = new Vc_Add_Element_Box_Grid_Item(); $add_element_box->render(); // Edit form for mapped shortcode. visual_composer()->editForm()->render(); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/popups/class-vc-templates-editor-grid-item.php'); $templates_editor = new Vc_Templates_Editor_Grid_Item(); $templates_editor->render(); require_once vc_path_dir('EDITORS_DIR', 'popups/class-vc-edit-layout.php'); $edit_layout = new Vc_Edit_Layout(); $edit_layout->render(); $grid_item = new Vc_Grid_Item(); $shortcodes = $grid_item->shortcodes(); $grid_item->mapShortcodes(); ?> <script type="text/javascript"> var vc_user_mapper = <?php echo json_encode($shortcodes); ?> , vc_mapper = <?php echo json_encode($shortcodes); ?> , vc_frontend_enabled = false, vc_mode = '<?php echo vc_mode(); ?> ';
/** * Get shortcodes from param type vc_grid_item * @return array|bool */ public function shortcodes() { $grid_item = new Vc_Grid_Item(); return $grid_item->shortcodes(); }