本文整理汇总了PHP中osc_run_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_run_hook函数的具体用法?PHP osc_run_hook怎么用?PHP osc_run_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_run_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
// this is necessary because if HTTP_HOST doesn't have the PORT the parse_url is null
$current_host = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_HOST);
if ($current_host === null) {
$current_host = Params::getServerParam('HTTP_HOST');
}
if (parse_url(osc_base_url(), PHP_URL_HOST) !== $current_host) {
// first check if it's http or https
$url = 'http://';
if (osc_is_ssl()) {
$url = 'https://';
}
// append the domain
$url .= parse_url(osc_base_url(), PHP_URL_HOST);
// append the port number if it's necessary
$http_port = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT);
if ($http_port !== 80) {
$url .= ':' . parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT);
}
// append the request
$url .= Params::getServerParam('REQUEST_URI', false, false);
$this->redirectTo($url);
}
$this->subdomain_params($current_host);
$this->page = Params::getParam('page');
$this->action = Params::getParam('action');
$this->ajax = false;
$this->time = list($sm, $ss) = explode(' ', microtime());
WebThemes::newInstance();
osc_run_hook('init');
}
示例2: osc_deleteResource
/**
* Remove resources from disk
* @param <type> $id
* @param boolean $admin
* @return boolean
*/
function osc_deleteResource($id, $admin)
{
if (defined('DEMO')) {
return false;
}
if (is_array($id)) {
$id = $id[0];
}
$resource = ItemResource::newInstance()->findByPrimaryKey($id);
if (!is_null($resource)) {
Log::newInstance()->insertLog('item', 'delete resource', $resource['pk_i_id'], $id, $admin ? 'admin' : 'user', $admin ? osc_logged_admin_id() : osc_logged_user_id());
$backtracel = '';
foreach (debug_backtrace() as $k => $v) {
if ($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require") {
$backtracel .= "#" . $k . " " . $v['function'] . "(" . $v['args'][0] . ") called@ [" . $v['file'] . ":" . $v['line'] . "] / ";
} else {
$backtracel .= "#" . $k . " " . $v['function'] . " called@ [" . $v['file'] . ":" . $v['line'] . "] / ";
}
}
Log::newInstance()->insertLog('item', 'delete resource backtrace', $resource['pk_i_id'], $backtracel, $admin ? 'admin' : 'user', $admin ? osc_logged_admin_id() : osc_logged_user_id());
@unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "." . $resource['s_extension']);
@unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_original." . $resource['s_extension']);
@unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_thumbnail." . $resource['s_extension']);
@unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_preview." . $resource['s_extension']);
osc_run_hook('delete_resource', $resource);
}
}
示例3: doView
function doView($file)
{
osc_run_hook('before_html');
osc_current_web_theme_path($file);
Session::newInstance()->_clearVariables();
osc_run_hook('after_html');
}
示例4: showAuthFailPage
function showAuthFailPage()
{
// juanramon: we add here de init_admin hook becuase if not, it's not called
osc_run_hook('init_admin');
require osc_admin_base_path() . 'gui/login.php';
exit;
}
示例5: doView
function doView($file)
{
osc_run_hook("before_admin_html");
osc_current_admin_theme_path($file);
Session::newInstance()->_clearVariables();
osc_run_hook("after_admin_html");
}
示例6: addTableHeader
private function addTableHeader()
{
$arg_date = '&sort=date';
if (Params::getParam('sort') == 'date') {
if (Params::getParam('direction') == 'desc') {
$arg_date .= '&direction=asc';
}
}
$arg_item = '&sort=attached_to';
if (Params::getParam('sort') == 'attached_to') {
if (Params::getParam('direction') == 'desc') {
$arg_item .= '&direction=asc';
}
}
Rewrite::newInstance()->init();
$page = (int) Params::getParam('iPage');
if ($page == 0) {
$page = 1;
}
Params::setParam('iPage', $page);
$url_base = preg_replace('|&direction=([^&]*)|', '', preg_replace('|&sort=([^&]*)|', '', osc_base_url() . Rewrite::newInstance()->get_raw_request_uri()));
$this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />');
$this->addColumn('file', __('File'));
$this->addColumn('action', __('Action'));
$this->addColumn('attached_to', '<a href="' . osc_esc_html($url_base . $arg_item) . '">' . __('Attached to') . '</a>');
$this->addColumn('date', '<a href="' . osc_esc_html($url_base . $arg_date) . '">' . __('Date') . '</a>');
$dummy =& $this;
osc_run_hook("admin_media_table", $dummy);
}
示例7: __construct
function __construct()
{
parent::__construct();
// @deprecated: to be removed
osc_run_hook('init_admin');
osc_run_hook('init_admin_insecure');
}
示例8: __construct
function __construct()
{
$this->action = Params::getParam('action');
$this->ajax = false;
$this->time = list($sm, $ss) = explode(' ', microtime());
WebThemes::newInstance();
osc_run_hook('init');
}
示例9: __construct
function __construct()
{
parent::__construct();
// check if is moderator and can enter to this page
if ($this->isModerator()) {
if (!in_array($this->page, array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', ''))) {
osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
$this->redirectTo(osc_admin_base_url());
}
}
osc_run_hook('init_admin');
// check if exist a new version each day
if (time() - osc_last_version_check() > 24 * 3600) {
$data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?');
$data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data);
$json = json_decode($data);
if ($json->version > osc_version()) {
osc_set_preference('update_core_json', $data);
} else {
osc_set_preference('update_core_json', '');
}
osc_set_preference('last_version_check', time());
osc_reset_preferences();
}
$config_version = str_replace('.', '', OSCLASS_VERSION);
$config_version = preg_replace('|-.*|', '', $config_version);
if ($config_version > Preference::newInstance()->get('version')) {
if (get_class($this) == 'CAdminTools') {
} else {
if (get_class($this) != 'CAdminUpgrade') {
$this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
}
}
}
// show messages subscribed
$status_subscribe = Params::getParam('subscribe_osclass');
if ($status_subscribe != '') {
switch ($status_subscribe) {
case -1:
osc_add_flash_error_message(_m('Entered an invalid email'), 'admin');
break;
case 0:
osc_add_flash_warning_message(_m("You're already subscribed"), 'admin');
break;
case 1:
osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin');
break;
default:
osc_add_flash_warning_message(_m("Error subscribing"), 'admin');
break;
}
}
// show donation successful
if (Params::getParam('donation') == 'successful') {
osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
}
}
示例10: addTableHeader
private function addTableHeader()
{
$this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />');
$this->addColumn('internal_name', __('Internal name'));
$this->addColumn('title', __('Title'));
$this->addColumn('order', __('Order'));
$dummy =& $this;
osc_run_hook("admin_pages_table", $dummy);
}
示例11: footer_js
function footer_js()
{
echo '<script type="text/javascript"><!--//--><![CDATA[//><!--';
osc_run_hook('footer_js');
echo "\n";
echo "\$('#error_list').append('<div class=\"hide_errors\">x</div>');\n";
echo "\$('.hide_errors').click(function(){ \$(this).parent().hide();});\n";
echo '//--><!]]></script>';
}
示例12: osc_runAlert
function osc_runAlert($type = null, $last_exec = null)
{
if (!in_array($type, array('HOURLY', 'DAILY', 'WEEKLY', 'INSTANT'))) {
return;
}
if ($last_exec == null) {
$cron = Cron::newInstance()->getCronByType($type);
if (is_array($cron)) {
$last_exec = $cron['d_last_exec'];
} else {
$last_exec = '0000-00-00 00:00:00';
}
}
$internal_name = 'alert_email_hourly';
switch ($type) {
case 'HOURLY':
$internal_name = 'alert_email_hourly';
break;
case 'DAILY':
$internal_name = 'alert_email_daily';
break;
case 'WEEKLY':
$internal_name = 'alert_email_weekly';
break;
case 'INSTANT':
$internal_name = 'alert_email_instant';
break;
}
$active = TRUE;
$searches = Alerts::newInstance()->findByTypeGroup($type, $active);
foreach ($searches as $s_search) {
// Get if there're new ads on this search
$json = $s_search['s_search'];
$array_conditions = (array) json_decode($json);
$new_search = Search::newInstance();
$new_search->setJsonAlert($array_conditions);
$new_search->addConditions(sprintf(" %st_item.dt_pub_date > '%s' ", DB_TABLE_PREFIX, $last_exec));
$items = $new_search->doSearch();
$totalItems = $new_search->count();
if (count($items) > 0) {
// If we have new items from last check
// Catch the user subscribed to this search
$users = Alerts::newInstance()->findUsersBySearchAndType($s_search['s_search'], $type, $active);
if (count($users) > 0) {
$ads = '';
foreach ($items as $item) {
$ads .= '<a href="' . osc_item_url_ns($item['pk_i_id']) . '">' . $item['s_title'] . '</a><br/>';
}
foreach ($users as $user) {
osc_run_hook('hook_' . $internal_name, $user, $ads, $s_search, $items, $totalItems);
AlertsStats::newInstance()->increase(date('Y-m-d'));
}
}
}
}
}
示例13: addTableHeader
private function addTableHeader()
{
$this->addColumn('id', __('Code', 'payment_pro'));
$this->addColumn('description', __('Product', 'payment_pro'));
$this->addColumn('amount', __('Price', 'payment_pro'));
$this->addColumn('quantity', __('Quantity', 'payment_pro'));
$this->addColumn('total', __('Total', 'payment_pro'));
$this->addColumn('delete', __('Delete', 'payment_pro'));
$dummy =& $this;
osc_run_hook("payment_pro_table", $dummy);
}
示例14: add_menus
/**
* Add toolbar menus and add menus running hook add_admin_toolbar_menus
*/
function add_menus()
{
// User related, aligned right.
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_menu', 0);
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_comments', 0);
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_spam', 0);
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_update_themes', 0);
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_update_plugins', 0);
osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_logout', 0);
osc_run_hook('add_admin_toolbar_menus');
}
示例15: addTableHeader
private function addTableHeader()
{
$this->addColumn('status-border', '');
$this->addColumn('status', __('Status'));
$this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />');
$this->addColumn('author', __('Author'));
$this->addColumn('comment', __('Comment'));
$this->addColumn('date', __('Date'));
$dummy =& $this;
osc_run_hook("admin_comments_table", $dummy);
}