示例#1
0
 function thb_contact_map($params = array())
 {
     $latlong = thb_get_option('contact_lat_long');
     $zoom = thb_get_option("contact_zoom");
     $marker = thb_get_option("contact_marker");
     $map_config = array('height' => '500');
     $map_config = thb_array_asum($map_config, $params);
     if ($latlong != '') {
         echo thb_do_shortcode("[thb_map latlong='{$latlong}' zoom='{$zoom}' " . thb_get_attributes($map_config) . " marker='{$marker}']");
     }
 }
示例#2
0
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
if (!function_exists('is_woocommerce')) {
    return;
}
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('disable_core_skin' => false);
$thb_theme->setConfig('core/woocommerce', thb_array_asum($thb_config, $config));
/**
 * Theme customizations
 * -----------------------------------------------------------------------------
 */
if (file_exists(THB_TEMPLATE_DIR . '/woocommerce/theme-woocommerce.php')) {
    include THB_TEMPLATE_DIR . '/woocommerce/theme-woocommerce.php';
}
add_theme_support('woocommerce');
// Disable WooCommerce styles
if (thb_config('core/woocommerce', 'disable_core_skin')) {
    add_filter('woocommerce_enqueue_styles', '__return_empty_array');
}
/**
 * Woocommerce product page sidebar
 * -----------------------------------------------------------------------------
示例#3
0
/**
 * Display a single portfolio items within the portfolio loop.
 *
 * @param array $params The portfolio item parameters.
 * @return void
 */
function thb_portfolio_item($params = array())
{
    $params = thb_array_asum(array('portfolio_item_template' => 'portfolio-item'), $params);
    thb_portfolio_get_template_part($params['portfolio_item_template'], $params);
}
示例#4
0
/**
 * Including the Slideshow class that's entitled to grab a collection of slides.
 */
include dirname(__FILE__) . '/lib.php';
/**
 * Including the file with the means to the creation of a Slideshow custom post
 * type. Also in this file, are the functions that allow for the creation of
 * a Slideshow metabox in selected templates, and the relative shortcode.
 */
include dirname(__FILE__) . '/posttype.php';
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('post_type' => false, 'submodules' => array(), 'templates' => array(), 'types' => array());
$thb_theme->setConfig('core/slideshows', thb_array_asum($thb_config, $config));
/**
 * Submodules
 * -----------------------------------------------------------------------------
 */
if (!empty($config['submodules'])) {
    foreach ($config['submodules'] as $submodule => $submodule_config) {
        $thb_theme->loadModule('core/slideshows/submodules/' . $submodule, $submodule_config);
    }
}
/**
 * Module bootstrap
 * -----------------------------------------------------------------------------
 */
