function justified_infinite_scroll_foogallery_attachment_resize_thumbnail($original_image_src, $args, $thumbnail_object) { // Some defaults for the dynamic generation... $arg_defaults = array('thumb_size' => 'large', 'width' => 0, 'height' => 0, 'jpeg_quality' => intval(foogallery_get_setting('thumb_jpeg_quality')), 'thumb_resize_animations' => foogallery_get_setting('thumb_resize_animations')); $args = wp_parse_args($args, $arg_defaults); $thumb_size = $args['thumb_size']; if ($thumb_size != 'dynamic') { //check if we are going to use the thumbnails that we already have //check to make sure we have a valid ID, else return the original image if ($thumbnail_object->ID > 0) { $thumbnail_attributes = wp_get_attachment_image_src($thumbnail_object->ID, $thumb_size); return $thumbnail_attributes[0]; } else { return $original_image_src; } } else { // To do dynamic generation, we need either a width or a height. //If nothing is given then default to the thumb width setting in Settings->Media $width = (int) $args['width']; $height = (int) $args['height']; if (0 == $width && 0 == $height) { $args['width'] = (int) get_option('thumbnail_size_w'); } return wpthumb($original_image_src, $args); } }
/** * Get back the extension endpoint based on a setting */ public function get_extensions_endpoint() { if ('on' === foogallery_get_setting('use_future_endpoint')) { $extension_url = FOOGALLERY_EXTENSIONS_FUTURE_ENDPOINT; } else { $extension_url = FOOGALLERY_EXTENSIONS_ENDPOINT; } return apply_filters('foogallery_extension_api_endpoint', $extension_url); }
function resize($original_image_src, $args, $thumbnail_object) { $arg_defaults = array('width' => 0, 'height' => 0, 'crop' => true, 'jpeg_quality' => foogallery_thumbnail_jpeg_quality(), 'thumb_resize_animations' => foogallery_get_setting('thumb_resize_animations')); $args = wp_parse_args($args, $arg_defaults); $width = (int) $args['width']; $height = (int) $args['height']; $crop = (bool) $args['crop']; //check if we are trying to get back the default thumbnail that we already have if ($thumbnail_object->ID > 0 && $width == get_option('thumbnail_size_w') && $height == get_option('thumbnail_size_h') && $crop == get_option('thumbnail_crop')) { $thumbnail_attributes = wp_get_attachment_image_src($thumbnail_object->ID); return $thumbnail_attributes[0]; } //we need either a width or a height. If nothing is given then default to the thumb width setting in Settings->Media if (0 == $width && 0 == $height) { $args['width'] = (int) get_option('thumbnail_size_w'); } return wpthumb($original_image_src, $args); }
/** * Returns the caption title source setting * * @return string */ function foogallery_caption_title_source() { $source = foogallery_get_setting('caption_title_source', 'caption'); if (empty($source)) { $source = 'caption'; } return $source; }
public function render_gallery_settings_metabox($post) { //gallery settings including: //gallery images link to image or attachment page //default template to use $gallery = $this->get_gallery($post); $available_templates = foogallery_gallery_templates(); //check if we have no templates if (0 === count($available_templates)) { //force the default template to activate if there are no other gallery templates foogallery_activate_default_templates_extension(); $available_templates = foogallery_gallery_templates(); } $gallery_template = foogallery_default_gallery_template(); if (!empty($gallery->gallery_template)) { $gallery_template = $gallery->gallery_template; } $hide_help = 'on' == foogallery_get_setting('hide_gallery_template_help'); ?> <table class="foogallery-metabox-settings"> <tbody> <tr class="gallery_template_field gallery_template_field_selector"> <th> <label for="FooGallerySettings_GalleryTemplate"><?php _e('Gallery Template', 'foogallery'); ?> </label> </th> <td> <select id="FooGallerySettings_GalleryTemplate" name="<?php echo FOOGALLERY_META_TEMPLATE; ?> "> <?php foreach ($available_templates as $template) { $selected = $gallery_template === $template['slug'] ? 'selected' : ''; $preview_css = isset($template['preview_css']) ? ' data-preview-css="' . $template['preview_css'] . '" ' : ''; echo "<option {$selected}{$preview_css} value=\"{$template['slug']}\">{$template['name']}</option>"; } ?> </select> <br /> <small><?php _e('The gallery template that will be used when the gallery is output to the frontend.', 'foogallery'); ?> </small> </td> </tr> <?php foreach ($available_templates as $template) { $field_visibility = $gallery_template !== $template['slug'] ? 'style="display:none"' : ''; //allow for extensions to override fields for every gallery template. // Also passes the $template along so you can inspect and conditionally alter fields based on the template properties $fields = apply_filters('foogallery_override_gallery_template_fields', $template['fields'], $template); $section = ''; foreach ($fields as $field) { //allow for the field to be altered by extensions. Also used by the build-in fields, e.g. lightbox $field = apply_filters('foogallery_alter_gallery_template_field', $field, $gallery); $class = "gallery_template_field gallery_template_field-{$template['slug']} gallery_template_field-{$template['slug']}-{$field['id']}"; if (isset($field['section']) && $field['section'] !== $section) { $section = $field['section']; ?> <tr class="<?php echo $class; ?> " <?php echo $field_visibility; ?> > <td colspan="2"><h4><?php echo $section; ?> </h4></td> </tr> <?php } if (isset($field['type']) && 'help' == $field['type'] && $hide_help) { continue; //skip help if the 'hide help' setting is turned on } ?> <tr class="<?php echo $class; ?> " <?php echo $field_visibility; ?> > <?php if (isset($field['type']) && 'help' == $field['type']) { ?> <td colspan="2"> <div class="foogallery-help"> <?php echo $field['desc']; ?> </div> </td> <?php } else { ?> <th> <label for="FooGallerySettings_<?php echo $template['slug'] . '_' . $field['id']; ?> "><?php echo $field['title']; ?> </label> </th> <td> <?php do_action('foogallery_render_gallery_template_field', $field, $gallery, $template); ?> </td> <?php } ?> </tr> <?php } } ?> </tbody> </table> <?php }
/** * Returns the default album template * * @return string */ function foogallery_default_album_template() { return foogallery_get_setting('album_template'); }
/** * Loads default settings from another gallery if it is set on the settings page */ public function load_default_settings_if_new() { if ($this->is_new()) { $default_gallery_id = foogallery_get_setting('default_gallery_settings'); $this->gallery_template = get_post_meta($default_gallery_id, FOOGALLERY_META_TEMPLATE, true); $this->settings = get_post_meta($default_gallery_id, FOOGALLERY_META_SETTINGS, true); $this->sorting = foogallery_get_setting('gallery_sorting'); } }
<div class="banner active-banner"><?php _e('Activated', 'foogallery'); ?> </div> <div class="banner error-banner"><?php echo $api->get_error_message($slug); ?> </div> <div class="banner coming-soon-banner"><?php _e('Coming Soon!', 'foogallery'); ?> </div> </div> <?php } ?> </div> <?php $hide_build_your_own_tab = foogallery_get_setting('whitelabel_extensions_hide_build_your_own'); if ('on' != $hide_build_your_own_tab) { ?> <div class="extension-page extension-page-build_your_own"> <?php include 'view-extensions-build-your-own.php'; ?> </div> <?php } ?> </div>
/** * Returns the gallery slug used when generating gallery URL's * * @return string */ function foogallery_album_gallery_url_slug() { $slug = foogallery_get_setting('album_gallery_slug', 'gallery'); return apply_filters('foogallery_album_gallery_url_slug', $slug); }
/** * Returns the gallery permalink * * @return string */ function foogallery_permalink() { return foogallery_get_setting('gallery_permalink'); }
public function render_settings_metabox($post) { $album = $this->get_album($post); $available_templates = foogallery_album_templates(); $album_template = foogallery_default_album_template(); if (!empty($album->album_template)) { $album_template = $album->album_template; } if (false === $album_template) { $album_template = $available_templates[0]['slug']; } $hide_help = 'on' == foogallery_get_setting('hide_gallery_template_help'); ?> <table class="foogallery-album-metabox-settings"> <tbody> <tr class="gallery_template_field gallery_template_field_selector"> <th> <label for="FooGallerySettings_AlbumTemplate"><?php _e('Album Template', 'foogallery'); ?> </label> </th> <td> <select id="FooGallerySettings_AlbumTemplate" name="<?php echo FOOGALLERY_ALBUM_META_TEMPLATE; ?> "> <?php foreach ($available_templates as $template) { $selected = $album_template === $template['slug'] ? 'selected' : ''; echo "<option {$selected} value=\"{$template['slug']}\">{$template['name']}</option>"; } ?> </select> <br /> <small><?php _e('The album template that will be used when the album is output to the frontend.', 'foogallery'); ?> </small> </td> </tr> <?php foreach ($available_templates as $template) { $field_visibility = $album_template !== $template['slug'] ? 'style="display:none"' : ''; $section = ''; $fields = isset($template['fields']) ? $template['fields'] : array(); foreach ($fields as $field) { //allow for the field to be altered by extensions. $field = apply_filters('foogallery_alter_gallery_template_field', $field, $album); $class = "gallery_template_field gallery_template_field-{$template['slug']} gallery_template_field-{$template['slug']}-{$field['id']}"; if (isset($field['section']) && $field['section'] !== $section) { $section = $field['section']; ?> <tr class="<?php echo $class; ?> " <?php echo $field_visibility; ?> > <td colspan="2"><h4><?php echo $section; ?> </h4></td> </tr> <?php } if (isset($field['type']) && 'help' == $field['type'] && $hide_help) { continue; //skip help if the 'hide help' setting is turned on } ?> <tr class="<?php echo $class; ?> " <?php echo $field_visibility; ?> > <?php if (isset($field['type']) && 'help' == $field['type']) { ?> <td colspan="2"> <div class="foogallery-help"> <?php echo $field['desc']; ?> </div> </td> <?php } else { ?> <th> <label for="FooGallerySettings_<?php echo $template['slug'] . '_' . $field['id']; ?> "><?php echo $field['title']; ?> </label> </th> <td> <?php do_action('foogallery_render_gallery_template_field', $field, $album, $template); ?> </td> <?php } ?> </tr> <?php } } ?> </tbody> </table> <?php }
private function should_hide_editor_button() { return 'on' == foogallery_get_setting('hide_editor_button'); }
global $current_foogallery_album; global $current_foogallery_album_arguments; $gallery = foogallery_album_get_current_gallery(); $alignment = foogallery_album_template_setting('alignment', 'alignment-left'); $foogallery = false; if (!empty($gallery)) { $foogallery = FooGallery::get_by_slug($gallery); //check to see if the gallery belongs to the album if (!$current_foogallery_album->includes_gallery($foogallery->ID)) { $foogallery = false; } } if (false !== $foogallery) { $album_url = foogallery_album_remove_gallery_from_link(); echo '<div id="' . $current_foogallery_album->slug . '" class="foogallery-album-header">'; echo '<p><a href="' . esc_url($album_url) . '">' . foogallery_get_setting('language_back_to_album_text', __('« back to album', 'foogallery')) . '</a></p>'; echo '<h2>' . $foogallery->name . '</h2>'; echo '</div>'; echo do_shortcode('[foogallery id="' . $foogallery->ID . '"]'); } else { $title_bg = foogallery_album_template_setting('title_bg', '#ffffff'); $title_font_color = foogallery_album_template_setting('title_font_color', '#000000'); $args = foogallery_album_template_setting('thumbnail_dimensions', array()); if (!empty($title_bg) || !empty($title_font_color)) { echo '<style type="text/css">'; if (!empty($title_bg)) { echo '.foogallery-album-gallery-list .foogallery-pile h3 { background: ' . $title_bg . ' !important; }'; } if (!empty($title_font_color)) { echo '.foogallery-album-gallery-list .foogallery-pile h3 { color: ' . $title_font_color . ' !important; }'; }