当前位置: 首页>>代码示例>>PHP>>正文


PHP ossn_trigger_callback函数代码示例

本文整理汇总了PHP中ossn_trigger_callback函数的典型用法代码示例。如果您正苦于以下问题:PHP ossn_trigger_callback函数的具体用法?PHP ossn_trigger_callback怎么用?PHP ossn_trigger_callback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ossn_trigger_callback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ossn_action

/**
 * Load action.
 *
 * @param string $action The name of the action
 *
 * @return void
 */
function ossn_action($action)
{
    global $Ossn;
    if (isset($Ossn->action) && array_key_exists($action, $Ossn->action)) {
        if (is_file($Ossn->action[$action])) {
            $params['action'] = $action;
            ossn_trigger_callback('action', 'load', $params);
            include_once $Ossn->action[$action];
            if (ossn_is_xhr()) {
                header('Content-Type: application/json');
                $vars = array();
                if (isset($_SESSION['ossn_messages']['success']) && !empty($_SESSION['ossn_messages']['success'])) {
                    $vars['success'] = $_SESSION['ossn_messages']['success'];
                }
                //danger = error bootstrap
                if (isset($_SESSION['ossn_messages']['danger']) && !empty($_SESSION['ossn_messages']['danger'])) {
                    $vars['error'] = $_SESSION['ossn_messages']['danger'];
                }
                if (isset($Ossn->redirect) && !empty($Ossn->redirect)) {
                    $vars['redirect'] = $Ossn->redirect;
                }
                if (isset($Ossn->ajaxData) && !empty($Ossn->ajaxData)) {
                    $vars['data'] = $Ossn->ajaxData;
                }
                unset($_SESSION['ossn_messages']);
                if (!empty($vars)) {
                    echo json_encode($vars);
                }
            }
        }
    } else {
        ossn_error_page();
    }
}
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:41,代码来源:ossn.lib.actions.php

示例2: Like

 /**
  * Like item
  *
  * @params $subject_id: Id of item which users liked
  *         $guid: Guid of user
  *         $type: Post or Entity
  *
  * @return bool
  */
 public function Like($subject_id, $guid, $type = 'post')
 {
     if (empty($subject_id) || empty($guid) || empty($type)) {
         return false;
     }
     if ($type == 'annotation') {
         $annotation = new OssnAnnotation();
         $annotation->annotation_id = $subject_id;
         $annotation = $annotation->getAnnotationById();
         if (empty($annotation->id)) {
             return false;
         }
     }
     if ($type == 'post') {
         $post = new OssnObject();
         $post->object_guid = $subject_id;
         $post = $post->getObjectById();
         if (empty($post->time_created)) {
             return false;
         }
     }
     if (!$this->isLiked($subject_id, $guid, $type)) {
         $this->statement("INSERT INTO ossn_likes (`subject_id`, `guid`, `type`)\n\t\t\t\t\t           VALUES('{$subject_id}', '{$guid}', '{$type}');");
         if ($this->execute()) {
             $params['subject_guid'] = $subject_id;
             $params['owner_guid'] = $guid;
             $params['type'] = "like:{$type}";
             ossn_trigger_callback('like', 'created', $params);
             return true;
         }
     }
     return false;
 }
开发者ID:aidovoga,项目名称:opensource-socialnetwork,代码行数:42,代码来源:OssnLikes.php

示例3: ossn_search_page

