本文整理汇总了PHP中add_event_handler函数的典型用法代码示例。如果您正苦于以下问题:PHP add_event_handler函数的具体用法?PHP add_event_handler怎么用?PHP add_event_handler使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_event_handler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_index_thumbnails
static function on_index_thumbnails($thumbs)
{
global $page, $template;
$total = count($page['items']);
if (count($thumbs) >= $total) {
add_event_handler('loc_end_index', array('RVTS', 'on_end_index'));
return $thumbs;
}
$url_model = str_replace('123456789', '%start%', duplicate_index_url(array('start' => 123456789)));
$ajax_url_model = add_url_params($url_model, array('rvts' => '%per%'));
$url_model = str_replace('&', '&', $url_model);
$ajax_url_model = str_replace('&', '&', $ajax_url_model);
$my_base_name = basename(dirname(__FILE__));
$ajax_loader_image = get_root_url() . "plugins/{$my_base_name}/ajax-loader.gif";
$template->func_combine_script(array('id' => 'jquery', 'load' => 'footer', 'path' => 'themes/default/js/jquery.min.js'));
$template->func_combine_script(array('id' => $my_base_name, 'load' => 'async', 'path' => 'plugins/' . $my_base_name . '/rv_tscroller.min.js', 'require' => 'jquery', 'version' => RVTS_VERSION));
$start = (int) $page['start'];
$per_page = $page['nb_image_page'];
$moreMsg = 'See the remaining %d photos';
if ('en' != $GLOBALS['lang_info']['code']) {
load_language('lang', dirname(__FILE__) . '/');
$moreMsg = l10n($moreMsg);
}
// the String.fromCharCode comes from google bot which somehow manage to get these urls
$template->block_footer_script(null, "var RVTS = {\najaxUrlModel: String.fromCharCode(" . ord($ajax_url_model[0]) . ")+'" . substr($ajax_url_model, 1) . "',\nstart: {$start},\nperPage: {$per_page},\nnext: " . ($start + $per_page) . ",\ntotal: {$total},\nurlModel: String.fromCharCode(" . ord($url_model[0]) . ")+'" . substr($url_model, 1) . "',\nmoreMsg: '{$moreMsg}',\nprevMsg: '" . l10n("Previous") . "',\najaxLoaderImage: '{$ajax_loader_image}'\n};\njQuery('.navigationBar').hide();");
return $thumbs;
}
示例2: GDThumb_index
function GDThumb_index()
{
global $template;
$template->smarty->registerPlugin("function", "media_type", "GDThumb_media_type");
$template->set_prefilter('index', 'GDThumb_prefilter');
add_event_handler('loc_end_index_thumbnails', 'GDThumb_process_thumb', 50, 2);
}
示例3: init
public function init()
{
$this->setPluginWarnings();
add_event_handler('loc_begin_page_header', array($this, 'assignConfig'));
$shortname = $this->config->comments_disqus_shortname;
if ($this->config->comments_type == 'disqus' && !empty($shortname)) {
add_event_handler('blockmanager_apply', array($this, 'hideMenus'));
}
}
示例4: Fotorama_element_content
function Fotorama_element_content($content)
{
global $page;
if (Fotorama_is_replace_picture()) {
$page['slideshow'] = true;
}
if ($page['slideshow']) {
add_event_handler('loc_end_page_header', 'Fotorama_end_page_header');
}
return $content;
}
示例5: polaroid_index
function polaroid_index()
{
global $template, $page, $conf;
if ($conf['polaroid']['apply_to_albums'] == 'list') {
if (!isset($page['category'])) {
return;
}
if (!$page['category']['polaroid_active']) {
return;
}
}
$template->set_prefilter('index', 'polaroid_prefilter');
add_event_handler('loc_end_index_thumbnails', 'process_polaroid', 50, 2);
}
示例6: find_available_check_key
$nbm_user['check_key'] = find_available_check_key();
// Save key
array_push($check_key_list, $nbm_user['check_key']);
// Insert new nbm_users
array_push($inserts, array('user_id' => $user['id'], 'check_key' => $nbm_user['check_key'], 'enabled' => $_POST['NBM_Subscription']));
mass_inserts(USER_MAIL_NOTIFICATION_TABLE, array('user_id', 'check_key', 'enabled'), $inserts);
} elseif ($count != 0 and !empty($_POST['NBM_Subscription']) && in_array($_POST['NBM_Subscription'], array('true', 'false'))) {
$query = '
UPDATE ' . USER_MAIL_NOTIFICATION_TABLE . '
SET enabled = \'' . $_POST['NBM_Subscription'] . '\'
WHERE user_id = \'' . $user['id'] . '\';';
pwg_query($query);
}
}
/* Adding NBMS in profile page */
add_event_handler('load_profile_in_template', 'NBMS_Load_Profile');
function NBMS_Load_Profile()
{
global $conf, $user, $template, $lang;
$query = '
SELECT enabled
FROM ' . USER_MAIL_NOTIFICATION_TABLE . '
WHERE user_id = \'' . $user['id'] . '\'
;';
$data = pwg_db_fetch_assoc(pwg_query($query));
$values = $data['enabled'];
if (is_null($values)) {
$values = 'false';
}
$template->assign('radio_options', array('true' => l10n('Yes'), 'false' => l10n('No')));
$template->assign(array('NBMS' => $values));
示例7: Pure_default_prefilter_index
{
global $template;
$template->set_prefilter('index', 'Pure_default_prefilter_index');
}
function Pure_default_prefilter_index($content, &$smarty)
{
global $pattern;
$r = $pattern['Pure_default_prefilter_index']['R'];
$ps = $pattern['Pure_default_prefilter_index']['S'];
foreach ($r as $i => $pr) {
$content = preg_replace($ps[$i], $pr, $content);
}
return $content;
}
/************************************ picture.tpl ************************************/
add_event_handler('loc_begin_picture', 'Pure_default_picture');
function Pure_default_picture()
{
global $template;
$template->set_prefilter('picture', 'Pure_default_prefilter_picture');
}
function Pure_default_prefilter_picture($content, &$smarty)
{
global $pattern;
$r = $pattern['Pure_default_prefilter_picture']['R'];
$ps = $pattern['Pure_default_prefilter_picture']['S'];
foreach ($r as $i => $pr) {
$content = preg_replace($ps[$i], $pr, $content);
}
return $content;
}
示例8: define
define('ADMINTOOLS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID);
include_once ADMINTOOLS_PATH . 'include/events.inc.php';
include_once ADMINTOOLS_PATH . 'include/MultiView.class.php';
global $MultiView;
$MultiView = new MultiView();
add_event_handler('init', 'admintools_init');
add_event_handler('user_init', array(&$MultiView, 'user_init'));
add_event_handler('init', array(&$MultiView, 'init'));
add_event_handler('ws_add_methods', array('MultiView', 'register_ws'));
add_event_handler('delete_user', array('MultiView', 'invalidate_cache'));
add_event_handler('register_user', array('MultiView', 'invalidate_cache'));
if (!defined('IN_ADMIN')) {
add_event_handler('loc_after_page_header', 'admintools_add_public_controller');
add_event_handler('loc_begin_picture', 'admintools_save_picture');
add_event_handler('loc_begin_index', 'admintools_save_category');
} else {
add_event_handler('loc_begin_page_header', 'admintools_add_admin_controller_setprefilter');
add_event_handler('loc_after_page_header', 'admintools_add_admin_controller');
add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link');
}
function admintools_init()
{
global $conf;
$conf['AdminTools'] = safe_unserialize($conf['AdminTools']);
load_language('plugin.lang', ADMINTOOLS_PATH);
}
function admintools_admin_link($menu)
{
$menu[] = array('NAME' => 'Admin Tools', 'URL' => ADMINTOOLS_ADMIN);
return $menu;
}
示例9: define
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
define('PHPWG_ROOT_PATH', './');
define('IN_WS', true);
include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
check_status(ACCESS_FREE);
if (!$conf['allow_web_services']) {
page_forbidden('Web services are disabled');
}
include_once PHPWG_ROOT_PATH . 'include/ws_core.inc.php';
add_event_handler('ws_add_methods', 'ws_addDefaultMethods');
add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
$requestFormat = 'rest';
$responseFormat = null;
if (isset($_GET['format'])) {
$responseFormat = $_GET['format'];
}
if (!isset($responseFormat) and isset($requestFormat)) {
$responseFormat = $requestFormat;
}
$service = new PwgServer();
if (!is_null($requestFormat)) {
$handler = null;
switch ($requestFormat) {
case 'rest':
include_once PHPWG_ROOT_PATH . 'include/ws_protocols/rest_handler.php';
$handler = new PwgRestRequestHandler();
示例10: try_log_user
}
return $pwg_hasher->CheckPassword($password, $hash);
}
/**
* Tries to login a user given username and password (must be MySql escaped).
*
* @param string $username
* @param string $password
* @param bool $remember_me
* @return bool
*/
function try_log_user($username, $password, $remember_me)
{
return trigger_change('try_log_user', false, $username, $password, $remember_me);
}
add_event_handler('try_log_user', 'pwg_login');
/**
* Default method for user login, can be overwritten with 'try_log_user' trigger.
* @see try_log_user()
*
* @param string $username
* @param string $password
* @param bool $remember_me
* @return bool
*/
function pwg_login($success, $username, $password, $remember_me)
{
if ($success === true) {
return true;
}
// we force the session table to be clean
示例11: __construct
function __construct()
{
add_event_handler('list_check_integrity', array(&$this, 'c13y_version'));
add_event_handler('list_check_integrity', array(&$this, 'c13y_exif'));
add_event_handler('list_check_integrity', array(&$this, 'c13y_user'));
}
示例12: IN
$clauses[] = 'image_id IN (' . implode(', ', $search['image_ids']) . ')';
}
}
if (isset($search['fields']['ip'])) {
$clauses[] = 'IP LIKE "' . $search['fields']['ip'] . '"';
}
$clauses = prepend_append_array_items($clauses, '(', ')');
$where_separator = implode("\n AND ", $clauses);
$query = '
SELECT
date,
time,
user_id,
IP,
section,
category_id,
tag_ids,
image_id,
image_type
FROM ' . HISTORY_TABLE . '
WHERE ' . $where_separator . '
;';
// LIMIT '.$conf['nb_logs_page'].' OFFSET '.$page['start'].'
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
$data[] = $row;
}
return $data;
}
add_event_handler('get_history', 'get_history');
trigger_notify('functions_history_included');
示例13: get_absolute_root_url
include_once PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php';
if (check_upgrade_feed()) {
$header_msgs[] = 'Some database upgrades are missing, ' . '<a href="' . get_absolute_root_url(false) . 'upgrade_feed.php">upgrade now</a>';
}
}
if (count($header_msgs) > 0) {
$template->assign('header_msgs', $header_msgs);
$header_msgs = array();
}
if (!empty($conf['filter_pages']) and get_filter_page_value('used')) {
include PHPWG_ROOT_PATH . 'include/filter.inc.php';
} else {
$filter['enabled'] = false;
}
if (isset($conf['header_notes'])) {
$header_notes = array_merge($header_notes, $conf['header_notes']);
}
// default event handlers
add_event_handler('render_category_literal_description', 'render_category_literal_description');
if (!$conf['allow_html_descriptions']) {
add_event_handler('render_category_description', 'nl2br');
}
add_event_handler('render_comment_content', 'render_comment_content');
add_event_handler('render_comment_author', 'strip_tags');
add_event_handler('render_tag_url', 'str2url');
add_event_handler('blockmanager_register_blocks', 'register_default_menubar_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL - 1);
if (!empty($conf['original_url_protection'])) {
add_event_handler('get_element_url', 'get_element_url_protection_handler');
add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler');
}
trigger_notify('init');
示例14: dirname
// Plugin on picture page
if (script_basename() == 'picture') {
include_once dirname(__FILE__) . '/picture.inc.php';
} elseif (script_basename() == 'index') {
include_once dirname(__FILE__) . '/category.inc.php';
include_once dirname(__FILE__) . '/menu.inc.php';
}
// Do we have to show a link on the left menu
if ($conf['osm_conf']['left_menu']['enabled']) {
// Hook to add link on the left menu
add_event_handler('blockmanager_apply', 'osm_blockmanager_apply');
}
// Hook to add worldmap link on the album/category thumbnails
add_event_handler('loc_begin_index_category_thumbnails', 'osm_index_cat_thumbs_displayed');
// Hook to add worldmap link on the index thumbnails page
add_event_handler('loc_end_index', 'osm_end_index');
function osm_index_cat_thumbs_displayed()
{
global $page;
$page['osm_cat_thumbs_displayed'] = true;
}
define('OSM_ACTION_MODEL', '<a href="%s" title="%s" rel="nofollow" class="pwg-state-default pwg-button"%s><span class="pwg-icon pwg-icon-globe"> </span><span class="pwg-button-text">%s</span></a>');
function osm_end_index()
{
global $page, $filter, $template;
if (isset($page['chronology_field']) || $filter['enabled']) {
return;
}
if ('categories' == @$page['section']) {
// flat or no flat ; has subcats or not; ?
if (!@$page['osm_cat_thumbs_displayed'] and empty($page['items'])) {
示例15: embellish_url
$filename = embellish_url(get_gallery_home_url() . $picture['current']['element_url']);
$height = isset($conf['osm_conf']['gpx']['height']) ? $conf['osm_conf']['gpx']['height'] : '500';
$width = isset($conf['osm_conf']['gpx']['width']) ? $conf['osm_conf']['gpx']['width'] : '320';
$local_conf = array();
$local_conf['contextmenu'] = 'false';
$local_conf['control'] = true;
$local_conf['img_popup'] = false;
$local_conf['popup'] = 2;
$local_conf['center_lat'] = 0;
$local_conf['center_lng'] = 0;
$local_conf['zoom'] = '12';
$local_conf['divname'] = 'mapgpx';
$js_data = array(array(null, null, null, null, null, null, null, null));
$js = osm_get_js($conf, $local_conf, $js_data);
// Select the template
$template->set_filenames(array('osm_content' => dirname(__FILE__) . "/template/osm-gpx.tpl"));
// Assign the template variables
$template->assign(array('HEIGHT' => $height, 'WIDTH' => $width, 'FILENAME' => $filename, 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'OSMGPX' => $js));
// Return the rendered html
$osm_content = $template->parse('osm_content', true);
return $osm_content;
}
// Hook to display a fallback thumbnail if not defined
add_event_handler('get_mimetype_location', 'osm_get_mimetype_icon');
function osm_get_mimetype_icon($location, $element_info)
{
if ($element_info == 'gpx') {
$location = 'plugins/' . basename(dirname(__FILE__)) . '/mimetypes/' . $element_info . '.png';
}
return $location;
}