function foogallery_settings() { if (isset($_GET['settings-updated'])) { ?> <div id="message" class="updated"> <p><strong><?php printf(__('%s settings updated.', 'foogallery'), foogallery_plugin_name()); ?> </strong></p> </div> <?php } $instance = FooGallery_Plugin::get_instance(); $instance->admin_settings_render_page(); }
$img_html = $attachment->html_img($args); $images = $gallery->image_count($no_images_text, $single_image_text, $images_text); $gallery_link = foogallery_album_build_gallery_link($current_foogallery_album, $gallery); ?> <li> <div class="foogallery-pile"> <div class="foogallery-pile-inner"> <a href="<?php echo $gallery_link; ?> "> <?php echo $img_html; ?> <?php $title = empty($gallery->name) ? sprintf(__('%s #%s', 'foogallery'), foogallery_plugin_name(), $gallery->ID) : $gallery->name; ?> <h3><?php echo $title; ?> <span><?php echo $images; ?> </span> </h3> </a> </div> </div> </li> <?php
function get_galleries_html_for_modal() { $galleries = foogallery_get_all_galleries(); ob_start(); foreach ($galleries as $gallery) { $img_src = $gallery->featured_image_src(array(200, 200)); $images = $gallery->image_count(); ?> <li class="foogallery-pile"> <div class="foogallery-gallery-select" data-foogallery-id="<?php echo $gallery->ID; ?> " style="background: url('<?php echo $img_src; ?> ') no-repeat"> <div class="foogallery-gallery-select-inner" > <?php $title = empty($gallery->name) ? sprintf(__('%s #%s', 'foogallery'), foogallery_plugin_name(), $gallery->ID) : $gallery->name; ?> <h3><?php echo $title; ?> </h3> <span><?php echo $images; ?> </span> <code>[<?php echo foogallery_gallery_shortcode_tag(); ?> id="<?php echo $gallery->ID; ?> "]</code> </div> </div> </li> <?php } ?> <li class="foogallery-pile"> <div class="foogallery-gallery-select foogallery-add-gallery"> <a href="<?php echo esc_url(foogallery_admin_add_gallery_url()); ?> " target="_blank" class="thumbnail" style="display: table;"> <span></span> <div class="foogallery-gallery-select-inner" > <h3><?php _e('Add New Gallery', 'foogallery'); ?> </h3> </div> </a> </div> </li> <?php return ob_get_clean(); }
</div> <?php } if ($has_errors) { ?> <div class="foogallery-message-error"> <p><?php _e('There was a problem loading all the public extensions! Only the default bundled extensions will be shown.', 'foogallery'); ?> </p> </div> <?php } ?> <h1><?php printf(__('%s Extensions', 'foogallery'), foogallery_plugin_name()); ?> <span class="spinner"></span></h1> <div class="foogallery-text"><?php echo $tagline; ?> </div> <?php if ($show_foobot) { ?> <div class="foogallery-badge-foobot"></div><?php } ?> <h2 class="foo-nav-tabs nav-tab-wrapper">
<h4><?php _e('Easy To Code', 'foogallery'); ?> </h4> <p><?php printf(__('We have done all the hard work to make your life easier. Creating an extension for %s can be done in a couple lines of code.', 'foogallery'), foogallery_plugin_name()); ?> </p> <h4><?php _e('Actions and Filters', 'foogallery'); ?> </h4> <p><?php printf(__('We coded %s with extensibility in mind. There are hundreds of actions and filters and helper functions to change every aspect of the plugin.', 'foogallery'), foogallery_plugin_name()); ?> </p> <h4><?php _e('Host Anywhere', 'foogallery'); ?> </h4> <p><?php _e('Host your extensions on the WordPress.org plugin repo, or GitHub, or even in your own Amazon S3 bucket. You have the power and choice!', 'foogallery'); ?> </p> </div> </div> <?php
function render_import_form($galleries = false) { if (false === $galleries) { $galleries = $this->get_galleries(); } $has_imports = get_option(self::NEXTGEN_OPTION_IMPORT_PROGRESS); $overall_progress = $this->get_overall_progress(); $all_imports_completed = 100 === $overall_progress; $import_has_started = $this->import_in_progress(); $importing = $import_has_started && defined('DOING_AJAX') && DOING_AJAX; $current_nextgen_id = get_option(self::NEXTGEN_OPTION_IMPORT_CURRENT, 0); ?> <table class="wp-list-table widefat" cellspacing="0"> <thead> <tr> <th scope="col" id="cb" class="manage-column column-cb check-column"> <?php if (!$importing && $all_imports_completed) { ?> <label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select All', 'foogallery'); ?> </label> <input id="cb-select-all-1" type="checkbox" <?php echo $importing ? 'disabled="disabled"' : ''; ?> checked="checked"> <?php } ?> </th> <th scope="col" class="manage-column"> <span><?php _e('NextGen Gallery', 'foogallery'); ?> </span> </th> <th scope="col" id="title" class="manage-column"> <span><?php printf(__('%s Name', 'foogallery'), foogallery_plugin_name()); ?> </span> </th> <th scope="col" id="title" class="manage-column"> <span><?php _e('Import Progress', 'foogallery'); ?> </span> </th> </tr> </thead> <tbody> <?php $counter = 0; foreach ($galleries as $gallery) { $counter++; $progress = $this->get_import_progress($gallery->gid); $done = $progress->is_completed(); $edit_link = ''; $foogallery = false; if ($progress->foogallery_id > 0) { $foogallery = FooGallery::get_by_id($progress->foogallery_id); if ($foogallery) { $edit_link = '<a href="' . admin_url('post.php?post=' . $progress->foogallery_id . '&action=edit') . '">' . $foogallery->name . '</a>'; } else { $done = false; } } ?> <tr class="<?php echo $counter % 2 === 0 ? 'alternate' : ''; ?> "> <?php if (!$importing && !$done && $all_imports_completed) { ?> <th scope="row" class="column-cb check-column"> <input name="nextgen-id[]" type="checkbox" checked="checked" value="<?php echo $gallery->gid; ?> "> </th> <?php } else { if ($importing && $gallery->gid == $current_nextgen_id) { ?> <th> <div class="dashicons dashicons-arrow-right"></div> </th> <?php } else { ?> <th> </th> <?php } } ?> <td> <?php echo $gallery->title . ' ' . sprintf(__('(%s images)', 'foogallery'), $gallery->image_count); ?> </td> <td> <?php if ($foogallery) { echo $edit_link; } else { ?> <input name="foogallery-name-<?php echo $gallery->gid; ?> " value="<?php echo $gallery->title; ?> "> <?php } ?> </td> <td class="nextgen-import-progress nextgen-import-progress-<?php echo $progress->status; ?> "> <?php echo $progress->message(); ?> </td> </tr> <?php } ?> </tbody> </table> <br/> <?php echo '<input type="hidden" id="nextgen_import_progress" value="' . $overall_progress . '" />'; wp_nonce_field('foogallery_nextgen_import', 'foogallery_nextgen_import'); wp_nonce_field('foogallery_nextgen_import_refresh', 'foogallery_nextgen_import_refresh', false); wp_nonce_field('foogallery_nextgen_import_cancel', 'foogallery_nextgen_import_cancel', false); wp_nonce_field('foogallery_nextgen_import_reset', 'foogallery_nextgen_import_reset', false); if (!$import_has_started && !$importing) { ?> <input type="submit" class="button button-primary start_import" value="<?php _e('Start Import', 'foogallery'); ?> "> <?php } else { if ($import_has_started && !$importing) { ?> <input type="submit" class="button button-primary continue_import" value="<?php _e('Resume Import', 'foogallery'); ?> "> <?php } else { ?> <input type="submit" class="button cancel_import" value="<?php _e('Stop Import', 'foogallery'); ?> "> <?php } } if ($has_imports && !$importing) { ?> <input type="submit" name="foogallery_nextgen_reset" class="button reset_import" value="<?php _e('Reset All Gallery Imports', 'foogallery'); ?> "> <?php } ?> <div id="import_spinner" style="width:20px"> <span class="spinner"></span> </div> <?php if ($importing) { ?> <div class="nextgen-import-progressbar"> <span style="width:<?php echo $overall_progress; ?> %"></span> </div> <?php echo intval($overall_progress); ?> % <div style="width:20px; display: inline-block;"> <span class="spinner shown"></span> </div> <?php } }
?> <div class="foogallery-help"> <?php _e('Importing galleries is really simple:', 'foogallery'); ?> <ol> <li><?php printf(__('Choose the NextGen galleries you want to import into %s by checking their checkboxes.', 'foogallery'), foogallery_plugin_name()); ?> </li> <li><?php _e('Click the Start Import button to start the import process.', 'foogallery'); ?> </li> <li><?php printf(__('Once a gallery is imported, you can click on the link under the %s Name column to edit the gallery.', 'foogallery'), foogallery_plugin_name()); ?> </li> </ol> <?php _e('Please note: importing large galleries with lots of images can take a while!', 'foogallery'); ?> </div> <form id="nextgen_import_form" method="POST"> <?php $nextgen->render_import_form($galleries); ?> </form> <?php }
function alter_gallery_template_field($field, $gallery) { if ($field) { switch ($field['type']) { case 'thumb_link': $field['type'] = 'radio'; $field['choices'] = $this->get_thumb_link_field_choices(); break; case 'lightbox': $field['lightbox'] = true; $lightboxes = $this->get_lightbox_field_choices(); if (1 === count($lightboxes) && array_key_exists('none', $lightboxes)) { $field['type'] = 'html'; $field['desc'] = '<strong>' . __('You have no lightbox extensions activated!', 'foogallery') . '</strong><br />'; $api = new FooGallery_Extensions_API(); if ($api->is_downloaded(false, FOOGALLERY_FOOBOX_FREE_EXTENSION_SLUG)) { //just need to activate it $foobox_install_link = foogallery_build_admin_menu_url(array('page' => 'foogallery-extensions', 'extension' => FOOGALLERY_FOOBOX_FREE_EXTENSION_SLUG, 'action' => 'activate')); $field['desc'] .= '<a target="_blank" href="' . esc_url($foobox_install_link) . '">' . __('Activate FooBox FREE right now!', 'foogallery') . '</a>'; } else { //we need to download it $foobox_install_link = foogallery_build_admin_menu_url(array('page' => 'foogallery-extensions', 'extension' => FOOGALLERY_FOOBOX_FREE_EXTENSION_SLUG, 'action' => 'download')); $foobox_install_html = '<a target="_blank" href="' . esc_url($foobox_install_link) . '">' . __('Download and activate FooBox FREE', 'foogallery') . '</a>'; $field['desc'] .= sprintf(__('%s which works flawlessly with %s.', 'foogallery'), $foobox_install_html, foogallery_plugin_name()); } } else { $field['type'] = 'select'; $field['choices'] = $lightboxes; } break; } if (isset($field['help']) && $field['help']) { $field['type'] = 'help'; } } return $field; }
function register() { //allow extensions to override the gallery post type $args = apply_filters('foogallery_gallery_posttype_register_args', array('labels' => array('name' => __('Galleries', 'foogallery'), 'singular_name' => __('Gallery', 'foogallery'), 'add_new' => __('Add Gallery', 'foogallery'), 'add_new_item' => __('Add New Gallery', 'foogallery'), 'edit_item' => __('Edit Gallery', 'foogallery'), 'new_item' => __('New Gallery', 'foogallery'), 'view_item' => __('View Gallery', 'foogallery'), 'search_items' => __('Search Galleries', 'foogallery'), 'not_found' => __('No Galleries found', 'foogallery'), 'not_found_in_trash' => __('No Galleries found in Trash', 'foogallery'), 'menu_name' => foogallery_plugin_name(), 'all_items' => __('Galleries', 'foogallery')), 'hierarchical' => false, 'public' => false, 'rewrite' => false, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => 'dashicons-format-gallery', 'supports' => array('title', 'thumbnail'))); register_post_type(FOOGALLERY_CPT_GALLERY, $args); }
function create_settings() { //region General Tab $tabs['general'] = __('General', 'foogallery'); $gallery_templates = foogallery_gallery_templates(); $gallery_templates_choices = array(); foreach ($gallery_templates as $template) { $gallery_templates_choices[$template['slug']] = $template['name']; } $settings[] = array('id' => 'gallery_template', 'title' => __('Default Gallery Template', 'foogallery'), 'desc' => __('The default gallery template to use for new galleries', 'foogallery'), 'default' => foogallery_get_default('gallery_template'), 'type' => 'select', 'choices' => $gallery_templates_choices, 'tab' => 'general', 'section' => __('Gallery Defaults', 'foogallery')); $settings[] = array('id' => 'gallery_sorting', 'title' => __('Default Gallery Sorting', 'foogallery'), 'desc' => __('The default attachment sorting to use for new galleries', 'foogallery'), 'default' => '', 'type' => 'select', 'choices' => foogallery_sorting_options(), 'tab' => 'general', 'section' => __('Gallery Defaults', 'foogallery')); $galleries = foogallery_get_all_galleries(); $gallery_choices = array(); foreach ($galleries as $gallery) { $gallery_choices[$gallery->ID] = $gallery->name; } $settings[] = array('id' => 'default_gallery_settings', 'title' => __('Default Gallery Settings', 'foogallery'), 'desc' => __('When creating a new gallery, it can use the settings from an existing gallery as the default settings. This will save you time when creating many galleries that all have the same look and feel.', 'foogallery'), 'type' => 'select', 'choices' => $gallery_choices, 'tab' => 'general', 'section' => __('Gallery Defaults', 'foogallery')); $settings[] = array('id' => 'hide_gallery_template_help', 'title' => __('Hide Gallery Template Help', 'foogallery'), 'desc' => __('Some gallery templates show helpful tips, which are useful for new users. You can choose to hide these tips.', 'foogallery'), 'type' => 'checkbox', 'tab' => 'general', 'section' => __('Admin', 'foogallery')); $settings[] = array('id' => 'hide_editor_button', 'title' => __('Hide WYSIWYG Editor Button', 'foogallery'), 'desc' => sprintf(__('If enabled, this will hide the "Add %s" button in the WYSIWYG editor.', 'foogallery'), foogallery_plugin_name()), 'type' => 'checkbox', 'tab' => 'general', 'section' => __('Admin', 'foogallery')); //endregion General //region Extensions Tab $tabs['extensions'] = __('Extensions', 'foogallery'); $settings[] = array('id' => 'use_future_endpoint', 'title' => __('Use Beta Endpoint', 'foogallery'), 'desc' => __('The list of available extensions are pulled from an external URL. You can also pull from a "beta" endpoint which will sometimes contain beta extensions that are not publicly available.', 'foogallery'), 'type' => 'checkbox', 'tab' => 'extensions'); //endregion Extensions Tab //region Images Tab $tabs['thumb'] = __('Images', 'foogallery'); $settings[] = array('id' => 'thumb_jpeg_quality', 'title' => __('Thumbnail JPEG Quality', 'foogallery'), 'desc' => __('The image quality to be used when resizing JPEG images.', 'foogallery'), 'type' => 'text', 'default' => '80', 'tab' => 'thumb'); $settings[] = array('id' => 'clear_css_optimizations', 'title' => __('Clear CSS Cache', 'foogallery'), 'desc' => sprintf(__('%s optimizes the way it loads gallery stylesheets to improve page performance. This can lead to the incorrect CSS being loaded in some cases. Use this button to clear all the CSS optimizations that have been cached across all galleries.', 'foogallery'), foogallery_plugin_name()), 'type' => 'clear_optimization_button', 'tab' => 'thumb'); $settings[] = array('id' => 'thumb_resize_animations', 'title' => __('Resize Animated GIFs', 'foogallery'), 'desc' => __('Should animated gifs be resized or not. If enabled, only the first frame is used in the resize.', 'foogallery'), 'type' => 'checkbox', 'tab' => 'thumb'); //endregion Thumbnail Tab // //region Advanced Tab // $tabs['advanced'] = __( 'Advanced', 'foogallery' ); // // $example_url = '<code>' . trailingslashit( site_url() ) . foogallery_permalink() . '/my-cool-gallery</code>'; // // $settings[] = array( // 'id' => 'gallery_permalinks_enabled', // 'title' => __( 'Enable Friendly URL\'s', 'foogallery' ), // 'desc' => sprintf( __( 'If enabled, you will be able to access your galleries from a friendly URL e.g. %s', 'foogallery' ), $example_url ), // 'default' => foogallery_get_default( 'gallery_permalinks_enabled' ), // 'type' => 'checkbox', // 'tab' => 'advanced', // ); // // $settings[] = array( // 'id' => 'gallery_permalink', // 'title' => __( 'Gallery Permalink', 'foogallery' ), // 'desc' => __( 'If friendly URL\'s are enabled, this is used in building up a friendly URL', 'foogallery' ), // 'default' => foogallery_get_default( 'gallery_permalink' ), // 'type' => 'text', // 'tab' => 'advanced', // ); // //endregion Advanced //region Language Tab $tabs['language'] = __('Language', 'foogallery'); $settings[] = array('id' => 'language_images_count_none_text', 'title' => __('Image Count None Text', 'foogallery'), 'type' => 'text', 'default' => __('No images', 'foogallery'), 'tab' => 'language'); $settings[] = array('id' => 'language_images_count_single_text', 'title' => __('Image Count Single Text', 'foogallery'), 'type' => 'text', 'default' => __('1 image', 'foogallery'), 'tab' => 'language'); $settings[] = array('id' => 'language_images_count_plural_text', 'title' => __('Image Count Many Text', 'foogallery'), 'type' => 'text', 'default' => __('%s images', 'foogallery'), 'tab' => 'language'); //endregion Language Tab return apply_filters('foogallery_admin_settings_override', array('tabs' => $tabs, 'sections' => array(), 'settings' => $settings)); }
public function render_gallery_metabox($post) { $album = $this->get_album($post); $galleries = $this->get_ordered_galleries($album); ?> <input type="hidden" name="<?php echo FOOGALLERY_CPT_ALBUM; ?> _nonce" id="<?php echo FOOGALLERY_CPT_ALBUM; ?> _nonce" value="<?php echo wp_create_nonce(plugin_basename(FOOGALLERY_FILE)); ?> "/> <input type="hidden" name='foogallery_album_galleries' id="foogallery_album_galleries" value="<?php echo $album->gallery_id_csv(); ?> "/> <div> <ul class="foogallery-album-gallery-list"> <?php foreach ($galleries as $gallery) { $img_src = $gallery->featured_image_src(array(150, 150)); $images = $gallery->image_count(); $selected = $album->includes_gallery($gallery->ID) ? ' selected' : ''; ?> <li class="foogallery-pile"> <div class="foogallery-gallery-select attachment-preview landscape<?php echo $selected; ?> " data-foogallery-id="<?php echo $gallery->ID; ?> "> <div class="thumbnail" style="display: table;"> <div style="display: table-cell; vertical-align: middle; text-align: center;"> <img src="<?php echo $img_src; ?> "/> <?php $title = empty($gallery->name) ? sprintf(__('%s #%s', 'foogallery'), foogallery_plugin_name(), $gallery->ID) : $gallery->name; ?> <h3><?php echo $title; ?> <span><?php echo $images; ?> </span> </h3> </div> </div> </div> </li> <?php } ?> </ul> <div style="clear: both;"></div> </div> <?php }
public function get_custom_fields() { $target_options = apply_filters('foogallery_attachment_field_custom_target_options', array('default' => __('Default', 'foogallery'), '_blank' => __('New tab (_blank)', 'foogallery'), '_self' => __('Same tab (_self)', 'foogallery'), 'foobox' => __('FooBox', 'foogallery'))); $fields = array('foogallery_custom_url' => array('label' => sprintf(__('%s Custom URL', 'foogallery'), foogallery_plugin_name()), 'input' => 'text', 'helps' => __('Point your attachment to a custom URL', 'foogallery'), 'exclusions' => array('audio', 'video')), 'foogallery_custom_target' => array('label' => sprintf(__('%s Custom Target', 'foogallery'), foogallery_plugin_name()), 'input' => 'select', 'helps' => __('Set a custom target for your attachment', 'foogallery'), 'exclusions' => array('audio', 'video'), 'options' => $target_options)); return apply_filters('foogallery_attachment_custom_fields', $fields); }
function show_nextgen_import_help() { ?> <div class="changelog"> <div class="feature-section"> <img src="<?php echo FOOGALLERY_URL . 'assets/screenshots/admin-nextgen-import.jpg'; ?> " class="foogallery-help-screenshot"/> <h2><?php _e('Import Your NextGen Galleries', 'foogallery'); ?> </h2> <h4><?php _e('Import Galleries', 'foogallery'); ?> </h4> <p><?php printf(__('Import all your NextGen galleries in a single click, or choose the galleries you would like to migrate over to %s.', 'foogallery'), foogallery_plugin_name()); ?> </p> <h4><?php _e('Import Images', 'foogallery'); ?> </h4> <p><?php _e('NextGen gallery images are imported into your WordPress media library, where they should be!', 'foogallery'); ?> </p> </div> </div> <?php }
return '?'; } // ...otherwise use phpinfo(). ob_start(); phpinfo(8); $info = ob_get_contents(); ob_end_clean(); $info = stristr($info, 'gd version'); preg_match('/\\d/', $info, $match); return $match[0]; } if (current_user_can('activate_plugins')) { $instance = FooGallery_Plugin::get_instance(); $info = $instance->get_plugin_info(); $title = apply_filters('foogallery_admin_systeminfo_title', sprintf(__('%s System Information', 'foogallery'), foogallery_plugin_name())); $support_text = apply_filters('foogallery_admin_systeminfo_supporttext', sprintf(__('Below is some information about your server configuration. You can use this info to help debug issues you may have with %s.'), foogallery_plugin_name())); $api = new FooGallery_Extensions_API(); //clear any extenasion cache $api->clear_cached_extensions(); $extension_slugs = $api->get_all_slugs(); //get all gallery templates $template_slugs = array(); foreach (foogallery_gallery_templates() as $template) { $template_slugs[] = $template['slug']; } //get all activated plugins $plugins = array(); foreach (get_option('active_plugins') as $plugin_slug => $plugin) { $plugins[] = $plugin; } $current_theme = wp_get_theme();