本文整理汇总了PHP中hook::action方法的典型用法代码示例。如果您正苦于以下问题:PHP hook::action方法的具体用法?PHP hook::action怎么用?PHP hook::action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hook
的用法示例。
在下文中一共展示了hook::action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteEntry
public function deleteEntry($newsID, $news)
{
// Delete entry
$retval = $this->fields_model->deleteValues('news', $newsID);
if ($retval) {
// Delete comments
if ($news['total_comments']) {
loader::model('comments/comments');
$this->comments_model->deleteComments('news', $newsID, $news['total_comments']);
}
// Delete likes
if ($news['total_likes']) {
loader::model('comments/likes');
$this->likes_model->deleteLikes('news', $newsID, $news['total_likes']);
}
// Delete votes
if ($news['total_votes']) {
loader::model('comments/votes');
$this->votes_model->deleteVotes('news', $newsID, $news['total_votes']);
}
// Action hook
hook::action('news/delete', $newsID, $news);
}
return $retval;
}
示例2: deleteType
public function deleteType($typeID, $type)
{
loader::library('dbforge');
$this->dbforge->dropTable(':prefix:users_data_' . $type['keyword']);
// Delete user type
if ($retval = $this->db->delete('users_types', array('type_id' => $typeID), 1)) {
// Update order IDs
$this->db->query("UPDATE `:prefix:users_types` SET `order_id`=`order_id`-1 WHERE `order_id`>?", array($type['order_id']));
// Select fields IDs
$fieldIDs = array();
foreach ($this->db->query("SELECT `field_id`, `category_id`, `keyword` FROM `:prefix:core_fields` WHERE `category_id`=?", array($typeID))->result() as $field) {
$fieldIDs[] = $field['field_id'];
}
// Do we have any field IDs?
if ($fieldIDs) {
// Delete field items
$this->db->query("DELETE FROM `:prefix:core_fields_items` WHERE `field_id` IN (" . implode(',', $fieldIDs) . ")");
}
// Delete fields
$this->db->delete('core_fields', array('category_id' => $typeID));
// Action hook
hook::action('users/types/delete', $typeID, $type);
}
$this->cache->cleanup();
return $retval;
}
示例3: initialize
public function initialize($config = array())
{
$this->data = array();
if (isset($config['cache']) && !$config['cache'] || !($this->data = $this->cache->item('core_config_' . (input::isCP() ? 'cp' : 'fe'), true)) || isset($this->data['settings']['system']['devmode']) && $this->data['settings']['system']['devmode']) {
if (isset($this->data['settings']['system']['devmode'])) {
$this->cache->cleanup();
}
$this->getSettings();
$this->getPlugins();
$this->getResources();
$this->getHooks();
$this->getLanguages();
$this->getTemplates();
$this->getStorages();
$this->cache->set('core_config_' . (input::isCP() ? 'cp' : 'fe'), $this->data, 60 * 60 * 24 * 30, true);
}
$this->setSettings();
$this->setPlugins();
$this->setResources();
$this->setHooks();
$this->setLanguages();
$this->setTemplates();
$this->setStorages();
hook::action('initialize');
}
示例4: __construct
public function __construct($tabs = true, $loggedin = true)
{
parent::__construct();
// Is user loggedin ?
if ($loggedin && !users_helper::isLoggedin()) {
router::redirect('users/login');
}
// Set trail
view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
view::setTrail('users/settings', __('settings', 'users'));
// Set tabs
if ($tabs) {
view::setTab('users/settings', __('settings', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'settings' && (!uri::segment(3) || in_array(uri::segment(3), array('email', 'password', 'username', 'cancel'))) || uri::segment(1) == 'billing' && uri::segment(2) != 'invoices' ? 'active' : '') . ' icon-users-settings'));
if (config::item('privacy_edit', 'users')) {
view::setTab('users/settings/privacy', __('privacy', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'privacy' ? 'active' : '') . ' icon-users-privacy'));
}
if (config::item('notifications_edit', 'users')) {
view::setTab('users/settings/notifications', __('notifications', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'notifications' ? 'active' : '') . ' icon-users-notifications'));
}
if (config::item('blacklist_active', 'users')) {
view::setTab('users/blocked', __('blacklist', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'blocked' ? 'active' : '') . ' icon-users-blacklist'));
}
}
// Filter hook
hook::action('users/settings/tabs');
}
示例5: deleteUser
public function deleteUser($userID, $user)
{
// Delete messages
$retval = $this->db->query("DELETE FROM `:prefix:timeline_messages` WHERE `user_id`=? OR `poster_id`=?", array($userID, $userID));
// Action hook
hook::action('timeline/messages/delete_user', $userID, $user);
return $retval;
}
示例6: deleteBanner
public function deleteBanner($groupID, $bannerID, $banner)
{
$retval = $this->db->delete('banners_data', array('banner_id' => $bannerID), 1);
if ($retval) {
// Action hook
hook::action('banners/delete', $bannerID, $banner);
}
return $retval;
}
示例7: deleteUser
public function deleteUser($userID, $user)
{
// Delete reports
$retval = $this->db->query("DELETE FROM `:prefix:reports` WHERE `user_id`=? OR `poster_id`=?", array($userID, $userID));
if ($retval) {
// Action hook
hook::action('reports/delete_user', $userID, $user);
}
return $retval;
}
示例8: toggleItemStatus
public function toggleItemStatus($plugin, $type, $keyword, $status)
{
$retval = $this->db->update('core_lists', array('active' => $status), array('plugin' => $plugin, 'type' => $type, 'keyword' => $keyword), 1);
if ($retval) {
// Action hook
hook::action('system/templates/navigation/status', $plugin, $type, $keyword, $status);
}
$this->cache->cleanup();
return $retval;
}
示例9: process
public function process($userID, $productID, $params)
{
// Get credits package
$package = $this->getPackage($productID);
// Update total credits
$retval = $this->addCredits($userID, $package['credits']);
// Action hook
hook::action('billing/credits/process', $productID, $userID, $package['credits']);
return $retval;
}
示例10: saveMetaTags
public function saveMetaTags($plugin, $keyword, $data)
{
$retval = $this->db->update('core_meta_tags', $data, array('plugin' => $plugin, 'keyword' => $keyword), 1);
if ($retval) {
// Action hook
hook::action('system/seo/update', $plugin, $keyword, $data);
}
$this->cache->cleanup();
return $retval;
}
示例11: sendFeedback
public function sendFeedback($email, $subject, $message)
{
loader::library('email');
$this->email->reply($email);
$retval = $this->email->sendEmail(config::item('feedback_email', 'feedback'), $subject, $message);
if ($retval) {
// Action hook
hook::action('feedback/send/post', $email, $subject, $message);
}
return $retval;
}
示例12: deleteGroup
public function deleteGroup($groupID, $group)
{
// Delete banner group
$retval = $this->db->delete('banners_groups', array('group_id' => $groupID), 1);
if ($retval) {
// Delete banners
$this->db->delete('banners_data', array('group_id' => $groupID));
// Action hook
hook::action('banners/groups/delete', $groupID, $group);
}
return $retval;
}
示例13: deleteUser
public function deleteUser($userID, $user)
{
// Get users
$users = $this->db->query("SELECT * FROM `:prefix:users_blocked` WHERE `blocked_id`=?", array($userID))->result();
foreach ($users as $user) {
$this->db->query("UPDATE `:prefix:users` SET `total_blocked`=`total_blocked`-1 WHERE `user_id`=? LIMIT 1", array($user['user_id']));
}
// Delete blocked users
$retval = $this->db->query("DELETE FROM `:prefix:users_blocked` WHERE `user_id`=? OR `blocked_id`=?", array($userID, $userID));
// Action hook
hook::action('users/blocked/delete_user', $userID, $user);
return $retval;
}
示例14: cleanup
public function cleanup()
{
$timestamp = date_helper::now() - 60 * 60 * 24 * config::item('notices_cleanup_delay', 'timeline');
// Get old unseen notices
$notices = $this->db->query("SELECT * FROM `:prefix:timeline_notices` WHERE `new`=1 AND `post_date`<?", array($timestamp))->result();
foreach ($notices as $notice) {
$this->db->query("UPDATE `:prefix:users` SET `total_notices_new`=`total_notices_new`-1 WHERE `user_id`=? LIMIT 1", array($notice['user_id']));
}
// Delete notices
$retval = $this->db->query("DELETE FROM `:prefix:timeline_notices` WHERE `post_date`<?", array($timestamp));
// Action hook
hook::action('timeline/notices/cleanup');
$this->cron_model->addLog('[Timeline] Cleaned up old timeline notifications.');
return $retval;
}
示例15: saveSetting
public function saveSetting($plugin, $keyword, $value, $orderID = false)
{
$data = array('val' => $value);
if ($orderID !== false) {
$data['order_id'] = $orderID;
}
$retval = $this->db->update('core_config', $data, array('plugin' => $plugin, 'keyword' => $keyword), 1);
if ($retval) {
// Action hook
hook::action('system/settings/update', $plugin, $keyword, $value, $orderID);
}
session::delete('', 'config');
$this->cache->cleanup();
return $retval;
}