本文整理汇总了PHP中zotop::module方法的典型用法代码示例。如果您正苦于以下问题:PHP zotop::module方法的具体用法?PHP zotop::module怎么用?PHP zotop::module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zotop
的用法示例。
在下文中一共展示了zotop::module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: codemirror
function codemirror($attrs)
{
$url = zotop::module('codemirror', 'url');
$options = new stdClass();
$options->path = $url . '/codemirror/js/';
$options->parserfile = array('parsexml.js');
$options->stylesheet = array($url . '/codemirror/css/xmlcolors.css');
$options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height'];
$options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width'];
$options->continuousScanning = 500;
$options->autoMatchParens = true;
if ($attrs['linenumbers'] !== false) {
$options->lineNumbers = true;
$options->textWrapping = false;
}
if ($attrs['tabmode'] == '') {
$options->tabMode = 'shift';
}
$html = array();
$html[] = html::script($url . '/codemirror/js/codemirror.js');
$html[] = html::stylesheet($url . '/codemirror/css/codemirror.css');
$html[] = ' ' . field::textarea($attrs);
$html[] = '<script type="text/javascript">';
$html[] = ' var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');';
$html[] = '$(function(){';
$html[] = ' $("form").submit(function(){';
$html[] = ' $("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());';
$html[] = ' });';
$html[] = '})';
$html[] = '</script>';
return implode("\n", $html);
}
示例2: getActive
public function getActive()
{
$active = array();
$modules = zotop::module();
foreach ($modules as $module) {
if ($module['status'] >= 0) {
$active[$module['id']] = $module;
}
}
return $active;
}
示例3: actionIndex
public function actionIndex()
{
$module = zotop::module('content');
$menus = array(array('id' => 'category', 'icon' => '', 'title' => '内容管理', 'url' => zotop::url('content/content'), 'description' => '内容管理,添加,编辑以及删除等操作'), array('id' => 'category', 'icon' => '', 'title' => '栏目管理', 'url' => zotop::url('content/category'), 'description' => '栏目分类管理,新建栏目及调整栏目顺序'), array('id' => 'category', 'icon' => '', 'title' => '模型管理', 'url' => zotop::url('content/model'), 'description' => '内容模型管理,可以自定义内容模型'), array('id' => 'category', 'icon' => '', 'title' => '模块设置', 'url' => zotop::url('content/setting'), 'description' => '内容模块的相关设置'));
$page = new page();
$page->set('title', $module['title']);
//$page->set('description', $module['description']);
$page->set('navbar', $this->navbar());
$page->set('module', $module);
$page->set('menus', $menus);
$page->display();
}
示例4: actionSide
public function actionSide()
{
$m = array();
$modules = (array) zotop::module();
foreach ($modules as $module) {
if ($module['type'] == 'com') {
$module['href'] = zotop::url($module['id']);
$m[$module['id']] = $module;
}
}
$page = new side();
$page->set('modules', $page->navlist($m));
$page->display();
}
示例5: getTemplatePath
public function getTemplatePath($action = '')
{
if (empty($this->template)) {
if (empty($action)) {
$action = application::getAction();
}
$module = application::getModule();
$controller = application::getController();
$path = zotop::module($module, 'path');
$path = $path . DS . router::application() . DS . 'template' . DS . $controller . DS . $action . '.php';
return $path;
}
return $this->template;
}
示例6: indexAction
public function indexAction()
{
$apps = array();
$modules = (array) zotop::module();
foreach ($modules as $module) {
if ($module['type'] == 'plugin') {
$apps[] = $module;
}
}
$page = new page();
$page->set('apps', $apps);
$page->addScript('$common/js/side.js');
$page->body = array('class' => 'side');
$page->display();
}
示例7: actionSide
public function actionSide()
{
$modules = (array) zotop::module();
foreach ($modules as $id => $module) {
if ($module['type'] != 'com') {
unset($modules[$id]);
} else {
$modules[$id]['href'] = zotop::url($module['id']);
}
}
$page = new side();
$page->title = '系统管理';
$page->set('modules', $modules);
$page->display();
}
示例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: model
/**
* 用于实例化一个模型{module}.{model},如 zotop.user,实例化系统模块的user模型
*
*
* @param $name 模型名称空间
* @return object(model)
*/
public static function model($name = '')
{
static $models = array();
if (empty($name)) {
return new model();
}
if (isset($models[$name])) {
return $models[$name];
}
list($module, $model) = explode('.', $name);
$modelName = $model . '_model';
if (!class_exists($modelName)) {
$modelPath = zotop::module($module, 'root') . DS . 'models' . DS . $model . '.php';
zotop::load($modelPath);
}
if (class_exists($modelName)) {
$m = new $modelName();
$models[$name] = $m;
return $m;
}
zotop::error(100, '未能找到模型', zotop::t('<h2>未能找到模型{$modelName},请检查模型文件是否存在错误</h2>文件地址:{$modelPath}', array('modelName' => $modelName, 'modelPath' => $modelPath)));
}
示例10: model
/**
* 用于实例化一个模型{module}.{model},如 zotop.user,实例化系统模块的user模型
*
*
* @param $name 模型名称空间
* @return object(model)
*/
public static function model($name = '')
{
static $models = array();
if (empty($name)) {
return new model();
}
if (isset($models[$name])) {
return $models[$name];
}
list($module, $model) = explode('.', $name);
$modelName = $model . '_model';
if (!class_exists($modelName)) {
$modelPath = zotop::module($module, 'path') . DS . 'models' . DS . $model . '.php';
if (zotop::load($modelPath) == false) {
zotop::error(zotop::t('<h2>请检查相应的模型文件是否存在</h2>文件地址:{$modelPath}', array('modelPath' => $modelPath)));
}
}
if (class_exists($modelName)) {
$m = new $modelName();
$m->moduleName = $module;
$models[$name] = $m;
return $m;
}
zotop::error(zotop::t('<h2>请检查相应的模型文件中是否存在模型类 {$modelName}</h2>文件地址:{$modelPath}', array('modelPath' => $modelPath, 'modelName' => $modelName)));
}
示例11: data
/**
* 存储简单类型数据,字符串,数组
* @param string $file 完整的file名称或者system.data.setting
* @param mix $value 值
* @param int $expire 缓存时间
*
* @return mix
*/
public static function data($file, $value = '', $expire = 0)
{
static $files = array();
if (strtolower(substr($file, -4)) != '.php' && strpos($file, DS) == false) {
//应该对应module的数据
$moduleID = substr($file, 0, strpos($file, '.'));
$modulePath = zotop::module($moduleID, 'path');
$fileName = substr($file, strpos($file, '.') + 1);
//根据module返回文件路径
$file = $modulePath . DS . str_replace('.', DS, $fileName) . '.php';
}
if ('' !== $value) {
if (is_null($value)) {
$result = unlink($file);
if ($result) {
unset($files[$file]);
}
return $result;
} else {
$content = "<?php\nif (!defined('ZOTOP')) exit();\n//" . sprintf('%012d', $expire) . "\nreturn " . var_export($value, true) . ";\n?>";
$result = file_put_contents($file, $content);
$files[$file] = $value;
}
return true;
}
if (isset($files[$file])) {
return $files[$file];
}
if (file_exists($file) && false !== ($content = file_get_contents($file))) {
$expire = (int) substr($content, strpos($content, '//') + 2, 12);
if ($expire != 0 && time() > filemtime($file) + $expire) {
unlink($file);
//过期删除
return false;
}
$value = eval(substr($content, strpos($content, '//') + 14, -2));
$files[$file] = $value;
} else {
$value = false;
}
return $value;
}
示例12: controllerPath
public static function controllerPath()
{
$controller = router::controller();
if ($controller) {
return zotop::module(router::module(), 'root') . DS . router::application() . DS . router::controller() . '.php';
}
return '';
}
示例13: getControllerPath
/**
* 返回当前的控制器的真实路径
*
* @return string
*/
public static function getControllerPath()
{
$controller = application::getController();
$module = application::getModule();
$path = zotop::module($module, 'root') . DS . router::application() . DS . $controller . '.php';
return $path;
}
示例14: module
public static function module($id = '')
{
$id = empty($id) ? router::module() : $id;
if ($id) {
return zotop::module($id, 'url');
}
return '';
}
示例15: template
public static function template($namespace = '')
{
if (empty($namespace)) {
$namespace = application::module() . '/' . application::controller() . '/' . application::action();
}
$namespace = str_replace('.', '/', $namespace);
$namespaces = explode('/', $namespace);
switch (count($namespaces)) {
case 1:
$module = application::module();
$namespace = $namespaces[0];
break;
default:
$module = array_shift($namespaces);
$namespace = implode('/', $namespaces);
break;
}
$template = zotop::module($module, 'path') . DS . ZOTOP_APPLICATION . DS . 'template' . DS . str_replace('/', DS, $namespace) . '.php';
return $template;
}