function load_page() { $this->set_tooltips($this->tips); if (isset($_POST['options_update'])) { $this->save(); } if (isset($_GET['cache'])) { $this->clear_cache(); } add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_metabox_scripts')); add_action('admin_enqueue_scripts', array($this, 'enqueue_postbox_scripts')); $this->add_meta_box('intro', 'Intro', 'intro_panel'); $this->add_meta_box('general', 'General Settings', 'general_panel', array('options' => Slickr_Flickr_Options::get_options()), 'normal'); $this->add_meta_box('extras', 'Extras', 'extras_panel', null, 'advanced'); $this->add_meta_box('news', 'Slickr Flickr News', 'news_panel', null, 'advanced'); $this->add_meta_box('help', 'Free Tutorials', 'tutorials_panel', null, 'side'); $current_screen = get_current_screen(); if (method_exists($current_screen, 'add_help_tab')) { $current_screen->add_help_tab(array('id' => 'slickr_flickr_overview', 'title' => 'Overview', 'content' => '<p>This admin screen is used to configure your Flickr settings, set display defaults, and choose which LightBox and version of the Galleria /theme you wish to use with Slickr Flickr.</p>')); $current_screen->add_help_tab(array('id' => 'slickr_flickr_troubleshooting', 'title' => 'Troubleshooting', 'content' => '<p>Make sure you only have one version of jQuery installed, and have a single LightBox activated otherwise you may have conflicts. For best operation your page should not have any JavaScript errors. Some Javascript conflicts are removed by loading Slickr Flickr in the footer (see Advanced Options)</p> <p>For help go to <a href="http://www.slickrflickr.com/slickr-flickr-help/">Slickr Flickr Help</a> or for priority support upgrade to <a href="http://www.slickrflickr.com/upgrade/">Slickr Flickr Pro</a></p>')); } }
static function load_galleria_theme() { $options = Slickr_Flickr_Options::get_options(); if ('galleria-latest' != $options['galleria'] || 'dynamic' != $options['galleria_theme_loading'] || count(self::$galleria_themes) == 0) { return; } print <<<LOAD_THEME_START <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function() { LOAD_THEME_START; foreach (self::$galleria_themes as $theme) { printf('Galleria.loadTheme("%1$s");', self::get_galleria_theme_path($theme)); } print <<<LOAD_THEME_END }) //]]> </script> LOAD_THEME_END; }
function show($attr) { Slickr_Flickr_Public::note_active(); $this->params = shortcode_atts(Slickr_Flickr_Options::get_options(), $attr); //apply plugin defaults foreach ($this->params as $k => $v) { if ($k != 'id' && $k != 'options' && $k != 'galleria_options' && $k != 'attribution' && $k != 'flickr_link_title') { $this->params[$k] = strtolower($v); } } //set all params as lower case $this->params['tag'] = str_replace(' ', '', $this->params['tag']); if (strpos($this->params['tag'], ',-') !== FALSE) { $this->params['tagmode'] = 'bool'; } if (empty($this->params['id']) && empty($this->params['text'])) { return "<p>Please specify a Flickr ID for this " . $this->params['type'] . "</p>"; } if ('single' == $this->params['search'] && empty($this->params['photo_id'])) { return "<p>Please specify the photo id of the single photo you want to display.</p>"; } if (!empty($this->params['tagmode']) && empty($this->params['tag']) && $this->params['search'] == "photos") { return "<p>Please set up a Flickr tag for this " . $this->params['type'] . "</p>"; } if (empty($this->params['api_key']) && $this->params['use_key'] == "y") { return "<p>Please add your Flickr API Key in Slickr Flickr Admin settings to fetch more than 20 photos.</p>"; } $this->set_api_required(); if (empty($this->params['use_key'])) { $this->force_api_key(); } //set api_key if required by other parameters $rand_id = rand(1, 10000); $this->id = empty($this->params['element_id']) ? $this->get_unique_id($attr, $rand_id) : $this->params['element_id']; $photos = $this->fetch_photos(); if (!is_array($photos)) { return $this->no_photos($photos); } //return if an array of photos is not returned. then show error message if not in silent mode $divclear = '<div style="clear:both"></div>'; $attribution = empty($this->params['attribution']) ? "" : '<p class="slickr-flickr-attribution align' . $this->params['align'] . '">' . $this->params['attribution'] . '</p>'; $bottom = empty($this->params['bottom']) ? "" : ' style="margin-bottom:' . $this->params['bottom'] . 'px;"'; $lightboxrel = $thumb_scale = $pagination = $s = ''; switch ($this->params['type']) { case "slightbox": if (empty($this->params['ptags'])) { $this->params['ptags'] = "on"; } //paragraph tags arounds titles if (empty($this->params['thumbnail_size'])) { $this->params['thumbnail_size'] = 'medium'; } //set default slideshow size as Medium $this->set_lightboxrel($rand_id); $divstart = sprintf('%1$s<div class="slickr-flickr-slideshow%2$s %3$s %4$s %5$s%6$%7$s" %8$s>', $attribution, $this->params['lightbox'] == 'sf-lightbox' ? ' sf-lightbox' : '', $this->params['orientation'], $this->params['thumbnail_size'], $this->params['descriptions'] == 'on' ? 'descriptions ' : '', $this->params['captions'] == 'off' ? 'nocaptions ' : '', $this->params['align'], $bottom); $divend = '</div>' . $this->set_options(array_merge($this->slideshow_options(), $this->lightbox_options($this->prepare_lightbox_data($photos)))); break; case "slideshow": if (empty($this->params['ptags'])) { $this->params['ptags'] = "on"; } //paragraph tags arounds titles $divstart = $attribution . '<div class="slickr-flickr-slideshow ' . $this->params['orientation'] . ' ' . $this->params['size'] . ($this->params['responsive'] == "on" ? " responsive" : "") . ($this->params['descriptions'] == "on" ? " descriptions" : "") . ($this->params['captions'] == "off" ? " nocaptions " : " ") . $this->params['align'] . '"' . $bottom . '>'; $divend = '</div>' . $this->set_options($this->slideshow_options()); break; case "galleria": if (empty($this->params['thumbnail_size'])) { $this->params['thumbnail_size'] = 'square'; } //set default thumbnail size as Square if ($this->params['galleria'] == 'galleria-original') { $this->params['galleria_theme'] = 'original'; //set a default value if (empty($bottom)) { $style = ' style="visibility:hidden;"'; } else { $style = substr($bottom, 0, strlen($bottom - 2)) . 'visibility:hidden;"'; } $startstop = $this->params['pause'] == 'off' ? '' : '| <a href="#" class="startSlide">start</a> | <a href="#" class="stopSlide">stop</a>'; $nav = <<<NAV <p class="nav {$this->params['size']}"><a href="#" class="prevSlide">« previous</a> {$startstop} | <a href="#" class="nextSlide">next »</a></p> NAV; $data = false; } else { $style = $bottom; $nav = ''; $data = $this->prepare_galleria_data($photos); } switch ($this->params['nav']) { case "above": $nav_below = ''; $nav_above = $nav; break; case "below": $nav_below = $nav; $nav_above = ''; break; case "none": $nav_below = ''; $nav_above = ''; break; default: $nav_below = $nav; $nav_above = $nav; break; } $divstart = '<div class="slickr-flickr-galleria ' . $this->params['orientation'] . ' ' . $this->params['size'] . ' ' . $this->params['align'] . ' ' . $this->params['galleria_theme'] . '"' . $style . '>' . $attribution . $nav_above; $divend = $divclear . $attribution . $nav_below . '</div>' . $this->set_options($this->galleria_options($data)); Slickr_Flickr_Public::add_galleria_theme($this->params['galleria_theme']); //add count of gallerias on page break; default: $this->set_thumbnail_params(); $this->set_lightboxrel($rand_id); $divstart = sprintf('<div class="slickr-flickr-gallery%1$s"%2$s>%3$s', $this->params['lightbox'] == 'sf-lightbox' ? ' sf-lightbox' : '', $bottom, $attribution); $divend = '</div>' . $this->set_options($this->lightbox_options($this->prepare_lightbox_data($photos))); } if ($this->params['type'] == 'galleria' && $this->params['galleria'] == 'galleria-latest') { $content = ''; } else { $content = $this->wrap_photos($photos); } $class = $this->params['class'] ? sprintf(' class="%1$s"', $this->params['class']) : ''; return sprintf('<div id="%1$s"%2$s>%3$s%4$s%5$s%6$s%7$s</div>', $this->id, $class, $divstart, $content, $divend, $pagination, $divclear); }