function thb_add_shortcodes_plugin($plugin_array)
 {
     $resource = thb_custom_resource('admin/shortcodes');
     $resource = str_replace('&', '&', $resource);
     $plugin_array['shortcodes'] = $resource;
     return $plugin_array;
 }
 function thb_get_resized_image($id, $width, $height, $crop = false)
 {
     if (!$crop) {
         $url = thb_custom_resource('frontend/getImageSize');
     } else {
         $url = thb_custom_resource('frontend/resizeImage');
     }
     $url .= '&id=' . $id;
     $url .= '&w=' . $width;
     $url .= '&h=' . $height;
     return $url;
 }
 /**
  * Retrieve the collection items from duplicable slides.
  *
  * @return void
  */
 protected function retrieveSlides()
 {
     if ($this->_id == 0) {
         return;
     }
     global $_wp_additional_image_sizes;
     $items = thb_duplicable_get($this->_key, $this->_id);
     foreach ($items as $item) {
         $type = isset($item['meta']['subtemplate']) && $item['meta']['subtemplate'] == 'add_image' ? 'image' : 'video';
         $id = isset($item['value']['id']) ? $item['value']['id'] : 0;
         $url = isset($item['value']['url']) ? $item['value']['url'] : '';
         $caption = isset($item['value']['caption']) ? $item['value']['caption'] : '';
         if ($type == 'video' && thb_video_is_selfhosted($url)) {
             $type = 'video-selfhosted';
         }
         $autoplay = isset($item['value']['autoplay']) ? $item['value']['autoplay'] : '0';
         $loop = isset($item['value']['loop']) ? $item['value']['loop'] : '0';
         $poster = '';
         $orginal_poster_img = false;
         if ($type == 'image') {
             $thumb = thb_image_get_size($id, $this->_thumbSize);
         } else {
             $poster_width = $_wp_additional_image_sizes[$this->_thumbSize]['width'];
             $poster_height = $_wp_additional_image_sizes[$this->_thumbSize]['height'];
             $thumb = '';
             $poster = $item['value']['poster'];
             if (!empty($poster)) {
                 $orginal_poster_img = true;
                 $thumb = thb_custom_resource('frontend/resizeImage');
                 $thumb .= '&id=' . $poster;
                 $thumb .= '&w=' . $poster_width;
                 $thumb .= '&h=' . $poster_height;
             } else {
                 $thumb = thb_get_video_thumbnail($url, $this->_posterSize);
                 $poster = $thumb;
                 if (empty($thumb)) {
                     $thumb = THB_ADMIN_CSS_URL . '/i/video.png';
                 }
             }
         }
         $this->_slides[] = array('post_id' => $this->_id, 'id' => $id, 'url' => $type == 'image' ? thb_image_get_size($id, $this->_size) : $url, 'full' => $type == 'image' ? thb_image_get_size($id, 'full') : $url, 'thumb' => $thumb, 'poster' => $poster, 'poster_custom' => $orginal_poster_img, 'caption' => $caption, 'type' => $type, 'autoplay' => $autoplay, 'loop' => $loop, 'link' => thb_image_get_size($id, 'full'));
     }
 }
 /**
  * Enqueue the theme styles.
  *
  * @return void
  */
 public function enqueueStyles()
 {
     global $wp_version;
     if (!empty($this->_styles['compressed'])) {
         $deps = array();
         foreach ($this->_styles['compressed'] as $style) {
             foreach ($style['deps'] as $dep) {
                 if (!in_array($dep, $deps) && !$this->isCompressedStyle($dep)) {
                     $deps[] = $dep;
                 }
             }
         }
         $src = thb_custom_resource('frontend/compressStyles');
         wp_enqueue_style('thb_compressed_styles', $src, $deps, $wp_version);
     }
     $i = 0;
     foreach ($this->_styles['not_compressed'] as $style) {
         if (is_array($style)) {
             extract($style);
             $page_id = thb_get_page_ID();
             if (empty($name)) {
                 $name = 'thb_uncompressed_' . $i;
             }
             if (!empty($templates)) {
                 foreach ($templates as $template) {
                     if (thb_check_page_template($page_id, $template)) {
                         wp_enqueue_style($name, $path, $deps, $wp_version, $media);
                         break;
                     }
                 }
             } else {
                 wp_enqueue_style($name, $path, $deps, $wp_version, $media);
             }
         }
         $i++;
     }
 }