/**
  * (non-PHPdoc)
  * @see GalleryHelper::get_markup()
  */
 public function get_markup()
 {
     $toret = '';
     if (count($this->images) > 0) {
         $subs = new SubstitutionTemplate();
         $subs->set_tpl($this->tpl)->set_markup('prev', HtmlHelper::anchor('javascript:;', '<', array('class' => 'prev control')))->set_markup('next', HtmlHelper::anchor('javascript:;', '>', array('class' => 'next control')));
         ThemeHelpers::load_js('minigallery-thumbs-link-to-big');
         ThemeHelpers::load_css('jquery-fancybox');
         foreach ($this->images as $index => $image) {
             $image_big = wp_get_attachment_image_src($this->get_image_id($index), $this->media_dimension_big);
             $image_small = wp_get_attachment_image_src($this->get_image_id($index), $this->media_dimension);
             $toret .= HtmlHelper::anchor($image_big[0], HtmlHelper::image($this->get_image_src($index), array('alt' => $this->get_image_alt($index), 'title' => $this->get_image_description($index), 'data-caption' => $this->get_image_caption($index))), array('class' => 'fancybox', 'rel' => 'group', 'title' => $this->get_image_caption($index)));
         }
         $toret = $subs->set_markup('list', $toret)->replace_markup();
     }
     return $toret;
 }
 /**
  * Retrieves the markup for this minigallery
  * @return the markup for the minigallery
  */
 public function get_markup()
 {
     $toret = '';
     if (count($this->images) > 0) {
         $this->load_assets();
         $thumb_list = '';
         foreach ($this->images as $k => $image) {
             if ($k % $this->thumb_list_config['number'] == 0 && $k > 0) {
                 $thumb_list .= $this->thumb_list_config['separator']['close'] . $this->thumb_list_config['separator']['open'];
             }
             // $src = $this->get_image_src($k);
             $big_img_link = wp_get_attachment_image_src($this->get_image_id($k), $this->sizes['big']);
             // vd($big_img_link);
             $small_img_link = wp_get_attachment_image_src($this->get_image_id($k), $this->sizes['small']);
             $thumb_list .= HtmlHelper::anchor($big_img_link[0], HtmlHelper::image($small_img_link[0], array('class' => 'image')), array('class' => 'thumb-link', 'data-caption' => $this->get_image_caption($k)));
         }
         if (!$this->unid) {
             $this->calculate_unique();
         }
         $this->static_markup['minigallery-id'] = $this->unid;
         $this->static_markup['thumb-list'] = $this->thumb_list_config['separator']['open'] . $thumb_list . $this->thumb_list_config['separator']['close'];
         $toret = str_replace(array_map(create_function('$k', 'return "%".$k."%";'), array_keys($this->static_markup)), array_values($this->static_markup), $this->tpl);
     }
     return $toret;
 }
 /**
  * Prints the HTML markup for the metabox
  */
 public static function metabox_html($post)
 {
     if (is_null($post)) {
         global $post;
     }
     $template = self::get_template($post);
     if (count(self::$media_list)) {
         $is_first = true;
         foreach (self::$media_list as $k => $elem) {
             $template_checker = new TemplateChecker($elem['include'], $elem['exclude']);
             if (!$template_checker->check($template)) {
                 continue;
             }
             $name = self::META_KEY_NAME . '-' . $elem['id'];
             wp_nonce_field(__FILE__, $name . '_nonce');
             $value = get_post_meta($post->ID, $name, true);
             // main edit button
             $edit_button = HtmlHelper::anchor('javascript:;', HtmlHelper::span('', array('class' => 'wp-media-buttons-icon')) . __('Manage Media', 'wtu_framework'), array('id' => 'wtu-media-manager-button-' . $elem['id'], 'class' => 'button media-manager-button', 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-frame-id' => 'wtu-media-manager-' . $elem['id'], 'data-title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label']), 'data-button-label' => sprintf(__('Add selected media to %s set', 'wtu_framework'), $elem['label']), 'data-multiple' => 'true', 'data-elem-id' => $elem['id'], 'data-shortcode' => $elem['shortcode'], 'title' => sprintf(__('Manage Media for %s', 'wtu_framework'), $elem['label'])));
             // input to store temp values, use text instead of hidden to debug
             $input = HtmlHelper::input($name, 'hidden', array('id' => 'wtu-media-manager-element-' . $elem['id'], 'value' => $value));
             // Counter
             $number = 0;
             if (isset($value) && $value != '') {
                 $number = count(explode(',', $value));
             }
             $counter = ' ' . HtmlHelper::span($number > 0 ? sprintf(_n('1 element', '%s elements', $number, 'wtu_framework'), $number) : __('Empty', 'wtu_framework'), array('id' => 'wtu-media-manager-counter-' . $elem['id'], 'data-label-no-images' => __('Empty', 'wtu_framework'), 'data-label-one-image' => __('1 element', 'wtu_framework'), 'data-label-more-images' => __('%s elements', 'wtu_framework')));
             // delete button
             $delete = HtmlHelper::anchor('javascript:;', __('Delete', 'wtu_framework'), array('id' => 'wtu-media-manager-delete-' . $elem['id'], 'style' => $value ? '' : 'display:none;', 'class' => 'delete-media-manager-gallery submitdelete', 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-target-undo' => '#wtu-media-manager-undo-' . $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'title' => __('Delete Media Set', 'wtu_framework')));
             // undo button
             $undo = HtmlHelper::anchor('javascript:;', __('Undo', 'wtu_framework'), array('id' => 'wtu-media-manager-undo-' . $elem['id'], 'style' => 'display:none;', 'class' => 'undo-media-manager-gallery', 'data-gallery' => $elem['id'], 'data-target' => '#wtu-media-manager-element-' . $elem['id'], 'data-elem-id' => $elem['id'], 'data-target-origin' => '#wtu-media-manager-button-' . $elem['id'], 'data-target-delete' => '#wtu-media-manager-delete-' . $elem['id'], 'data-counter' => '#wtu-media-manager-counter-' . $elem['id'], 'title' => __('Restore Media Set', 'wtu_framework')));
             $title = HtmlHelper::paragraph(HtmlHelper::strong($elem['label']));
             $inner_html = '';
             if (!$is_first) {
                 $inner_html .= HtmlHelper::br();
             }
             $inner_html .= '<table class="widefat"><thead>';
             $inner_html .= '<td width="33%">' . $title . '</td>';
             $inner_html .= '<td width="33%">&nbsp;</td>';
             $inner_html .= '<td width="33%">' . $edit_button . '</td></thead>';
             $inner_html .= '<tbody><tr style="line-height: 25px;"><td class="submitbox">' . $delete . $undo . '</td>';
             $inner_html .= '<td>&nbsp;</td>';
             $inner_html .= '<td>' . $counter . '</td>';
             $inner_html .= '</tr></tbody></table>';
             $inner_html .= $input;
             echo HtmlHelper::div($inner_html, array('class' => ''));
             $is_first = false;
         }
     }
     //var_dump($value);
 }
 /**
  * Calculates the url for the attachment with id $id
  * @param int $id the attachment id
  * @param string $label the text inside the <a> tag
  * @param array $parms additional parameters for the <a> tag 
  * @see HtmlHelper::anchor()
  * @return string an <a> tag
  */
 public function force_download_anchor($id, $label, $parms)
 {
     return HtmlHelper::anchor(admin_url('admin-ajax.php') . '?action=download&id=' . $id, $label, $parms);
 }
 /**
  * Renders the list of anchors
  * @return the rendered the list of anchors
  */
 protected function render_list()
 {
     $toret = '';
     $first = true;
     foreach ($this->links as $link) {
         if (!$first) {
             $toret .= $this->list_separator;
         }
         $toret .= HtmlHelper::anchor($link->href, $link->label, $link->params);
         $first = false;
     }
     return $toret;
 }
 /**
  * This is called back by WordPress when the tab list shortcode is found
  * @param array $atts User defined attributes in shortcode tag.
  */
 public function list_hook($atts)
 {
     $parms = shortcode_atts(array('class' => 'tabs'), $atts);
     $inner_html = '';
     foreach ($this->list_of_entries as $entry) {
         $inner_html .= HtmlHelper::list_item(HtmlHelper::anchor('#' . sanitize_title($entry['title']), $this->get_image($entry['icon']) . $entry['title'], array('data-title' => $entry['title'], 'data-from' => $entry['from'], 'data-route-type' => $entry['route_type'])), array('class' => $entry['class']));
     }
     return HtmlHelper::unorderd_list($inner_html, array('class' => $parms['class']));
 }
 /**
  * (non-PHPdoc)
  * @see GalleryHelper::get_markup()
  */
 public function get_markup()
 {
     $markup_images = '';
     if (count($this->images) > 0) {
         $images_per_line = $this->images_per_row;
         foreach ($this->images as $k => $image) {
             $classes = array($this->single_image_container_class, 'image_' . $k);
             if ($images_per_line == 0) {
                 $images_per_line = $this->images_per_row;
             }
             if ($images_per_line == $this->images_per_row) {
                 $classes[] = 'alpha';
             }
             if ($images_per_line == 1) {
                 $classes[] = 'omega';
             }
             $images_per_line--;
             $big_img_src = wp_get_attachment_image_src($this->get_image_id($k), 'full');
             $big_img_src = $big_img_src[0];
             $markup_images .= '<div class="' . implode(' ', $classes) . '">' . HtmlHelper::anchor($big_img_src, HtmlHelper::image($this->get_image_src($k), array('alt' => $this->get_image_alt($k))), array('rel' => 'group', 'class' => 'fancy', 'title' => $this->get_image_title($k), 'data-description' => $this->get_image_description($k), 'data-caption' => $this->get_image_caption($k))) . '</div>';
         }
     }
     if (!$this->unid) {
         $this->calculate_unique();
     }
     $this->subs->set_markup('gallery-id', $this->unid);
     $this->subs->set_markup('images', $markup_images);
     ThemeHelpers::load_js('jquery-fancybox');
     ThemeHelpers::load_css('jquery-fancybox');
     return $this->subs->replace_markup();
 }
 /**
  * Builds the %permalink% substitution
  * @param int $post_id the post ID
  * @param array $args optional arguments for the anchor tag
  * @return string html anchor tag for the permalink
  */
 public function get_permalink($item, $args = array())
 {
     return HtmlHelper::anchor(get_permalink($item->object_id), $this->get_title($item), $args);
 }