Пример #1
0
 public function getColumn($column)
 {
     global $post;
     switch ($column) {
         case 'category':
             echo get_the_term_list($post->ID, $post->post_type . '_category', '', ', ', '');
             break;
         case 'thumbnail':
             if ($post->Thumbnail) {
                 echo GummRegistry::get('Helper', 'Media')->display($post->Thumbnail->guid, array('width' => 70, 'height' => 70));
             }
             break;
         case 'gallery_album':
             echo get_the_term_list($post->ID, 'gallery_album', '', ', ', '');
             break;
         case 'portfolio_cats':
             echo get_the_term_list($post->ID, 'portfolio_cat', '', ', ', '');
             break;
         case $post->post_type . '_author':
             $author = isset($post->PostMeta['author']) ? $post->PostMeta['author'] : '';
             $organisation = isset($post->PostMeta['organisation']) ? $post->PostMeta['organisation'] : '';
             echo '<span class="testimonial_author_name">' . $author . '</span>';
             if ($organisation) {
                 echo ' - <span class="testimonial_author_occupation">' . $organisation . '</span>';
             }
             break;
         case $post->post_type . '_excerpt':
             edit_post_link(GummRegistry::get('Helper', 'Text')->truncate(get_the_excerpt(), 100, array('exact' => false)));
             break;
     }
 }
Пример #2
0
 public function display($options = array())
 {
     $options = array_merge(array('separator' => ' / '), $options);
     $crumbs = array();
     $path = array();
     $post = GummRegistry::get('Model', 'Post')->getQueriedObject();
     if (is_page() && $post->ID != $this->Wp->getFrontPageId()) {
         $path = $this->getPathFromNavMenu($post->ID);
         if (!$path) {
             $path = $this->getPathFromAncestors($post);
         }
     } elseif ($post && is_home()) {
         $path[] = $this->getNode($post, 'page');
     } elseif (is_single()) {
         $postCategories = $this->Wp->getPostCategories($post);
         $counter = 1;
         foreach ($postCategories as $catId => $postCategory) {
             if ($counter > 4) {
                 break;
             }
             $path[] = array('id' => $catId, 'title' => $postCategory, 'url' => $this->Wp->getPostCategoryLink($post, $catId));
             $counter++;
         }
         $path[] = $this->getNode($post, 'page');
     } elseif (is_search()) {
         $path[] = array('id' => null, 'title' => __('Search', 'gummfw'), 'url' => null);
     }
     array_unshift($path, array('id' => $this->Wp->getFrontPageId(), 'title' => __('Home', 'gummfw'), 'url' => home_url()));
     $path = apply_filters('gumm_breadcrumb_path', $path);
     foreach ($path as $item) {
         $crumbs[] = $this->crumb($item);
     }
     return implode($options['separator'], $crumbs);
 }
Пример #3
0
 /**
  * @return object
  */
 public static function get($type, $name)
 {
     $name = Inflector::camelize($name);
     $registry = GummRegistry::getRegistry();
     $regKey = $type . '_' . $name;
     if (isset($registry[$regKey])) {
         return $registry[$regKey];
     }
     App::import($type, $name);
     $objName = false;
     switch (strtolower($type)) {
         case 'model':
             $objName = $name . 'Model';
             break;
         case 'controller':
             $objName = $name . 'Controller';
             break;
         case 'helper':
             $objName = $name . 'Helper';
             break;
         case 'widget':
             $objName = $name;
             break;
         case 'component':
             $objName = $name . 'Component';
             break;
         case 'editor':
             $objName = $name . 'Editor';
             break;
     }
     $obj = new $objName();
     GummRegistry::updateRegistry($regKey, $obj);
     return $obj;
 }
 public function get_styles_structure()
 {
     $this->autoRender = false;
     if (!$this->RequestHandler->isAjax()) {
         return;
     }
     echo json_encode(GummRegistry::get('Helper', 'Html')->getStylesStructureForLayout());
     die;
 }
 public function __construct(array $settings)
 {
     parent::__construct();
     $this->Wp = GummRegistry::get('Helper', 'Wp');
     if (!isset($settings['path'])) {
         trigger_error(__('Cannot intialize external plugin without supplying path', 'gummfw'));
     }
     if ($this->Wp->isPluginActive($settings['path'])) {
         $this->initialize();
     }
 }
