protected function _render($options)
 {
     $metaFields = array_keys(Set::filter(Set::booleanize($this->getParam('metaFields'))));
     echo '<div class="line-meta-details">';
     echo $this->Html->postDetails($metaFields, array('prefixes' => array('author' => __('By', 'gummfw'), 'date' => __('/', 'gummfw'), 'comments' => __('/', 'gummfw'), 'category' => __('/', 'gummfw')), 'formats' => array('date' => 'd F Y')));
     echo '</div>';
 }
Ejemplo n.º 2
0
 protected function _render($options)
 {
     $networks = Set::filter(Set::booleanize($this->getParam('socialNetworks')));
     echo '<div class="bluebox-share-options">';
     echo '<span>' . __('Share The Story', 'gummfw') . '</span>';
     echo '<div class="bluebox-details-social">';
     View::renderElement('social-links', array('networks' => $networks, 'accountMode' => 'share', 'additionalClass' => 'bluebox-shadows'));
     echo '</div>';
     echo '</div>';
 }
 /**
  * @return void
  */
 public function render($fields)
 {
     $networks = Set::filter(Set::booleanize($this->getParam('socialNetworks')));
     $mode = $this->getParam('mode');
     // echo '<div class="bluebox-share-options">';
     //     echo '<span>' . __('Share The Story') . '</span>';
     echo '<div class="bluebox-details-social">';
     View::renderElement('social-links', array('networks' => $networks, 'accountMode' => $mode, 'additionalClass' => 'social-link bluebox-shadows'));
     echo '</div>';
     // echo '</div>';
 }
 protected function filterQueryPostsArgs($args)
 {
     global $woocommerce;
     if ($_args = $woocommerce->query->get_catalog_ordering_args()) {
         $args = array_merge($args, $_args);
     }
     if ($termIds = Set::filter(Set::booleanize($this->getParam('product_cat')))) {
         $termIds = array_keys($termIds);
         $args = Set::merge($args, array('tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => (array) $termIds))));
     }
     return $args;
 }
Ejemplo n.º 5
0
 /**
  * @param int $postId
  * @param string $metaId
  * @param bool $single
  * @return mixed
  */
 public function find($postId, $metaId, $single = true)
 {
     $metaId = $this->gummOptionId($metaId, true);
     $meta = false;
     if (strpos($metaId, '.') !== false) {
         $parts = explode('.', $metaId);
         $rootId = array_shift($parts);
         $rootMetaData = get_post_meta($postId, $rootId, $single);
         $metaXPath = implode('.', $parts);
         $meta = Set::classicExtract($rootMetaData, $metaXPath);
         if ($meta === null || $rootMetaData === '' && !$meta) {
             $meta = false;
         }
     } else {
         $meta = get_post_meta($postId, $metaId, $single);
         // if ($postId == 442 && $metaId == 'nova_postmeta') {
         //     debug(get_post_meta(442, 'nova_postmeta'), true);
         //     d($meta);
         // } else {
         //     debug($postId);
         //     debug($metaId);
         // }
     }
     // debug($metaId);
     $_post = get_post($postId);
     $friendlyId = $this->friendlyOptionId($metaId);
     $postTypes = array($_post->post_type);
     if (in_array($_post->post_type, $this->Post->getPostTypes())) {
         $postTypes[] = 'single';
     }
     if (!$meta && isset($this->_schema[$friendlyId])) {
         $meta = $this->_schema[$friendlyId];
     } elseif ($friendlyId == 'postmeta') {
         foreach ($postTypes as $postType) {
             if (isset($this->_schema[$postType]) && isset($this->_schema[$postType]['postmeta'])) {
                 if (!$meta) {
                     $meta = $this->_schema[$postType]['postmeta'];
                 } else {
                     $meta = array_merge($this->_schema[$postType]['postmeta'], (array) $meta);
                 }
                 if (is_array($meta)) {
                     $meta = Set::booleanize($meta);
                 }
             }
         }
     }
     if ($meta && !is_admin() && function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
         $meta = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($meta);
     }
     return $meta;
 }
 public function _renderVCardLayout($options)
 {
     while (have_posts()) {
         the_post();
         global $post;
         $divAtts = array('class' => array('gumm-filterable-item', 'row-fluid', 'bluebox-single-staff-wrap', 'new-builder-element'));
         $categories = $this->Wp->getPostCategories($post);
         foreach ($categories as $catId => $catName) {
             $divAtts['class'][] = 'for-category-' . $catId;
         }
         echo '<div' . $this->Html->_constructTagAttributes($divAtts) . '>';
         $this->requestAction(array('controller' => 'layout_elements', 'action' => 'display', 'single_staff_vcard', array(), array('moreLink' => true, 'socialNetworksDisplay' => Set::booleanize($this->getParam('socialNetworksDisplay')), 'excerptLength' => $this->getParam('excerptLength'))));
         echo '</div>';
     }
 }
Ejemplo n.º 7
0
 public function beforeRender($options)
 {
     global $post;
     $this->posts = GummRegistry::get('Model', 'Post')->findRelated($post, (int) $this->getParam('postsNumber'));
     if (!$this->posts) {
         return false;
     }
     $visibleNum = $this->getParam('layout') === 'blog' ? (int) $this->getParam('rows') : (int) $this->getParam('columns');
     if (count($this->posts) > $visibleNum) {
         if ($this->getParam('layout') === 'blog') {
             $this->shouldPaginate = true;
             $this->htmlClass .= 'flex-slider';
             $this->htmlElementData = array('data-direction-nav-container' => '#' . $this->id() . '-nav-controls', 'data-animation' => $this->getParam('flexSliderAnimation'), 'data-animation-loop' => '1', 'data-smooth-height' => '1');
         } else {
             $this->shouldPaginate = true;
             $this->htmlClass .= ' gumm-layout-element-slider';
             $this->htmlElementData = array('data-directional-nav' => '.heading-pagination', 'data-num-visible' => (int) $this->getParam('columns'));
         }
     }
     $this->supports['title'] = __('Related', 'gummfw');
     $this->htmlClass .= ' bluebox-related-blog-posts';
     $this->metaFields = array_keys(Set::filter(Set::booleanize($this->getParam('metaFields'))));
 }
Ejemplo n.º 8
0
 protected function getDefaultSettingsForSlider($sliderType)
 {
     $settings = (array) $this->getParam('sliderType-settings.' . $sliderType);
     $settings = Set::booleanize($settings);
     return $settings;
 }
Ejemplo n.º 9
0
 /**
  * @param string $optionId
  * @param array $options
  * @return mixed False if option not set
  */
 public function find($optionId, $options = array())
 {
     $options = array_merge(array('booleanize' => false), $options);
     $optionId = $this->gummOptionId($optionId);
     if (strpos($optionId, '.') !== false) {
         $optionPath = explode('.', $optionId);
         $rootOptionId = array_shift($optionPath);
         $rootValue = get_option($rootOptionId);
         if ($rootValue) {
             $optionXPath = implode('/', $optionPath);
             $extractedValue = Set::extract('/Option/' . $optionXPath, array('Option' => $rootValue));
             $optionLastId = end($optionPath);
             $parsedValue = array();
             if ($extractedValue) {
                 foreach ($extractedValue as $val) {
                     if (is_array($val)) {
                         if (isset($val[$optionLastId])) {
                             $val = $val[$optionLastId];
                         }
                         $parsedValue = array_merge($parsedValue, $val);
                     } else {
                         // We are working with ids, so extract will match only one id, and if not array - we need the string returned
                         $parsedValue = $val;
                         break;
                     }
                 }
                 if ($options['booleanize']) {
                     $parsedValue = Set::booleanize($parsedValue);
                 }
                 if (is_array($parsedValue)) {
                     $parsedValue = Set::applyNative(Set::filter($parsedValue), 'stripslashes');
                 } elseif ($parsedValue !== false) {
                     $parsedValue = stripslashes($parsedValue);
                 }
                 return $parsedValue;
             }
         }
     }
     // if (strpos($optionId, '[') !== false) {
     //  if (preg_match_all("'(.*)(\[(.*)\])+'msU", $optionId, $out)) {
     //      $baseOptionId = $out[1][0];
     //      $baseValue = get_option($baseOptionId);
     //      if (is_array($baseValue)) {
     //          $innerVal = Set::extract('/Option/' . implode('/', $out[3]), array('Option' => $baseValue));
     //          if ($innerVal) return reset($innerVal);
     //      }
     //  }
     // }
     $value = get_option($optionId);
     if ($value === false) {
         $configOption = $this->getConfigOption($optionId);
         if (isset($configOption['default'])) {
             $value = $configOption['default'];
             if (isset($optionPath) && is_array($optionPath)) {
                 $optionLastId = end($optionPath);
                 if (isset($optionLastId) && $value && is_array($value) && isset($value[$optionLastId])) {
                     $value = $value[$optionLastId];
                 }
             }
         } elseif (isset($configOption['options'])) {
             $value = array();
             foreach ($configOption['options'] as $configSubOption) {
                 if (preg_match_all("'(.*)(\\[(.*)\\])+'msU", $configSubOption['id'], $out)) {
                     $valueKey = end($out[3]);
                     $value[$valueKey] = $this->find($configSubOption['id']);
                 }
             }
         }
     }
     if (is_array($value)) {
         $value = Set::applyNative(Set::filter($value), 'stripslashes');
     } elseif ($value !== false) {
         $value = stripslashes($value);
     }
     if ($optionId === GUMM_THEME_PREFIX . '_email' && !$value) {
         $value = get_option('admin_email');
     }
     if ($options['booleanize']) {
         $value = Set::booleanize($value);
     }
     return $value;
 }
 protected function queryPosts($args = array(), $params = array())
 {
     global $paged, $wp_query;
     if ($this->posts) {
         return $this->posts;
     }
     $postType = $this->supports('postType') ? $this->getParam('postType') : $this->queryPostType;
     if ($postType === 'default') {
         $this->posts = $wp_query->posts;
         return $this->posts;
     }
     if (!$paged && isset($wp_query->query) && isset($wp_query->query['paged'])) {
         $paged = $wp_query->query['paged'];
     }
     $this->resetQueryAfterRender = true;
     $this->_originalQuery = clone $wp_query;
     $posts = array();
     if ($postType === 'flickr') {
         App::uses('GummFlickr', '/Vendor/Flickr');
         $Flickr = new GummFlickr();
         $posts = $Flickr->findPhotos($this->getParam('flickrUser'), array('limit' => $this->getParam('postsNumber')));
         if ($posts) {
             $wp_query->posts = $posts;
             $wp_query->found_posts = count($posts);
             $wp_query->post_count = count($posts);
         }
     } else {
         $args = array_merge(array('post_type' => $postType, 'posts_per_page' => $this->getParam('postsNumber'), 'paged' => $paged ? $paged : 1), $args);
         $postType = $args['post_type'];
         $termIds = (array) $this->getParam($postType . '-category');
         $termIds = Set::filter(Set::booleanize($termIds));
         if ($termIds) {
             $termIds = array_keys($termIds);
         }
         if ($termIds) {
             $termName = $postType == 'post' ? 'category' : $postType . '_category';
             $args['tax_query'] = array(array('taxonomy' => $termName, 'field' => 'term_id', 'terms' => (array) $termIds));
         }
         if ($this->getParam('postOrder') === 'custom') {
             $args['orderby'] = $this->getParam('postOrderBy');
             $args['order'] = $this->getParam('postOrderDirection');
         } elseif ($postType === 'event') {
             $args['meta_key'] = GUMM_THEME_PREFIX . '_event_start_time';
             $args['orderby'] = GUMM_THEME_PREFIX . '_event_start_time';
             $args['order'] = 'ASC';
             $args['meta_query'] = array(array('key' => GUMM_THEME_PREFIX . '_event_start_time', 'value' => date_i18n('Y/m/d') . ' 00:00', 'compare' => '>='));
         }
         $args = $this->filterQueryPostsArgs($args);
         $posts = query_posts($args);
     }
     return $posts;
 }
Ejemplo n.º 11
0
 protected function queryPosts($instanceData = array())
 {
     if (!$this->supports('postType')) {
         return;
     }
     $this->resetQueryAfterRender = true;
     if ($this->posts) {
         return $this->posts;
     }
     $postType = GummHash::get($instanceData, 'post_type.post_type');
     if (!$postType) {
         $postType = $this->queryPostType;
     }
     $postsNumber = (int) GummHash::get($instanceData, 'post_type.posts_number');
     if (!$postsNumber) {
         $postsNumber = 4;
     }
     $args = array('post_type' => $postType, 'posts_per_page' => $postsNumber);
     $termIds = Set::filter(Set::booleanize(GummHash::get($instanceData, 'post_type.' . $postType . '-category')));
     if ($termIds) {
         $termIds = array_keys($termIds);
     }
     if ($termIds) {
         $termName = $postType == 'post' ? 'category' : $postType . '_category';
         $args['tax_query'] = array(array('taxonomy' => $termName, 'field' => 'term_id', 'terms' => (array) $termIds));
     }
     $this->posts = query_posts($args);
     return $this->posts;
 }
Ejemplo n.º 12
0
 private function getEventCategories()
 {
     $eventCatIds = false;
     $eventCats = Set::booleanize($this->getParam('event-category'));
     if ($eventCats) {
         if ($eventCats = Set::filter($eventCats)) {
             $eventCatIds = array_keys($eventCats);
         }
     }
     return $eventCatIds;
 }
Ejemplo n.º 13
0
 public function getThemeOptionForPost($post)
 {
     $postType = $post->post_type === 'post' ? 'blog' : $post->post_type;
     if (!isset($this->_postTypesOptions[$postType])) {
         $options = $this->Option->find($postType);
         if (!$options) {
             $options = array();
         }
         $optionId = $this->gummOptionId($postType);
         $configOptions = $this->Option->getConfigOption($optionId);
         if ($configOptions && is_array($configOptions) && isset($configOptions['default'])) {
             $options = Set::merge($configOptions['default'], $options);
             $options = Set::booleanize($options);
         }
         $this->_postTypesOptions[$postType] = $options;
     }
     return $this->_postTypesOptions[$postType];
 }
Ejemplo n.º 14
0
 /**
  * @param mixed $data
  */
 public static function booleanize($data)
 {
     if (is_array($data)) {
         $result = array();
         foreach ($data as $k => $val) {
             if (is_string($val)) {
                 if ($val == 'true') {
                     $val = true;
                 } elseif ($val == 'false') {
                     $val = false;
                 }
             } elseif (is_array($val)) {
                 $val = Set::booleanize($val);
             }
             $result[$k] = $val;
         }
     } else {
         $result = $data;
         if ($result == 'true') {
             $result = true;
         } elseif ($result == 'false') {
             $result = false;
         }
     }
     return $result;
 }