Esempio n. 1
0
function woocommerce_subcategory_thumbnail($category)
{
    // Figure
    $figure = \Drone\HTML::figure()->class('featured full-width');
    // Hyperlink
    $a = $figure->addNew('a')->attr(Everything::getImageAttrs('a', array('fancybox' => false)))->href(get_term_link($category->slug, 'product_cat'));
    // Thumbnail
    $thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
    $thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog');
    if ($thumbnail_id) {
        $a->add(wp_get_attachment_image($thumbnail_id, $thumbnail_size));
    } elseif (woocommerce_placeholder_img_src()) {
        $a->add(woocommerce_placeholder_img($thumbnail_size));
    }
    echo $figure->html();
}
Esempio n. 2
0
 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'))));
 }
Esempio n. 3
0
 /**
  * Cart info
  *
  * @since 1.0
  *
  * @param  string $type
  * @param  array  $visible
  * @return string
  */
 public static function woocommerceGetCartInfo($type, $visible = array('desktop', 'mobile'))
 {
     if (count($visible) == 0) {
         return '';
     }
     // HTML
     $a = \Drone\HTML::a()->href($GLOBALS['woocommerce']->cart->get_cart_url())->title(__('Cart', 'everything'))->addClass('cart-info', $type);
     // Visibility
     if (count($visible) == 1) {
         $a->addClass($visible[0] . '-only');
     }
     // Icon
     $a->addNew('i')->addClass('icon-woocommerce-cart', 'icon-' . Everything::to('woocommerce/cart/icon'));
     // Content
     if (Everything::to_('header/cart/content')->value('count')) {
         $a->addNew('span')->class('count')->add($GLOBALS['woocommerce']->cart->get_cart_contents_count());
     }
     if (Everything::to_('header/cart/content')->value('total') && $GLOBALS['woocommerce']->cart->get_cart_contents_count()) {
         $cart_total = strip_tags($GLOBALS['woocommerce']->cart->get_cart_total());
         $cart_total = preg_replace('/(' . preg_quote(get_option('woocommerce_price_decimal_sep'), '/') . ')([0-9]+)/', '\\1<small>\\2</small>', $cart_total);
         $a->addNew('span')->class('total')->add($cart_total);
     }
     return $a->html();
 }
Esempio n. 4
0
 protected function _html()
 {
     $html = HTML::div()->class($this->getCSSClass(__CLASS__));
     $html->add($this->icon->html(), HTML::div()->style('margin: 0 0 4px 36px;')->add($this->title->html()), $this->url->html());
     return $html;
 }
Esempio n. 5
0
 function widget($args, $instance)
 {
     ob_start();
     parent::widget($args, $instance);
     $output = ob_get_clean();
     $output = Everything::woocommerceWidgetParseList($output);
     $output = preg_replace_callback('#' . '<li>' . '<a[^>]*?href="(?P<url>[^"]*)"[^>]*?>\\s*(?P<thumbnail><img[^>]*>)(?P<title>[^<>]*)</a>' . '<div[^>]*class="star-rating"[^>]*><span[^>]*><strong class="rating">(?P<average>[,\\.0-9]+)</strong>[^>]*</span></div>' . '<span class="reviewer">(?P<author>[^<>]*)</span>' . '</li>' . '#i', function ($m) {
         $html = \Drone\HTML::li();
         $html->addNew('figure')->class('alignright fixed')->addNew('a')->attr(Everything::getImageAttrs('a', array('border' => true, 'hover' => '', 'fanbcybox' => false)))->href($m['url'])->title($m['title'])->add($m['thumbnail']);
         $html->addNew('h3')->addNew('a')->href($m['url'])->title($m['title'])->add($m['title']);
         $html->add(Everything::getShortcodeOutput('rating', array('rate' => $m['average'] . '/5', 'author' => $m['author'])));
         return $html->html();
     }, $output);
     echo $output;
 }
Esempio n. 6
0
 protected function _html()
 {
     $html = HTML::div()->class($this->getCSSClass(__CLASS__))->add($this->family->html());
     if (isset($this->color)) {
         $html->add(' ', $this->color->html());
     }
     if (isset($this->size)) {
         $html->add(' ', $this->size->html());
     }
     if (isset($this->line_height)) {
         $html->add(isset($this->size) ? ' / ' : ' ', $this->line_height->html());
     }
     if (isset($this->styles)) {
         $html->add('<br />', $this->styles->html());
     }
     return $html;
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 protected function onWidget(array $args, \Drone\HTML &$html)
 {
     if ($this->wo('description')) {
         $html->addNew('p')->add($this->wo_('description')->__());
     }
     $cf = \Everything::getShortcodeOutput('contact');
     $cf = str_replace('<textarea ', '<textarea class="full-width" ', $cf);
     $html->add($cf);
 }
Esempio n. 9
0
 protected function onShortcode($content, $code, \Drone\HTML &$html)
 {
     if ($this->so('id') && ($page = get_post((int) $this->so('id'))) !== null) {
         $html->add(Func::wpProcessContent($page->post_content));
     }
 }