Пример #6
0
 public function __construct()
 {
     parent::__construct();
     if (!$this->name) {
         $this->name = str_replace('Helper', '', get_class($this));
     }
     if (isset($this->data['_mergeonsave']) && (int) $this->data['_mergeonsave'] === 0) {
         $this->mergeOnSave = false;
     }
     foreach ($this->helpers as $helper) {
         $this->{$helper} = GummRegistry::get('Helper', $helper);
     }
     GummRegistry::updateRegistry('Helper_' . $this->name, $this);
 }
Пример #7
0
 public function __construct()
 {
     $this->options['classname'] = Inflector::slug(Inflector::underscore(get_class($this)), '-');
     $this->WP_Widget($this->options['classname'], GUMM_THEME . ' ' . $this->customName, $this->options);
     foreach ($this->helpers as $helper) {
         $helper = Inflector::camelize($helper);
         $this->{$helper} = GummRegistry::get('Helper', $helper);
     }
     if ($fields = $this->_fields()) {
         foreach ($fields as $k => $v) {
             $val = isset($v['value']) ? $v['value'] : null;
             $this->fields[$k] = $val;
         }
     }
 }
Пример #8
0
 public function __construct()
 {
     parent::__construct();
     $thisclassVars = get_class_vars(get_class($this));
     $selfClassVars = get_class_vars('Controller');
     $this->name = $this->getName();
     if (isset($thisClassVars['helpers'])) {
         $this->helpers = array_merge($selfClassVars['helpers'], $thisClassVars['helpers']);
     }
     foreach ($this->components as $component) {
         $this->{$component} = GummRegistry::get('Component', $component);
     }
     foreach ($this->uses as $model) {
         $this->{$model} = GummRegistry::get('Model', $model);
     }
 }
Пример #9
0
 /**
  * @param int $optionId
  * @return string
  */
 public function getNewBlockLayerId($optionId)
 {
     $gummWpHelper = GummRegistry::get('Helper', 'Wp');
     $newBlockLayerId = sprintf($this->_layerIdSchema, $this->_layerBlockDepth);
     $blockData = $gummWpHelper->getOption($optionId);
     if ($blockData && is_array($blockData)) {
         for ($i = $this->_layerBlockDepth; $i >= 1; $i--) {
             $currLayerId = sprintf($this->_layerIdSchema, $i);
             if (!isset($blockData[$currLayerId])) {
                 $newBlockLayerId = $currLayerId;
                 break;
             }
         }
     }
     return $newBlockLayerId;
 }
Пример #10
0
 public function getExcerptLengthForLayout($layoutSchema)
 {
     $layout = GummRegistry::get('Model', 'Layout')->findSchemaForLayout();
     $sidebarsNumber = count($layout['sidebars']);
     $length = null;
     switch ($sidebarsNumber) {
         case 0:
             $length = Configure::read('excerptLengthMap.noSidebars.' . $layoutSchema);
             break;
         case 1:
             $length = Configure::read('excerptLengthMap.oneSidebar.' . $layoutSchema);
             break;
         case 2:
             $length = Configure::read('excerptLengthMap.twoSidebars.' . $layoutSchema);
             break;
     }
     return $length;
 }
 public function parseTweets($tweets)
 {
     $result = array();
     if ($tweets) {
         foreach ($tweets as $tweet) {
             $text = $tweet->text;
             $text = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" >\\2</a>", $text);
             $text = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" >\\2</a>", $text);
             $text = preg_replace("/@(\\w+)/", "<a href=\"http://www.twitter.com/\\1\" class=\"twitter-atreply pretty-link\" >@\\1</a>", $text);
             $text = preg_replace("/#(\\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" >#\\1</a>", $text);
             // return $ret;
             // if ($replyTo = $tweet['in_reply_to_screen_name']) {
             //     $replyToLink = '<a href="https://twitter.com/' . $replyTo . '" class="twitter-atreply pretty-link"><s>@</s><strong>' . $replyTo . '</strong></a>';
             //     $text = str_replace('@' . $replyTo, $replyToLink, $text);
             // }
             $time = GummRegistry::get('Helper', 'Time')->timeAgoInWords($tweet->created_at);
             $result[] = array('text' => $text, 'time' => $time, 'user' => $tweet->user);
         }
     }
     return $result;
 }