if (!function_exists('thb_slideshows_boot')) {
    /**
示例#5
0
 function thb_post_format_video($config = array())
 {
     $config = thb_array_asum(array(), $config);
     $video_url = thb_get_post_format_video_url();
     if (!empty($video_url)) {
         echo do_shortcode('[thb_video url="' . $video_url . '"]');
     }
 }
示例#6
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\Core\Sidebars
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('options' => true, 'duplicable' => true, 'templates' => array('default'));
$thb_theme->setConfig('core/sidebars', thb_array_asum($thb_config, $config));
/**
 * Load custom post type operations
 * -----------------------------------------------------------------------------
 */
include dirname(__FILE__) . '/posttype.php';
/**
 * Custom body classes
 * -----------------------------------------------------------------------------
 */
if (!function_exists('sidebars_body_classes')) {
    function sidebars_body_classes($classes)
    {
        $entry_id = thb_get_page_ID();
        if ($entry_id != 0) {
            $is_sidebar_page = in_array(thb_get_page_template($entry_id), thb_config('core/sidebars', 'templates')) || is_single();
示例#7
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\Core\Photogallery
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('templates' => array(), 'image_sizes' => array(), 'image_size' => 'large', 'grid_templates_columns_label' => __('Gallery columns', 'thb_text_domain'), 'grid_templates_columns' => array('2' => '2', '3' => '3', '4' => '4'), 'item_thumb_rel' => '');
$thb_theme->setConfig('core/photogallery', thb_array_asum($thb_config, $config));
/**
 * Photogallery metabox
 * -----------------------------------------------------------------------------
 */
if (!function_exists('thb_photogallery_container')) {
    function thb_photogallery_container()
    {
        $thb_theme = thb_theme();
        $thb_photogallery_page_template = thb_config('core/photogallery', 'templates');
        if (thb_is_admin_template($thb_photogallery_page_template)) {
            $thb_metabox = new THB_Metabox(__('Gallery', 'thb_text_domain'), 'slideshow');
            $thb_container = $thb_metabox->createContainer(__('Configuration', 'thb_text_domain'), 'photogallery_masonry_details_container');
            $thb_field = new THB_NumberField('slides_per_page');
            $thb_field->setLabel(__('Pictures per page', 'thb_text_domain'));
            // $thb_field->setHelp( __('In case of AJAX loading, chose how many pictures to display.', 'thb_text_domain') );
 function thb_pagination($config = array())
 {
     $show_pagination = true;
     $base_config = array('type' => 'numbers', 'class' => '', 'id' => '', 'previousText' => is_single() ? '%link' : __('Previous', 'thb_text_domain'), 'nextText' => is_single() ? '%link' : __('Next', 'thb_text_domain'), 'previousPostTitle' => '', 'nextPostTitle' => '', 'arrowPreviousText' => '', 'arrowNextText' => '', 'alwaysShowLinks' => false);
     $base_config = thb_array_asum($base_config, $config);
     $base_config['previousText'] = $base_config['arrowPreviousText'] . $base_config['previousText'];
     $base_config['nextText'] = $base_config['nextText'] . $base_config['arrowNextText'];
     if ($base_config['type'] == 'numbers') {
         global $wp_query;
         $show_pagination = $wp_query->max_num_pages > 1;
     } else {
         if (is_single()) {
             $show_pagination = thb_post_has_previous() || thb_post_has_next();
         } else {
             $show_pagination = thb_page_has_previous() || thb_page_has_next();
         }
     }
     if (!$show_pagination) {
         return;
     }
     $pagination_template = new THB_TemplateLoader('frontend/components/pagination', $base_config);
     $pagination_template->render();
 }
示例#9
0
 function thb_portfolio_item($params = array())
 {
     $default = array('portfolio_item_template' => 'portfolio-item');
     $params = thb_array_asum($default, $params);
     thb_get_module_template_part('core/portfolio', $params['portfolio_item_template'], $params);
 }
示例#10
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\Core\Layout
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('options' => true, 'options_logo_position' => array('logo-left' => __('Left', 'thb_text_domain'), 'logo-center' => __('Center', 'thb_text_domain'), 'logo-right' => __('Right', 'thb_text_domain')), 'meta_options' => true, 'meta_options_subtitle' => true, 'meta_options_pageheader_disable' => true, 'meta_options_page_boxed' => true, 'meta_options_gutter' => true, 'meta_options_gutter_default' => true);
$thb_theme->setConfig('core/layout', thb_array_asum($thb_config, $config));
/**
 * Options tab
 * -----------------------------------------------------------------------------
 */
$thb_page = $thb_theme->getAdmin()->getMainPage();
$thb_tab = new THB_Tab(__('Layout', 'thb_text_domain'), 'layout');
/**
 * Header
 */
$thb_container = $thb_tab->createContainer(__('Header', 'thb_text_domain'), 'layout_options_header');
if (thb_config('core/layout', 'options_logo_position') !== false) {
    $thb_field = new THB_SelectField('logo_position');
    $thb_field->setLabel(__('Logo position', 'thb_text_domain'));
    $thb_field->setOptions(thb_config('core/layout', 'options_logo_position'));
    $thb_container->addField($thb_field);
示例#11
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\FooterStripe
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('templates' => array('default'));
$thb_theme->setConfig('footerstripe', thb_array_asum($thb_config, $config));
/**
 * Including the file with the means to the creation of a Footer Stripe custom post
 * type.
 */
include dirname(__FILE__) . '/posttype.php';
thb_create_footerstripes_posttype();
/**
 * Metabox
 */
if (!function_exists('thb_add_footerstripe_metabox')) {
    function thb_add_footerstripe_metabox()
    {
        if (thb_is_admin_template(thb_config('footerstripe', 'templates'))) {
            $thb_metabox = thb_theme()->getPostType('page')->getMetabox('layout');
            $thb_container = $thb_metabox->createContainer(__('Footer stripe', 'thb_text_domain'), 'footerstripe_container');
示例#12
0
 /**
  * Create the duplicable fields container for image and video slides.
  *
  * @param string $label The fields container label.
  * @return THB_MetaboxDuplicableFieldsContainer
  */
 function thb_create_slideshows_slides_container($label = '', $config = array())
 {
     $config = thb_array_asum(array('slug' => 'slides_container', 'slides_key' => THB_SLIDES, 'captions' => true, 'images' => true, 'videos' => true), $config);
     extract($config);
     $thb_container = new THB_MetaboxDuplicableFieldsContainer($label, $slug);
     $thb_container->setSortable();
     if ($images) {
         $thb_container->addControl(__('Add images', 'thb_text_domain'), 'add_image', 'images.png', array('action' => 'thb_add_multiple_slides', 'title' => __('Add image slides', 'thb_text_domain')));
     }
     if ($videos) {
         $thb_container->addControl(__('Add video', 'thb_text_domain'), 'add_video', 'film.png');
     }
     $field = new THB_SlideField($slides_key);
     $field->setLabel(__('Slide', 'thb_text_domain'));
     if (!$captions) {
         $field->disableCaptions();
     }
     $thb_container->setField($field);
     return $thb_container;
 }
示例#13
0
 function thb_post_query($override = array())
 {
     global $wp_query;
     $post_type = 'post';
     $args = thb_post_type_query_args($post_type);
     $args = thb_array_asum($args, $override);
     thb_query_posts($post_type, $args);
 }
 /**
  * Add a stylesheet to the admin interface.
  *
  * @param string $name The stylesheet registered name.
  * @param array $options The (template,compress) options of the style.
  * @return void
  **/
 public function addStyle($path, $options = array())
 {
     if (empty($path)) {
         wp_die('Empty stylesheet path.');
     }
     if (!is_array($options)) {
         wp_die('Styles options are not in array form.');
     }
     $styleDefaults = array('compress' => false, 'templates' => array(), 'name' => '', 'deps' => array(), 'media' => 'all');
     extract(thb_array_asum($styleDefaults, $options));
     if (in_array($name, $deps)) {
         unset($deps[array_search($name, $deps)]);
     }
     global $wp_customize;
     if (isset($wp_customize)) {
         $compressed = 'not_compressed';
     } else {
         $compressed = $compress ? 'compressed' : 'not_compressed';
     }
     $this->_styles[$compressed][] = array('name' => $name, 'path' => $path, 'templates' => (array) $templates, 'media' => $media, 'deps' => $deps);
 }
 /**
  * Retrieve the collection items from a specific post type.
  *
  * @return void
  */
 protected function retrievePostSlides()
 {
     $args = thb_post_type_query_args('slideshows', $this->_id);
     /**
      * Default arguments
      */
     $defaultArgs = array('paged' => 1, 'meta_key' => '_thumbnail_id', 'post_type' => $this->_type, 'posts_per_page' => '-1');
     $args = thb_array_asum($defaultArgs, $args);
     foreach (get_posts($args) as $item) {
         $thumb_id = get_post_thumbnail_id($item->ID);
         $this->_slides[] = array('post_id' => $item->ID, 'id' => $thumb_id, 'url' => thb_image_get_size($thumb_id, $this->_size), 'full' => thb_get_featured_image($item->ID, 'full'), 'thumb' => thb_get_featured_image($item->ID, $this->_thumbSize), 'caption' => '', 'type' => 'image', 'link' => false);
     }
 }
 /**
  * Set a list of taxonomies for the field.
  *
  * @param $taxonomies array The list of taxonomies.
  * @return void
  */
 public function setTaxonomies($taxonomies = array())
 {
     if (!empty($taxonomies)) {
         $this->_data['taxonomies'] = thb_array_asum($this->_data['taxonomies'], $taxonomies);
     }
 }
 /**
  * Render the shortcode.
  *
  * @param array $atts The shortcode provided attributes.
  * @param string $content The shortcode enclosed content.
  * @return string
  */
 public function render($atts = array(), $content = '')
 {
     if (empty($this->_template)) {
         wp_die('Empty template path.');
     }
     self::$instance_number++;
     if (empty($atts)) {
         $atts = array();
     }
     $this->_userData['attributes'] = thb_array_asum($this->_defaultData['attributes'], $atts);
     $loopArgs = thb_array_asum($this->_defaultData['loop'], $this->resolveAliases($this->_userData['attributes']));
     if ($this->_dynamicLoopFunction) {
         $loopArgs += call_user_func($this->_dynamicLoopFunction);
     }
     foreach ($atts as $att) {
         if (in_array($att, $this->_classAttributes)) {
             $this->setUserClass($att);
         }
     }
     if (isset($atts['class']) && !empty($atts['class'])) {
         $this->setUserClass($atts['class']);
     }
     $this->_data['class'] = array_merge($this->_defaultData['class'], $this->_userData['class']);
     $this->_data['content'] = $content;
     $this->_data['items'] = array();
     if ($this->_loopable) {
         $this->_data['items'] = get_posts($loopArgs);
     }
     $template_data = $this->_userData['attributes'] + $this->_data + $loopArgs;
     if (!empty($this->_module)) {
         $shortcode_output = thb_return_module_template_part($this->_module, $this->_template, $template_data);
     } else {
         $output = new THB_TemplateLoader($this->_template, $template_data);
         $shortcode_output = $output->render(true);
     }
     $this->reset();
     return $shortcode_output;
 }
示例#18
0
 function thb_system_get_button($label, $url = '#', $atts = array())
 {
     $atts = thb_array_asum(array('class' => '', 'id' => '', 'icon' => '', 'data' => array()), $atts);
     extract($atts);
     $btn = '<a href="' . $url . '" class="thb-btn ' . $class . '"';
     if ($id != '') {
         $btn .= ' id="' . $id . '" ';
     }
     $btn .= thb_get_data_attributes($data);
     $btn .= '>';
     if ($icon != '') {
         $btn .= '<img class="thb-btn-icon" src="' . THB_ADMIN_CSS_URL . '/i/' . $icon . '" />';
     }
     $btn .= $label;
     $btn .= '</a>';
     return $btn;
 }
示例#19
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\Core\Lightbox\magnific-popup
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('options' => true, 'skin' => false);
$thb_theme->setConfig('core/lightbox/submodules/magnific-popup', thb_array_asum($thb_config, $config));
$lightbox_enable = thb_config('core/lightbox/submodules/magnific-popup', 'options') == false || thb_get_option('enable_lightbox_images') == 1 || thb_get_option('enable_lightbox_videos') == 1;
/**
 * Module scripts
 * -----------------------------------------------------------------------------
 */
if ($lightbox_enable) {
    $thb_lightbox = thb_get_module_url('core/lightbox/submodules/magnific-popup');
    if (thb_config('core/lightbox/submodules/magnific-popup', 'skin') == false) {
        $thb_theme->getFrontend()->addStyle($thb_lightbox . '/css/magnific-popup.css');
    }
    $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/jquery.magnific-popup.min.js');
    if (thb_get_option('enable_lightbox_images') == 1) {
        $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.config_images.js');
    }
    if (thb_get_option('enable_lightbox_videos') == 1) {
示例#20
0
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Modules\Core\Slideshow\Flexslider
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('image_size' => 'slideshow');
$thb_theme->setConfig('core/slideshows/submodules/flexslider', thb_array_asum($thb_config, $config));
/**
 * Module bootstrap
 * -----------------------------------------------------------------------------
 */
/**
 * Set the module to require the post type to be loaded.
 */
thb_theme()->setConfigKey('core/slideshows', 'post_type', true);
if (!function_exists('thb_flexslider_register_templates')) {
    function thb_flexslider_register_templates($templates)
    {
        $flexslider_templates = thb_config('core/slideshows/submodules/flexslider', 'templates');
        foreach ($flexslider_templates as $t) {
            if (!in_array($t, $templates)) {
                $templates[] = $t;