本文整理汇总了PHP中serendipity_plugin_api::get_event_plugins方法的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_plugin_api::get_event_plugins方法的具体用法?PHP serendipity_plugin_api::get_event_plugins怎么用?PHP serendipity_plugin_api::get_event_plugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serendipity_plugin_api
的用法示例。
在下文中一共展示了serendipity_plugin_api::get_event_plugins方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_content
function generate_content(&$title)
{
$plug = $this->get_config('event_plugin', 'false');
if ($plug == 'false') {
return;
}
$wrap =& serendipity_plugin_api::get_event_plugins($plug);
$faketitle = '';
if (is_object($wrap)) {
$wrap->generate_content($faketitle);
}
if ($this->get_config('title') != '') {
$title = $this->get_config('title');
} else {
$title = $faketitle;
}
}
示例2: hook_event
/**
* Executes a specific Eventhook
*
* If you want to temporarily block any event plugins, you can set $serendipity['no_events'] before
* this method call.
*
* @access public
* @param string The name of the event to hook on to
* @param mixed May contain any type of variables that are passed by reference to an event plugin
* @param mixed May contain any type of variables that are passed to an event plugin
* @return true
*/
function hook_event($event_name, &$eventData, $addData = null)
{
global $serendipity;
// Can be bypassed globally by setting $serendipity['no_events'] = TRUE;
if (isset($serendipity['no_events']) && $serendipity['no_events'] == true) {
return false;
}
if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($event_name)) {
return false;
}
// We can NOT use a "return by reference" here, because then when
// a plugin executes another event_hook, the referenced variable within
// that call will overwrite the previous original plugin listing and
// skip the execution of any follow-up plugins.
$plugins = serendipity_plugin_api::get_event_plugins();
if (function_exists('serendipity_plugin_api_pre_event_hook')) {
$apifunc = 'serendipity_plugin_api_pre_event_hook';
$apifunc($event_name, $bag, $eventData, $addData);
}
if (is_array($plugins)) {
// foreach() operates on copies of values, but we want to operate on references, so we use while()
@reset($plugins);
while (list($plugin, $plugin_data) = each($plugins)) {
$bag =& $plugin_data['b'];
$phooks =& $bag->get('event_hooks');
if (isset($phooks[$event_name])) {
// Check for cachable events.
if (isset($eventData['is_cached']) && $eventData['is_cached']) {
$chooks =& $bag->get('cachable_events');
if (is_array($chooks) && isset($chooks[$event_name])) {
continue;
}
}
if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($plugin)) {
continue;
}
$plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData);
}
}
if (function_exists('serendipity_plugin_api_event_hook')) {
$apifunc = 'serendipity_plugin_api_event_hook';
$apifunc($event_name, $bag, $eventData, $addData);
}
}
return true;
}
示例3: showBackend
//.........这里部分代码省略.........
<label for="properties_access_author"><?php
echo AUTHOR;
?>
:</label>
<select id="properties_access_author" name="serendipity[change_author]">
<?php
if (isset($serendipity['POST']['change_author'])) {
$selected_user = $serendipity['POST']['change_author'];
} elseif (!empty($eventData['authorid'])) {
$selected_user = $eventData['authorid'];
} else {
$selected_user = $serendipity['authorid'];
}
$avail_users =& $this->getValidAuthors();
foreach ($avail_users as $user) {
echo '<option value="' . $user['authorid'] . '" ' . ($selected_user == $user['authorid'] ? ' selected="selected"' : '') . '>' . serendipity_specialchars($user['realname']) . '</option>' . "\n";
}
?>
</select>
</div>
<?php
return true;
case 'markup':
?>
<div class="entryproperties_markup adv_opts_box form_multiselect">
<label for="properties_markup"><?php
echo PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP;
?>
</label>
<select id="properties_markup" name="serendipity[properties][disable_markups][]" multiple="multiple" size="4">
<?php
$plugins = serendipity_plugin_api::get_event_plugins();
if (is_array($plugins)) {
// foreach() operates on copies of values, but we want to operate on references, so we use while()
@reset($plugins);
while (list($plugin, $plugin_data) = each($plugins)) {
if (!is_array($plugin_data['p']->markup_elements)) {
continue;
}
if (isset($serendipity['POST']['properties']['disable_markups']) && in_array($plugin_data['p']->instance, $serendipity['POST']['properties']['disable_markups'])) {
$selected = true;
} elseif (isset($eventData['properties']['ep_disable_markup_' . $plugin_data['p']->instance])) {
$selected = true;
} else {
$selected = false;
}
// automatically mark nl2br markup parser as disabled, when WYSIWYG is active
if (!$selected && $serendipity['wysiwyg'] && $plugin_data['p']->act_pluginPath == 'serendipity_event_nl2br') {
$selected = true;
}
echo '<option ' . ($selected ? 'selected="selected"' : '') . ' value="' . $plugin_data['p']->instance . '">' . serendipity_specialchars($plugin_data['p']->title) . '</option>' . "\n";
}
}
?>
</select>
</div>
<?php
return true;
case 'customfields':
?>
<div class="entryproperties_customfields adv_opts_box">
<?php
$fields = trim($this->get_config('customfields'));
// Capture special characters for "," and ":"
示例4: introspect_config_item
function introspect_config_item($name, &$propbag)
{
switch ($name) {
case 'publishflag':
$propbag->add('type', 'radio');
$propbag->add('name', PLUGIN_AGGREGATOR_PUBLISH);
$propbag->add('description', '');
$propbag->add('radio', array('value' => array('true', 'false'), 'desc' => array(PUBLISH, DRAFT)));
$propbag->add('default', 'true');
break;
case 'cronjob':
if (class_exists('serendipity_event_cronjob')) {
$propbag->add('type', 'select');
$propbag->add('name', PLUGIN_EVENT_CRONJOB_CHOOSE);
$propbag->add('description', '');
$propbag->add('default', 'daily');
$propbag->add('select_values', serendipity_event_cronjob::getValues());
} else {
$propbag->add('type', 'content');
$propbag->add('default', PLUGIN_AGGREGATOR_CRONJOB);
}
break;
case 'debug':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_AGGREGATOR_DEBUG);
$propbag->add('description', PLUGIN_AGGREGATOR_DEBUG_BLAHBLAH);
$propbag->add('default', false);
break;
case 'markup':
$plugins = serendipity_plugin_api::get_event_plugins();
$markups = array();
if (is_array($plugins)) {
// foreach() operates on copies of values, but we want to operate on references, so we use while()
@reset($plugins);
while (list($plugin, $plugin_data) = each($plugins)) {
if (!is_array($plugin_data['p']->markup_elements)) {
continue;
}
$markups[$plugin_data['p']->instance] = function_exists('serendipity_specialchars') ? serendipity_specialchars($plugin_data['p']->title) : htmlspecialchars($plugin_data['p']->title, ENT_COMPAT, LANG_CHARSET);
}
}
$propbag->add('type', 'multiselect');
$propbag->add('name', PLUGIN_AGGREGATOR_MARKUP_DISABLE);
$propbag->add('description', PLUGIN_AGGREGATOR_MARKUP_DISABLE_DESC);
$propbag->add('select_values', $markups);
$propbag->add('select_size', 6);
$propbag->add('default', '');
break;
case 'engine':
$propbag->add('type', 'radio');
$propbag->add('radio', array('value' => array('onyx', 'magpierss', 'simplepie'), 'desc' => array('Onyx [BSD]', 'MagpieRSS [GPL]', 'SimplePie')));
$propbag->add('name', PLUGIN_AGGREGATOR_CHOOSE_ENGINE);
$propbag->add('description', PLUGIN_AGGREGATOR_CHOOSE_ENGINE_DESC);
$propbag->add('default', 'onyx');
break;
case 'delete_dependencies':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_AGGREGATOR_DELETEDEPENDENCIES);
$propbag->add('description', PLUGIN_AGGREGATOR_DELETEDEPENDENCIES_DESC);
$propbag->add('default', true);
break;
case 'expire':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_AGGREGATOR_EXPIRE);
$propbag->add('description', PLUGIN_AGGREGATOR_EXPIRE_BLAHBLAH);
$propbag->add('default', 2);
break;
case 'expire_md5':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_AGGREGATOR_EXPIRE_MD5);
$propbag->add('description', PLUGIN_AGGREGATOR_EXPIRE_MD5_BLAHBLAH);
$propbag->add('default', 90);
break;
case 'ignore_updates':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_AGGREGATOR_IGNORE_UPDATES);
$propbag->add('description', PLUGIN_AGGREGATOR_IGNORE_UPDATES_DESC);
$propbag->add('default', false);
break;
case 'allow_comments':
$propbag->add('type', 'boolean');
$propbag->add('name', COMMENTS_ENABLE);
$propbag->add('description', '');
$propbag->add('default', false);
break;
default:
return false;
}
return true;
}
示例5: showBackend
//.........这里部分代码省略.........
<br /><?php
echo AUTHOR;
?>
:<br />
<div class="entryproperties_access_author" style="margin-left: 10px">
<select name="serendipity[change_author]">
<?php
if (isset($serendipity['POST']['change_author'])) {
$selected_user = $serendipity['POST']['change_author'];
} elseif (!empty($eventData['authorid'])) {
$selected_user = $eventData['authorid'];
} else {
$selected_user = $serendipity['authorid'];
}
$avail_users =& $this->getValidAuthors();
foreach ($avail_users as $user) {
echo '<option value="' . $user['authorid'] . '" ' . ($selected_user == $user['authorid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($user['realname']) . '</option>' . "\n";
}
?>
</select>
</div>
<?php
return true;
case 'markup':
?>
<br /><div class="entryproperties_markup">
<?php
echo PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP;
?>
<br />
<div style="margin-left: 10px">
<select name="serendipity[properties][disable_markups][]" multiple="multiple" size="4">
<?php
$plugins = serendipity_plugin_api::get_event_plugins();
if (is_array($plugins)) {
// foreach() operates on copies of values, but we want to operate on references, so we use while()
@reset($plugins);
while (list($plugin, $plugin_data) = each($plugins)) {
if (!is_array($plugin_data['p']->markup_elements)) {
continue;
}
if (isset($serendipity['POST']['properties']['disable_markups']) && in_array($plugin_data['p']->instance, $serendipity['POST']['properties']['disable_markups'])) {
$selected = true;
} elseif (isset($eventData['properties']['ep_disable_markup_' . $plugin_data['p']->instance])) {
$selected = true;
} else {
$selected = false;
}
echo '<option ' . ($selected ? 'selected="selected"' : '') . ' value="' . $plugin_data['p']->instance . '">' . htmlspecialchars($plugin_data['p']->title) . '</option>' . "\n";
}
}
?>
</select>
</div>
</div>
<?php
return true;
case 'customfields':
?>
<br /><div class="entryproperties_customfields">
<?php
$fields = trim($this->get_config('customfields'));
if (!empty($fields)) {
$fields = explode(',', $fields);
}
if (is_array($fields) && count($fields) > 0) {
示例6: hook_event
/**
* Executes a specific Eventhook
*
* If you want to temporarily block any event plugins, you can set $serendipity['no_events'] before
* this method call.
*
* @access public
* @param string The name of the event to hook on to
* @param mixed May contain any type of variables that are passed by reference to an event plugin
* @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)
{
global $serendipity;
// Can be bypassed globally by setting $serendipity['no_events'] = TRUE;
if (isset($serendipity['no_events']) && $serendipity['no_events'] == true) {
return false;
}
if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($event_name)) {
return false;
}
// We can NOT use a "return by reference" here, because then when
// a plugin executes another event_hook, the referenced variable within
// that call will overwrite the previous original plugin listing and
// skip the execution of any follow-up plugins.
$plugins = serendipity_plugin_api::get_event_plugins();
if ($serendipity['core_events'][$event_name]) {
foreach ($serendipity['core_events'][$event_name] as $apifunc_key => $apifunc) {
$apifunc($event_name, $bag, $eventData, $addData);
}
}
// execute backend needed core hooks
serendipity_plugin_api_core_event_hook($event_name, $bag, $eventData, $addData);
if (function_exists('serendipity_plugin_api_pre_event_hook')) {
$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
// that act as an engine for other themes.
$safe_event_name = preg_replace('@[^a-z0-9_]+@i', '_', $event_name);
if (function_exists('serendipity_plugin_api_pre_event_hook_' . $safe_event_name)) {
$apifunc = 'serendipity_plugin_api_pre_event_hook_' . $safe_event_name;
$apifunc($event_name, $bag, $eventData, $addData);
}
if (is_array($plugins)) {
// foreach() operates on copies of values, but we want to operate on references, so we use while()
@reset($plugins);
while (list($plugin, $plugin_data) = each($plugins)) {
$bag =& $plugin_data['b'];
$phooks =& $bag->get('event_hooks');
if (isset($phooks[$event_name])) {
// Check for cachable events.
if (isset($eventData['is_cached']) && $eventData['is_cached']) {
$chooks =& $bag->get('cachable_events');
if (is_array($chooks) && isset($chooks[$event_name])) {
continue;
}
}
if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($plugin)) {
continue;
}
$plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData);
}
}
if (function_exists('serendipity_plugin_api_event_hook')) {
$apifunc = 'serendipity_plugin_api_event_hook';
$apifunc($event_name, $bag, $eventData, $addData);
}
if (function_exists('serendipity_plugin_api_event_hook_' . $safe_event_name)) {
$apifunc = 'serendipity_plugin_api_event_hook_' . $safe_event_name;
$apifunc($event_name, $bag, $eventData, $addData);
}
}
return true;
}
示例7: htmlspecialchars
$permname = $perm;
}
if (!serendipity_checkPermission($perm) && $perm != 'hiddenGroup') {
echo "<tr>\n";
echo "<td>{$indent}" . htmlspecialchars($permname) . "</td>\n";
echo '<td>' . $indentB . ' ' . (!empty($selected) ? YES : NO) . '</td>' . "\n";
echo "</tr>\n";
} else {
echo "<tr>\n";
echo "<td>{$indent}<label for=\"" . htmlspecialchars($perm) . "\">" . htmlspecialchars($permname) . "</label></td>\n";
echo '<td>' . $indentB . '<input class="input_checkbox" id="' . htmlspecialchars($perm) . '" type="checkbox" name="serendipity[' . htmlspecialchars($perm) . ']" value="true" ' . $selected . ' /></td>' . "\n";
echo "</tr>\n";
}
}
if ($serendipity['enablePluginACL']) {
$allplugins =& serendipity_plugin_api::get_event_plugins();
$allhooks = array();
?>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td valign="top"><?php
echo PERMISSION_FORBIDDEN_PLUGINS;
?>
</td>
<td>
<select name="serendipity[forbidden_plugins][]" multiple="multiple" size="5">
<?php
foreach ($allplugins as $plugid => $currentplugin) {
foreach ($currentplugin['b']->properties['event_hooks'] as $hook => $set) {
示例8: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
if (!class_exists('serendipity_event_emoticate')) {
return false;
}
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'frontend_comment':
if (serendipity_db_bool($this->get_config('frontend', false)) === false) {
break;
}
$txtarea = 'serendipity_commentform_comment';
$func = 'comment';
$style = '';
$popcl = '';
case 'backend_entry_toolbar_extended':
if (!isset($txtarea)) {
$txtarea = 'serendipity[extended]';
$func = 'extended';
}
case 'backend_entry_toolbar_body':
if (!isset($txtarea)) {
if (isset($eventData['backend_entry_toolbar_body:textarea'])) {
// event caller has given us the name of the textarea converted
// into a wysiwg editor(for example, the staticpages plugin)
$txtarea = $eventData['backend_entry_toolbar_body:textarea'];
} else {
// default value
$txtarea = 'serendipity[body]';
}
if (isset($eventData['backend_entry_toolbar_body:nugget'])) {
$func = $eventData['backend_entry_toolbar_body:nugget'];
} else {
$func = 'body';
}
}
// CKEDITOR and plain editor need this little switch
if (preg_match('@^nugget@i', $func)) {
$cke_txtarea = $func;
} else {
$cke_txtarea = $txtarea;
}
if (!isset($popcl)) {
$popcl = ' serendipityPrettyButton';
}
if (!isset($style)) {
$style = 'margin-top: 5px; vertical-align: bottom';
}
$popupstyle = '';
$popuplink = '';
if (serendipity_db_bool($this->get_config('popup', false))) {
$popupstyle = '; display: none';
$popuplink = serendipity_db_bool($this->get_config('button', false)) ? '<input type="button" onclick="toggle_emoticon_bar_' . $func . '(); return false" href="#" class="serendipity_toggle_emoticon_bar' . $popcl . '" value="' . $this->get_config('popuptext') . '">' : '<a class="serendipity_toggle_emoticon_bar' . $popcl . '" href="#" onclick="toggle_emoticon_bar_' . $func . '(); return false">' . $this->get_config('popuptext') . '</a>';
}
$i = 1;
// This plugin wants to access serendipity_event_emoticate. Its methods are non-static
// and it's not properly working with PHP5 to call. So to perform properly, let's take
// the actual plugin:
$plugins = serendipity_plugin_api::get_event_plugins();
$emoticate_plugin = null;
while (list($plugin, $plugin_data) = each($plugins)) {
if (strpos($plugin, 'serendipity_event_emoticate') !== FALSE) {
$emoticate_plugin =& $plugin_data['p'];
break;
}
}
if ($emoticate_plugin === null) {
return;
}
$emoticons = $emoticate_plugin->getEmoticons();
$unique = array();
foreach ($emoticons as $key => $value) {
if (is_callable(array($emoticate_plugin, 'humanReadableEmoticon'))) {
$key = $emoticate_plugin->humanReadableEmoticon($key);
}
$unique[$value] = $key;
}
// script include has to stick to to backend_header, while using inline onclick (see above)
if (IN_serendipity_admin === true) {
?>
<div class="serendipity_emoticon_bar">
<script type="text/javascript">
emoticonchooser('<?php
echo $func;
?>
', '<?php
echo $txtarea;
?>
', '<?php
echo $cke_txtarea;
?>
');
</script>
<?php
} else {
// in frontend footer
?>
//.........这里部分代码省略.........