本文整理汇总了PHP中find_all_hooks函数的典型用法代码示例。如果您正苦于以下问题:PHP find_all_hooks函数的具体用法?PHP find_all_hooks怎么用?PHP find_all_hooks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_all_hooks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists(0, $parameters)) {
// Load up the relevant block and grab its help output
$hooks = find_all_hooks('modules', 'admin_occle_commands');
$hook_return = NULL;
foreach (array_keys($hooks) as $hook) {
if ($hook == $parameters[0]) {
require_code('hooks/modules/admin_occle_commands/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$hook_return = $object->run(array('help' => NULL), array(), $occle_fs);
break;
}
}
if (!is_null($hook_return)) {
return array($hook_return[0], $hook_return[1], $hook_return[2], $hook_return[3]);
} else {
return array('', '', '', do_lang('NO_HELP'));
}
} else {
// Output a standard "how to use Occle" help page
return array('window.open(unescape("' . urlencode('http://ocportal.com/docs' . strval(ocp_version()) . '/pg/tut_occle') . '"),"occle_window1","");', '', do_lang('SUCCESS'), '');
}
}
示例2: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('textfiles');
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$lang = $lang_none == '1' ? NULL : '';
$file = filter_naughty($file, true);
$new = post_param('new', NULL);
if (!is_null($new)) {
$hooks = find_all_hooks('blocks', 'main_notes');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($file);
}
write_text_file($file, $lang, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = read_text_file($file, $lang, true);
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
}
示例3: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
require_lang('custom_comcode');
$tags = array();
$wmap = array('tag_enabled' => 1);
if (!has_specific_permission(get_member(), 'comcode_dangerous')) {
$wmap['tag_dangerous_tag'] = 0;
}
$tags = array_merge($tags, $GLOBALS['SITE_DB']->query_select('custom_comcode', array('tag_title', 'tag_description', 'tag_example', 'tag_parameters', 'tag_replace', 'tag_tag', 'tag_dangerous_tag', 'tag_block_tag', 'tag_textual_tag'), $wmap));
if (isset($GLOBALS['FORUM_DB']) && $GLOBALS['FORUM_DB']->connection_write != $GLOBALS['SITE_DB']->connection_write && get_forum_type() == 'ocf') {
$tags = array_merge($tags, $GLOBALS['FORUM_DB']->query_select('custom_comcode', array('tag_title', 'tag_description', 'tag_example', 'tag_parameters', 'tag_replace', 'tag_tag', 'tag_dangerous_tag', 'tag_block_tag', 'tag_textual_tag'), $wmap));
}
// From Comcode hooks
$hooks = find_all_hooks('systems', 'comcode');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/comcode/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_comcode_' . filter_naughty_harsh($hook), true);
$tags[] = $object->get_tag();
}
if (!array_key_exists(0, $tags)) {
return paragraph(do_lang_tempcode('NONE_EM'), '', 'nothing_here');
}
$content = new ocp_tempcode();
foreach ($tags as $tag) {
$content->attach(do_template('CUSTOM_COMCODE_TAG_ROW', array('_GUID' => '28c257f5d0c596aa828fd9556b0df4a9', 'TITLE' => is_string($tag['tag_title']) ? $tag['tag_title'] : get_translated_text($tag['tag_title']), 'DESCRIPTION' => is_string($tag['tag_description']) ? $tag['tag_description'] : get_translated_text($tag['tag_description']), 'EXAMPLE' => $tag['tag_example'])));
}
return do_template('BLOCK_MAIN_CUSTOM_COMCODE_TAGS', array('_GUID' => 'b8d3436e6e5fe679ae9b0a368e607610', 'TAGS' => $content));
}
示例4: init__themewizard
/**
* Standard code module initialisation function.
*/
function init__themewizard()
{
global $THEME_WIZARD_IMAGES_CACHE, $THEME_SEED_CACHE, $THEME_DARK_CACHE;
$THEME_WIZARD_IMAGES_CACHE = array();
$THEME_SEED_CACHE = array();
$THEME_DARK_CACHE = array();
global $THEME_WIZARD_IMAGES, $THEME_WIZARD_IMAGES_NO_WILD;
$THEME_WIZARD_IMAGES = array();
$THEME_WIZARD_IMAGES_NO_WILD = array();
if (function_exists('imagecreatefromgif')) {
$THEME_WIZARD_IMAGES[] = '';
}
$hooks = find_all_hooks('modules', 'admin_themewizard');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/modules/admin_themewizard/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_admin_themewizard_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$results = $ob->run();
if (is_null($results)) {
continue;
}
list($a, $b) = $results;
$THEME_WIZARD_IMAGES = array_merge($THEME_WIZARD_IMAGES, $a);
$THEME_WIZARD_IMAGES_NO_WILD = array_merge($THEME_WIZARD_IMAGES_NO_WILD, $b);
}
}
示例5: get_num_unvalidated
/**
* Get the number of unvalidated items.
*
* @return array A pair: Number of major things, number of minor things
*/
function get_num_unvalidated()
{
$sum = 0;
$sum2 = 0;
$_hooks = find_all_hooks('modules', 'admin_unvalidated');
foreach (array_keys($_hooks) as $hook) {
require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$info = $object->info();
if (is_null($info)) {
continue;
}
$db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB'];
$amount = $db->query_value($info['db_table'], 'COUNT(*)', array($info['db_validated'] => 0));
if (is_null($info) || array_key_exists('is_minor', $info) && $info['is_minor']) {
$sum2 += $amount;
} else {
$sum += $amount;
}
}
return array($sum, $sum2);
}
示例6: get_chmod_array
/**
* Get the list of files that need CHmodding for write access.
*
* @return array The list of files
*/
function get_chmod_array()
{
global $LANG;
// if ((function_exists('ocp_enterprise')) && (ocp_enterprise()))
// {
$extra_files = array('collaboration/pages/html_custom', 'collaboration/pages/html_custom/' . $LANG, 'collaboration/pages/comcode_custom', 'collaboration/pages/comcode_custom/' . $LANG);
// } else $extra_files=array();
if (function_exists('find_all_hooks')) {
$hooks = find_all_hooks('systems', 'addon_registry');
$hook_keys = array_keys($hooks);
foreach ($hook_keys as $hook) {
//require_code('hooks/systems/addon_registry/'.filter_naughty_harsh($hook));
//$object=object_factory('Hook_addon_registry_'.filter_naughty_harsh($hook));
//$extra_files=array_merge($extra_files,$object->get_chmod_array());
// Save memory compared to above commented code...
$path = get_custom_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
if (!file_exists($path)) {
$path = get_file_base() . '/sources/hooks/systems/addon_registry/' . filter_naughty_harsh($hook) . '.php';
}
$matches = array();
if (preg_match('#function get_chmod_array\\(\\)\\s*\\{([^\\}]*)\\}#', file_get_contents($path), $matches) != 0) {
if (!defined('HIPHOP_PHP')) {
$extra_files = array_merge($extra_files, eval($matches[1]));
} else {
require_code('hooks/systems/addon_registry/' . $hook);
$hook = object_factory('Hook_addon_registry_' . $hook);
$extra_files = array_merge($extra_files, $hook->get_chmod_array());
}
}
}
}
return array_merge($extra_files, array('safe_mode_temp', 'persistant_cache', 'data_custom/modules/admin_backup', 'data_custom/modules/chat', 'data_custom/fields.xml', 'data_custom/breadcrumbs.xml', 'data_custom/modules/admin_stats', 'data_custom/spelling/write.log', 'data_custom/spelling/output.log', 'data_custom/spelling/personal_dicts', 'themes/map.ini', 'text_custom', 'text_custom/' . $LANG, 'data_custom/modules/chat/chat_last_msg.dat', 'data_custom/modules/chat/chat_last_event.dat', 'lang_cached', 'lang_cached/' . $LANG, 'lang_custom', 'lang_custom/' . $LANG, 'data_custom/errorlog.php', 'ocp_sitemap.xml', 'data_custom/permissioncheckslog.php', 'pages/html_custom', 'site/pages/html_custom', 'docs/pages/html_custom', 'adminzone/pages/html_custom', 'forum/pages/html_custom', 'cms/pages/html_custom', 'pages/html_custom/' . $LANG, 'site/pages/html_custom/' . $LANG, 'docs/pages/html_custom/' . $LANG, 'adminzone/pages/html_custom/' . $LANG, 'forum/pages/html_custom/' . $LANG, 'cms/pages/html_custom/' . $LANG, 'pages/comcode_custom', 'site/pages/comcode_custom', 'docs/pages/comcode_custom', 'adminzone/pages/comcode_custom', 'forum/pages/comcode_custom', 'cms/pages/comcode_custom', 'pages/comcode_custom/' . $LANG, 'site/pages/comcode_custom/' . $LANG, 'docs/pages/comcode_custom/' . $LANG, 'adminzone/pages/comcode_custom/' . $LANG, 'forum/pages/comcode_custom/' . $LANG, 'cms/pages/comcode_custom/' . $LANG, 'themes/default/css_custom', 'themes/default/images_custom', 'themes/default/templates_custom', 'themes/default/templates_cached', 'themes/default/templates_cached/' . $LANG, 'themes/default/theme.ini', 'uploads/incoming', 'uploads/website_specific', 'uploads/personal_sound_effects', 'uploads/banners', 'uploads/downloads', 'uploads/galleries', 'uploads/watermarks', 'uploads/grepimages', 'uploads/galleries_thumbs', 'uploads/iotds', 'uploads/iotds_thumbs', 'uploads/catalogues', 'uploads/attachments', 'uploads/attachments_thumbs', 'uploads/auto_thumbs', 'uploads/ocf_avatars', 'uploads/ocf_cpf_upload', 'uploads/ocf_photos', 'uploads/ocf_photos_thumbs', 'uploads/filedump', 'info.php', 'exports/backups', 'exports/file_backups', 'exports/mods', 'imports/mods', 'site/pages/html_custom/' . $LANG . '/download_tree_made.htm', 'site/pages/html_custom/' . $LANG . '/cedi_tree_made.htm'));
}
示例7: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (get_value('implicit_usergroup_sync') === '1') {
$last = get_value('last_implicit_sync');
if (is_null($last) || intval($last) < time() - 60 * 60) {
$hooks = find_all_hooks('systems', 'ocf_implicit_usergroups');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/ocf_implicit_usergroups/' . $hook);
$ob = object_factory('Hook_implicit_usergroups_' . $hook);
$group_id = $ob->get_bound_group_id();
$GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_group_id' => $group_id));
$list = $ob->get_member_list();
if (!is_null($list)) {
foreach ($list as $member_row) {
$GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_row['id'], 'gm_validated' => 1));
}
} else {
$start = 0;
do {
$members = collapse_1d_complexity('id', $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 400, $start));
foreach ($members as $member_id) {
if ($ob->is_member_within($member_id)) {
$GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_id, 'gm_validated' => 1));
}
}
$start += 400;
} while (count($members) == 400);
}
}
set_value('last_implicit_sync', strval(time()));
}
}
}
示例8: adminzone_extend_breadcrumbs
/**
* Extend breadcrumbs for the Admin Zone (called by breadcrumbs_get_default_stub).
*
* @param tempcode Reference to the breadcrumbs stub we're assembling
*/
function adminzone_extend_breadcrumbs(&$stub)
{
global $BREADCRUMB_SET_PARENTS;
if (count($BREADCRUMB_SET_PARENTS) > 0 && !is_object($BREADCRUMB_SET_PARENTS[0][0])) {
// Works by finding where our oldest ancestor connects on to the do-next menus, and carries from there
list($zone, $attributes, ) = page_link_decode($BREADCRUMB_SET_PARENTS[0][0]);
$type = array_key_exists('type', $attributes) ? $attributes['type'] : 'misc';
$page = $attributes['page'];
if ($page == '_SELF') {
$page = get_page_name();
}
if ($zone == '_SEARCH') {
$zone = get_module_zone($page);
}
if ($zone == '_SELF') {
$zone = get_zone_name();
}
} else {
// Works by finding where we connect on to the do-next menus, and carries from there
$type = get_param('type', 'misc');
$page = get_page_name();
$zone = get_zone_name();
}
if ($page != 'admin' && $page != 'cms') {
// Loop over menus, hunting for connection
$hooks = find_all_hooks('systems', 'do_next_menus');
$_hooks = array();
$page_looking = $page;
$page_looking = preg_replace('#^(cms|admin)\\_#', '', $page_looking);
if (array_key_exists($page_looking, $hooks)) {
$_hooks[$page_looking] = $hooks[$page_looking];
unset($hooks[$page_looking]);
$hooks = array_merge($_hooks, $hooks);
}
foreach ($hooks as $hook => $sources_dir) {
$run_function = extract_module_functions(get_file_base() . '/' . $sources_dir . '/hooks/systems/do_next_menus/' . $hook . '.php', array('run'));
if ($run_function[0] !== NULL) {
$info = is_array($run_function[0]) ? call_user_func_array($run_function[0][0], $run_function[0][1]) : eval($run_function[0]);
foreach ($info as $i) {
if ($i === NULL) {
continue;
}
if ($page == $i[2][0] && (!array_key_exists('type', $i[2][1]) && $type == 'misc' || array_key_exists('type', $i[2][1]) && ($type == $i[2][1]['type'] || $i[2][1]['type'] == 'misc')) && $zone == $i[2][2]) {
if ($i[0] == 'cms') {
$url = build_url(array('page' => 'cms', 'type' => $i[0] == 'cms' ? NULL : $i[0]), 'cms');
} else {
$url = build_url(array('page' => 'admin', 'type' => $i[0]), 'adminzone');
}
require_lang('menus');
require_lang('security');
$stub->attach(hyperlink($url, do_lang_tempcode(strtoupper($i[0])), false, false, do_lang_tempcode('GO_BACKWARDS_TO', @html_entity_decode(strip_tags(do_lang(strtoupper($i[0]))), ENT_QUOTES, get_charset()))));
//if ((!array_key_exists('type',$i[2][1])) || ($type==$i[2][1]['type'])) break;
return;
}
}
}
}
}
}
示例9: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('unvalidated');
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/unvalidated';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_censor';
$_title = get_page_title('UNVALIDATED_RESOURCES');
$out = new ocp_tempcode();
require_code('form_templates');
$_hooks = find_all_hooks('modules', 'admin_unvalidated');
foreach (array_keys($_hooks) as $hook) {
require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$info = $object->info();
if (is_null($info)) {
continue;
}
$identifier_select = is_array($info['db_identifier']) ? implode(',', $info['db_identifier']) : $info['db_identifier'];
$db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB'];
$rows = $db->query('SELECT ' . $identifier_select . (array_key_exists('db_title', $info) ? ',' . $info['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $info['db_table'] . ' WHERE ' . $info['db_validated'] . '=0', 100);
$content = new ocp_tempcode();
foreach ($rows as $row) {
if (is_array($info['db_identifier'])) {
$id = '';
foreach ($info['db_identifier'] as $_id) {
if ($id != '') {
$id .= ':';
}
$id .= $row[$_id];
}
} else {
$id = $row[$info['db_identifier']];
}
if (array_key_exists('db_title', $info)) {
$title = $row[$info['db_title']];
if ($info['db_title_dereference']) {
$title = get_translated_text($title, $db);
}
// May actually be comcode (can't be certain), but in which case it will be shown as source
} else {
$title = '#' . (is_integer($id) ? strval($id) : $id);
}
if ($title == '') {
$title = '#' . strval($id);
}
$content->attach(form_input_list_entry(is_integer($id) ? strval($id) : $id, false, strip_comcode($title)));
}
$post_url = build_url(array('page' => $info['edit_module'], 'type' => $info['edit_type'], 'validated' => 1), get_module_zone($info['edit_module']), NULL, false, true);
$fields = form_input_list(do_lang_tempcode('EDIT'), do_lang_tempcode('DESCRIPTION_EDIT'), $info['edit_identifier'], $content);
if (!$content->is_empty()) {
// Could debate whether to include "'TARGET'=>'_blank',". However it does redirect back, so it's a nice linear process like this. If it was new window it could be more efficient, but also would confuse people with a lot of new windows opening and not closing.
$content = do_template('FORM', array('_GUID' => '51dcee39273a0fee29569190344f2e41', 'GET' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('EDIT'), 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => ''));
}
$out->attach(do_template('UNVALIDATED_SECTION', array('_GUID' => '838240008e190b9cbaa0280fbddd6baf', 'TITLE' => $info['title'], 'CONTENT' => $content)));
}
return do_template('UNVALIDATED_SCREEN', array('_GUID' => '4e971f1c8851b821af030b5c7bbcb3fb', 'TITLE' => $_title, 'SECTIONS' => $out));
}
示例10: send_validation_request
/**
* Send (by e-mail) a validation request for a submitted item to the admin.
*
* @param ID_TEXT The validation request will say one of this type has been submitted. By convention it is the language code of what was done, e.g. ADD_DOWNLOAD
* @param ?ID_TEXT The table saved into (NULL: unknown)
* @param boolean Whether the ID field is not an integer
* @param ID_TEXT The validation request will say this ID has been submitted
* @param tempcode The validation request will link to this URL
* @param ?MEMBER Member doing the submitting (NULL: current member)
*/
function send_validation_request($type, $table, $non_integer_id, $id, $url, $member_id = NULL)
{
$good = NULL;
if (!is_null($table)) {
$_hooks = find_all_hooks('modules', 'admin_unvalidated');
foreach (array_keys($_hooks) as $hook) {
require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$info = $object->info();
if (is_null($info)) {
continue;
}
if ($info['db_table'] == $table) {
$good = $info;
break;
}
}
}
$title = mixed();
$title = '';
if (!is_null($good) && !is_array($good['db_identifier'])) {
$db = array_key_exists('db', $good) ? $good['db'] : $GLOBALS['SITE_DB'];
$where = $good['db_identifier'] . '=' . $id;
if ($non_integer_id) {
$where = db_string_equal_to($good['db_identifier'], $id);
}
$rows = $db->query('SELECT ' . $good['db_identifier'] . (array_key_exists('db_title', $good) ? ',' . $good['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $good['db_table'] . ' WHERE ' . $where, 100);
if (array_key_exists('db_title', $good)) {
$title = $rows[0][$good['db_title']];
if ($good['db_title_dereference']) {
$title = get_translated_text($title, $db);
}
// May actually be comcode (can't be certain), but in which case it will be shown as source
} else {
$title = '#' . (is_integer($id) ? strval($id) : $id);
}
}
if ($title == '') {
$title = '#' . (is_integer($id) ? strval($id) : $id);
}
if (is_null($member_id)) {
$member_id = get_member();
}
require_lang('unvalidated');
$_type = do_lang($type, NULL, NULL, NULL, NULL, false);
if (!is_null($_type)) {
$type = $_type;
}
$comcode = do_template('VALIDATION_REQUEST', array('_GUID' => '1885be371b2ff7810287715ef2f7b948', 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'TYPE' => $type, 'ID' => $id, 'URL' => $url), get_site_default_lang());
require_code('notifications');
$subject = do_lang('UNVALIDATED_TITLE', $title, '', '', get_site_default_lang());
$message = $comcode->evaluate(get_site_default_lang(), false);
dispatch_notification('needs_validation', NULL, $subject, $message);
}
示例11: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('commands', array('h'), array()), '', '');
} else {
$hooks = find_all_hooks('modules', 'admin_occle_commands');
$commands = array_keys($hooks);
sort($commands);
return array('', do_template('OCCLE_COMMANDS', array('COMMANDS' => $commands)), '', '');
}
}
示例12: run
/**
* Standard modular run function.
*
* @return tempcode Results
*/
function run()
{
if (!is_null($GLOBALS['CURRENT_SHARE_USER'])) {
return new ocp_tempcode();
}
$hooks = find_all_hooks('systems', 'disposable_values');
foreach (array_keys($hooks) as $hook) {
$GLOBALS['SITE_DB']->query_delete('values', array('the_name' => $hook), '', 1);
}
persistant_cache_delete('VALUES');
return new ocp_tempcode();
}
示例13: get_realtime_events
/**
* Get all the events within a timestamp range.
*
* @param TIME From time (inclusive).
* @param TIME To time (inclusive).
* @return array List of template parameter sets (perfect for use in a Tempcode LOOP).
*/
function get_realtime_events($from, $to)
{
//restrictify();
$drops = array();
$hooks = find_all_hooks('systems', 'realtime_rain');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/realtime_rain/' . filter_naughty($hook));
$ob = object_factory('Hook_realtime_rain_' . $hook);
$drops = array_merge($drops, $ob->run($from, $to));
}
return $drops;
}
示例14: render_tab
/**
* Standard modular render function for profile tab hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return array A triple: The tab title, the tab contents, the suggested tab order
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('EDIT_EM');
require_lang('ocf');
require_css('ocf');
$order = 200;
if ($leave_to_ajax_if_possible && strtoupper(ocp_srv('REQUEST_METHOD')) != 'POST') {
return array($title, NULL, $order);
}
$tabs = array();
$hooks = find_all_hooks('systems', 'profiles_tabs_edit');
if (isset($hooks['settings'])) {
$hooks = array('settings' => $hooks['settings']) + $hooks;
}
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/profiles_tabs_edit/' . $hook);
$ob = object_factory('Hook_Profiles_Tabs_Edit_' . $hook);
if ($ob->is_active($member_id_of, $member_id_viewing)) {
$tabs[] = $ob->render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible);
}
}
if ($leave_to_ajax_if_possible) {
return array($title, NULL, $order);
}
global $M_SORT_KEY;
$M_SORT_KEY = 4;
usort($tabs, 'multi_sort');
$javascript = '';
$hidden = new ocp_tempcode();
// Session ID check, if saving
if (count($_POST) != 0 && count($tabs) != 0) {
global $SESSION_CONFIRMED;
if ($SESSION_CONFIRMED == 0) {
access_denied('SESSION', '', true);
}
}
$_tabs = array();
$first = true;
foreach ($tabs as $i => $tab) {
if (is_null($tab)) {
continue;
}
$javascript .= $tab[3];
if (isset($tab[5])) {
$hidden->attach($tab[5]);
}
$_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_FIELDS' => $tab[1], 'TAB_TEXT' => $tab[2], 'TAB_FIRST' => $first, 'TAB_LAST' => !array_key_exists($i + 1, $tabs));
$first = false;
}
$url = build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, false);
$content = do_template('OCF_MEMBER_PROFILE_EDIT', array('JAVASCRIPT' => $javascript, 'HIDDEN' => $hidden, 'URL' => $url, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'), 'AUTOCOMPLETE' => false, 'SKIP_VALIDATION' => true, 'TABS' => $_tabs));
return array($title, $content, $order);
}
示例15: has_external_site_wide_syndication
/**
* Detect whether we have external site-wide syndication support somewhere.
*
* @return boolean Whether we do
*/
function has_external_site_wide_syndication()
{
$dests = find_all_hooks('systems', 'syndication');
foreach (array_keys($dests) as $hook) {
require_code('hooks/systems/syndication/' . $hook);
$ob = object_factory('Hook_Syndication_' . $hook);
if ($ob->is_available() && $ob->auth_is_set_site()) {
return true;
}
}
return false;
}