make $serendipity['capabilities'][*] variables work
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
Version 2.0-beta4 / RC? ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Change name and fix $serendipity['capabilities']['jquery_noConflictMode']
|
||||
|
||||
* Fix bug in entry listing, which showed wrong categories for
|
||||
entries (Issue #201)
|
||||
|
||||
@ -97,7 +99,7 @@ Version 2.0-beta3 (July 25th, 2014)
|
||||
to older plugins.
|
||||
This mode is now considered deprecated and will be removed in
|
||||
future releases. A new variable:
|
||||
$serendipity['capabilities']['jquery-noconflict'] = false;
|
||||
$serendipity['capabilities']['jquery_noConflictMode'] = false;
|
||||
in your theme's config.inc.php file can now turn of that
|
||||
noConflict-mode.
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
@ -8,16 +9,18 @@ if (IN_serendipity !== true) {
|
||||
|
||||
include_once S9Y_INCLUDE_PATH . 'include/functions.inc.php';
|
||||
|
||||
|
||||
|
||||
/* Core API function mappings
|
||||
* This allows the s9y Core to also execute internal core actions on plugin API hooks
|
||||
* Future use: Global variable can be customized/overriden by your own plugin on the frontend_configure event
|
||||
* or during runtime,
|
||||
* or during runtime, or the serendipity_config_local.inc.php file.
|
||||
*/
|
||||
$serendipity['capabilities']['jquery'] = true;
|
||||
$serendipity['capabilities']['jquery_backend'] = true;
|
||||
$serendipity['capabilities']['jquery-noconflict'] = true; //set as being deprecated
|
||||
if ( false !== $serendipity['capabilities']['jquery'])
|
||||
$serendipity['capabilities']['jquery'] = true;
|
||||
if ( false !== $serendipity['capabilities']['jquery_backend'])
|
||||
$serendipity['capabilities']['jquery_backend'] = true;
|
||||
if ( false !== $serendipity['capabilities']['jquery_noConflictMode'])
|
||||
$serendipity['capabilities']['jquery_noConflictMode'] = true; //set as being deprecated, while we should not need it anymore
|
||||
|
||||
$serendipity['core_events']['frontend_header']['jquery'] = 'serendipity_plugin_api_frontend_header';
|
||||
$serendipity['core_events']['backend_header']['jquery'] = 'serendipity_plugin_api_backend_header';
|
||||
|
||||
@ -28,13 +31,13 @@ function serendipity_plugin_api_frontend_header($event_name, &$bag, &$eventData,
|
||||
// Only execute if current template does not have its own jquery.js file
|
||||
// jquery can be disabled if a template's config.inc.php or a plugin sets
|
||||
// $serendipity['capabilities']['jquery'] = false
|
||||
|
||||
|
||||
$check = serendipity_getTemplateFile('jquery.js');
|
||||
if (!$check && $serendipity['capabilities']['jquery']) {
|
||||
?>
|
||||
<script src="<?php echo $serendipity['serendipityHTTPPath']; ?>templates/jquery.js"></script>
|
||||
<?php
|
||||
if ($serendipity['capabilities']['jquery-noconflict']) {
|
||||
if ($serendipity['capabilities']['jquery_noConflictMode']) {
|
||||
?>
|
||||
<script>jQuery.noConflict();</script>
|
||||
<?php
|
||||
@ -81,7 +84,7 @@ function errorHandlerCreateDOM(htmlStr) {
|
||||
} \n";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'external_plugin':
|
||||
switch ($eventData) {
|
||||
case 'admin/serendipity_editor.js':
|
||||
@ -122,7 +125,7 @@ function errorHandlerCreateDOM(htmlStr) {
|
||||
* The user can configure instances of plugins.
|
||||
*/
|
||||
|
||||
class serendipity_plugin_api
|
||||
class serendipity_plugin_api
|
||||
{
|
||||
|
||||
/**
|
||||
@ -200,7 +203,7 @@ class serendipity_plugin_api
|
||||
// Secure Plugin path. No leading slashes, no backslashes, no "up" directories
|
||||
$pluginPath = preg_replace('@^(/)@', '', $pluginPath);
|
||||
$pluginPath = str_replace(array('..', "\\"), array('', '/'), serendipity_db_escape_string($pluginPath));
|
||||
|
||||
|
||||
if ($pluginPath == 'online_repository') {
|
||||
$pluginPath = $key;
|
||||
}
|
||||
@ -349,7 +352,7 @@ class serendipity_plugin_api
|
||||
* @param string The maindir where we started searching from [for recursive use]
|
||||
* @return
|
||||
*/
|
||||
static function traverse_plugin_dir($ppath, &$classes, $event_only, $maindir = '')
|
||||
static function traverse_plugin_dir($ppath, &$classes, $event_only, $maindir = '')
|
||||
{
|
||||
$d = @opendir($ppath);
|
||||
if ($d) {
|
||||
@ -419,7 +422,7 @@ class serendipity_plugin_api
|
||||
* @param string The filter for plugins (left|right|hide|event|eventh)
|
||||
* @return array The list of plugins
|
||||
*/
|
||||
static function get_installed_plugins($filter = '*')
|
||||
static function get_installed_plugins($filter = '*')
|
||||
{
|
||||
$plugins = serendipity_plugin_api::enum_plugins($filter);
|
||||
$res = array();
|
||||
@ -518,7 +521,7 @@ class serendipity_plugin_api
|
||||
* @param string If an instance ID is passed this means, the plugin to be loaded is internally available
|
||||
* @return string Returns the filename to include for a specific plugin
|
||||
*/
|
||||
static function includePlugin($name, $pluginPath = '', $instance_id = '')
|
||||
static function includePlugin($name, $pluginPath = '', $instance_id = '')
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -551,7 +554,7 @@ class serendipity_plugin_api
|
||||
* @param boolean If true, the plugin is a internal plugin (prefixed with '@')
|
||||
* @return string The classname of the plugin
|
||||
*/
|
||||
static function getClassByInstanceID($instance_id, &$is_internal)
|
||||
static function getClassByInstanceID($instance_id, &$is_internal)
|
||||
{
|
||||
$instance = explode(':', $instance_id);
|
||||
$class_name = ltrim($instance[0], '@');
|
||||
@ -568,7 +571,7 @@ class serendipity_plugin_api
|
||||
* @return string Returns the filename of a plugin to load
|
||||
*/
|
||||
/* Probes for the plugin filename */
|
||||
static function probePlugin($instance_id, &$class_name, &$pluginPath)
|
||||
static function probePlugin($instance_id, &$class_name, &$pluginPath)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -618,7 +621,7 @@ class serendipity_plugin_api
|
||||
* @param string The filename of a plugin (can be autodetected)
|
||||
* @return
|
||||
*/
|
||||
static function &load_plugin($instance_id, $authorid = null, $pluginPath = '', $pluginFile = null)
|
||||
static function &load_plugin($instance_id, $authorid = null, $pluginPath = '', $pluginFile = null)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -653,7 +656,7 @@ class serendipity_plugin_api
|
||||
$p->serendipity_owner = $owner[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$p->pluginPath = $p->act_pluginPath = $pluginPath;
|
||||
if (empty($p->act_pluginPath)) {
|
||||
$p->act_pluginPath = $class_name;
|
||||
@ -672,7 +675,7 @@ class serendipity_plugin_api
|
||||
* @param type The type of the plugin (local|spartacus|...)
|
||||
* @return array Information about the plugin
|
||||
*/
|
||||
static function &getPluginInfo(&$pluginFile, &$class_data, $type)
|
||||
static function &getPluginInfo(&$pluginFile, &$class_data, $type)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -725,7 +728,7 @@ class serendipity_plugin_api
|
||||
* @param string The location/type of a plugin (local|spartacus)
|
||||
* @return
|
||||
*/
|
||||
static function &setPluginInfo(&$plugin, &$pluginFile, &$bag, &$class_data, $pluginlocation = 'local')
|
||||
static function &setPluginInfo(&$plugin, &$pluginFile, &$bag, &$class_data, $pluginlocation = 'local')
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -914,7 +917,7 @@ class serendipity_plugin_api
|
||||
if (count($plugins) == 0) {
|
||||
$serendipity['prevent_sidebar_plugins_' . $side] = true;
|
||||
}
|
||||
|
||||
|
||||
$loggedin = false;
|
||||
if (serendipity_userLoggedIn() && serendipity_checkPermission('adminPlugins')) {
|
||||
$loggedin = true;
|
||||
@ -931,7 +934,7 @@ class serendipity_plugin_api
|
||||
$show_plugin = $plugin->generate_content($title);
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
if ($loggedin) {
|
||||
$content .= '<div class="serendipity_edit_nugget"><a href="' . $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=' . htmlentities($plugin->instance) . '">' . EDIT . '</a></div>';
|
||||
}
|
||||
@ -1006,7 +1009,7 @@ class serendipity_plugin_api
|
||||
* @param string Name of a plugin
|
||||
* @return boolean
|
||||
*/
|
||||
static function is_event_plugin($name)
|
||||
static function is_event_plugin($name)
|
||||
{
|
||||
return (strstr($name, '_event_'));
|
||||
}
|
||||
@ -1019,7 +1022,7 @@ class serendipity_plugin_api
|
||||
* @param boolean If set to true, the list of cached event plugins will be refreshed
|
||||
* @return mixed Either returns the whole list of event plugins, or only a specific instance
|
||||
*/
|
||||
static function &get_event_plugins($getInstance = false, $refresh = false)
|
||||
static function &get_event_plugins($getInstance = false, $refresh = false)
|
||||
{
|
||||
static $event_plugins;
|
||||
static $false = false;
|
||||
@ -1073,7 +1076,7 @@ class serendipity_plugin_api
|
||||
* @param mixed May contain any type of variables that are passed to an event plugin
|
||||
* @return true
|
||||
*/
|
||||
static function hook_event($event_name, &$eventData, $addData = null)
|
||||
static function hook_event($event_name, &$eventData, $addData = null)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -1097,7 +1100,7 @@ class serendipity_plugin_api
|
||||
$apifunc($event_name, $bag, $eventData, $addData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// execute backend needed core hooks
|
||||
serendipity_plugin_api_core_event_hook($event_name, $bag, $eventData, $addData);
|
||||
|
||||
@ -1105,7 +1108,7 @@ class serendipity_plugin_api
|
||||
$apifunc = 'serendipity_plugin_api_pre_event_hook';
|
||||
$apifunc($event_name, $bag, $eventData, $addData);
|
||||
}
|
||||
|
||||
|
||||
// Function names cannot contain ":" etc, so if we ever have event looks like "backend:js" this
|
||||
// needs to be replaced to "backend_js". The real event name is passed as a function argument
|
||||
// These specific per-hook functions are utilized for theme's config.inc.php files
|
||||
@ -1161,7 +1164,7 @@ class serendipity_plugin_api
|
||||
* @param string A name (may contain wildcards) of a plugin class to check
|
||||
* @return boolean True if a plugin was found
|
||||
*/
|
||||
static function exists($instance_id)
|
||||
static function exists($instance_id)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
@ -1187,7 +1190,7 @@ class serendipity_plugin_api
|
||||
* @param boolean Indicates if the plugin is an event plugin
|
||||
* @return object Returns the plugin object or false, if failure
|
||||
*/
|
||||
static function &autodetect_instance($plugin_name, $authorid, $is_event_plugin = false)
|
||||
static function &autodetect_instance($plugin_name, $authorid, $is_event_plugin = false)
|
||||
{
|
||||
if ($is_event_plugin) {
|
||||
$side = 'event';
|
||||
@ -1219,16 +1222,16 @@ class serendipity_plugin_api
|
||||
if (file_exists($probelang)) {
|
||||
include $probelang;
|
||||
}
|
||||
|
||||
|
||||
include $path . '/lang_en.inc.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* holds a bunch of properties; since serendipity 0.8 only one value per key is
|
||||
* allowed [was never really useful]
|
||||
/**
|
||||
* holds a bunch of properties; since serendipity 0.8 only one value per key is
|
||||
* allowed [was never really useful]
|
||||
*/
|
||||
class serendipity_property_bag
|
||||
class serendipity_property_bag
|
||||
{
|
||||
/**
|
||||
* @access private
|
||||
@ -1282,9 +1285,9 @@ class serendipity_property_bag
|
||||
}
|
||||
|
||||
/**
|
||||
* A core plugin, with methods that both event and sidebar plugins share
|
||||
* A core plugin, with methods that both event and sidebar plugins share
|
||||
*/
|
||||
class serendipity_plugin
|
||||
class serendipity_plugin
|
||||
{
|
||||
var $instance = null;
|
||||
var $protected = false;
|
||||
@ -1420,7 +1423,7 @@ class serendipity_plugin
|
||||
* @param value The value of a config item
|
||||
* @return
|
||||
*/
|
||||
function validate($config_item, &$cbag, &$value)
|
||||
function validate($config_item, &$cbag, &$value)
|
||||
{
|
||||
static $pattern_mail = '([\.\-\+~@_0-9a-z]+?)';
|
||||
static $pattern_url = '([@!=~\?:&;0-9a-z#\.\-_\/]+?)';
|
||||
@ -1655,7 +1658,7 @@ class serendipity_plugin
|
||||
* Events can be called on several occasions when s9y performs an action.
|
||||
* One or multiple plugin can be registered for each of those hooks.
|
||||
*/
|
||||
class serendipity_event extends serendipity_plugin
|
||||
class serendipity_event extends serendipity_plugin
|
||||
{
|
||||
|
||||
/**
|
||||
@ -1685,7 +1688,7 @@ class serendipity_event extends serendipity_plugin
|
||||
* @param array The entry superarray to get the reference from
|
||||
* @return array The value of the array for the fieldname (reference)
|
||||
*/
|
||||
function &getFieldReference($fieldname = 'body', &$eventData)
|
||||
function &getFieldReference($fieldname = 'body', &$eventData)
|
||||
{
|
||||
// Get a reference to a content field (body/extended) of
|
||||
// $entries input data. This is a unifying function because
|
||||
@ -1734,7 +1737,7 @@ class serendipity_event extends serendipity_plugin
|
||||
* @param mixed Any additional data from the hook_event call
|
||||
* @return true
|
||||
*/
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null)
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null)
|
||||
{
|
||||
// Define event hooks here, if you want you plugin to execute those instead of being a sidebar item.
|
||||
// Look at external plugins 'serendipity_event_mailer' or 'serendipity_event_weblogping' for usage.
|
||||
@ -1748,4 +1751,4 @@ class serendipity_event extends serendipity_plugin
|
||||
|
||||
}
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
|
Reference in New Issue
Block a user