本文整理汇总了PHP中getModule函数的典型用法代码示例。如果您正苦于以下问题:PHP getModule函数的具体用法?PHP getModule怎么用?PHP getModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getModule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* construct method
*/
public function __construct()
{
$route_action = Route::currentRouteAction();
$this->module_name = 'laravel-modules-core::' . getModule($route_action) . '/';
$this->route_name = Route::currentRouteName();
$this->index_route_name = substr($this->route_name, 0, strrpos($this->route_name, '.') + 1) . 'index';
}
开发者ID:erenmustafaozdal,项目名称:laravel-modules-core,代码行数:10,代码来源:BreadcrumbService.php
示例2: sendView
public function sendView($to, $view, $view_data = array(), $from_email = false, $from_name = false)
{
$text = getModule('Utils')->getRunView($view, $view_data);
$subject = strtok($text, "\n");
$text = substr($text, strlen($subject) + 1);
$subject = strip_tags($subject);
return $this->send($to, $subject, $text, $from_email, $from_name);
}
开发者ID:peter23,项目名称:PicoFramework,代码行数:8,代码来源:EMail.php
示例3: changeRelationModel
/**
* change relation model
*/
protected function changeRelationModel()
{
$module = getModule(get_called_class());
$module = explode('-', $module);
$module = ucfirst_tr($module[1]);
$this->relations['thumbnails']['relation_model'] = "\\App\\{$module}Thumbnail";
$this->relations['extras']['relation_model'] = "\\App\\{$module}Extra";
}
开发者ID:erenmustafaozdal,项目名称:laravel-modules-base,代码行数:11,代码来源:BaseNodeController.php
示例4: getBaseName
/**
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $subBase
* @return string
*/
function getBaseName($model, $subBase = '')
{
$class = is_string($model) ? $model : get_class($model);
$baseName = class_basename($class);
$moduleName = studly_case(getModule($class));
$namespace = "\\ErenMustafaOzdal\\{$moduleName}";
$namespace .= $subBase ? "\\{$subBase}" : "";
return $namespace . "\\{$baseName}";
}
开发者ID:erenmustafaozdal,项目名称:laravel-modules-base,代码行数:14,代码来源:helpers.php
示例5: unauth
public function unauth()
{
$Session = getModule('Session');
unset($Session->data['auth_user_id']);
unset($Session->data['auth_user_agent']);
$Session->write();
$this->auth_user_id = null;
$this->auth_user_data = null;
}
开发者ID:peter23,项目名称:PicoFramework,代码行数:9,代码来源:Auth.php
示例6: getModule
function getModule($name, $ver, $path, $output_file = '')
{
global $code_path;
global $module_path;
global $output_list;
#模块绝对路径
$abs_path = realpath($code_path . '/' . $path);
#检测路径,防止恶意用户通过给 path 加 ../ 访问模块之外的目录
if (strpos($abs_path, $code_path) !== 0) {
die("{$name}({$ver}) 模块路径错误!");
}
#拷贝模块到 tmp,备用
system("rm -rf {$module_path}/{$path}");
system("mkdir -p {$module_path}/{$path}");
system("cp -r {$abs_path}/* {$module_path}/{$path}");
#没有指定output_file,从模块package.json取默认的output
if (empty($output_file)) {
#读取模块 package.json 信息
$package_file = $abs_path . '/package.json';
if (!is_file($package_file)) {
die("{$name}({$ver}) 模块的 package.json 不存在!");
}
#从 package.json 中,找到模块 output 的 JS 文件名
$package_info = json_decode(file_get_contents($package_file), true);
$output_file = trim($package_info['output']);
if (empty($output_file)) {
die("{$name}({$ver}) 模块的 output 不存在!");
}
}
#如果之前添加过这个文件,直接返回
if (false !== array_search($path . '/' . $output_file, $output_list)) {
return;
}
#把 output 的 JS 文件名存起来(后面给模块具名时会用到)
array_push($output_list, $path . '/' . $output_file);
#解析依赖
$output_content = file_get_contents($abs_path . '/' . $output_file);
$rDep = "/((?:define|require|requirejs)\\([^\\[\\(\\{]*\\[)([^\\]]+)/";
if (preg_match($rDep, $output_content, $matches)) {
$deps = explode(',', preg_replace("/['\"]/", '', $matches[2]));
#依赖的模块,也需要递归处理
foreach ($deps as $dep) {
$sections = explode('/', trim($dep));
#不是「module/<模块名>/<模块版本>/<output>」格式的模块,不处理
if (count($sections) <= 1 || $sections[0] !== 'module') {
continue;
}
$name = $sections[1];
$ver = $sections[2];
$path = $name . '/' . $ver;
$file = $sections[3] . '.js';
getModule($name, $ver, $path, $file);
}
}
}
开发者ID:sdgdsffdsfff,项目名称:component-1,代码行数:55,代码来源:download.php
示例7: auth
public function auth($email, $password)
{
if (!($password_salt = $this->DB->select('password_salt')->from('users')->where('email', $email)->fetchVal())) {
throw new MsgException('Incorrect email or password');
}
if (!($id = $this->DB->select('id')->from('users')->where(array('email' => $email, 'password' => hash('sha256', $password_salt . $password)))->fetchVal())) {
throw new MsgException('Incorrect email or password');
}
getModule('Auth')->auth($id);
return $id;
}
开发者ID:peter23,项目名称:PicoFramework,代码行数:11,代码来源:User.php
示例8: setToFileOptions
/**
* set file options
*
* @param \Illuminate\Http\Request $request
* @param array $params [ ['column_name' => 'option_name'] ]
* @return void
*/
protected function setToFileOptions($request, $params)
{
$module = getModule(get_called_class());
$model = getModelSlug(get_called_class());
$options = [];
$elfinders = [];
foreach ($params as $column => $optionName) {
$isGroup = is_integer($column) && is_array($optionName) && isset($optionName['group']);
$configName = $isGroup || isset($optionName['column']) ? $optionName['config'] : $optionName;
$columnParts = explode('.', $isGroup || isset($optionName['column']) ? $optionName['column'] : $column);
$inputName = count($columnParts) > 1 ? $columnParts[1] : $columnParts[0];
$inputName = isset($optionName['inputPrefix']) ? $optionName['inputPrefix'] . $inputName : $inputName;
$fullColumn = implode('.', $columnParts);
// options set edilir
if ($isGroup && (is_array($request->file($optionName['group'])) && $request->file("{$optionName['group']}.{$column}.{$inputName}") || $request->has("{$optionName['group']}.{$column}.{$inputName}")) || (is_array($request->file($inputName)) && $request->file($inputName)[0] || !is_array($request->file($inputName)) && $request->file($inputName)) || $request->has($inputName)) {
$moduleOptions = config("{$module}.{$model}.uploads.{$configName}");
// if column is array
if (is_array($moduleOptions['column'])) {
$moduleOptions['column'] = $moduleOptions['column'][$inputName];
}
// is group
if ($isGroup) {
$moduleOptions['group'] = $optionName['group'];
}
// add some data
if ($isGroup || isset($optionName['column'])) {
$moduleOptions['index'] = $column;
if (isset($optionName['changeThumb'])) {
$moduleOptions['changeThumb'] = $optionName['changeThumb'];
}
if (isset($optionName['changeToHasOne'])) {
$moduleOptions['changeToHasOne'] = $optionName['changeToHasOne'];
}
if (isset($optionName['is_reset'])) {
$moduleOptions['is_reset'] = $optionName['is_reset'];
}
$moduleOptions['add_column'] = isset($optionName['add_column']) ? $optionName['add_column'] : [];
$moduleOptions['inputPrefix'] = isset($optionName['inputPrefix']) ? $optionName['inputPrefix'] : [];
}
array_push($options, $moduleOptions);
}
// elfinder mi belirtilir
if ($isGroup && $request->has("{$optionName['group']}.{$column}.{$inputName}") || $request->has($inputName) && !$request->file($inputName)[0]) {
$elfinderOption = $isGroup || isset($optionName['column']) ? ['index' => count($options) - 1, 'column' => $optionName['column']] : $fullColumn;
array_push($elfinders, $elfinderOption);
}
}
$this->setFileOptions($options);
foreach ($elfinders as $elfinder) {
$this->setElfinderToOptions($elfinder);
}
}
开发者ID:erenmustafaozdal,项目名称:laravel-modules-base,代码行数:59,代码来源:BaseController.php
示例9: procInstallAdminUpdate
/**
* @brief 모듈 업데이트
**/
function procInstallAdminUpdate()
{
$module_name = Context::get('module_name');
if (!$module_name) {
return new object(-1, 'invalid_request');
}
$oModule =& getModule($module_name, 'class');
if ($oModule) {
$output = $oModule->moduleUpdate();
} else {
$output = new Object(-1, 'invalid_request');
}
return $output;
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:17,代码来源:install.admin.controller.php
示例10: post
public function post()
{
$modules = request()->post('module', []);
if (!is_array($modules)) {
redirect(getURL('/module-manager'));
}
foreach ($modules as $module => $action) {
if (!in_array($action, array('enable', 'disable', 'install', 'uninstall'))) {
continue;
}
$module = getModule($module);
if (!$module->exists()) {
continue;
}
if ($module->{$action}()) {
$text = r('Module <stron>@module</strong> was @action', ['module' => $module->name(), 'action' => t($action . 'd')]);
System::alerts()->success($text);
} else {
$text = r('Module <stron>@module</strong> could not be @action', array('module' => $module->name(), 'action' => t($action . 'd')));
System::alerts()->error($text);
}
}
redirect(getURL('/module-manager'));
}
开发者ID:opis-colibri,项目名称:manager,代码行数:24,代码来源:Module.php
示例11: loadModules
function loadModules($str)
{
$result = array();
if ($str == "*") {
$files = scandir(__DIR__ . '/modules/');
foreach ($files as $file) {
if ($file == '.' || $file == '..' || substr($file, -4) != ".php") {
continue;
}
//require_once 'modules/'.$file;
$module = getModule(substr($file, 0, -4));
$result[] = $module;
}
return $result;
}
$tokens = explode(",", $str);
foreach ($tokens as $k => $v) {
$result[] = getModule($v);
}
return $result;
}
开发者ID:pavelhuerta,项目名称:litefilesystem.js,代码行数:21,代码来源:core.php
示例12: json_decode
}
#从 package.json 中,找到模块 output 的 JS 文件名
$package_info = json_decode(file_get_contents($package_file), true);
$output_file = trim($package_info['output']);
if (empty($output_file)) {
die("{$name}({$ver}) 模块的 output 不存在!");
}
$full_output_file = $path . '/' . $output_file;
#如果之前添加过这个模块,直接返回
if (false !== array_search($full_output_file, $output_list)) {
return;
}
#解析依赖
$abs_output_file = $code_path . '/' . $full_output_file;
if (!is_file($abs_output_file)) {
return;
}
#把模块路径存到 list 中
array_push($output_list, $full_output_file);
$output_content = file_get_contents($abs_output_file);
$rDep = "/((?:define|require|requirejs)\\([^\\[\\(\\{]*\\[)([^\\]]+)/";
if (preg_match($rDep, $output_content, $matches)) {
$deps = explode(',', preg_replace("/['\"]/", '', $matches[2]));
#依赖的模块,也需要递归处理
foreach ($deps as $dep) {
getModuleByPath($dep);
}
}
}
getModule($name, $ver, $path);
echo json_encode($output_list);
开发者ID:sdgdsffdsfff,项目名称:component-1,代码行数:31,代码来源:getdeps.php
示例13: getClass
/**
* Create a class instance of the module
*
* @param string $module_name The module name to get a class instance
* @return mixed Module class instance
*/
function getClass($module_name)
{
return getModule($module_name, 'class');
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:10,代码来源:func.inc.php
示例14: createTables
public function createTables()
{
$database = getSQLDB();
$login = getModule("user");
//UNITS
$query = "CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "units (\r\n\t\t\t`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n\t\t\t`name` VARCHAR(256) NOT NULL,\r\n\t\t\t`author_id` INT NOT NULL,\r\n\t\t\t`metadata` TEXT NOT NULL,\r\n\t\t\t`used_size` INT NOT NULL,\r\n\t\t\t`total_size` INT NOT NULL,\r\n\t\t\t`timestamp` TIMESTAMP NOT NULL)\r\n\t\t\tENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
$result = $database->query($query);
if ($result !== TRUE) {
debug("Units table not created");
$this->result["msg"] = "Units table not created";
$this->result["status"] = -1;
return false;
} else {
debug("Units table created");
}
//PRIVILEGES
$query = "CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "privileges (\r\n\t\t\t`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n\t\t\t`user_id` INT NOT NULL,\r\n\t\t\t`unit_id` INT NOT NULL,\r\n\t\t\t`timestamp` TIMESTAMP NOT NULL,\r\n\t\t\t`mode` ENUM('READ','WRITE','ADMIN') NOT NULL\r\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
$result = $database->query($query);
if ($result !== TRUE) {
debug("Privileges table not created");
$this->result["msg"] = "Privileges table not created";
$this->result["status"] = -1;
return false;
} else {
debug("Privileges table created");
}
//FILES
$query = "CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "files (\r\n\t\t\t`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n\t\t\t`unit_id` INT NOT NULL,\r\n\t\t\t`folder` VARCHAR(256) NOT NULL,\r\n\t\t\t`filename` VARCHAR(256) NOT NULL,\r\n\t\t\t`category` VARCHAR(256) NOT NULL,\r\n\t\t\t`metadata` TEXT NOT NULL,\r\n\t\t\t`author_id` INT NOT NULL,\r\n\t\t\t`size` INT NOT NULL,\r\n\t\t\t`timestamp` TIMESTAMP NOT NULL,\r\n\t\t\t`status` ENUM('DRAFT','PRIVATE','PUBLIC','BLOCKED') NOT NULL\r\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
$result = $database->query($query);
if ($result !== TRUE) {
debug("Files table not created");
$this->result["msg"] = "Files table not created";
$this->result["status"] = -1;
return false;
} else {
debug("Files table created");
}
//COMMENTS
$query = "CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "comments (\r\n\t\t\t`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n\t\t\t`file_id` INT UNSIGNED NOT NULL,\r\n\t\t\t`info` TEXT NOT NULL,\r\n\t\t\t`author_id` INT NOT NULL,\r\n\t\t\t`timestamp` TIMESTAMP NOT NULL\r\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1";
$result = $database->query($query);
if ($result !== TRUE) {
debug("Comments table not created");
$this->result["msg"] = "Comments table not created";
$this->result["status"] = -1;
return false;
} else {
debug("Comments table created");
}
return true;
}
开发者ID:pavelhuerta,项目名称:litefilesystem.js,代码行数:50,代码来源:files.php
示例15: getMenu
</title>
<meta charset="utf-8">
<link rel="stylesheet" href="templates/css/books.css">
<link rel="icon" href="templates/images/eb.png">
</head>
<body>
<header>
<nav>
<?php
echo getMenu();
?>
</nav>
</header>
<aside>
<?php
echo getModule();
?>
</aside>
<section id="section">
<h2>Op safari met Doomla</h2>
</section>
<section>
<article>
<?php
echo getContent($content)['content1'];
?>
</article>
</section>
<footer>
© 2016 Eline Boekweit
</footer>
开发者ID:elineboekweit,项目名称:doomla,代码行数:31,代码来源:books.php
示例16: triggerCall
/**
* @brief trigger_name, called_position을 주고 trigger 호출
**/
function triggerCall($trigger_name, $called_position, &$obj)
{
// 설치가 안되어 있다면 trigger call을 하지 않고 바로 return
if (!Context::isInstalled()) {
return new Object();
}
$oModuleModel =& getModel('module');
$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
if (!$triggers || !count($triggers)) {
return new Object();
}
foreach ($triggers as $item) {
$module = $item->module;
$type = $item->type;
$called_method = $item->called_method;
$oModule = null;
$oModule =& getModule($module, $type);
if (!$oModule || !method_exists($oModule, $called_method)) {
continue;
}
$output = $oModule->{$called_method}($obj);
if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) {
return $output;
}
unset($oModule);
}
return new Object();
}
开发者ID:hottaro,项目名称:xpressengine,代码行数:31,代码来源:ModuleHandler.class.php
示例17: triggerCall
/**
* call a trigger
* @param string $trigger_name trigger's name to call
* @param string $called_position called position
* @param object $obj an object as a parameter to trigger
* @return Object
* */
function triggerCall($trigger_name, $called_position, &$obj)
{
// skip if not installed
if (!Context::isInstalled()) {
return new Object();
}
$oModuleModel = getModel('module');
$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
if (!$triggers || count($triggers) < 1) {
return new Object();
}
//store before trigger call time
$before_trigger_time = NULL;
if (__LOG_SLOW_TRIGGER__ > 0) {
$before_trigger_time = microtime(true);
}
foreach ($triggers as $item) {
$module = $item->module;
$type = $item->type;
$called_method = $item->called_method;
// todo why don't we call a normal class object ?
$oModule = getModule($module, $type);
if (!$oModule || !method_exists($oModule, $called_method)) {
continue;
}
$before_each_trigger_time = microtime(true);
$output = $oModule->{$called_method}($obj);
$after_each_trigger_time = microtime(true);
$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
$slowlog = new stdClass();
$slowlog->caller = $trigger_name . '.' . $called_position;
$slowlog->called = $module . '.' . $called_method;
$slowlog->called_extension = $module;
if ($trigger_name != 'XE.writeSlowlog') {
writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
}
if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) {
return $output;
}
unset($oModule);
}
return new Object();
}
开发者ID:kimkucheol,项目名称:xe-core,代码行数:50,代码来源:ModuleHandler.class.php
示例18: getTriggersToBeDeleted
/**
* @brief 삭제해도 상관없는 트리거 목록 반환
* @param boolean $advanced
* @return array
*/
function getTriggersToBeDeleted($advanced = FALSE)
{
// DB 상의 트리거 목록
$trigger_list = $this->getTriggers();
// 설치되어 있는 모듈 목록
$module_list = $this->getModuleList();
// 삭제해도 상관없는 트리거 목록
$invalid_trigger_list = array();
foreach ($trigger_list as $trigger) {
if (in_array($trigger->module, $module_list)) {
// 고급 삭제 옵션
if ($advanced === TRUE) {
$oModule = getModule($trigger->module, strtolower($trigger->type));
if (!@method_exists($oModule, $trigger->called_method)) {
$invalid_trigger_list[] = $trigger;
}
}
} else {
$invalid_trigger_list[] = $trigger;
}
}
return $invalid_trigger_list;
}
开发者ID:rhymix,项目名称:rhymix-profiler,代码行数:28,代码来源:profiler.admin.model.php
示例19: foreach
}
/*
* Use $server_info to accumulate
* information about the server
* Always give an error if one of the modules
* isn't found for reliance
*/
$server_info = new \stdClass();
$error = null;
// Get all the variables or only specific; less loading time
foreach ($modules as $module) {
if (!isset($sources[$module])) {
$error = 'Module \'' . $module . '\' not available';
break;
}
$data = getModule($module, $sources[$module]);
$server_info->{$module} = $data;
}
/*
* Return a json formatted copy
* of the server information.
*/
header('Content-Type: application/json;');
if ($error) {
header("HTTP/1.0 400 Error");
$response = ['error' => $error];
} else {
$response = ['server_info' => $server_info];
header("HTTP/1.0 200 OK");
}
echo json_encode($response);
开发者ID:ColinWaddell,项目名称:CurrantPi,代码行数:31,代码来源:api.php
示例20: setModuleThumbnails
/**
* set the module config
*
* @param $category
* @param string $model
* @param string $uploadType
* @return void
*/
protected function setModuleThumbnails($category, $model, $uploadType)
{
$module = getModule(get_called_class());
if (is_null($category->thumbnails)) {
return;
}
Config::set("{$module}.{$model}.uploads.{$uploadType}.thumbnails", $category->thumbnails->map(function ($item) {
return ['width' => $item->photo_width, 'height' => $item->photo_height, 'slug' => $item->slug];
})->keyBy('slug')->toArray());
}
开发者ID:erenmustafaozdal,项目名称:laravel-modules-base,代码行数:18,代码来源:OperationTrait.php
注:本文中的getModule函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论