Пример #12
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'))));
 }
Пример #13
0
 public function element($name, $params = array(), $output = true)
 {
     if (!$this->controller) {
         $this->controller = GummRegistry::get('Controller', 'Posts');
         foreach ($this->controller->helpers as $helperName) {
             $this->{$helperName} = GummRegistry::get('Helper', $helperName);
         }
     }
     $this->__passedArgs = $params;
     $name = explode('/', $name);
     $name = implode(DS, $name);
     $form = GummRegistry::get('Helper', 'Form');
     $gummWpHelper = GummRegistry::get('Helper', 'Wp');
     $gummMediaHelper = GummRegistry::get('Helper', 'Media');
     $gummHtmlHelper = GummRegistry::get('Helper', 'Html');
     $gummTextHelper = GummRegistry::get('Helper', 'Text');
     extract($params, EXTR_SKIP);
     ob_start();
     include GUMM_ELEMENTS . $name . '.gtp';
     $contentHtml = ob_get_clean();
     $this->assign('content', $contentHtml);
     if ($this->__parents) {
         ob_start();
         $this->__assignOverwrite = false;
         foreach ($this->__parents as $parentViewFile) {
             include $parentViewFile;
         }
         $outputHtml = ob_get_clean();
         // d($outputHtml);
     } else {
         $outputHtml = $contentHtml;
     }
     // $outputHtml = ob_get_clean();
     if (!$output) {
         return $outputHtml;
     } else {
         echo $outputHtml;
     }
 }
Пример #14
0
    public function printFooterScriptData()
    {
        if (!$this->scriptData) {
            return true;
        }
        $isAjax = GummRegistry::get('Component', 'RequestHandler')->isAjax();
        ?>
        <script type="text/javascript">
<?php 
        if (isset($this->scriptData[1])) {
            ?>
        (function( $ ){
<?php 
            if (!$isAjax) {
                ?>
        $(window).load(function(){
<?php 
            }
            foreach ($this->scriptData[1] as $scriptBlock) {
                echo $scriptBlock;
            }
            if (!$isAjax) {
                ?>
        });
<?php 
            }
            ?>
        })( jQuery );
<?php 
        }
        ?>
        </script>
<?php 
        return true;
    }
Пример #15
0
    private function _renderLayoutGaugeWithText($options)
    {
        $iconLinkAtts = array_merge($this->_defaultLinkAtts(), array('class' => 'bb-gauge-icon-container'));
        ?>
        <h4 class="head-link">
            <a<?php 
        echo $this->Html->_constructTagAttributes($this->_defaultLinkAtts());
        ?>
><?php 
        echo $this->getParam('headingText');
        ?>
<span class="icon-chevron-right"></span></a>
        </h4>
        <div class="bluebox-clear"></div>
        <a<?php 
        echo $this->Html->_constructTagAttributes($iconLinkAtts);
        ?>
>
        <?php 
        $icon = $this->getParam('gaugeIcon');
        echo GummRegistry::get('Helper', 'Layout')->gaugeChart(array('size' => $this->getParam('gaugeSize'), 'percent' => $this->getParam('gaugePercent'), 'backgroundColor' => '#fafafa', 'strokeWidth' => $this->getParam('gaugeStroke'), 'icon' => $icon, 'iconStyle' => $this->getGaugeIconStyle(), 'fontSize' => $this->getParam('gaugeIconSize')));
        ?>
        </a>
        <?php 
        echo wpautop(do_shortcode($this->getParam('content')));
        echo $this->_renderReadMoreLink();
    }
Пример #16
0
 public function __construct()
 {
     $this->phpFlickr = new phpFlickr(self::API_KEY);
     $this->wpHelper = GummRegistry::get('Helper', 'Wp');
 }
