static function includeFileFromDir($path)
 {
     $file = PBFile::scanDir($path);
     if ($file === false) {
         return false;
     }
     foreach ($file as $value) {
         self::includeFile($path . $value);
     }
     return true;
 }
Exemplo n.º 2
0
 static function setFile($componentId, $name, $path)
 {
     global $pb_data;
     PBComponentData::prepare($componentId);
     if (array_key_exists($name, $pb_data['component'][$componentId])) {
         return $pb_data['component'][$componentId][$name];
     }
     $pb_data['component'][$componentId][$name] = array();
     $file = PBFile::scanDir($path);
     if (is_array($file)) {
         foreach ($file as $value) {
             $pb_data['component'][$componentId][$name][$value] = $value;
         }
     }
     return $pb_data['component'][$componentId][$name];
 }
 function __construct()
 {
     $this->bullet = array();
     $this->bullet['file'] = array();
     $bullet = (array) PBComponentData::get($this->getComponentId(), 'bullet');
     $this->bullet['url'] = $bullet['url'];
     $this->bullet['url_retina'] = $bullet['url_retina'];
     $this->bullet['path'] = $bullet['path'];
     $this->bullet['css_class'] = $bullet['css_class'];
     $file = PBFile::scanDir($bullet['path']);
     if (is_array($file)) {
         $this->bullet['file'] = array_combine($file, $file);
     }
     $this->style = array('list' => array('use' => 2, 'path' => $this->getStyleURL(), 'file' => 'style.css'));
     $this->component = array('name' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN), 'description' => __('Displays list', PLUGIN_PAGE_BUILDER_DOMAIN), 'structure' => array('window' => array('title' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array(array('id' => 'bullet', 'ui' => array('text' => array('header' => __('Bullet', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select bullet of the list element', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => $this->bullet['file'])))), array('id' => 'list', 'ui' => array('text' => array('header' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Content of the list', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'editor')), 'visibility' => 1, 'shortcode' => array('path' => '@content')), array('id' => 'css_class', 'ui' => array('text' => array('header' => __('CSS class', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of CSS classes defined in CSS files separated by space.', PLUGIN_PAGE_BUILDER_DOMAIN)))))));
     parent::__construct();
 }
 function __construct()
 {
     $Post = new PBPost();
     $this->style = array('sitemap' => array('use' => 2, 'path' => $this->getStyleURL(), 'file' => 'style.css'));
     $bullet = (array) PBComponentData::get($this->getComponentId(), 'bullet');
     $this->bullet = array();
     $this->bullet['url'] = $bullet['url'];
     $this->bullet['url_retina'] = $bullet['url_retina'];
     $this->bullet['path'] = $bullet['path'];
     $file = PBFile::scanDir($bullet['path']);
     $this->bullet['file'] = array();
     if (is_array($file)) {
         $this->bullet['file'] = array_combine($file, $file);
     }
     /***/
     $this->component = array('name' => __('Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN), 'description' => __('Displays Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN), 'structure' => array('window' => array('title' => __('Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array(array('id' => 'bullet', 'ui' => array('text' => array('header' => __('List bullet', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => $this->bullet['file'], 'use_default' => false)))), array('id' => 'post_type', 'ui' => array('text' => array('header' => __('Post type', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select types of posts which have to be displayed.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'checkbox', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->postType)))), 'shortcode' => array('default' => '')), array('id' => 'post_status', 'ui' => array('text' => array('header' => __('Post status', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select types of post statuses which have to be displayed.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'checkbox', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->postStatus)))), 'shortcode' => array('default' => '')), array('id' => 'post__in', 'ui' => array('text' => array('header' => __('Include', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Define a comma-separated list of page ID\'s to be included to the list', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '')), array('id' => 'post__not_in', 'ui' => array('text' => array('header' => __('Exclude', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Define a comma-separated list of page ID\'s to be excluded from the list.', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '')), array('id' => 'posts_per_page', 'ui' => array('text' => array('header' => __('Limit number of posts', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Number of posts to show. Leave this field empty to show all posts.', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '-2')), array('id' => 'orderby', 'ui' => array('text' => array('header' => __('Sort column', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'radio', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->sortColumn)))), 'shortcode' => array('default' => 'date')), array('id' => 'order', 'ui' => array('text' => array('header' => __('Sort order', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'radio', 'dictionary' => array('source' => array('asc' => __('Ascending', PLUGIN_PAGE_BUILDER_DOMAIN), 'desc' => __('Descending', PLUGIN_PAGE_BUILDER_DOMAIN))))), 'shortcode' => array('default' => 'asc')), array('id' => 'css_class', 'ui' => array('text' => array('header' => __('CSS class', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of CSS classes defined in CSS files separated by space.', PLUGIN_PAGE_BUILDER_DOMAIN)))))));
     parent::__construct();
 }
 function __construct()
 {
     $this->style = array('list' => array('use' => 2, 'path' => $this->getStyleURL(), 'file' => 'style.css'));
     $this->script = array('list' => array('use' => 2, 'path' => $this->getScriptURL(), 'file' => 'PB.List.js'));
     $element = array();
     if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
         $bullet = (array) PBComponentData::get($this->getComponentId(), 'bullet');
         $file = PBFile::scanDir($bullet['path']);
         $this->bullet = array('url' => $bullet['url'], 'url_retina' => $bullet['url_retina'], 'path' => $bullet['path'], 'file' => array_combine($file, $file), 'css_class' => $bullet['css_class']);
         $element = array(array('id' => 'bullet', 'ui' => array('panel' => 2, 'text' => array('header' => __('Bullet', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select bullet of the list element', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => $this->bullet['file'])))));
     } else {
         $element = array(array('id' => 'font_icon_name', 'ui' => array('panel' => 2, 'text' => array('header' => __('Icon', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Enter name of the icon (you have to enter at least two characters to get best matched set of icons).', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'fa-icon')), 'shortcode' => array('default' => 'check-square')), array('id' => 'font_icon_color', 'ui' => array('panel' => 2, 'text' => array('header' => __('Icon color', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Icon color in HEX', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'color-picker'))), array('id' => 'font_icon_size', 'ui' => array('panel' => 2, 'text' => array('header' => __('Icon size', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Icon size in pixels. Value 0 means that default size will be used.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'slider', 'value' => 0, 'option' => array('min' => 0, 'max' => 200)))));
     }
     $this->component = array('name' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN), 'description' => __('Displays list', PLUGIN_PAGE_BUILDER_DOMAIN), 'structure' => array('window' => array('title' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN)), 'ui' => array('panel' => array(1 => array('header' => __('General', PLUGIN_PAGE_BUILDER_DOMAIN)), 2 => array('header' => __('Styles', PLUGIN_PAGE_BUILDER_DOMAIN)))), 'element' => array(array('id' => 'list', 'ui' => array('panel' => 1, 'text' => array('header' => __('List', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Content of the list', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'editor')), 'shortcode' => array('path' => '@content')), array('id' => 'css_class', 'ui' => array('panel' => 1, 'text' => array('header' => __('CSS class', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of CSS classes defined in CSS files separated by space.', PLUGIN_PAGE_BUILDER_DOMAIN)))))));
     foreach ($element as $elementValue) {
         $this->component['structure']['element'][] = $elementValue;
     }
     parent::__construct();
 }
 function __construct()
 {
     $Post = new PBPost();
     $this->style = array('sitemap' => array('use' => 2, 'path' => $this->getStyleURL(), 'file' => 'style.css'));
     /***/
     $element = array();
     if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
         $bullet = (array) PBComponentData::get($this->getComponentId(), 'bullet');
         $file = PBFile::scanDir($bullet['path']);
         $this->bullet = array('url' => $bullet['url'], 'url_retina' => $bullet['url_retina'], 'path' => $bullet['path'], 'file' => array_combine($file, $file));
         $element = array(array('id' => 'bullet', 'ui' => array('panel' => 3, 'text' => array('header' => __('List bullet', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => $this->bullet['file'], 'use_default' => false)))));
     } else {
         $element = array(array('id' => 'font_icon_name', 'ui' => array('panel' => 3, 'text' => array('header' => __('Icon', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Enter name of the icon (you have to enter at least two characters to get best matched set of icons).', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'fa-icon')), 'shortcode' => array('default' => 'check-square')), array('id' => 'font_icon_color', 'ui' => array('panel' => 3, 'text' => array('header' => __('Icon color', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Icon color in HEX', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'color-picker'))), array('id' => 'font_icon_size', 'ui' => array('panel' => 3, 'text' => array('header' => __('Icon size', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Icon size in pixels. Value 0 means that default size for will be used.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'slider', 'value' => 0, 'option' => array('min' => 0, 'max' => 200)))));
     }
     /***/
     $this->component = array('name' => __('Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN), 'description' => __('Displays Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN), 'structure' => array('window' => array('title' => __('Sitemap', PLUGIN_PAGE_BUILDER_DOMAIN)), 'ui' => array('panel' => array(1 => array('header' => __('General', PLUGIN_PAGE_BUILDER_DOMAIN)), 2 => array('header' => __('Data source', PLUGIN_PAGE_BUILDER_DOMAIN)), 3 => array('header' => __('Styles', PLUGIN_PAGE_BUILDER_DOMAIN)))), 'element' => array(array('id' => 'css_class', 'ui' => array('panel' => 1, 'text' => array('header' => __('CSS class', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of CSS classes defined in CSS files separated by space.', PLUGIN_PAGE_BUILDER_DOMAIN)))), array('id' => 'post_type', 'ui' => array('panel' => 2, 'text' => array('header' => __('Post type', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select types of posts which have to be displayed.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'checkbox', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->postType)))), 'shortcode' => array('default' => '')), array('id' => 'post_status', 'ui' => array('panel' => 2, 'text' => array('header' => __('Post status', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select types of post statuses which have to be displayed.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'checkbox', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->postStatus)))), 'shortcode' => array('default' => '')), array('id' => 'post__in', 'ui' => array('panel' => 2, 'text' => array('header' => __('Include', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Define a comma-separated list of page ID\'s to be included to the list', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '')), array('id' => 'post__not_in', 'ui' => array('panel' => 2, 'text' => array('header' => __('Exclude', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Define a comma-separated list of page ID\'s to be excluded from the list.', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '')), array('id' => 'posts_per_page', 'ui' => array('panel' => 2, 'text' => array('header' => __('Limit number of posts', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Number of posts to show. Leave this field empty to show all posts.', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('default' => '-2')), array('id' => 'orderby', 'ui' => array('panel' => 2, 'text' => array('header' => __('Sort column', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'radio', 'dictionary' => array('source' => PBHelper::extractDictionary($Post->sortColumn)))), 'shortcode' => array('default' => 'date')), array('id' => 'order', 'ui' => array('panel' => 2, 'text' => array('header' => __('Sort order', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'radio', 'dictionary' => array('source' => array('asc' => __('Ascending', PLUGIN_PAGE_BUILDER_DOMAIN), 'desc' => __('Descending', PLUGIN_PAGE_BUILDER_DOMAIN))))), 'shortcode' => array('default' => 'asc')))));
     foreach ($element as $elementValue) {
         $this->component['structure']['element'][] = $elementValue;
     }
     parent::__construct();
 }
 function __construct()
 {
     $Background = new PBBackground();
     $bullet = (array) PBComponentData::get($this->getComponentId(), 'bullet');
     $this->bullet = array();
     $this->bullet['url'] = $bullet['url'];
     $this->bullet['url_retina'] = $bullet['url_retina'];
     $this->bullet['path'] = $bullet['path'];
     $file = PBFile::scanDir($bullet['path']);
     $this->bullet['file'] = array();
     if (is_array($file)) {
         $this->bullet['file'] = array_combine($file, $file);
     }
     $Layout = new PBLayout();
     $this->currentIndex = 0;
     $this->currentLayout = null;
     $this->style = array('pricing-plan' => array('use' => 2, 'path' => $this->getStyleURL(), 'file' => 'style.css'));
     $this->script = array('pricing-plan' => array('use' => 2, 'path' => $this->getScriptURL(), 'file' => 'PB.PricingPlan.js'));
     $this->type = array('1' => array(__('Type 1', PLUGIN_PAGE_BUILDER_DOMAIN)), '2' => array(__('Type 2', PLUGIN_PAGE_BUILDER_DOMAIN)));
     $this->layout = $Layout->getMainLayout();
     $this->component = array('name' => __('Pricing Plan', PLUGIN_PAGE_BUILDER_DOMAIN), 'description' => __('Displays Pricing Plan', PLUGIN_PAGE_BUILDER_DOMAIN), 'structure' => array('window' => array('title' => __('Pricing Plan', PLUGIN_PAGE_BUILDER_DOMAIN)), 'ui' => array('panel' => array(1 => array('header' => __('General', PLUGIN_PAGE_BUILDER_DOMAIN)), 2 => array('header' => __('Plans', PLUGIN_PAGE_BUILDER_DOMAIN))), 'multi' => array(1 => array('header' => __('Content of the plan', PLUGIN_PAGE_BUILDER_DOMAIN)))), 'element' => array(array('id' => 'layout', 'ui' => array('panel' => 1, 'text' => array('header' => __('Layout', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select layout of the pricing plan.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => PBHelper::extractDictionary($this->layout, 'name')))), 'shortcode' => array('default' => '50x50')), array('id' => 'type', 'ui' => array('panel' => 1, 'text' => array('header' => __('Type', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select one from the available types.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'radio', 'dictionary' => array('source' => PBHelper::extractDictionary($this->type)))), 'shortcode' => array('default' => '1')), array('id' => 'css_class', 'ui' => array('panel' => 1, 'text' => array('header' => __('CSS class', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of CSS classes defined in CSS files separated by space.', PLUGIN_PAGE_BUILDER_DOMAIN)))), array('id' => 'item_header', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Header', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/item_header/@content')), array('id' => 'item_description', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Description', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'textarea')), 'shortcode' => array('path' => '*item/item_description/@content')), array('id' => 'item_feature', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Feature list', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('List of features separated by new line.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'textarea')), 'shortcode' => array('path' => '*item/item_feature/@content')), array('id' => 'item_feature_bullet', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Feature list bullet', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Bullet for the feature list elements', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => $this->bullet['file'], 'use_default' => false))), 'shortcode' => array('path' => '*item/item_feature/@bullet')), array('id' => 'item_image_url', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Image URL', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select image of the background. This option works only with type named "Style 2".', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-image')), 'shortcode' => array('path' => '*item/@image_url')), array('id' => 'item_image_position', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Image position', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/@image_position')), array('id' => 'item_image_repeat', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Image repeat', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Select type of background repeat.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => PBHelper::extractDictionary($Background->backgroundRepeat)))), 'shortcode' => array('path' => '*item/@image_repeat')), array('id' => 'item_image_size_a', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Image size', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => __('Specify the image size. For options "Length" and "Percentage" you have to specify these values in next field.', PLUGIN_PAGE_BUILDER_DOMAIN)), 'element' => array('type' => 'select-one', 'dictionary' => array('source' => PBHelper::extractDictionary($Background->backgroundSize)))), 'shortcode' => array('path' => '*item/@image_size_a')), array('id' => 'item_image_size_b', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Image size', PLUGIN_PAGE_BUILDER_DOMAIN), 'subheader' => array(__('Sets the width and height of the background image.', PLUGIN_PAGE_BUILDER_DOMAIN), __('Sets the width and height of the background image in percent of the parent element.', PLUGIN_PAGE_BUILDER_DOMAIN), __('The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto"', PLUGIN_PAGE_BUILDER_DOMAIN)))), 'shortcode' => array('path' => '*item/@image_size_b')), array('id' => 'item_button_label', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Button label', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/item_button/@content')), array('id' => 'item_button_url', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Button URL', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/item_button/@url')), array('id' => 'item_price_value', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Price', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/item_price/item_price_value/@content')), array('id' => 'item_price_suffix', 'ui' => array('panel' => 2, 'multi' => 1, 'text' => array('header' => __('Price suffix', PLUGIN_PAGE_BUILDER_DOMAIN))), 'shortcode' => array('path' => '*item/item_price/item_price_suffix/@content')))));
     parent::__construct();
 }
    function processShortcodeNivoSlider($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $option = array();
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $paginationHTML = null;
        $Validation = new PBValidation();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['transition_effect'], $this->effect)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_slice'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_column'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_row'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['transition_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['pause_time'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['start_slide'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['direction_navigation_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_navigation_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_navigation_thumbs_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_hover'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['manual_advance_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['random_start_enable'])) {
            return $html;
        }
        $key = array('transition_effect', 'count_slice', 'count_column', 'count_row', 'transition_speed', 'pause_time', 'start_slide', 'preloader_enable', 'direction_navigation_enable', 'control_navigation_enable', 'control_navigation_thumbs_enable', 'pause_on_hover', 'manual_advance_enable', 'random_start_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $class = array(array(), array());
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[0], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[1], 'pb-image');
        global $post;
        $bPost = $post;
        while ($file->have_posts()) {
            $file->the_post();
            $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            $url = null;
            $meta = PBMeta::get($post->ID);
            PBHelper::removeUIndex($meta, 'media_library_url');
            if ($Validation->isNotEmpty($attribute['url'])) {
                $url = $attribute['url'];
            } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
            }
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"><img src="' . $src[0] . '" alt=""/></a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>';
            }
            $imageBoxHTML .= '
				<div' . PBHelper::createClassAttribute($class[0]) . '>
					<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . '</div>
				</div>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('pb_nivo_slider');
        $class = array(array(), array());
        array_push($class[0], 'pb-nivo-slider', $attribute['css_class']);
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[1], 'pb-preloader');
        }
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<div' . PBHelper::createClassAttribute($class[1]) . ' id="' . $id . '">
					' . $imageBoxHTML . '
					' . $paginationHTML . '
				</div>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBNivoSlider(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
    function processShortcodeGallery($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $elementHTML = null;
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        $ImageHover = new PBImageHover();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['layout'], $this->layout)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['hover_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['caption_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['description_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['layout_full_width_enable'])) {
            return $html;
        }
        $key = array('hover_type', 'hover_enable', 'preloader_enable', 'layout_full_width_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $id = PBHelper::createId('pb_gallery');
        global $post;
        $bPost = $post;
        $i = 0;
        while ($file->have_posts()) {
            global $post;
            $file->the_post();
            $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), $attribute['image_size']);
            $meta = PBMeta::get($post);
            PBHelper::removeUIndex($meta, 'media_library_video_url', 'media_library_url');
            $class = array();
            $class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i));
            $class[1] = array('pb-image-box');
            $class[2] = array('pb-image');
            if ($attribute['preloader_enable'] == 1) {
                array_push($class[1], 'pb-image-preloader', 'pb-image-preloader-animation-enable');
            }
            if ($attribute['hover_enable'] == 1) {
                array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']);
            }
            /****/
            $imageTextHTML = null;
            if ($Validation->isNotEmpty($post->post_excerpt) && $attribute['caption_enable'] == 1) {
                $imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . get_the_excerpt() . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>';
            }
            if ($Validation->isNotEmpty($post->post_content) && $attribute['description_enable'] == 1) {
                $imageTextHTML .= '<div class="pb-image-text-description">' . get_the_content() . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML .= '<div class="pb-image-text-fancybox"><b>' . get_the_excerpt() . '</b> ' . get_the_content() . '</div>';
            }
            /****/
            $url = null;
            $rel = null;
            if ($Validation->isVideoURL($meta['media_library_video_url'])) {
                $url = $meta['media_library_video_url'];
                array_push($class[1], 'pb-image-type-video');
            } elseif ($Validation->isURL($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
                array_push($class[1], 'pb-image-type-link');
            } else {
                $rel = $id;
                $url = $full[0];
                array_push($class[1], 'pb-image-type-image');
            }
            /****/
            $imageHTML = null;
            if ($attribute['hover_enable'] == 1) {
                $imageHTML = '<a href="' . $url . '"' . PBHelper::createClassAttribute($class[2]) . ($Validation->isEmpty($rel) ? null : ' data-fancybox-group="' . esc_attr($rel) . '"') . '><img src="' . $thumbnail[0] . '" alt=""/><span><span><span></span></span></span></a>';
            } else {
                $imageHTML = '<div' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/></div>';
            }
            /****/
            if ($Validation->isNotEmpty($imageTextHTML)) {
                array_push($class[1], 'pb-image-text-enable');
            }
            $elementHTML .= '<li' . PBHelper::createClassAttribute($class[0]) . '><div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . $imageTextHTML . '</div></li>';
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        $class = array();
        $class[0] = array('pb-gallery', 'pb-clear-fix', $attribute['css_class']);
        $class[1] = array($Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix');
        if ($attribute['layout_full_width_enable'] == 1) {
            array_push($class[1], 'pb-layout-full-width');
        }
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[1]) . '>
					' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
				</ul>			
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBGallery(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, $elementHTML);
    }
    function processShortcodeZAccordion($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Image = new PBImage();
        $Easing = new PBEasing();
        $Validation = new PBValidation();
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $option = array();
        if (!array_key_exists($attribute['data_source'], $this->dataSource)) {
            return $html;
        }
        if ($attribute['data_source'] == 1) {
            $query = PBFile::getImage(explode(',', $attribute['image']));
            if ($query === false) {
                return $html;
            }
            if (!count($query->posts)) {
                return $html;
            }
        } else {
            $argument = array('meta_query' => array(array('key' => '_thumbnail_id')));
            if ($Validation->isNotEmpty($attribute['post_type'])) {
                $argument['post_type'] = explode(',', $attribute['post_type']);
            }
            if ($Validation->isNotEmpty($attribute['post_status'])) {
                $argument['post_status'] = explode(',', $attribute['post_status']);
            }
            if ($Validation->isNotEmpty($attribute['post__in'])) {
                $argument['post__in'] = explode(',', $attribute['post__in']);
            }
            if ($Validation->isNotEmpty($attribute['post__not_in'])) {
                $argument['post__not_in'] = explode(',', $attribute['post__not_in']);
            }
            if ($Validation->isNotEmpty($attribute['posts_per_page'])) {
                $argument['posts_per_page'] = $attribute['posts_per_page'] == -2 ? -1 : $attribute['posts_per_page'];
            }
            if ($Validation->isNotEmpty($attribute['orderby'])) {
                $argument['orderby'] = $attribute['orderby'];
            }
            if ($Validation->isNotEmpty($attribute['order'])) {
                $argument['order'] = $attribute['order'];
            }
            $query = new WP_Query($argument);
            if ($query === false) {
                return $html;
            }
            if ($query->post_count == 0) {
                return $html;
            }
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['starting_slide'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['timeout'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['auto'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause'])) {
            return $html;
        }
        if (!array_key_exists($attribute['easing'], $Easing->easingType)) {
            return $html;
        }
        if (!array_key_exists($attribute['trigger'], $this->tabOpenTriggerEvent)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['display_slide_title'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['display_slide_excerpt'])) {
            return $html;
        }
        $imageSize = $Image->getImageDimension($attribute['image_size']);
        if ($imageSize === false) {
            return $html;
        }
        $key = array('preloader_enable', 'starting_slide', 'timeout', 'speed', 'auto', 'pause', 'easing', 'trigger', 'display_slide_title', 'display_slide_excerpt');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $option['width'] = $imageSize['width'];
        $option['height'] = $imageSize['height'];
        $class = array(array(), array(), array(), array());
        array_push($class[0], 'pb-zaccordion', $attribute['css_class']);
        array_push($class[1], 'pb-reset-list');
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[1], 'pb-preloader');
            array_push($class[2], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[3], 'pb-image');
        global $post;
        $bPost = $post;
        while ($query->have_posts()) {
            $query->the_post();
            $url = null;
            if ($attribute['data_source'] == 1) {
                $meta = PBMeta::get($post->ID);
                PBHelper::removeUIndex($meta, 'media_library_url');
                if ($Validation->isNotEmpty($attribute['url'])) {
                    $url = $attribute['url'];
                } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                    $url = $meta['media_library_url'];
                }
                $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            } else {
                $url = get_the_permalink();
                $src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $attribute['image_size']);
            }
            $captionHTML = null;
            if ($attribute['display_slide_title'] == 1) {
                $captionHTML .= '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box-title')) . '>' . ($attribute['data_source'] == 1 ? strip_tags(get_the_excerpt()) : get_the_title()) . '</span>';
            }
            if ($attribute['display_slide_excerpt'] == 1) {
                $captionHTML .= '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box-excerpt')) . '>' . ($attribute['data_source'] == 1 ? get_the_content() : strip_tags(get_the_excerpt())) . '</span>';
            }
            if ($Validation->isNotEmpty($captionHTML)) {
                $captionHTML = '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box"')) . '>' . $captionHTML . '</span>';
            }
            $imageHTML = null;
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"' . PBHelper::createClassAttribute($class[3]) . '><img src="' . $src[0] . '" alt=""/>' . $captionHTML . '</a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>' . $captionHTML;
            }
            $imageBoxHTML .= '
				<li>
					<div' . PBHelper::createClassAttribute($class[2]) . '>' . $imageHTML . '</div>
				</li>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('accordion');
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<ul' . PBHelper::createClassAttribute($class[1]) . ' id="' . $id . '">
					' . $imageBoxHTML . '
				</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBZAccordion(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Exemplo n.º 11
0
    function processShortcodeTeam($attribute, $content, $tag)
    {
        $html = null;
        $teamHTML = null;
        $option = array();
        $attribute = $this->processAttribute($tag, $attribute);
        $Window = new PBWindow();
        $Easing = new PBEasing();
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        $ImageHover = new PBImageHover();
        $data = $this->getTeam($attribute);
        if ($data === false) {
            return;
        }
        if (!count($data->posts)) {
            return;
        }
        if (!array_key_exists($attribute['template'], $this->template)) {
            return $html;
        }
        if (!array_key_exists($attribute['layout'], $this->layout)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['hover_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['skill_list_waypoint_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['skill_list_waypoint_duration'], 0, 99999)) {
            return $html;
        }
        if (!array_key_exists($attribute['skill_list_waypoint_easing'], $Easing->easingType)) {
            return $html;
        }
        $key = array('hover_type', 'hover_enable', 'preloader_enable', 'skill_list_waypoint_enable', 'skill_list_waypoint_easing', 'skill_list_waypoint_duration', 'skill_list_waypoint_offset_trigger');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $layoutCurrent = '100';
        if ($attribute['template'] == 2) {
            $layoutCurrent = '50x50';
        } elseif ($attribute['template'] == 3) {
            $layoutCurrent = $attribute['layout'];
        }
        global $post;
        $bPost = $post;
        $i = 0;
        while ($data->have_posts()) {
            global $post;
            $data->the_post();
            $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), $attribute['image_size']);
            if ($full == false || $thumbnail == false) {
                continue;
            }
            $meta = PBMeta::get($post);
            PBHelper::removeUIndex($meta, 'team_social', 'team_skill');
            /***/
            $class = array(array(), array());
            $class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($layoutCurrent, $i));
            $class[1] = array('pb-image-box', 'pb-image-preloader-animation-enable');
            $class[2] = array('pb-image');
            if ($attribute['preloader_enable'] == 1) {
                array_push($class[1], 'pb-image-preloader');
            }
            if ($attribute['hover_enable'] == 1) {
                array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type'], 'pb-image-type-image');
            }
            /***/
            $textHTML = null;
            if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) {
                $textHTML .= '<h3 class="pb-team-text-box-member-name">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</h3>';
            }
            if ($Validation->isNotEmpty($meta['team_position'])) {
                $textHTML .= '<div class="pb-team-text-box-member-position">' . $meta['team_position'] . '</div>';
            }
            /***/
            $socialHTML = null;
            if (is_array($meta['team_social'])) {
                $social = PBHelper::orderArrayByElement($meta['team_social'], 'team_social_order');
                foreach ($social as $index => $value) {
                    if (!array_key_exists($value['team_social_name'], $this->social)) {
                        continue;
                    }
                    $socialHTML .= '
						<li>
							<a href="' . esc_attr($value['team_social_url']) . '" class="pb-team-social-icon-' . $value['team_social_name'] . ' ' . $Window->getTargetCSSClass('_blank') . '"></a>
						</li>
					';
                }
                if ($Validation->isNotEmpty($socialHTML)) {
                    $socialHTML = '
						<ul class="pb-team-social-icon-box pb-reset-list pb-clear-fix">
							' . $socialHTML . '
						</ul>
					';
                }
            }
            /***/
            $skillHTML = null;
            if (is_array($meta['team_skill'])) {
                $skill = PBHelper::orderArrayByElement($meta['team_skill'], 'team_skill_order');
                foreach ($skill as $index => $value) {
                    if (!$Validation->isNumber($value['team_skill_level'], 0, 100)) {
                        continue;
                    }
                    $skillHTML .= '
						<div class="pb-team-skill pb-value-' . (int) $value['team_skill_level'] . '">
							<span class="pb-team-skill-label">' . esc_html($value['team_skill_name']) . '</span>
							<span class="pb-team-skill-value">
								<span class="pb-team-skill-value-value">' . (int) $value['team_skill_level'] . '</span>
								<span class="pb-team-skill-value-character-after">%</span>
							</span>
							<span class="pb-team-skill-foreground"></span>
							<span class="pb-team-skill-background"></span>						
						</div>
					';
                }
                if ($Validation->isNotEmpty($skillHTML)) {
                    $skillHTML = '
						<div class="pb-team-skill-box">
							' . $skillHTML . '
						</div>
					';
                }
            }
            /***/
            $imageTextHTML = null;
            if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) {
                $imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>';
            }
            if ($Validation->isNotEmpty($meta['team_position'])) {
                $imageTextHTML .= '<div class="pb-image-text-description">' . $meta['team_position'] . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>';
            }
            /***/
            $imageHTML = null;
            if ($attribute['hover_enable'] == 1) {
                $imageHTML = '<a href="' . $full[0] . '"' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/><span><span><span></span></span></span></a>';
            } else {
                $imageHTML = '<div' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/></div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                array_push($class[1], 'pb-image-text-enable');
            }
            $imageBoxHTML = '<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . $imageTextHTML . '</div>';
            /***/
            $teamHTML .= '
				<li' . PBHelper::createClassAttribute($class[0]) . '>
			';
            switch ($attribute['template']) {
                case 1:
                    $teamHTML .= '<div class="pb-layout-33x66 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . $socialHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-text-box">' . $textHTML . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $skillHTML . '</div></div>';
                    break;
                case 2:
                    $teamHTML .= '<div class="pb-layout-50x50 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-quote-box"></div><div class="pb-team-text-box">' . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $socialHTML . '</div></div>';
                    break;
                case 3:
                    $teamHTML .= '<div>' . $imageBoxHTML . $socialHTML . '</div>';
                    break;
            }
            $teamHTML .= '
				</li>
			';
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        if ($Validation->isEmpty($teamHTML)) {
            return;
        }
        $id = PBHelper::createId('pb_team');
        $class = array();
        $class[0] = array('pb-team', 'pb-team-template-' . $attribute['template'], 'pb-clear-fix', $attribute['css_class']);
        $class[1] = array('pb-layout-' . $layoutCurrent, 'pb-reset-list', 'pb-clear-fix');
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[1]) . '>
					' . $teamHTML . '
				</ul>			
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBTeam(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return $html;
    }
Exemplo n.º 12
0
    function processShortcodeFlexSlider($attribute, $content, $tag)
    {
        $Easing = new PBEasing();
        $attribute = $this->processAttribute($tag, $attribute);
        $option = array();
        $class = array(array(), array(), array(), array());
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $Validation = new PBValidation();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['easing'], $Easing->easingType)) {
            return $html;
        }
        if (!array_key_exists($attribute['animation'], $this->animation)) {
            return $html;
        }
        if (!array_key_exists($attribute['direction'], $this->direction)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['start_at'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['init_delay'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['slideshow_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['animation_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['touch'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['reverse'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['use_css'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['keyboard'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['slideshow'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['randomize'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['mousewheel'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_nav'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['direction_nav'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['smooth_height'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['animation_loop'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_hover'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_action'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['multiple_keyboard'])) {
            return $html;
        }
        $key = array('easing', 'animation', 'direction', 'start_at', 'init_delay', 'slideshow_speed', 'animation_speed', 'preloader_enable', 'touch', 'use_css', 'reverse', 'keyboard', 'slideshow', 'randomize', 'mousewheel', 'control_nav', 'direction_nav', 'smooth_height', 'pause_on_hover', 'animation_loop', 'pause_on_action', 'multiple_keyboard');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[0], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[1], 'pb-image');
        global $post;
        $bPost = $post;
        while ($file->have_posts()) {
            $file->the_post();
            $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            $url = null;
            $meta = PBMeta::get($post->ID);
            PBHelper::removeUIndex($meta, 'media_library_url');
            if ($Validation->isNotEmpty($attribute['url'])) {
                $url = $attribute['url'];
            } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
            }
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"><img src="' . $src[0] . '" alt=""/></a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>';
            }
            $imageBoxHTML .= '
				<li' . PBHelper::createClassAttribute($class[0]) . '>
					<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . '</div>
				</li>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('pb_flex_slider');
        array_push($class[2], 'pb-flex-slider', $attribute['css_class']);
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[2], 'pb-preloader');
        }
        array_push($class[3], 'pb-reset-list', 'slides');
        $html = '
			<div' . PBHelper::createClassAttribute($class[2]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[3]) . '>
					' . $imageBoxHTML . '
				</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBFlexSlider(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Exemplo n.º 13
0
    function processShortcodeRecentPost($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        $ImageHover = new PBImageHover();
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['layout'], $this->layout)) {
            return $html;
        }
        if (!array_key_exists($attribute['template'], $this->template)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['post_count'], 1, 999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['hover_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['date_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['image_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['header_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['author_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['excerpt_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['category_enable'])) {
            return $html;
        }
        $option = array();
        $key = array('hover_type', 'hover_enable', 'preloader_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $data = $this->getPost($attribute);
        if ($data === false) {
            return null;
        }
        if (!count($data->posts)) {
            return null;
        }
        $i = 0;
        global $post;
        $bPost = $post;
        while ($data->have_posts()) {
            $data->the_post();
            $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i));
            $meta = array('date' => null, 'comment_count' => null, 'image' => null, 'header' => null, 'excerpt' => null, 'meta' => null);
            if ($attribute['date_enable']) {
                $meta['date'] = '<div class="pb-recent-post-date">' . get_the_date() . '</div>';
            }
            if ($attribute['image_enable']) {
                if (has_post_thumbnail()) {
                    $commentCountHTML = null;
                    if ($attribute['template'] == 1) {
                        if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
                            $commentCount = wp_count_comments(get_the_id());
                            $commentCountHTML = '<div class="pb-recent-post-comment-count"><span class="pb-recent-post-comment-count-value">' . $commentCount->approved . '</span><span class="pb-recent-post-comment-count-arrow"></span></div>';
                        }
                    }
                    $classImage = array(array('pb-recent-post-image', 'pb-image-box'), array('pb-image'));
                    if ($attribute['preloader_enable'] == 1) {
                        array_push($classImage[0], 'pb-image-preloader', 'pb-image-preloader-animation-enable');
                    }
                    if ($attribute['hover_enable'] == 1) {
                        array_push($classImage[0], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']);
                    }
                    if ($attribute['hover_enable'] == 1) {
                        $meta['image'] = '<a href="' . get_permalink(get_the_ID()) . '"' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '<span><span><span></span></span></span></a>';
                    } else {
                        $meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '</div>';
                    }
                    $meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[0]) . '>' . $meta['image'] . $commentCountHTML . '</div>';
                }
            }
            if ($attribute['header_enable']) {
                $meta['header'] = '<h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . ' class="pb-recent-post-header"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . '>';
            }
            if ($attribute['excerpt_enable']) {
                $meta['excerpt'] = '<div class="pb-recent-post-excerpt">' . get_the_excerpt() . '</div>';
            }
            if ($attribute['author_enable'] || $attribute['category_enable'] || $attribute['template'] == 2 && $attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
                $authorHTML = null;
                $categoryHTML = null;
                $commentCountHTML = null;
                if ($attribute['author_enable']) {
                    $authorHTML = '<div class="pb-recent-post-meta-author">' . get_the_author() . '</div>';
                }
                $category = get_the_category(get_the_ID());
                $count = count($category);
                if ($count) {
                    foreach ($category as $index => $value) {
                        $separator = $index == $count - 1 ? '' : ',&nbsp;';
                        $title = $Validation->isEmpty($value->description) ? sprintf(__('View all posts filed under %s', PLUGIN_PAGE_BUILDER_DOMAIN), $value->name) : strip_tags(apply_filters('category_description', $value->description, $value));
                        $categoryHTML .= '<li><a href="' . get_category_link($value->term_id) . '" title="' . esc_attr($title) . '">' . esc_html($value->name) . '</a>' . $separator . '</li>';
                    }
                    $categoryHTML = '<div class="pb-recent-post-meta-category"><ul class="pb-reset-list">' . $categoryHTML . '</ul></div>';
                }
                if ($attribute['template'] == 2) {
                    if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) {
                        $commentCount = wp_count_comments(get_the_id());
                        $commentCountHTML = '<div class="pb-recent-post-meta-comment-count">' . __(sprintf('%d Comments', $commentCount->approved), PLUGIN_PAGE_BUILDER_DOMAIN) . '</div>';
                    }
                }
                $meta['meta'] = '<div class="pb-recent-post-meta pb-clear-fix">' . $authorHTML . $categoryHTML . $commentCountHTML . '</div>';
            }
            $templateHTML = array();
            $templateOrder = array('date', 'image', 'header', 'excerpt', 'meta');
            if ($attribute['template'] == 2) {
                $templateOrder = array('image', 'header', 'date', 'excerpt', 'meta');
            }
            foreach ($templateOrder as $value) {
                if (isset($meta[$value])) {
                    $templateHTML[$value] = $meta[$value];
                }
            }
            $html .= '<li' . PBHelper::createClassAttribute($class) . '><div>' . implode($templateHTML) . '</div></li>';
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('pb_recent_post');
        $class = array();
        $class[0] = array('pb-recent-post', 'pb-recent-post-template-' . $attribute['template'], $attribute['css_class']);
        $class[1] = array('pb-clear-fix', 'pb-reset-list', $Layout->getLayoutCSSClass($attribute['layout']));
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[1]) . '>
					' . $html . '
				</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($) 
					{
						$("#' . $id . '").PBRecentPost(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Exemplo n.º 14
0
    function processShortcodeSupersized($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['autoplay'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['fit_always'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['fit_landscape'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['fit_portrait'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['horizontal_center'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['vertical_center'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['min_width'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['min_height'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['image_protect'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['keyboard_nav'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['new_window'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_hover'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['random'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['start_slide'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['stop_loop'])) {
            return $html;
        }
        if (!array_key_exists($attribute['performance'], $this->performance)) {
            return $html;
        }
        if (!array_key_exists($attribute['transition'], $this->transition)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['transition_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['slide_interval'], 0, 99999)) {
            return $html;
        }
        $option = array();
        $key = array('autoplay', 'fit_always', 'fit_landscape', 'fit_portrait', 'horizontal_center', 'vertical_center', 'min_width', 'min_height', 'image_protect', 'keyboard_nav', 'new_window', 'pause_hover', 'random', 'start_slide', 'stop_loop', 'performance', 'transition', 'transition_speed', 'slide_interval', 'css_class');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        global $post;
        $bPost = $post;
        $i = 0;
        while ($file->have_posts()) {
            global $post;
            $file->the_post();
            $meta = PBMeta::get($post);
            PBHelper::removeUIndex($meta, 'media_library_url');
            $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $option['slides'][$i]['url'] = $meta['media_library_url'];
            $option['slides'][$i]['image'] = $full[0];
            $option['slides'][$i]['title'] = get_the_title();
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        $html = '
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$().PBSupersized(' . json_encode($option) . ');
					});
				</script>
			</div>				
		';
        return PBHelper::formatHTML($html);
    }