本文整理匯總了PHP中zotop::filter方法的典型用法代碼示例。如果您正苦於以下問題:PHP zotop::filter方法的具體用法?PHP zotop::filter怎麽用?PHP zotop::filter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zotop
的用法示例。
在下文中一共展示了zotop::filter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: smiles
/**
* 表情轉換,可以通過hook(zotop.smiles)擴展
*
*
*/
public static function smiles($str)
{
$smiles = array(':)' => url::theme() . '/image/smiles/smile.gif', ':-)' => url::theme() . '/image/smiles/cool.gif');
$smiles = zotop::filter('zotop.smiles', $smiles);
foreach ($smiles as $key => $val) {
$str = str_replace($key, '<img src=' . $val . ' class="zotop-smile"/>', $str);
}
return $str;
}
示例2: login
/**
* 寫入登陸信息
*
*/
public function login($data = array())
{
$data = array_merge($this->data, (array) $data);
$data = zotop::filter('zotop.user.login', $data);
//刷新信息
$this->refresh();
//記錄用戶數據
zotop::user($data);
return true;
}
示例3: login
/**
* 寫入登陸信息
*
*/
public function login($data = array())
{
$data = array_merge($this->bind(), (array) $data);
$data = zotop::filter('zotop.user.login', $data);
//刷新信息
$this->refresh();
//記錄用戶數據
zotop::user($data);
zotop::log('login', zotop::t('用戶 <b>{$username}</b> 於 {$time} 登陸成功', array('username' => $data['username'], 'time' => TIME)));
return true;
}
示例4: shutdown
/**
* 係統關閉,並輸出渲染內容
*
* @return string
*/
public static function shutdown()
{
//獲取頁麵內容
$contents = ob_get_contents();
//清理輸出數據
ob_end_clean();
//渲染頁麵內容
$contents = zotop::filter('system.render', $contents);
//輸入頁麵內容
echo $contents;
}
示例5: sideAction
public function sideAction()
{
$tools = array('reboot' => array('id' => 'reboot', 'title' => '係統重啟', 'href' => zotop::url('zotop/system/reboot')), 'close' => array('id' => 'close', 'title' => '關閉網站', 'href' => zotop::url('zotop/system/close')), 'config' => array('id' => 'config', 'title' => '注冊表管理', 'href' => zotop::url('zotop/config')));
$tools = zotop::filter('zotop.system.tools', $tools);
$users = array('user' => array('id' => 'reboot', 'title' => '係統用戶管理', 'href' => zotop::url('zotop/user')), 'usergroup' => array('id' => 'close', 'title' => '係統用戶組管理', 'href' => zotop::url('zotop/usergroup')));
$modules = array('list' => array('id' => 'list', 'title' => '模塊列表', 'href' => zotop::url('zotop/module')), 'install' => array('id' => 'uninstalled', 'title' => '安裝新模塊', 'href' => zotop::url('zotop/module/uninstalled')));
$page = new side();
$page->title = '係統控製麵板';
$page->set('tools', $page->navlist($tools));
$page->set('users', $page->navlist($users));
$page->set('modules', $page->navlist($modules));
$page->display();
}
示例6: build
/**
* 根據參數生成完整的URL,如:url::build('site://zotop/index/default/arg1/arg2',array('param1'=>'1'),'#top')
*
* @param string $uri 如:{application}://{module}/{controller}/{action}/{arg1}/arg2 組成
* @param array|string $params URL參數 ,一般為數組,也可以是字符串,如:param1/1/param2/2
* @param string $extra 額外數據:如錨點信息等
* @return string 如:/index.php/module/controller/action/arg1/arg2?param1=1¶m2=2#top
*/
public static function build($uri = '', $params = null, $extra = '')
{
$application = '';
if (strpos($uri, '://')) {
list($application, $uri) = explode('://', $uri);
}
//獲取入口文件地址
if (empty($application)) {
$base = url::scriptname();
} else {
$base = zotop::application($application, 'url') . '/' . zotop::application($application, 'base');
$base = url::decode($base);
}
//uri處理
if ($u = explode('/', trim($uri, '/'))) {
//獲取namespace 和 arguments
$namespace = array_slice($u, 0, 3);
$namespace = implode('/', $namespace);
$arguments = array_slice($u, 3);
//namespace切換
$namespace = zotop::filter('zotop.namespace', $namespace, &$arguments);
foreach ($arguments as $arg) {
$querystring .= '/' . $arg;
}
//querystring
$querystring = $namespace . $querystring;
$querystring = empty($querystring) ? '' : '/' . $uri;
$querystring .= empty($suffix) ? '' : $suffix;
}
//處理id/5/n/6 形式的參數
if (!is_array($params)) {
$args = explode('/', $params);
while ($key = array_shift($args)) {
$params[$key] = array_shift($args);
}
}
if (is_array($params) && !empty($params)) {
if (strpos($querystring, '?')) {
$querystring .= '&' . http_build_query($params);
} else {
$querystring .= '?' . http_build_query($params);
}
}
//組裝url
$url = $base . $querystring . $extra;
$url = url::clean($url);
return $url;
}
示例7: execute
/**
* 解析URI
*
* URI 由模塊名/控製器/動作/參數組成,采用如下的格式:
*
* @code php
* module/controller/action/param1/param2
* @endcode
*
*/
public static function execute()
{
$u = explode('/', trim(router::$uri, '/'));
//獲取namespace 和 arguments
$namespace = implode('/', array_slice($u, 0, 3));
$arguments = array_slice($u, 3);
$namespace = zotop::filter('zotop.namespace', $namespace, &$arguments);
if ($namespace) {
list(router::$module, router::$controller, router::$action) = explode('/', $namespace);
}
//處理參數
for ($i = 0, $cnt = count($arguments); $i < $cnt; $i++) {
$arguments[$i] = rawurldecode($arguments[$i]);
}
router::$arguments = $arguments;
}
示例8: xheditor_rc1
function xheditor_rc1($attrs)
{
$attrs['class'] = isset($attrs['class']) ? 'editor ' . $attrs['class'] : 'editor';
$tools = array('image' => '<a href="' . zotop::url('system/image/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-imageuploader button-icon"></span><span class="button-text">插入圖片</span></a>', 'file' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-fileuploader button-icon"></span><span class="button-text">插入文件</span></a>', 'template' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-template button-icon"></span><span class="button-text">插入模板</span></a>');
$tools = zotop::filter('editor.tools', $tools);
$tools = arr::take('tools', $attrs) === false ? array() : $tools;
$url = zotop::module('xheditor', 'url');
$html[] = html::script($url . '/editor/xheditor-zh-cn.min.js');
$html[] = html::script($url . '/common/global.js');
if (is_array($tools) && !empty($tools)) {
$html[] = '<div class="field-toolbar">';
foreach ($tools as $tool) {
$html[] = ' ' . $tool;
}
$html[] = '</div>';
}
$html[] = ' ' . field::textarea($attrs);
return implode("\n", $html);
}
示例9: controls
public function controls()
{
$controls = array();
$controls['folder']['name'] = '文件夾';
$controls['text']['name'] = '單行文本輸入控件';
$controls['textarea']['name'] = '多行文本輸入控件';
$controls['select']['name'] = '單選下拉控件';
$controls['select']['attr']['options'] = array('type' => 'textarea', 'label' => '控件選項', 'value' => '選項名稱1|選項值1', 'description' => '每行一個,選項名稱和選項值使用<b>|</b>隔開');
$controls['radio']['name'] = '單選按鈕控件';
$controls['radio']['attr']['options'] = array('type' => 'textarea', 'label' => '控件選項', 'value' => '選項名稱1|選項值1', 'description' => '每行一個,選項名稱和選項值使用<b>|</b>隔開');
$controls['checkbox']['name'] = '複選框控件';
$controls['checkbox']['attr']['options'] = array('type' => 'textarea', 'label' => '控件選項', 'value' => '選項名稱1|選項值1', 'description' => '每行一個,選項名稱和選項值使用<b>|</b>隔開');
$controls['image']['name'] = '圖片上傳控件';
$controls['image']['attr']['upload'] = array('type' => 'radio', 'label' => '圖片上傳', 'options' => array(true => '允許上傳', false => '不允許上傳'));
$controls['editor']['name'] = '富文本編輯器';
$controls['editor']['attr']['toolbar'] = array('type' => 'radio', 'label' => '編輯器類型', 'options' => array('basic' => '簡潔型', 'standard' => '標準型', 'full' => '全功能型'), 'value' => 'standard');
$controls = zotop::filter('config.controls', $controls);
return $controls;
}
示例10: navbar
public function navbar()
{
$navbar = array('index' => array('id' => 'index', 'title' => '模型列表', 'href' => zotop::url('content/model')), 'add' => array('id' => 'add', 'title' => '添加模型', 'href' => zotop::url('content/model/add')), 'edit' => array('id' => 'edit', 'title' => '編輯模型', 'href' => ''));
$navbar = zotop::filter('content.model.navbar', $navbar);
return $navbar;
}
示例11: controls
public function controls()
{
$controls = array('width' => array('type' => 'text', 'name' => 'settings[width]', 'label' => '控件寬度', 'value' => '', 'valid' => '', 'description' => '控件的寬度,單位為<b>px</b>'), 'height' => array('type' => 'text', 'name' => 'settings[height]', 'label' => '控件高度', 'value' => '', 'valid' => '', 'description' => '控件的高度,單位為<b>px</b>'), 'style' => array('type' => 'text', 'name' => 'settings[style]', 'label' => '控件樣式', 'value' => '', 'valid' => '', 'description' => '控件的style屬性'), 'class' => array('type' => 'text', 'name' => 'settings[class]', 'label' => '控件風格', 'value' => '', 'valid' => '', 'description' => '控件的class屬性'), 'options' => array('type' => 'textarea', 'name' => 'settings[options]', 'label' => '控件選項', 'value' => '選項名稱1|選項值1', 'valid' => '', 'description' => '每行一個,值和數據使用<b> | </b>隔開'), 'upload' => array('type' => 'radio', 'name' => 'settings[upload]', 'options' => array('1' => '允許上傳', '0' => '不允許上傳'), 'label' => '上傳設置', 'value' => '0', 'valid' => ''));
$controls = zotop::filter('zotop.config.field.controls', $controls);
return $controls;
}
示例12: update
/**
* 更新數據
*
* @param mix $data 待更新的數據
* @param mix $where 條件
*
* @return array
*/
public function update($data = array(), $where = '')
{
$data = empty($data) ? $this->bind() : $data;
$data = zotop::filter($this->table() . '.update', $data, $where);
$data = $this->_check_data($data);
if (!is_array($where)) {
$key = $this->key();
if (empty($where)) {
if (isset($data[$key])) {
$where = array($key, '=', $data[$key]);
} else {
$where = array($key, '=', $this->{$key});
}
}
if (is_numeric($where) || is_string($where)) {
$where = array($key, '=', $where);
}
}
if (is_array($data) && !empty($data) && !$this->error()) {
$update = $this->db()->set($data)->where($where)->update();
}
unset($data);
return $update;
}
示例13: navbar
public function navbar($categoryid = 0)
{
$navbar = array('index' => array('id' => 'index', 'title' => zotop::t('內容列表'), 'href' => zotop::url("content/content/index/{$categoryid}")), 'add' => array('id' => 'add', 'title' => zotop::t('添加內容'), 'href' => zotop::url("content/content/add/{$categoryid}")), 'edit' => array('id' => 'edit', 'title' => zotop::t('編輯內容')), 'category' => array('id' => 'category', 'title' => zotop::t('欄目設置'), 'href' => zotop::url("content/category/edit/{$categoryid}"), 'class' => 'dialog'));
$navbar = zotop::filter('content.content.navbar', $navbar);
return $navbar;
}
示例14: navbar
public function navbar()
{
$navbar = array('index' => array('id' => 'index', 'title' => '首 頁', 'href' => zotop::url('content')), 'setting' => array('id' => 'setting', 'title' => '模塊設置', 'href' => zotop::url('content/setting')));
$navbar = zotop::filter('content.index.navbar', $navbar);
return $navbar;
}
示例15: status
public function status()
{
$status = array('100' => zotop::t('通過審核並發布'), '0' => zotop::t('等待審核'), '-1' => zotop::t('未通過審核'), '-50' => zotop::t('草稿'));
$status = zotop::filter($this->table() . '.status', $status);
return $status;
}