Пример #17
0
    protected function _render($options)
    {
        $mediaIds = array();
        foreach ($this->slides as $slideId => $slide) {
            if (isset($slide['media']) && $slide['media']) {
                $mediaIds[] = $slide['media'][0];
                $this->slides[$slideId]['media'] = $slide['media'][0];
            } else {
                $this->slides[$slideId]['media'] = false;
            }
        }
        $images = GummRegistry::get('Model', 'Post')->findAttachmentPosts(array_unique($mediaIds));
        foreach ($this->slides as $slideId => $slide) {
            foreach ($images as $image) {
                if ($image->ID == $slide['media']) {
                    $this->slides[$slideId]['media'] = $image;
                    break;
                }
            }
        }
        foreach ($this->slides as $slideId => $slide) {
            if (!$slide['media']) {
                unset($this->slides[$slideId]);
            }
        }
        $rowSpan = 12 * $this->widthRatio();
        $divWrapperAtts = array('class' => 'iosSliderContainer bluebox-slider-wrap', 'style' => 'padding-bottom:' . 1 / $this->getParam('aspectRatio') * 100 . '%;');
        switch ($this->getParam('layout')) {
            case 'bottomnav':
                $divWrapperAtts['class'] .= ' nova-slider-bottom-nav';
                break;
            case 'righttabs':
                $divWrapperAtts['class'] .= ' nova-right-tabs-slider';
                break;
            case 'leftdetails':
                $divWrapperAtts['class'] .= ' nova-slider-four';
                break;
        }
        $divSliderAtts = array('class' => 'iosSlider loading');
        if ($sliderAutoPlay = $this->getParam('autoplay')) {
            if ($sliderAutoPlay > 0) {
                $divSliderAtts['data-auto-slide'] = 'true';
                $divSliderAtts['data-auto-slide-timer'] = $sliderAutoPlay * 1000;
            }
        }
        ?>
        <!-- BEGIN slider area -->
        <div<?php 
        echo $this->Html->_constructTagAttributes($divWrapperAtts);
        ?>
>
            <div<?php 
        echo $this->Html->_constructTagAttributes($divSliderAtts);
        ?>
>
                <div class="slider">
                <?php 
        foreach ($this->slides as $slide) {
            if ($slide['media'] && !is_string($slide['media'])) {
                echo $this->Media->display($slide['media']->guid, array('ar' => $this->getParam('aspectRatio'), 'context' => 'wrap'), array('alt' => $slide['media']->post_title, 'class' => 'swipe-item'));
            }
        }
        ?>
                </div>
                <?php 
        switch ($this->getParam('layout')) {
            case 'rightdetails':
                $this->_renderRightDetails();
                break;
            case 'leftdetails':
                $this->_renderLeftDetails();
                break;
            case 'bottomnav':
                $this->_renderBottomNav();
                break;
            case 'righttabs':
                $this->_renderRightTabs();
                break;
        }
        ?>
            </div>
            
        
            <div class="bluebox-slider-top-detail"></div>
            <div class="bluebox-slider-bottom-detail"></div>
        </div>
        <!-- END slider area -->
<?php 
    }
Пример #18
0
 public function getPageIdForPostType($postType)
 {
     return GummRegistry::get('Model', 'Layout')->getPageIdForPostType($postType);
 }
Пример #19
0
 /**
  * @param int $w
  * @param int $h
  * @param string $context
  * @return array
  */
 public function getMediaDimensionsForClientResolution($w, $h, $context = null)
 {
     $dimensions = array('width' => $w, 'height' => $h);
     $maxWidth = $this->getClientResolution();
     // $maxWidth = 768;
     if ($resolutionBreakPoints = Configure::read('imageResolutionsBreakPoints')) {
         rsort($resolutionBreakPoints);
         $identifier = reset($resolutionBreakPoints);
         foreach ($resolutionBreakPoints as $breakPoint) {
             // filter down
             if ($maxWidth <= $breakPoint) {
                 $identifier = $breakPoint;
             }
         }
         $percent = Configure::read('imageSizeResolutionMap.' . $identifier);
         if ($context && Configure::read('imageSizeResolutionMap.' . $context . '.' . $identifier)) {
             $percent = Configure::read('imageSizeResolutionMap.' . $context . '.' . $identifier);
         }
         $dimensions = array('width' => ceil($w * $percent) * $this->getClientPixelRatio(), 'height' => ceil($h * $percent) * $this->getClientPixelRatio());
     }
     // If less than 768 -> no sidebars rendered anwyay eh?
     if ($identifier > 768) {
         $sidebarsNum = GummRegistry::get('Helper', 'Layout')->numSidebars();
         $sidebarsMap = Configure::read('imageSidebarsResolutionMap');
         if ($sidebarsPercent = Configure::read('imageSidebarsResolutionMap.' . $sidebarsNum)) {
             $dimensions['width'] *= $sidebarsPercent;
             $dimensions['height'] *= $sidebarsPercent;
         }
     }
     $dimensions['width'] = ceil($dimensions['width']);
     $dimensions['height'] = ceil($dimensions['height']);
     return $dimensions;
 }
