Open Journal Systems
3.3.0
|
Public Member Functions | |
_getBaseDir ($path='') | |
_getBaseUrl ($path='') | |
_registerScripts () | |
addMenuArea ($menuAreas) | |
addOption ($name, $type, $args=array()) | |
addScript ($name, $script, $args=array()) | |
addStyle ($name, $style, $args=array()) | |
getMenuAreas ($existingAreas=array()) | |
getOption ($name) | |
getOptionConfig ($name) | |
getOptionsConfig () | |
getOptionValues ($contextId) | |
& | getScript ($name) |
& | getStyle ($name) |
init () | |
initAfter () | |
isActive () | |
isColourDark ($color, $limit=130) | |
modifyOptionsConfig ($name, $args=array()) | |
modifyScript ($name, $args=array()) | |
modifyStyle ($name, $args=array()) | |
register ($category, $path, $mainContextId=null) | |
removeMenuArea ($menuArea) | |
removeOption ($name) | |
removeScript ($name) | |
removeStyle ($name) | |
saveOption ($name, $value, $contextId=null) | |
setParent ($parent) | |
themeRegistered ($themes) | |
validateOptions ($options, $themePluginPath, $contextId, $request) | |
Public Member Functions inherited from LazyLoadPlugin | |
getCanDisable () | |
getCanEnable () | |
getCurrentContextId () | |
getEnabled ($contextId=null) | |
getName () | |
setEnabled ($enabled) | |
Public Member Functions inherited from Plugin | |
__construct () | |
_overridePluginTemplates ($hookName, $args) | |
addLocaleData ($locale=null) | |
getActions ($request, $actionArgs) | |
getCategory () | |
getContextSpecificPluginSettingsFile () | |
getCurrentVersion () | |
getDescription () | |
getDirName () | |
getDisplayName () | |
getEnabled () | |
getHideManagement () | |
getInstallControlledVocabFiles () | |
getInstallDataFile () | |
getInstallEmailTemplateDataFile () | |
getInstallEmailTemplatesFile () | |
getInstallFilterConfigFiles () | |
getInstallMigration () | |
getInstallSchemaFile () | |
getInstallSitePluginSettingsFile () | |
getLocaleFilename ($locale) | |
getPluginPath () | |
& | getRequest () |
getSeq () | |
getSetting ($contextId, $name) | |
getTemplatePath ($inCore=false) | |
getTemplateResource ($template=null, $inCore=false) | |
import ($class) | |
installContextSpecificSettings ($hookName, $args) | |
installControlledVocabs ($hookName, $args) | |
installData ($hookName, $args) | |
installEmailTemplateData ($hookName, $args) | |
installEmailTemplates ($hookName, $args) | |
installFilters ($hookName, $args) | |
installLocale ($hookName, $args) | |
installSiteSettings ($hookName, $args) | |
isSitePlugin () | |
manage ($args, $request) | |
smartyPluginUrl ($params, $smarty) | |
updateSchema ($hookName, $args) | |
updateSetting ($contextId, $name, $value, $type=null) | |
Data Fields | |
$menuAreas = array() | |
$options = array() | |
$parent | |
$scripts = array() | |
$styles = array() | |
Data Fields inherited from Plugin | |
$pluginCategory | |
$pluginPath | |
$request | |
Protected Attributes | |
$_optionValues = null | |
Additional Inherited Members | |
Protected Member Functions inherited from Plugin | |
_registerTemplateResource ($inCore=false) | |
Abstract class for theme plugins.
Definition at line 21 of file ThemePlugin.inc.php.
ThemePlugin::_getBaseDir | ( | $path = '' | ) |
Get the base path to be used for file references
$path | string An optional path to append to the base |
Definition at line 827 of file ThemePlugin.inc.php.
References Core\getBaseDir().
Referenced by addStyle(), and modifyStyle().
ThemePlugin::_getBaseUrl | ( | $path = '' | ) |
Get the base URL to be used for file paths
A base URL for loading LESS/CSS/JS files in <link> elements. It will also be set to the @baseUrl variable before LESS files are compiloed so that images and fonts can be located.
$path | string An optional path to append to the base |
Definition at line 815 of file ThemePlugin.inc.php.
References PKPApplication\get().
Referenced by addScript(), addStyle(), modifyScript(), and modifyStyle().
ThemePlugin::_registerScripts | ( | ) |
Register script assets
Passes scripts defined by the theme to the template manager for handling.
Definition at line 789 of file ThemePlugin.inc.php.
References PKPApplication\get(), and PKPTemplateManager\getManager().
Referenced by initAfter().
ThemePlugin::addMenuArea | ( | $menuAreas | ) |
Register a navigation menu area for this theme
$menuAreas | string|array One or more menu area names |
Definition at line 662 of file ThemePlugin.inc.php.
Referenced by ImmersionThemePlugin\init(), HealthSciencesThemePlugin\init(), BootstrapThreeThemePlugin\init(), CriticalTimesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::addOption | ( | $name, | |
$type, | |||
$args = array() |
|||
) |
Add a theme option
Theme options are added programmatically to the Settings > Website > Appearance form when this theme is activated. Common options are colour and typography selectors.
$name | string Unique name for this setting |
$type | string One of the Field* class names |
$args | array Optional parameters defining this setting. Some setting types may accept or require additional arguments. label string Locale key for a label for this field. description string Locale key for a description for this field. default mixed A default value. Default: '' |
Definition at line 393 of file ThemePlugin.inc.php.
References $options, and Plugin\getDisplayName().
Referenced by ImmersionThemePlugin\init(), HealthSciencesThemePlugin\init(), BootstrapThreeThemePlugin\init(), CriticalTimesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::addScript | ( | $name, | |
$script, | |||
$args = array() |
|||
) |
Add a script to load with this theme
$name | string A name for this script |
$script | string The script to be included. Should be path relative to the theme or, if the inline argument is included, script data to be output. |
$args | array Optional arguments hash. Supported args: context string Whether to load this on the frontend or backend . default: frontend priority int Controls order in which scripts are printed default: STYLE_SEQUENCE_NORMAL inline bool Whether the $script value should be output directly as script data. Used to pass backend data to the scripts. |
Definition at line 304 of file ThemePlugin.inc.php.
References _getBaseUrl().
Referenced by ImmersionThemePlugin\init(), HealthSciencesThemePlugin\init(), BootstrapThreeThemePlugin\init(), CriticalTimesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::addStyle | ( | $name, | |
$style, | |||
$args = array() |
|||
) |
Add a stylesheet to load with this theme
Style paths with a .less extension will be compiled and redirected to the compiled file.
$name | string A name for this stylesheet |
$style | string The stylesheet. Should be a path relative to the theme directory or, if the inline argument is included, style data to be output. |
$args | array Optional arguments hash. Supported args: 'context': Whether to load this on the frontend or backend . default: frontend 'priority': Controls order in which styles are printed 'addLess': Additional LESS files to process before compiling. Array 'addLessVariables': A string containing additional LESS variables to parse before compiling. Example: "@bg:#000;" inline bool Whether the $style value should be output directly as style data. |
Definition at line 191 of file ThemePlugin.inc.php.
References _getBaseDir(), and _getBaseUrl().
Referenced by ImmersionThemePlugin\init(), HealthSciencesThemePlugin\init(), BootstrapThreeThemePlugin\init(), CriticalTimesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::getMenuAreas | ( | $existingAreas = array() | ) |
Get all menu areas registered by this theme and any parents
$existingAreas | array Any existing menu areas from child themes |
Definition at line 694 of file ThemePlugin.inc.php.
ThemePlugin::getOption | ( | $name | ) |
Get the value of an option or default if the option is not set
$name | string The name of the option value to retrieve |
Definition at line 454 of file ThemePlugin.inc.php.
References PKPApplication\get(), and getOptionValues().
Referenced by ImmersionThemePlugin\addIssueTemplateData(), CriticalTimesThemePlugin\getAuthorString(), CriticalTimesThemePlugin\getTranslatorString(), ImmersionThemePlugin\homepageAnnouncements(), ImmersionThemePlugin\homepageJournalDescription(), BootstrapThreeThemePlugin\init(), HealthSciencesThemePlugin\init(), DefaultThemePlugin\init(), CriticalTimesThemePlugin\loadSpotlightTemplateData(), and modifyOptionsConfig().
ThemePlugin::getOptionConfig | ( | $name | ) |
Get an option's configuration settings
This retrives option settings for any option attached to this theme or any parent theme.
$name | The name of the option config to retrieve |
Definition at line 491 of file ThemePlugin.inc.php.
ThemePlugin::getOptionsConfig | ( | ) |
Get all options' configuration settings.
This retrieves a single array containing options settings for this theme and any parent themes.
Definition at line 508 of file ThemePlugin.inc.php.
References $options.
ThemePlugin::getOptionValues | ( | $contextId | ) |
Get all option values
This retrieves a single array containing option values for this theme and any parent themes.
$contextId | int |
Definition at line 564 of file ThemePlugin.inc.php.
References DAORegistry\getDAO().
Referenced by getOption().
& ThemePlugin::getScript | ( | $name | ) |
Get a script from this theme or any parent theme
$name | string The name of the script to retrieve |
Definition at line 362 of file ThemePlugin.inc.php.
Referenced by modifyScript().
& ThemePlugin::getStyle | ( | $name | ) |
Get a style from this theme or any parent theme
$name | string The name of the style to retrieve |
Definition at line 272 of file ThemePlugin.inc.php.
Referenced by modifyStyle().
|
abstract |
The primary method themes should use to add styles, scripts and fonts, or register hooks. This method is only fired for the currently active theme.
Reimplemented in DefaultThemePlugin, CriticalTimesThemePlugin, HealthSciencesThemePlugin, BootstrapThreeThemePlugin, and ImmersionThemePlugin.
Referenced by themeRegistered().
ThemePlugin::initAfter | ( | ) |
Perform actions after the theme has been initialized
Registers templates, styles and scripts that have been added by the theme or any parent themes
Definition at line 142 of file ThemePlugin.inc.php.
References _registerScripts().
ThemePlugin::isActive | ( | ) |
Determine whether or not this plugin is currently active
This only returns true if the theme is currently the selected theme in a given context. Use self::getEnabled() if you want to know if the theme is available for use on the site.
Reimplemented in DefaultThemePlugin.
Definition at line 157 of file ThemePlugin.inc.php.
References Plugin\$request, PKPApplication\get(), and Plugin\getPluginPath().
Referenced by register().
ThemePlugin::isColourDark | ( | $color, | |
$limit = 130 |
|||
) |
Check if the passed colour is dark
This is a utility function to determine the darkness of a hex colour. This is designed to be used in theme colour options, so that text can be adjusted to ensure it's readable on light or dark backgrounds. You can specify the brightness threshold by passing in a $limit value. Higher values are brighter.
Based on: http://stackoverflow.com/a/8468448/1723499
Definition at line 845 of file ThemePlugin.inc.php.
Referenced by ImmersionThemePlugin\addIssueTemplateData(), ImmersionThemePlugin\homepageAnnouncements(), ImmersionThemePlugin\homepageJournalDescription(), HealthSciencesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::modifyOptionsConfig | ( | $name, | |
$args = array() |
|||
) |
Modify option configuration settings
$name | The name of the option config to retrieve |
$args | The new configuration settings for this option |
Definition at line 530 of file ThemePlugin.inc.php.
References getOption().
ThemePlugin::modifyScript | ( | $name, | |
$args = array() |
|||
) |
Modify the params of an existing script
$name | string The name of the script to modify |
$args | array Parameters to modify. |
Definition at line 325 of file ThemePlugin.inc.php.
References _getBaseUrl(), and getScript().
ThemePlugin::modifyStyle | ( | $name, | |
$args = array() |
|||
) |
Modify the params of an existing stylesheet
$name | string The name of the stylesheet to modify |
$args | array Parameters to modify. |
Definition at line 229 of file ThemePlugin.inc.php.
References _getBaseDir(), _getBaseUrl(), and getStyle().
Referenced by HealthSciencesThemePlugin\init(), and DefaultThemePlugin\init().
ThemePlugin::register | ( | $category, | |
$path, | |||
$mainContextId = null |
|||
) |
Load and initialize the plug-in and register plugin hooks.
For backwards compatibility this method will be called whenever the plug-in's category is being loaded. If, however, registerOn() returns an array then this method will only be called when the plug-in is enabled and an entry in the result set of registerOn() matches the current request operation. An empty array matches all request operations.
$category | String Name of category plugin was registered to |
$path | String The path the plugin was found in |
$mainContextId | integer To identify if the plugin is enabled we need a context. This context is usually taken from the request but sometimes there is no context in the request (e.g. when executing CLI commands). Then the main context can be given as an explicit ID. |
Reimplemented from LazyLoadPlugin.
Definition at line 90 of file ThemePlugin.inc.php.
References isActive(), and HookRegistry\register().
ThemePlugin::removeMenuArea | ( | $menuArea | ) |
Remove a registered navigation menu area
$menuArea | string The menu area to remove |
Definition at line 677 of file ThemePlugin.inc.php.
ThemePlugin::removeOption | ( | $name | ) |
Remove an option
$name | The name of the option to remove |
Definition at line 545 of file ThemePlugin.inc.php.
ThemePlugin::removeScript | ( | $name | ) |
Remove a registered script
$name | string The name of the script to remove |
Definition at line 346 of file ThemePlugin.inc.php.
ThemePlugin::removeStyle | ( | $name | ) |
Remove a registered stylesheet
$name | string The name of the stylesheet to remove |
Definition at line 256 of file ThemePlugin.inc.php.
ThemePlugin::saveOption | ( | $name, | |
$value, | |||
$contextId = null |
|||
) |
Sanitize and save a theme option
$name | string A unique id for the option to save |
$value | mixed The new value to save |
$contextId | int Optional context id. Defaults to the current context |
Definition at line 631 of file ThemePlugin.inc.php.
References PKPApplication\get(), and DAORegistry\getDAO().
ThemePlugin::setParent | ( | $parent | ) |
Set a parent theme for this theme
$parent | string Key in the plugin registry for the parent theme |
Definition at line 707 of file ThemePlugin.inc.php.
References PluginRegistry\getPlugin().
ThemePlugin::themeRegistered | ( | $themes | ) |
Fire the init() method when a theme is registered
$themes | array List of all loaded themes |
Definition at line 116 of file ThemePlugin.inc.php.
References init().
ThemePlugin::validateOptions | ( | $options, | |
$themePluginPath, | |||
$contextId, | |||
$request | |||
) |
Overwrite this function to perform any validation on options before they are saved
If this is a child theme, you must call $this->parent->validateOptions() to perform any validation defined on the parent theme.
$options | array Key/value list of options to validate |
$themePluginPath | string The theme these options are for |
$contextId | int The context these theme options are for, or CONTEXT_ID_NONE for the site-wide settings. |
$request | Request |
Definition at line 619 of file ThemePlugin.inc.php.
|
protected |
Stored reference to option values
A null value indicates that no lookup has occured. If no options are set, the lookup will assign an empty array.
null|array;
Definition at line 85 of file ThemePlugin.inc.php.
$menuAreas ThemePlugin::$menuAreas = array() |
$options ThemePlugin::$options = array() |
Theme-specific options
array;
Definition at line 52 of file ThemePlugin.inc.php.
Referenced by addOption(), getOptionsConfig(), and CriticalTimesThemePlugin\init().
$parent ThemePlugin::$parent |
$scripts ThemePlugin::$scripts = array() |
Collection of scripts
array
Definition at line 42 of file ThemePlugin.inc.php.
$styles ThemePlugin::$styles = array() |
Collection of styles
array
Definition at line 31 of file ThemePlugin.inc.php.