Esempio n. 1
0
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof FooGallery_Plugin) {
         self::$instance = new FooGallery_Plugin();
     }
     return self::$instance;
 }
 /**
  * Adds a gallery insert button into the editor
  *
  * @param string $buttons the existing media buttons
  *
  * @return string $buttons    the amended media buttons
  */
 public function add_media_button($buttons)
 {
     //render the gallery modal
     add_action('admin_footer', array($this, 'render_gallery_modal'));
     $foogallery = FooGallery_Plugin::get_instance();
     $foogallery->register_and_enqueue_js('admin-foogallery-editor.js');
     $buttons .= '<a href="#" class="button foogallery-modal-trigger" title="' . esc_attr(sprintf(__('Add Gallery From %s', 'foogallery'), foogallery_plugin_name())) . '" style="padding-left: .4em;">';
     $buttons .= '<span class="wp-media-buttons-icon dashicons dashicons-format-gallery"></span> ' . sprintf(__('Add %s', 'foogallery'), foogallery_plugin_name()) . '</a>';
     return $buttons;
 }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 function admin_print_scripts()
 {
     $page = safe_get_from_request('page');
     $foogallery = FooGallery_Plugin::get_instance();
     $foogallery->register_and_enqueue_js('admin-page-' . $page . '.js');
 }
/**
 * Return the FooGallery saved setting, or a default value
 *
 * @param string $key The key for the setting
 *
 * @param bool $default The default if no value is saved or found
 *
 * @return mixed
 */
function foogallery_get_setting($key, $default = false)
{
    $foogallery = FooGallery_Plugin::get_instance();
    return $foogallery->options()->get($key, foogallery_get_default($key, $default));
}
Esempio n. 6
0
<?php

$instance = FooGallery_Plugin::get_instance();
$api = new FooGallery_Extensions_API();
$extensions = $api->get_all();
$has_errors = $api->has_extension_loading_errors();
$categories = $api->get_all_categories();
$show_message = safe_get_from_request('show_message');
if ('yes' === $show_message) {
    $result = get_transient(FOOGALLERY_EXTENSIONS_MESSAGE_TRANSIENT_KEY);
}
$tagline = apply_filters('foogallery_admin_extensions_tagline', sprintf(__('Extensions make %s even more awesome, without bloating the core plugin.', 'foogallery'), foogallery_plugin_name()));
$show_foobot = apply_filters('foogallery_admin_show_foobot', true);
?>
<style>
	.foogallery-badge-foobot {
		position: absolute;
		top: 5px;
		right: 0;
		background: url(<?php 
echo FOOGALLERY_URL;
?>
assets/foobot_small.png) no-repeat;
		width: 82px;
		height: 150px;
		z-index: 100;
	}
	.foogallery-text {
		font-size: 18px;
		margin: 10px 0;
	}
    $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();
    $foogallery = FooGallery_Plugin::get_instance();
    $settings = $foogallery->options()->get_all();
    $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()), __('Settings', 'foogallery') => $settings, __('Active Plugins', 'foogallery') => $plugins);
    $debug_info = apply_filters('foogallery_admin_debug_info', $debug_info);
    ?>
	<style>
		.foogallery-debug {
			width: 100%;
			font-family: "courier new";
			height: 500px;
		}
	</style>
	<div class="wrap about-wrap">
		<h1><?php 
    echo $title;
    ?>