function ossn_search_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        $page = 'search';
    }
    ossn_trigger_callback('page', 'load:search');
    switch ($page) {
        case 'search':
            $query = input('q');
            $type = input('type');
            $title = ossn_print("search:result", array($query));
            if (empty($type)) {
                $params['type'] = 'users';
            } else {
                $params['type'] = $type;
            }
            $type = $params['type'];
            if (ossn_is_hook('search', "type:{$type}")) {
                $contents['contents'] = ossn_call_hook('search', "type:{$type}", array('q' => input('q')));
            }
            $contents = array('content' => ossn_plugin_view('search/pages/search', $contents));
            $content = ossn_set_page_layout('search', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:30,代码来源:ossn_com.php

示例4: add

 /**
  * Add notification to database
  *
  * @param integer $subject_id Id of item which user comment
  * @param integer $poster_guid Guid of item poster
  * @param integer $item_guid: Guid of item
  * @param integer $notification_owner: Guid of notification owner
  *
  * @return boolean;
  */
 public function add($type, $poster_guid, $subject_guid, $item_guid = NULL, $notification_owner = '')
 {
     if (!empty($type) && !empty($subject_guid) && !empty($poster_guid)) {
         $vars = array('type' => $type, 'poster_guid' => $poster_guid, 'owner_guid' => null, 'item_guid' => $item_guid, 'subject_guid' => $subject_guid, 'notification_owner' => $notification_owner);
         $this->notification = ossn_call_hook('notification:add', $type, $vars, false);
         if (!$this->notification) {
             return false;
         }
         //check if owner_guid is empty or owner_guid is same as poster_guid then return false,
         if (empty($this->notification['owner_guid']) || $this->notification['owner_guid'] == $this->notification['poster_guid']) {
             return false;
         }
         //check if notification owner is set then use it.
         if (!empty($this->notification['notification_owner'])) {
             $this->notification['owner_guid'] = $this->notification['notification_owner'];
         }
         $callback = array('type' => $this->notification['type'], 'poster_guid' => $this->notification['poster_guid'], 'owner_guid' => $this->notification['owner_guid'], 'subject_guid' => $this->notification['subject_guid'], 'item_guid' => $this->notification['item_guid']);
         if ($poster_guid == $guid_two) {
             $paricipates = $this->get_comments_participates($subject_guid);
             if ($type !== 'like:post' && $paricipates) {
                 foreach ($paricipates as $partcipate) {
                     $params['into'] = 'ossn_notifications';
                     $params['names'] = array('type', 'poster_guid', 'owner_guid', 'subject_guid', 'item_guid', 'time_created');
                     $params['values'] = array($this->notification['type'], $this->notification['poster_guid'], $partcipate, $this->notification['subject_guid'], $this->notification['item_guid'], time());
                     if ($partcipate !== $poster_guid) {
                         ossn_trigger_callback('notification', 'add:participates', $callback);
                         $this->insert($params);
                     }
                 }
             }
             return false;
         }
         $params['into'] = 'ossn_notifications';
         $params['names'] = array('type', 'poster_guid', 'owner_guid', 'subject_guid', 'item_guid', 'time_created');
         $params['values'] = array($this->notification['type'], $this->notification['poster_guid'], $this->notification['owner_guid'], $this->notification['subject_guid'], $this->notification['item_guid'], time());
         if ($this->insert($params)) {
             //notify participates
             $paricipates = $this->get_comments_participates($subject_guid);
             if ($type !== 'like:post' && $paricipates) {
                 foreach ($paricipates as $partcipate) {
                     $params['into'] = 'ossn_notifications';
                     $params['names'] = array('type', 'poster_guid', 'owner_guid', 'subject_guid', 'item_guid', 'time_created');
                     $params['values'] = array($this->notification['type'], $this->notification['poster_guid'], $partcipate, $this->notification['subject_guid'], $this->notification['item_guid'], time());
                     if ($partcipate !== $poster_guid) {
                         if ($this->insert($params)) {
                             unset($callback['owner_guid']);
                             $callback['owner_guid'] = $partcipate;
                             ossn_trigger_callback('notification', 'add:participates', $callback);
                         }
                     }
                 }
             }
             ossn_trigger_callback('notification', 'add', $callback);
             return true;
         }
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:68,代码来源:OssnNotifications.php

示例5: ossn_action

function ossn_action($action)
{
    global $Ossn;
    if (isset($Ossn->action) && array_key_exists($action, $Ossn->action)) {
        if (is_file($Ossn->action[$action])) {
            ossn_trigger_callback('action', "load:{$action}");
            include_once $Ossn->action[$action];
        }
    } else {
        ossn_error_page();
        exit;
    }
}
开发者ID:alibasli,项目名称:Social-Network-PHP-Joomla,代码行数:13,代码来源:ossn.lib.actions.php

示例6: ossn_action

/**
 * Load action.
 *
 * @param string $action The name of the action
 *
 * @return void
 */
function ossn_action($action)
{
    global $Ossn;
    if (isset($Ossn->action) && array_key_exists($action, $Ossn->action)) {
        if (is_file($Ossn->action[$action])) {
            $params['action'] = $action;
            ossn_trigger_callback('action', 'load', $params);
            include_once $Ossn->action[$action];
        }
    } else {
        ossn_error_page();
    }
}
开发者ID:aidovoga,项目名称:opensource-socialnetwork,代码行数:20,代码来源:ossn.lib.actions.php

示例7: ossn_group_page

/**
 * Group page handler
 * This page also contain subpages like group/<guid>/members
 *
 * Pages:
 *      group/<guid>
 *      group/<guid>/<subpage>
 * Subpage need to be register seperatly.
 *
 * @return mixdata;
 * @access private
 */
function ossn_group_page($pages)
{
    if (empty($pages[0])) {
        ossn_error_page();
    }
    if (!empty($pages[0]) && !empty($pages[0])) {
        if (isset($pages[1])) {
            $params['subpage'] = $pages[1];
        } else {
            $params['subpage'] = '';
        }
        if (!ossn_is_group_subapge($params['subpage']) && !empty($params['subpage'])) {
            return false;
        }
        $group = ossn_get_group_by_guid($pages[0]);
        if (empty($group->guid)) {
            ossn_error_page();
        }
        ossn_set_page_owner_guid($group->guid);
        ossn_trigger_callback('page', 'load:group');
        $params['group'] = $group;
        $title = $group->title;
        $view = ossn_plugin_view('groups/pages/profile', $params);
        $contents['content'] = ossn_group_layout($view);
        $content = ossn_set_page_layout('contents', $contents);
        echo ossn_view_page($title, $content);
    }
}
开发者ID:emnaborgi,项目名称:RS,代码行数:40,代码来源:ossn_com.php

示例8: deleteUser

 /**
  * Delete user from syste,
  *
  * @return boolean
  */
 public function deleteUser()
 {
     self::initAttributes();
     if (!empty($this->guid) && !empty($this->username)) {
         $params['from'] = 'ossn_users';
         $params['wheres'] = array("guid='{$this->guid}'");
         if ($this->delete($params)) {
             //delete user files
             $datadir = ossn_get_userdata("user/{$this->guid}/");
             if (is_dir($datadir)) {
                 OssnFile::DeleteDir($datadir);
                 //From of v2.0 DeleteDir delete directory also #138
                 //rmdir($datadir);
             }
             //delete user entites also
             $this->deleteByOwnerGuid($this->guid, 'user');
             //delete annotations
             $this->OssnAnnotation->owner_guid = $this->guid;
             $this->OssnAnnotation->deleteAnnotationByOwner($this->guid);
             //trigger callback so other components can be notified when user deleted.
             //should delete relationships
             ossn_delete_user_relations($this);
             $vars['entity'] = $this;
             ossn_trigger_callback('user', 'delete', $vars);
             return true;
         }
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:34,代码来源:OssnUser.php

示例9: redirect

    redirect('home');
}
$username = input('username');
$password = input('password');
if (empty($username) || empty($password)) {
    ossn_trigger_message(ossn_print('login:error'));
    redirect();
}
$user = ossn_user_by_username($username);
//check if username is email
if (strpos($username, '@') !== false) {
    $user = ossn_user_by_email($username);
    $username = $user->username;
}
if ($user && !$user->isUserVALIDATED()) {
    $user->resendValidationEmail();
    ossn_trigger_message(ossn_print('ossn:user:validation:resend'), 'error');
    redirect(REF);
}
$vars = array('user' => $user);
ossn_trigger_callback('user', 'before:login', $vars);
$login = new OssnUser();
$login->username = $username;
$login->password = $password;
if ($login->Login()) {
    //One uneeded redirection when login #516
    ossn_trigger_callback('login', 'success', $vars);
    redirect('home');
} else {
    redirect('login?error=1');
}
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:31,代码来源:login.php

示例10: deleteGroup

 /**
  * Delete group
  *
  * @params $guid Group guid
  *
  * @return bool;
  */
 public function deleteGroup($guid)
 {
     if (empty($guid)) {
         return false;
     }
     $vars['entity'] = ossn_get_group_by_guid($guid);
     if ($this->deleteObject($guid)) {
         //delete group relations
         ossn_delete_group_relations($vars['entity']);
         //trigger callback so other components can be notified when group is deleted.
         ossn_trigger_callback('group', 'delete', $vars);
         return true;
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:22,代码来源:OssnGroup.php

示例11: loadComs

 /**
  * Load all active components
  *
  * @return false|null startup files;
  */
 public function loadComs()
 {
     $coms = $this->getActive();
     $lang = ossn_site_settings('language');
     $vars['activated'] = $coms;
     ossn_trigger_callback('components', 'before:load', $vars);
     if (!$coms) {
         return false;
     }
     foreach ($coms as $com) {
         $dir = ossn_route()->com;
         $name = $this->getCom($com->com_id);
         if (!empty($name->name)) {
             ossn_register_plugins_by_path("{$dir}{$com->com_id}/plugins/");
             if (is_file("{$dir}{$com->com_id}/locale/ossn.{$lang}.php")) {
                 include "{$dir}{$com->com_id}/locale/ossn.{$lang}.php";
             }
             include_once "{$dir}{$com->com_id}/ossn_com.php";
         }
     }
     ossn_trigger_callback('components', 'after:load', $vars);
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:27,代码来源:OssnComponents.php

示例12: deleteComment

 /**
  * Delete Comment
  *
  * @params $comment: Comment id
  *
  * @return bool
  */
 public function deleteComment($comment)
 {
     if ($this->deleteAnnotation($comment)) {
         $params['comment'] = $comment;
         ossn_trigger_callback('comment', 'delete', $params);
         return true;
     }
     return false;
 }
开发者ID:aidovoga,项目名称:opensource-socialnetwork,代码行数:16,代码来源:OssnComments.php

示例13: ossn_trigger_callback

<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <info@opensource-socialnetwork.org>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
ossn_trigger_callback('entity', 'load:comment:share:like', $params);
?>
<div class="comments-likes ossn-photos-comments" style="width:525px;">
	<div class="menu-likes-comments-share">
	    	<div class="like_share comments-like-comment-links">
            	<?php 
echo ossn_view_menu('entityextra');
?>
            </div>
	</div>     
 	<?php 
if (ossn_is_hook('post', 'likes:entity')) {
    $entity['entity_guid'] = $params['entity']->guid;
    echo ossn_call_hook('post', 'likes:entity', $entity);
}
?>
    <?php 
if (ossn_is_hook('post', 'comments:entity')) {
    $entity['entity_guid'] = $params['entity']->guid;
    echo ossn_call_hook('post', 'comments:entity', $entity);
开发者ID:emnaborgi,项目名称:RS,代码行数:31,代码来源:view.php

示例14: deleteEntity

 /**
  * Delete entity.
  *
  * @param integer $guid Entity guid in database
  *
  * @return boolean
  */
 public function deleteEntity($guid)
 {
     if (isset($this->guid) && !empty($this->guid) && empty($guid)) {
         $guid = $this->guid;
     }
     $params['from'] = 'ossn_entities';
     $params['wheres'] = array("guid = '{$guid}'");
     if ($this->delete($params)) {
         $metadata['from'] = 'ossn_entities_metadata';
         $metadata['wheres'] = array("guid = '{$guid}'");
         $this->delete($metadata);
         $vars['entity'] = $guid;
         ossn_trigger_callback('delete', 'entity', $vars);
         return true;
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:24,代码来源:OssnEntities.php

示例15: deleteAlbumPhoto

 /**
  * Delete profile photo
  *
  * @params = $this->photoid Id of photo
  *
  * @return bool;
  */
 public function deleteAlbumPhoto()
 {
     if (isset($this->photoid)) {
         $this->file_id = $this->photoid;
         $this->entity = new OssnEntities();
         $file = $this->fetchFile();
         $source = ossn_get_userdata("object/{$file->owner_guid}/{$file->value}");
         //delete croped photos
         unlink($source);
         foreach (ossn_photos_sizes() as $size => $dimensions) {
             $filename = str_replace('album/photos/', '', $file->value);
             $filename = ossn_get_userdata("object/{$file->owner_guid}/album/photos/{$size}_{$filename}");
             unlink($filename);
         }
         //delete photo from database
         if ($this->deleteEntity($file->guid)) {
             $params['photo'] = get_object_vars($file);
             ossn_trigger_callback('delete', 'album:photo', $params);
             return true;
         }
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:30,代码来源:OssnPhotos.php


注:本文中的ossn_trigger_callback函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。