Пример #20
0
        } else {
            the_content();
        }
        ?>
        
    <?php 
    }
    ?>

    <?php 
    // if (comments_open()) {
    //     echo '<div class="bluebox-builder-row"><div class="row-fluid bluebox-container">';
    //     comments_template('', true);
    //     echo '</div></div>';
    // }
    if ($pageLinks = GummRegistry::get('Helper', 'Pagination')->wpLinkPages()) {
        echo '<div class="bluebox-builder-row"><div class="row-fluid bluebox-container">';
        echo $pageLinks;
        echo '</div></div>';
    }
    ?>
    
<?php 
} else {
    ?>
    <div class="msg error">
        <p><?php 
    _e('No posts were found', 'gummfw');
    ?>
</p>
    </div>
Пример #21
0
 private function sanitize($params)
 {
     if (!isset($params['to'])) {
         $mailTo = GummRegistry::get('Helper', 'Wp')->getOption('email');
         $params['to'] = $mailTo ? $mailTo : get_option('admin_email');
     }
     foreach ($params as &$param) {
         wp_filter_nohtml_kses(trim($param));
     }
     $this->params = array_merge($this->params, $params);
 }
 public function admin_import_sample_page()
 {
     $pages = GummRegistry::get('Component', 'Importer')->getSamplePages();
     $formError = false;
     $successMessage = false;
     $id = false;
     if ($this->data && isset($this->data['urlToImport']) && $this->data['urlToImport']) {
         $url = $this->data['urlToImport'];
         $query = array('gummcontroller' => 'layouts', 'action' => 'get_sample_page_data');
         $query = http_build_query($query, 'PHP_QUERY_RFC1738');
         $rpcUrl = strpos($url, '?') === false ? $url . '?' . $query : $url . '&' . $query;
         $_pages = false;
         $rpcResult = false;
         $res = wp_remote_get($rpcUrl, array('timeout' => 120));
         if (is_wp_error($res)) {
             $formError = __('Errors: ', 'gummfw') . ' ' . implode('. ', Set::flatten($res->errors));
             $formError .= '. ' . __('Please check with your hosting provider if your server can connect to the specified URL.', 'gummfw');
         } else {
             if ($res['response']['code'] === 200) {
                 $rpcResult = json_decode($res['body'], true);
                 if ($rpcResult && isset($rpcResult['name'])) {
                     $_pages = GummRegistry::get('Component', 'Importer')->importSamplePage($rpcResult);
                 }
                 if ($_pages) {
                     $pages = $_pages;
                     $successMessage = __('Page imported successfully.', 'gummfw');
                 } else {
                     $formError = __('There was an error importing the page. Please make sure it is part of the demo site and is not a single post page.', 'gummfw');
                 }
             } else {
                 $formError = __('Page to import not found. Error code 404.', 'gummfw');
             }
         }
     } elseif ($this->data && isset($this->data['takeAction']) && $this->data['takeAction'] === 'removeAll') {
         if (GummRegistry::get('Component', 'Importer')->deleteSamplePages()) {
             $successMessage = __('Pages successfully deleted.', 'gummfw');
             $pages = array();
         } else {
             $formError = __('Could not delete pages. Please try again.', 'gummfw');
         }
     } elseif ($this->data) {
         $formError = __('Invalid url', 'gummfw');
     }
     $this->set(compact('formError', 'successMessage', 'pages'));
 }
Пример #23
0
 private function getSidebarElements()
 {
     $sidebars = GummRegistry::get('Model', 'Sidebar')->find('all', array('conditions' => array('id !=' => array('gumm-footer-sidebar-1', 'gumm-footer-sidebar-2', 'gumm-footer-sidebar-3', 'gumm-footer-sidebar-4'))));
     $elements = array();
     foreach ($sidebars as $sidebar) {
         $elements[] = $this->requestAction(array('admin' => true, 'controller' => 'sidebars', 'action' => 'view', $sidebar), false);
     }
     $elements[] = '<li class="new-sidebar icon-plus"></li>';
     return $elements;
 }
Пример #24
0
 /**
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->RequestHandler = GummRegistry::get('Component', 'RequestHandler');
 }
 public function __construct()
 {
     parent::__construct();
     $this->Wp = GummRegistry::get('Helper', 'Wp');
 }
Пример #26
0
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-T5RRF2');</script>
<!-- End Google Tag Manager -->

    <script type="text/javascript">
        if ( top !== self && document.referrer.indexOf('themeforest.net') > 0) {
            document.body.style.display = "none";
            top.location.replace( 'http://demo.antonibotev.com/theme/nova' )
        };
    </script>

    <?php 
$divHeaderAtts = array('class' => array('row-fluid', 'bluebox-header'));
$post = GummRegistry::get('Model', 'Post')->getQueriedObject();
if (is_a($post, 'WP_Post') && isset($post->PostMeta['header_settings']) && $post->PostMeta['header_settings'] === 'custom') {
    $headerLayout = $post->PostMeta['header_layout'];
    $headerMenuStyle = $post->PostMeta['header_menu_style'];
    $dropDownStyle = $post->PostMeta['main_menu_dropdown_style'];
} else {
    $headerLayout = $gummWpHelper->getOption('header_layout');
    $headerMenuStyle = $gummWpHelper->getOption('header_menu_style');
    $dropDownStyle = $gummWpHelper->getOption('main_menu_dropdown_style');
}
$divHeaderAtts['class'][] = 'nav-style-' . $headerMenuStyle;
$divHeaderAtts['class'][] = 'type-' . $headerLayout;
if ($dropDownStyle === 'dark') {
    $divHeaderAtts['class'][] = 'dark-dropdown';
}
?>
Пример #27
0
 function gummBeforeRender()
 {
     $LayoutModel = GummRegistry::get('Model', 'Layout');
     // if (isset($_GET['gummpreview']['layout'])) {
     //     $LayoutModel->setSchemaStringForLayout($_GET['gummpreview']['layout']);
     // }
     // if (isset($_GET['gummpreview']['layout_type'])) {
     //     $LayoutModel->setLayoutType($_GET['gummpreview']['layout_type'], $LayoutModel->getCurrentLayoutPage() . '-loop');
     // }
 }
Пример #28
0
 public function getSamplePages()
 {
     $result = array();
     if ($ids = $this->getSamplePagesData()) {
         $result = GummRegistry::get('Model', 'Post')->find('all', array('conditions' => array('id' => $ids, 'postType' => 'page')));
     }
     return $result;
 }
Пример #29
0
function gummPartnerLink_($url, $post, $leavename, $sample)
{
    if ('partner' == get_post_type($post)) {
        if (!($url = GummRegistry::get('Helper', 'Wp')->getPostMeta($post->ID, 'postmeta.url'))) {
            $url = '#';
        } else {
            $url = GummRegistry::get('Helper', 'Html')->url($url);
        }
    }
    return $url;
}
 protected function getMediaItems()
 {
     if (!$this->mediaItems) {
         $media = array();
         if (!($mediaSource = $this->getParam('mediaSource'))) {
             return $media;
         }
         switch ($mediaSource) {
             case 'post':
                 $posts = $this->queryPosts();
                 foreach ($posts as $post) {
                     if ($post->Thumbnail) {
                         $post->Thumbnail->post_parent = $post->ID;
                         $media[] = $post->Thumbnail;
                     }
                 }
                 break;
             case 'custom':
             case 'media':
                 $media = GummRegistry::get('Model', 'Post')->findAttachmentPosts($this->getParam('media'));
                 break;
         }
         $this->mediaItems = $media;
     }
     return $this->mediaItems;
 }