本文整理汇总了PHP中ossn_call_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP ossn_call_hook函数的具体用法?PHP ossn_call_hook怎么用?PHP ossn_call_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ossn_call_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: ossn_register_plugins_by_path
/**
* Register a plugins by path
* This will help us to override components files easily.
*
* @param string $path A valid path;
* @return boolean
*/
function ossn_register_plugins_by_path($path)
{
global $Ossn;
if (ossn_site_settings('cache') == 1) {
return false;
}
$type = 'default';
$type = ossn_call_hook('plugins', 'type', false, $type);
$path = $path . $type . '/';
if (!is_dir($path)) {
//disable error log, will cause a huge log file
//error_log("Ossn tried to register invalid plugins by path: {$path}");
return false;
}
$path = str_replace("\\", "/", $path);
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directory);
if ($iterator) {
foreach ($iterator as $file) {
if (pathinfo($file, PATHINFO_EXTENSION) == "php") {
$file = str_replace("\\", "/", $file);
$location = str_replace(dirname(__FILE__) . '/plugins/', '', $file);
$name = str_replace($path, '', $location);
$name = substr($name, 0, -4);
$fpath = substr($file, 0, -4);
$fpath = str_replace(array($name, ossn_route()->www), '', $fpath);
$Ossn->plugins[$name] = $fpath;
}
}
}
return true;
}
示例3: ossn_css_pagehandler
/**
* Add css page handler
*
* @return false|null
*/
function ossn_css_pagehandler($css)
{
if (ossn_site_settings('cache') == 1) {
return false;
}
header("Content-type: text/css");
$page = $css[0];
if (empty($css[1])) {
header('Content-Type: text/html; charset=utf-8');
ossn_error_page();
}
if (empty($page)) {
$page = 'view';
}
switch ($page) {
case 'view':
if (ossn_site_settings('cache') == 1) {
return false;
}
if (ossn_is_hook('css', "register")) {
echo ossn_call_hook('css', "register", $css);
}
break;
default:
header('Content-Type: text/html; charset=utf-8');
ossn_error_page();
break;
}
}
示例4: ossn_css_pagehandler
function ossn_css_pagehandler($css)
{
if (ossn_site_settings('cache') == 1) {
return false;
}
header("Content-type: text/css");
$page = $css[0];
if (empty($css[1])) {
echo '404 SWITCH ERROR';
}
if (empty($page)) {
$page = 'view';
}
switch ($page) {
case 'view':
if (ossn_site_settings('cache') == 1) {
return false;
}
if (ossn_is_hook('css', "register")) {
echo ossn_call_hook('css', "register", $css);
}
break;
default:
echo '404 SWITCH ERROR';
break;
}
}
示例5: ossn_plugin_view
/**
* View a plugin
* Plugins are registered using ossn_register_plugins_by_path()
*
* @param string $plugin A valid plugin name;
* @param array|object $vars A valid arrays or object
* @return void|mixed
*/
function ossn_plugin_view($plugin = '', $vars = array(), $type = 'default')
{
global $Ossn;
$args = array('plugin' => $plugin);
$plugin_type = ossn_call_hook('plugin', 'view:type', $args, $type);
if (isset($Ossn->plugins[$plugin_type][$plugin])) {
$extended_views = ossn_fetch_extend_views($plugin, $vars);
return ossn_view($Ossn->plugins[$plugin_type][$plugin] . $plugin, $vars) . $extended_views;
}
}
示例6: ossn_view
/**
* View a file
*
* @param string $file valid file name of php file without extension;
* @param array $params Options;
* @last edit: $arsalanshah
* @return mixed data
*/
function ossn_view($path = '', $params = array())
{
global $VIEW;
if (isset($path) && !empty($path)) {
//call hook in case to over ride the view
if (ossn_is_hook('halt', "view:{$path}")) {
return ossn_call_hook('halt', "view:{$path}", $params);
}
$path = ossn_route()->www . $path;
$file = ossn_include($path . '.php', $params);
return $file;
}
}
示例7: ossn_load_page
function ossn_load_page($handler, $page)
{
global $Ossn;
ossn_add_context($handler);
$page = explode('/', $page);
if (isset($Ossn->page) && isset($Ossn->page[$handler]) && !empty($handler) && is_callable($Ossn->page[$handler])) {
ob_start();
call_user_func($Ossn->page[$handler], $page, $handler);
$contents = ob_get_clean();
$params['page'] = $page;
$params['handler'] = $handler;
return ossn_call_hook('page', 'load', $params, $contents);
} else {
return ossn_error_page();
}
}
示例8: execute
/**
* Execute a mysqli query and store result in memory
*
* @return bool;
*/
public function execute()
{
$this->database = $this->Connect();
if (isset($this->query) && !empty($this->query)) {
$this->database->set_charset("utf8");
$this->exe = $this->database->query($this->query);
$exception = ossn_call_hook('database', 'execution:message', false, true);
if (!$this->exe && $exception) {
throw new OssnDatabaseException("{$this->database->error} \n {$this->query} ");
}
if (isset($this->database->insert_id)) {
$this->last_id = $this->database->insert_id;
}
unset($this->query);
$this->database->close();
return true;
}
return false;
}
示例9: NotifiyUser
/**
* Send email to user.
*
* @param string $email User email address
* @param string $subject Email subject
* @param string $body Email body
*
* @return boolean
*/
public function NotifiyUser($email, $subject, $body)
{
if (empty($email)) {
error_log('Can not send email to empty email address', 0);
}
$this->setFrom(ossn_site_settings('notification_email'), ossn_site_settings('site_name'));
$this->addAddress($email);
$this->Subject = $subject;
$this->Body = $body;
$this->CharSet = "UTF-8";
try {
$send = ossn_call_hook('email', 'send', $this->send(), $this);
if ($send) {
return true;
}
} catch (phpmailerException $e) {
error_log("Cannot send email " . $e->errorMessage(), 0);
}
return false;
}
示例10: ossn_load_page
/**
* Output a page.
*
* If page is not registered then user will see a 404 page;
*
* @param (string) $handler Page handler name;
* @param (string) $page handler/page;
* @last edit: $arsalanshah
* @Reason: Initial;
*
* @return mix|null data
* @access private
*/
function ossn_load_page($handler, $page)
{
global $Ossn;
$context = $handler;
if (isset($page) && !empty($page)) {
$context = "{$handler}/{$page}";
}
//set context
ossn_add_context($context);
$page = explode('/', $page);
if (isset($Ossn->page) && isset($Ossn->page[$handler]) && !empty($handler) && is_callable($Ossn->page[$handler])) {
//get page contents
ob_start();
call_user_func($Ossn->page[$handler], $page, $handler);
$contents = ob_get_clean();
//supply params to hook
$params['page'] = $page;
$params['handler'] = $handler;
return ossn_call_hook('page', 'load', $params, $contents);
} else {
return ossn_error_page();
}
}
示例11: mimeTypes
/**
* MIME types.
*
* This function contains most commonly used MIME types in Ossn
*
* You can find mimtypes on the url below:
* http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=markup
*
* Extra mimetypes has been removed in Ossn v3.1. You can add a hook to extends mimetypes
*
* @return array
*/
public static function mimeTypes()
{
$mimetypes = array('doc' => array('application/msword'), 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document'), 'gif' => array('image/gif'), 'jpeg' => array('image/jpeg'), 'jpg' => array('image/jpeg'), 'mp3' => array('audio/mpeg'), 'mp4' => array('video/mp4'), 'pdf' => array('application/pdf'), 'png' => array('image/png'), 'zip' => array('application/zip'));
return ossn_call_hook('file', 'mimetypes', false, $mimetypes);
}
示例12: ossn_call_hook
<?php
}
?>
<?php
}
?>
</div>
</div>
</div>
<!-- End of Header -->
<div class="group-body">
<?php
if (isset($params['subpage']) && !empty($params['subpage']) && ossn_is_group_subapge($params['subpage'])) {
if (ossn_is_hook('group', 'subpage')) {
echo ossn_call_hook('group', 'subpage', $params);
}
} else {
?>
<div class="group-wall">
<?php
//#113 make contents of public groups visible.
//send ismember, and member ship param to group wall
echo ossn_plugin_view('wall/group', array('group' => $params, 'ismember' => $ismember, 'membership' => $params['group']->membership));
if ($params['group']->membership == OSSN_PRIVATE && $ismember !== 1) {
?>
<div class="group-closed-container">
<div class="title-h3"><?php
echo ossn_print('closed:group');
?>
</div>
示例13: ossn_wall_templates
/**
* Wall template view
* Depends on wall post type
*
* @param string $callback Name of callback
* @param string $type Callback type
* @param array $params Arrays or Objects
*
* @return mixed data
* @access private
*/
function ossn_wall_templates($hook, $type, $return, $params)
{
$params = ossn_call_hook('wall', 'templates:item', $params, $params);
return ossn_plugin_view("wall/templates/wall/{$type}/item", $params);
}
示例14: ossn_call_hook
* @author OSSN Core Team <info@opensource-socialnetwork.com>
* @copyright 2014 iNFORMATIKON TECHNOLOGIES
* @license General Public Licence http://opensource-socialnetwork.com/licence
* @link http://www.opensource-socialnetwork.com/licence
*/
?>
<style> body {
background: #FDFDFD;
} </style>
<div class="ossn-layout-newsfeed">
<div class="ossn-inner">
<div class="coloum-left">
<?php
if (ossn_is_hook('search', "left")) {
$searchleft = ossn_call_hook('search', "left", NULL, array());
echo implode('', $searchleft);
}
?>
</div>
<div class="coloum-middle">
<?php
echo $params['content'];
?>
</div>
<div class="coloum-right">
<div style="padding:12px;min-height:300px;">
<?php
if (com_is_active('OssnAds')) {
示例15: ossn_site_url
</a>
<br/>
<table border="0" class="ossn-photo-viewer">
<tr>
<td class="image-block" style="text-align: center;width:465px;min-height:200px;">
<img
src="<?php
echo ossn_site_url("album/getphoto/") . $image->owner_guid;
?>
/<?php
echo $img;
?>
?type=1"/>
</td>
</tr>
</table>
</div>
<br/>
<br/>
<?php
$vars['entity'] = $image;
echo ossn_plugin_view('entity/comment/like/share/view', $vars);
?>
<div class="ossn-photo-view-controls">
<?php
if (ossn_is_hook('photo:view', 'profile:controls')) {
echo ossn_call_hook('photo:view', 'profile:controls', $image);
}
?>
</div>