Exemplo n.º 1
0
 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');
     $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');
     $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');
     $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');
     //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');
     //region Thumbnail Tab
     $tabs['thumb'] = __('Thumbnails', 'foogallery');
     $settings[] = array('id' => 'thumb_jpeg_quality', 'title' => __('JPEG Quality', 'foogallery'), 'desc' => __('The image quality to be used when resizing JPEG images.', 'foogallery'), 'type' => 'text', 'default' => '80', '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
     return apply_filters('foogallery_admin_settings_override', array('tabs' => $tabs, 'sections' => array(), 'settings' => $settings));
 }
Exemplo n.º 2
0
 public function include_required_scripts()
 {
     $screen_id = foo_current_screen_id();
     //only include scripts if we on the foogallery add/edit page
     if (FOOGALLERY_CPT_GALLERY === $screen_id || 'edit-' . FOOGALLERY_CPT_GALLERY === $screen_id) {
         //spectrum needed for the colorpicker field
         $url = FOOGALLERY_URL . 'lib/spectrum/spectrum.js';
         wp_enqueue_script('foogallery-spectrum', $url, array('jquery'), FOOGALLERY_VERSION);
         $url = FOOGALLERY_URL . 'lib/spectrum/spectrum.css';
         wp_enqueue_style('foogallery-spectrum', $url, array(), FOOGALLERY_VERSION);
         //include any admin js required for the templates
         foreach (foogallery_gallery_templates() as $template) {
             $admin_js = foo_safe_get($template, 'admin_js');
             if ($admin_js) {
                 wp_enqueue_script('foogallery-gallery-admin-' . $template['slug'], $admin_js, array('jquery', 'media-upload', 'jquery-ui-sortable'), FOOGALLERY_VERSION);
             }
         }
     }
 }
Exemplo n.º 3
0
 public function gallery_template_details()
 {
     if (!empty($this->gallery_template)) {
         foreach (foogallery_gallery_templates() as $template) {
             if ($this->gallery_template == $template['slug']) {
                 return $template;
             }
         }
     }
     return false;
 }
 public function include_required_scripts()
 {
     //only include scripts if we on the foogallery page
     if (FOOGALLERY_CPT_GALLERY === foo_current_screen_post_type()) {
         //zeroclipboard needed for copy to clipboard functionality
         $url = FOOGALLERY_URL . 'lib/zeroclipboard/ZeroClipboard.min.js';
         wp_enqueue_script('foogallery-zeroclipboard', $url, array('jquery'), FOOGALLERY_VERSION);
         //spectrum needed for the colorpicker field
         $url = FOOGALLERY_URL . 'lib/spectrum/spectrum.js';
         wp_enqueue_script('foogallery-spectrum', $url, array('jquery'), FOOGALLERY_VERSION);
         $url = FOOGALLERY_URL . 'lib/spectrum/spectrum.css';
         wp_enqueue_style('foogallery-spectrum', $url, array(), FOOGALLERY_VERSION);
         //include any admin js required for the templates
         foreach (foogallery_gallery_templates() as $template) {
             $admin_js = foo_safe_get($template, 'admin_js');
             if ($admin_js) {
                 wp_enqueue_script('foogallery-gallery-admin-' . $template['slug'], $admin_js, array('jquery'), FOOGALLERY_VERSION);
             }
         }
     }
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
    $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();
    $debug_info = array(__('FooGallery version', 'foogallery') => $info['version'], __('WordPress version', 'foogallery') => $wp_version, __('Activated Theme', 'foogallery') => $current_theme['Name'], __('WordPress URL', 'foogallery') => get_site_url(), __('PHP version', 'foogallery') => phpversion(), __('PHP GD Loaded', 'foogallery') => extension_loaded('gd') && function_exists('gd_info') ? foogallery_gdversion() : __('Not found!', 'foogallery'), __('Extensions Endpoint', 'foogallery') => $api->get_extensions_endpoint(), __('Extensions Errors', 'foogallery') => $api->has_extension_loading_errors() == true ? $api->get_extension_loading_errors_response() : __('Nope, all good', 'foogallery'), __('Extensions', 'foogallery') => $extension_slugs, __('Extensions Active', 'foogallery') => array_keys($api->get_active_extensions()), __('Gallery Templates', 'foogallery') => $template_slugs, __('Lightboxes', 'foogallery') => apply_filters('foogallery_gallery_template_field_lightboxes', array()), __('Active Plugins', 'foogallery') => $plugins);
    $debug_info = apply_filters('foogallery_admin_debug_info', $debug_info);
    ?>
	<style>
		.foogallery-debug {
			width: 100%;
			font-family: "courier new";