protected function onWidget(array $args, \Drone\HTML &$html) { $html = \Drone\HTML::div()->style("height: {$this->wo('height')}px;")->add($html = \Drone\HTML::div()->class('fb-like-box')->data('href', $this->wo('href'))->data('height', $this->wo('height'))->data('header', \Drone\Func::boolToString($this->wo('header')))->data('stream', \Drone\Func::boolToString($this->wo('stream')))->data('show-faces', \Drone\Func::boolToString($this->wo('show_faces')))->data('show-border', \Drone\Func::boolToString($this->wo('border')))); }
/** * Paginate links * * @since 1.0 * * @param string $name * @param WP_Query $query * @return string */ public static function getPaginateLinks($name, $query = null) { if (!apply_filters('everything_pagination_display', true, $name)) { return ''; } // Paginate links switch ($name) { // Page case 'page': if (!is_singular()) { return ''; } $pagination = wp_link_pages(array('before' => ' ', 'after' => ' ', 'next_or_number' => rtrim(Everything::to('site/page_pagination'), 's'), 'previouspagelink' => '<i class="icon-left-open"></i><span>' . __('Previous page', 'everything') . '</span>', 'nextpagelink' => '<span>' . __('Next page', 'everything') . '</span><i class="icon-right-open"></i>', 'echo' => false)); $pagination = str_replace('<a ', '<a class="button small" ', $pagination); $pagination = preg_replace('/ ([0-9]+) /', ' <span class="button small active">\\1</span> ', $pagination); break; // Comment // Comment case 'comments': if (!is_singular()) { return ''; } $pagination = paginate_comments_links(array('prev_next' => Everything::to('site/comments/pagination') == 'numbers_navigation', 'prev_text' => '<i class="icon-left-open"></i>', 'next_text' => '<i class="icon-right-open"></i>', 'echo' => false)); $pagination = str_replace(array('page-numbers', 'current'), array('button small', 'active'), $pagination); break; // Default // Default default: $args = array('prev_next' => Everything::to('site/pagination') == 'numbers_navigation', 'prev_text' => '<i class="icon-left-open"></i>', 'next_text' => '<i class="icon-right-open"></i>', 'end_size' => 1, 'mid_size' => 2); if ($name == 'woocommerce') { $args['base'] = esc_url(str_replace('99999999', '%#%', remove_query_arg('add-to-cart', htmlspecialchars_decode(get_pagenum_link(99999999))))); } $pagination = \Drone\Func::wpPaginateLinks($args, $query); $pagination = preg_replace_callback('/class=[\'"](?P<dir>prev |next )?page-numbers(?P<current> current)?[\'"]()/i', function ($m) { return "class=\"{$m['dir']}button small" . str_replace('current', 'active', $m['current']) . '"'; }, $pagination); } if (!$pagination) { return ''; } return \Drone\HTML::div()->class('pagination')->add($pagination)->html(); }
break; case 'wp-google-map-plugin': if (Everything::isPluginActive('wp-google-map-plugin')) { echo wpgmp_show_location_in_map(array('id' => $m['id'])); } break; } ?> <?php } elseif ($banner['type'] == 'page' && !is_null($page = get_post((int) $banner['page']))) { // Page ?> <div class="container"><?php echo \Drone\Func::wpProcessContent($page->post_content); ?> </div> <?php } elseif ($banner['type'] == 'embed' && $banner['embed']) { // Embed ?> <div class="embed"><?php echo $banner['embed']; ?> </div> <?php } elseif ($banner['type'] == 'custom') {
</span> </div> <div id="mobile-section"> <?php if (Everything::to_('header/main_menu/visible')->value('mobile')) { ?> <nav class="mobile-nav-menu main"> <?php Everything::navMenu('main-mobile'); ?> </nav> <?php if (\Drone\Func::wpAssignedMenu('additional-mobile')) { ?> <nav class="mobile-nav-menu additional"> <?php Everything::navMenu('additional-mobile', null, 1); ?> </nav> <?php } ?> <?php } ?> </div>
<?php /** * @package WordPress * @subpackage Everything * @since 1.0 */ $nav = Everything::po('layout/nav_secondary/upper/upper', '__hidden_ns', Everything::to_('nav/secondary/upper')->value()); if (!(\Drone\Func::wpAssignedMenu('secondary-upper') || is_numeric($nav)) || !apply_filters('everything_nav_secondary_upper_display', (bool) $nav)) { return; } ?> <div class="outer-container"> <nav class="nav-menu secondary upper"> <div class="container"> <div class="section"> <?php Everything::navMenu('secondary-upper', is_numeric($nav) ? $nav : null); ?> </div> </div> </nav> </div><!-- // .outer-container -->
public function __construct($name, $default, $properties = array()) { parent::__construct($name, $default, $properties); $type_options = array('' => __('None', 'everything'), 'empty' => __('Empty space', 'everything'), 'image' => __('Image', 'everything'), 'thumbnail' => __('Featured image', 'everything'), 'slider' => __('Slider', 'everything'), 'map' => __('Map', 'everything'), 'page' => __('Page', 'everything'), 'embed' => __('Embeding code', 'everything'), 'custom' => __('Custom HTML', 'everything')); if (!isset($this->slider)) { unset($type_options['slider']); } if (!isset($this->map)) { unset($type_options['map']); } $this->type->options = $type_options; $this->height->unit = 'px'; $this->height->min = 0; $this->height->indent = true; $this->height->owner = $this->type; $this->height->owner_value = 'empty'; $this->image->indent = true; $this->image->owner = $this->type; $this->image->owner_value = 'image'; if (isset($this->slider)) { $this->slider->required = false; $this->slider->options = function ($option) { $options = array(); if (\Everything::isPluginActive('layerslider')) { foreach (\lsSliders() as $slider) { $options['layerslider-' . $slider['id']] = $slider['name']; $option->groups['LayerSlider WP'][] = 'layerslider-' . $slider['id']; } } if (\Everything::isPluginActive('masterslider')) { foreach (get_masterslider_names() as $id => $name) { $options['masterslider-' . $id] = $name; $option->groups['Master Slider WP'][] = 'masterslider-' . $id; } } if (\Everything::isPluginActive('revslider')) { $revslider = new \RevSlider(); foreach ($revslider->getArrSliders() as $slider) { $options['revslider-' . $slider->getID()] = $slider->getTitle(); $option->groups['Revolution Slider'][] = 'revslider-' . $slider->getID(); } } return $options; }; $this->slider->indent = true; $this->slider->owner = $this->type; $this->slider->owner_value = 'slider'; } if (isset($this->map)) { $this->map->required = false; $this->map->options = function ($option) { $options = array(); if (\Everything::isPluginActive('wild-googlemap')) { $maps = \WiLD_BackendGooglemapManager::getInstance()->get_maps(); foreach ($maps as $map) { $options['wild-googlemap-' . $map->id] = $map->name; $option->groups['WiLD Googlemap'][] = 'wild-googlemap-' . $map->id; } } if (\Everything::isPluginActive('wp-google-map-plugin')) { $maps = $GLOBALS['wpdb']->get_results("SELECT map_id, map_title FROM {$GLOBALS['wpdb']->prefix}create_map ORDER BY map_id ASC", ARRAY_A); foreach ($maps as $map) { $options['wp-google-map-plugin-' . $map['map_id']] = $map['map_title']; $option->groups['WP Google Map Plugin'][] = 'wp-google-map-plugin-' . $map['map_id']; } } return $options; }; $this->map->indent = true; $this->map->owner = $this->type; $this->map->owner_value = 'map'; } $this->page->required = false; $this->page->options = function () { return \Drone\Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'page')); }; $this->page->indent = true; $this->page->owner = $this->type; $this->page->owner_value = 'page'; $this->embed->description = __('Embeding code from YouTube, Vimeo, Google Maps or other.', 'everything'); $this->embed->indent = true; $this->embed->owner = $this->type; $this->embed->owner_value = 'embed'; $this->custom->indent = true; $this->custom->owner = $this->type; $this->custom->owner_value = 'custom'; }
$this->addThemeFeature('option-contact-form'); // ----------------------------------------------------------------------------- // Advanced $advanced = $theme_options->addGroup('advanced', __('Advanced', 'everything')); $this->addThemeFeature('option-custom-css'); $this->addThemeFeature('option-custom-js'); $advanced->addOption('boolean', 'chrome_fonts_fix', false, __('Google Fonts', 'everything'), __('This option is not recommended since Chrome version 37 and Opera version 25 were released.', 'everything'), array('caption' => __('Enhance fonts in Chrome and Opera browsers', 'everything'))); // ----------------------------------------------------------------------------- // Other $other = $theme_options->addGroup('other', __('Other', 'everything')); $this->addThemeFeature('option-tracking-code'); $this->addThemeFeature('option-feed-url'); $this->addThemeFeature('option-ogp'); // ----------------------------------------------------------------------------- // Layout post options $nav_menus = \Drone\Func::wpTermsList('nav_menu'); $this->foreachPostOptions(array('post', 'page', 'gallery', 'portfolio', 'product'), function ($post_type, $post_options) use($breadcrumbs, $nav_menus, $sidebar_options) { $layout = $post_options->addGroup('layout', __('Layout', 'everything')); $layout->addEnabledOption('background', 'background', false, Everything::to_('general/background/background')->default, __('Background', 'everything'), __('Custom', 'everything')); $layout->addEnabledOption('banner', 'banner', false, Everything::to_('banner/content')->default, __('Banner', 'everything'), __('Custom', 'everything')); $nav = $layout->addGroup('nav_secondary', __('Secondary menu', 'everything')); $nav->addEnabledOption('select', 'upper', false, 'true', __('Upper', 'everything'), __('Custom', 'everything'), '', array('options' => array('true' => __('Show', 'everything'), '' => __('Hide', 'everything')) + $nav_menus, 'groups' => array(__('Custom menu', 'everything') => array_keys($nav_menus)))); $nav->addEnabledOption('select', 'lower', false, 'true', __('Lower', 'everything'), __('Custom', 'everything'), '', array('options' => array('true' => __('Show', 'everything'), '' => __('Hide', 'everything')) + $nav_menus, 'groups' => array(__('Custom menu', 'everything') => array_keys($nav_menus)))); $layout->addEnabledOption('group', 'headline', false, Everything::to_('nav/headline')->default, __('Headline', 'everything'), __('Custom', 'everything'), '', array('options' => array('' => __('Hide', 'everything'), 'none' => __('None (title only)', 'everything'), 'breadcrumbs' => __('Breadcrumbs', 'everything'), 'navigation' => __('Navigation (if possible)', 'everything')), 'disabled' => !$breadcrumbs ? array('breadcrumbs') : array())); $layout->addEnabledOption('layout', 'layout', false, Everything::to_('sidebar/layout')->default, __('Sidebar', 'everything'), __('Custom', 'everything'), '', array('options' => $sidebar_options)); if ($post_type != 'product') { $page = $layout->addGroup('page', __('Page', 'everything')); $page->addEnabledOption('group', 'hide_title', false, '', __('Title', 'everything'), __('Custom', 'everything'), '', array('options' => array('' => __('Show', 'everything'), 'true' => __('Hide', 'everything')))); $page->addEnabledOption('group', 'author_bio', false, 'true', __('Author details', 'everything'), __('Custom', 'everything'), '', array('options' => array('true' => __('Show', 'everything'), '' => __('Hide', 'everything')))); $page->addEnabledOption('group', 'meta', false, 'true', __('Meta', 'everything'), __('Custom', 'everything'), '', array('options' => array('true' => __('Show', 'everything'), '' => __('Hide', 'everything')))); $page->addEnabledOption('group', 'social_buttons', false, 'true', __('Social buttons', 'everything'), __('Custom', 'everything'), '', array('options' => array('true' => __('Show', 'everything'), '' => __('Hide', 'everything'))));
<section class="section"> <div class="bricks alt-mobile" data-bricks-columns="<?php echo Everything::to('site/blog/columns'); ?> " data-bricks-filter="<?php echo \Drone\Func::boolToString($filter = Everything::to('site/blog/filter/filter', '__hidden')); ?> "> <?php while (have_posts()) { the_post(); ?> <?php if ($filter) { $terms = \Drone\Func::wpPostTermsList(get_the_ID(), $filter); if (is_category() && ($term_id = array_search(single_cat_title('', false), $terms)) !== false) { unset($terms[$term_id]); } $terms = esc_attr(json_encode(array_values($terms))); } ?> <div<?php if ($filter) { echo " data-bricks-terms=\"{$terms}\""; } ?> > <?php get_template_part('parts/post'); ?>
/** * @package WordPress * @subpackage Everything * @since 1.0 */ // Separator $separator = '›'; // is_rtl() ? '‹' : '›' // bbPress if (Everything::isPluginActive('bbpress') && Everything::to('bbpress/breadcrumbs') && is_bbpress()) { $breadcrumbs_html = bbp_get_breadcrumb(array('before' => '', 'after' => '', 'sep' => $separator, 'sep_before' => '', 'sep_after' => '', 'current_before' => '', 'current_after' => '')); } else { if (Everything::isPluginActive('woocommerce') && Everything::to('woocommerce/breadcrumbs') && (is_shop() || is_product_taxonomy() || is_product())) { // || is_cart() || is_checkout() || is_order_received_page() || is_account_page() $breadcrumbs_html = \Drone\Func::functionGetOutputBuffer('woocommerce_breadcrumb', array('delimiter' => $separator, 'wrap_before' => '', 'wrap_after' => '')); } else { if (Everything::isPluginActive('breadcrumb-navxt')) { $options = get_option('bcn_options'); $separator = $options['hseparator']; $breadcrumbs_html = bcn_display(true); } else { if (Everything::isPluginActive('breadcrumb-trail')) { $breadcrumbs_html = breadcrumb_trail(array('separator' => $separator, 'show_browse' => false, 'echo' => false)); } else { if (Everything::isPluginActive('wordpress-seo')) { $options = get_option('wpseo_internallinks'); $separator = $options['breadcrumbs-sep'] ? $options['breadcrumbs-sep'] : '»'; $breadcrumbs_html = yoast_breadcrumb('', '', false); } else { return;
public static function __actionWPEnqueueScripts() { $google_fonts = array(); foreach (self::getUsedFonts() as $font) { if (isset(self::$web_safe[$font])) { continue; } else { if (($google_webfont = self::getGoogleWebfont($font)) !== false) { $variants = array(); foreach ($google_webfont['variants'] as $variant) { $variant = preg_replace('/^(regular|(italic))$/', '400\\2', $variant); if (strpos($variant, '400') === 0 || strpos($variant, '700') === 0) { $variants[] = $variant; } } $google_fonts[] = sprintf('%s:%s:%s', urlencode($google_webfont['family']), implode(',', $variants), implode(',', $google_webfont['subsets'])); } else { Theme::getInstance()->addDocumentStyle(Func::cssFontFace(Theme::getInstance()->stylesheet_dir . '/' . self::$fonts_path, Theme::getInstance()->stylesheet_uri . '/' . self::$fonts_path, $font)); } } } if (count($google_fonts) > 0) { wp_enqueue_script(Theme::getInstance()->theme->id . '-webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js', array(), '1.4.7'); Theme::getInstance()->addDocumentScript(sprintf(<<<'EOS' if (typeof WebFont != 'undefined') { WebFont.load({ google: {families: %s}, active: function() { if (document.createEvent) { var e = document.createEvent('HTMLEvents'); e.initEvent('webfontactive', true, false); document.dispatchEvent(e); } else { document.documentElement['webfontactive']++; } } }); } EOS , json_encode($google_fonts))); } }
protected function getBricks($query) { // HTML $html = HTML::div()->class('bricks')->data('bricks-columns', $this->so('columns'))->data('bricks-filter', Func::boolToString($this->so('filter'))); while (have_posts()) { the_post(); $GLOBALS['more'] = 0; $brick = $html->addNew('div')->add(\Drone\Func::functionGetOutputBuffer('get_template_part', 'parts/post')); if ($this->so('filter')) { $terms = \Drone\Func::wpPostTermsList(get_the_ID(), $this->so('filter')); if (is_category() && ($term_id = array_search(single_cat_title('', false), $terms)) !== false) { unset($terms[$term_id]); } $brick->data('bricks-terms', json_encode(array_values($terms))); } } wp_reset_query(); // Paginate links if ($this->so('pagination') && ($pagination = \Everything::getPaginateLinks('blog', $query))) { $html = HTML::make()->add($html, $pagination); } return $html; }
<?php /** * @package WordPress * @subpackage Everything * @since 1.0 */ ?> <?php get_header(); ?> <section class="section"> <?php echo \Drone\Func::wpProcessContent(Everything::to('not_found/content')); ?> </section> <?php get_footer();
protected function onWidget(array $args, \Drone\HTML &$html) { if (!$this->wo('id')) { return; } // Columns $columns_int = (int) rtrim($this->wo('columns'), '+'); $columns_plus = $this->wo('columns') != (string) $columns_int; // Posts $query = new \WP_Query(array('posts_per_page' => $this->wo('count', '__empty', -1), 'post_status' => 'publish', 'post_type' => 'portfolio', 'post_parent' => $this->wo('id'), 'post__not_in' => is_single() ? array(get_the_ID()) : array(), 'orderby' => $this->wo('orderby'), 'order' => $this->wo('order'))); if (!$query->have_posts()) { return; } // Bricks $bricks = $html->addNew('div')->class('bricks')->data('bricks-columns', $columns_int)->data('bricks-filter', Func::boolToString($this->wo('filter'))); while ($query->have_posts()) { $query->the_post(); $div = $bricks->addNew('div'); // Item $item = $div->addNew('article')->id('portfolio-item-' . get_the_ID())->addClass(get_post_class('portfolio-item')); if ($this->wo('show_title') || $this->wo('content') || $this->wo('taxonomy')) { $item->addClass('bordered'); } // Relation if ($this->wo('filter')) { $terms = Func::wpPostTermsList(get_the_ID(), 'portfolio-' . $this->wo('filter')); if (count($terms) > 0) { $div->data('bricks-terms', json_encode(array_values($terms))); } } // Columns + if ($columns_plus) { $ul = $item->addNew('div')->class('columns')->addNew('ul'); $item_featured = $ul->addNew('li')->class('col-2-3'); $item_desc = $ul->addNew('li')->class('col-1-3'); } else { $item_featured = $item_desc = $item; } // Featured image if (has_post_thumbnail()) { $item_featured->addNew('figure')->class('thumbnail featured full-width')->addNew('a')->attr(\Everything::getImageAttrs('a', array('border' => false, 'hover' => $this->wo('image_hover'), 'fancybox' => false)))->href(get_permalink())->add(get_the_post_thumbnail(null, $columns_plus ? 'auto-2' : 'auto')); } // Title if ($this->wo('show_title')) { $item_desc->addNew($columns_int == 1 ? 'h2' : 'h3')->addNew('a')->href(get_permalink())->title(the_title_attribute(array('echo' => false)))->add(get_the_title()); } // Content switch ($this->wo('content/content', '__hidden')) { case 'excerpt': $item_desc->addNew('p')->add(get_the_excerpt()); break; case 'excerpt_content': if (has_excerpt()) { $item_desc->addNew('p')->add(get_the_excerpt()); break; } case 'content': $GLOBALS['more'] = 0; $item_desc->add(\Drone\Func::wpProcessContent(get_the_content(\Everything::getReadMore()))); break; } // Taxonomy if ($this->wo('taxonomy/visible')) { $item_desc->add(get_the_term_list(get_the_ID(), 'portfolio-' . $this->wo('taxonomy/taxonomy'), '<p class="small alt">', ', ', '</p>')); } } wp_reset_postdata(); }
protected function onShortcode($content, $code, \Drone\HTML &$html) { $content = Func::wpShortcodeContent($content, false); if ($this->so('tag') == 'pre') { $content = preg_replace('#(<br ?/?>|^<p>|</p>$)#i', '', $content); $content = preg_replace('#(</p>\\r?\\n<p>|</p>\\r?\\n|\\r?\\n<p>)#i', "\n\n", $content); } $content = htmlspecialchars($content, defined('ENT_HTML5') ? ENT_COMPAT | ENT_HTML5 : ENT_COMPAT, get_bloginfo('charset'), false); $html = HTML::$tag()->add($content); if ($this->so('class')) { $html->class = $this->so('class'); } }