/** * Enqueues a stylesheet based on the stylesheet's name. This can either be a default stylesheet or a custom one. * If the name parameter is left unset, the default stylesheet will be used. * * Returns the name and version number of the stylesheet that's been enqueued, as this can be different from the * name passed. This can be this case if a stylesheet does not exist and a default stylesheet is enqueued. * * @param string $name (optional, defaults to null) * @return array [$name, $version] */ public static function enqueueStylesheet($name = null) { $enqueueDynamicStylesheet = true; $version = SlideshowPluginMain::$version; if (isset($name)) { // Try to get the custom style's version $customStyle = get_option($name, false); $customStyleVersion = false; if ($customStyle) { $customStyleVersion = get_option($name . '_version', false); } // Style name and version if ($customStyle && $customStyleVersion) { $version = $customStyleVersion; } else { $enqueueDynamicStylesheet = false; $name = str_replace('.css', '', $name); } } else { $enqueueDynamicStylesheet = false; $name = 'style-light'; } // Enqueue stylesheet if (SlideshowPluginGeneralSettings::getStylesheetLocation() == 'footer') { add_filter('style_loader_tag', array(__CLASS__, 'filterStyleLoaderTag'), 10, 3); if ($enqueueDynamicStylesheet) { wp_enqueue_style('slideshow-jquery-image-gallery-ajax-stylesheet_' . $name, admin_url('admin-ajax.php?action=slideshow_jquery_image_gallery_load_stylesheet&style=' . $name, 'admin'), array(), $version); } else { wp_enqueue_style('slideshow-jquery-image-gallery-stylesheet_' . $name, SlideshowPluginMain::getPluginUrl() . '/css/' . $name . '.css', array(), $version); } } return array($name, $version); }
/** * Enqueue stylesheet */ public static function enqueueFrontendStylesheets() { if (SlideshowPluginGeneralSettings::getStylesheetLocation() === 'head') { // Register functional stylesheet wp_enqueue_style('slideshow-jquery-image-gallery-stylesheet_functional', SlideshowPluginMain::getPluginUrl() . '/style/SlideshowPlugin/functional.css', array(), SlideshowPluginMain::$version); // Get default and custom stylesheets $stylesheets = SlideshowPluginGeneralSettings::getStylesheets(true, true); $defaultStylesheets = $stylesheets['default']; $customStylesheets = $stylesheets['custom']; // Clean the '.css' extension from the default stylesheets foreach ($defaultStylesheets as $defaultStylesheetKey => $defaultStylesheetValue) { $newDefaultStylesheetKey = str_replace('.css', '', $defaultStylesheetKey); $defaultStylesheets[$newDefaultStylesheetKey] = $defaultStylesheetValue; if ($defaultStylesheetKey !== $newDefaultStylesheetKey) { unset($defaultStylesheets[$defaultStylesheetKey]); } } // Enqueue stylesheets foreach (array_merge($defaultStylesheets, $customStylesheets) as $stylesheetKey => $stylesheetValue) { wp_enqueue_style('slideshow-jquery-image-gallery-ajax-stylesheet_' . $stylesheetKey, admin_url('admin-ajax.php?action=slideshow_jquery_image_gallery_load_stylesheet&style=' . $stylesheetKey, 'admin'), array(), $stylesheetValue['version']); } self::$allStylesheetsRegistered = true; } }
<?php // General settings $stylesheetLocation = SlideshowPluginGeneralSettings::getStylesheetLocation(); // Roles global $wp_roles; // Capabilities $capabilities = array(SlideshowPluginGeneralSettings::$capabilities['addSlideshows'] => __('Add slideshows', 'slideshow-plugin'), SlideshowPluginGeneralSettings::$capabilities['editSlideshows'] => __('Edit slideshows', 'slideshow-plugin'), SlideshowPluginGeneralSettings::$capabilities['deleteSlideshows'] => __('Delete slideshows', 'slideshow-plugin')); ?> <div class="general-settings-tab feature-filter"> <h4><?php _e('User Capabilities', 'slideshow-plugin'); ?> </h4> <p><?php _e('Select the user roles that will able to perform certain actions.', 'slideshow-plugin'); ?> </p> <table> <?php foreach ($capabilities as $capability => $capabilityName) { ?> <tr valign="top"> <th><?php echo $capabilityName;