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


PHP Modules::get方法代码示例

本文整理汇总了PHP中Modules::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::get方法的具体用法?PHP Modules::get怎么用?PHP Modules::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules的用法示例。


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

示例1: getStaticUrl

 function getStaticUrl()
 {
     if ($module = Modules::get($this->stylesheet)) {
         return $module->getName();
     }
     return $this->stylesheet;
 }
开发者ID:ycms,项目名称:wordpress,代码行数:7,代码来源:class-wp-theme.php

示例2: showPermission

 function showPermission($id)
 {
     if ($userData = Sentry::findUserById($id)) {
         if ($userData->isSuperUser()) {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     } else {
         return Redirect::to($this->moduleURL . 'show-list');
     }
     $this->data['status'] = Session::has("status") ? Session::get("status") : FALSE;
     $this->data['message'] = Session::has("message") ? Session::get("message") : "";
     $this->data['id'] = $id;
     // GET ALL PERMISSION
     $permissions = Permission::get()->toArray();
     $permissionMap = array();
     // GET ALL MODULE
     $moduleData = Modules::get()->toArray();
     if (!empty($permissions)) {
         foreach ($permissions as $permission) {
             $permissionMap[$permission['module_id']][] = $permission;
         }
     }
     if (!empty($moduleData)) {
         $moduleData = array_column($moduleData, 'name', 'id');
     }
     // GET USER PERMISSION
     $userPermissions = Sentry::findUserById($id)->getPermissions();
     $this->data['permissionMap'] = $permissionMap;
     $this->data['moduleData'] = $moduleData;
     $this->data['userPermissions'] = $userPermissions;
     if (Request::isMethod('post')) {
         $this->postPermission($id, $userData, $this->data);
         if ($this->data['status'] === TRUE) {
             return Redirect::to($this->moduleURL . 'permission/' . $this->data['id']);
         }
     }
     $this->layout->content = View::make('showPermission', $this->data);
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:38,代码来源:UserAdminController.php

示例3: get_template_directory_uri

/**
 * Retrieve theme directory URI.
 *
 * @since 1.5.0
 *
 * @return string Template directory URI.
 */
function get_template_directory_uri()
{
    $template = str_replace('%2F', '/', rawurlencode(get_template()));
    $theme_root_uri = get_theme_root_uri($template);
    if (class_exists('Modules') and $module = Modules::get($template)) {
        $template = $module->getName();
    }
    $template_dir_uri = "{$theme_root_uri}/{$template}";
    /**
     * Filter the current theme directory URI.
     *
     * @since 1.5.0
     *
     * @param string $template_dir_uri The URI of the current theme directory.
     * @param string $template         Directory name of the current theme.
     * @param string $theme_root_uri   The themes root URI.
     */
    return apply_filters('template_directory_uri', $template_dir_uri, $template, $theme_root_uri);
}
开发者ID:ycms,项目名称:wordpress,代码行数:26,代码来源:theme.php

示例4: call

 /**
  * Catch all Method that allows to use the tag name as method name and append options to it
  *
  * @param string $method the tag name with optional options i.e. s_div or h1
  * @param array  $args   the arguments passed to the method call
  * 
  * @return mixed  null or Tag instance or string
  */
 public static function call($method, $args = array(), $addedOptions = array())
 {
     /*
      * Return if not enabled.
      */
     if (Config::get('disable')) {
         return;
     }
     /*
      * Sanitize Method name. (Just to be sure XD)
      */
     $method = preg_replace('/[^a-z0-9_]+/', '', strtolower($method));
     /*
      * Split the method name into options and tag.
      */
     $e = explode('_', $method);
     if (count($e) == 1 && !empty($e[0])) {
         $tag = $e[0];
         $options = false;
     } elseif (count($e) == 2 && !empty($e[1])) {
         $tag = $e[1];
         $options = $e[0];
     } else {
         /*
          * Invalid format
          */
         self::debug(sprintf('Invalid format in HTML Call "%s"', $method), 3, 2);
         return null;
     }
     /*
      * Verify the options
      */
     $tmp = array();
     foreach (str_split($options) as $key) {
         if (isset(self::$tagOptionKeys[$key])) {
             $tmp[] = self::$tagOptionKeys[$key];
         }
     }
     $options = $tmp;
     unset($tmp);
     /*
      * Verify options passed indirectly to the generator (by a module for example).
      */
     foreach ($addedOptions as $key => $option) {
         if (!in_array($option, self::$tagOptionKeys)) {
             unset($addedOptions[$key]);
         }
     }
     /*
      * Merge all options.
      */
     $options = array_merge($options, $addedOptions);
     unset($addedOptions);
     $called = $tag;
     Modules::appendAlias($tag);
     $Module = '';
     /**
      * Loads the Module and asks if is should be used for this case.
      *
      * @var function
      */
     $useModule = function () use(&$Module, $tag, &$args, &$options, &$called) {
         $Module = Modules::get($tag, $args, $options, $called);
         return $Module->sure();
     };
     /*
      * Check if the Tag is forced to be generated or no module exists and generate it.
      * Otherwise prefer the module.
      */
     if (in_array('generate', $options) || !Modules::exist($tag) || !$useModule()) {
         $tag = $called;
         /*
          * Create new Tag
          */
         $Tag = new Tag($tag, $args, $options);
         /*
          * Do things that should be done before tag will be created
          */
         $r = self::_applyPreGenerationFilters($Tag);
         /*
          * Check if the pre-generation filters have returned anything and return it in this case.
          */
         if ($r !== null) {
             return $r;
         }
         $Tag->open();
         if (!$Tag->hasOption('start')) {
             $Tag->content();
             $Tag->close();
         }
         /*
          * Do things that should be done after tag generation.
//.........这里部分代码省略.........
开发者ID:xiphe,项目名称:html,代码行数:101,代码来源:Generator.php

示例5: render

 function render()
 {
     $listModuleFile = array();
     $listIgnores = array('.', '..', '.DS_Store', '.svn');
     $primaryArray = array('Create', 'Read', 'Edit', 'Delete');
     $listFiles = array_diff(scandir($this->modulePath), $listIgnores);
     // GET LIST FILE IN FOLDER
     if (!empty($listFiles)) {
         foreach ($listFiles as $file) {
             $fileName = ucwords(str_replace("_", " ", $file));
             $fileSlug = str_replace("_", "-", $file);
             $listModuleFile[$fileSlug] = $fileName;
         }
     }
     // GET LIST FILE IN DATABASE
     $listModuleStore = Modules::get()->toArray();
     $listModuleStore = array_column($listModuleStore, 'name', 'slug');
     // NEW MODULE
     $diffInsert = array_diff($listModuleFile, $listModuleStore);
     $insertData = array();
     if (!empty($diffInsert)) {
         foreach ($diffInsert as $k => $v) {
             $mA = explode("-", $k);
             $suffix = last($mA);
             if ($suffix == 'manager') {
                 $count = count($mA);
                 $preSuffix = $mA[$count - 2];
                 $suffix = $preSuffix . "_" . $suffix;
             }
             $groupString = "group_" . $suffix . "_id";
             $group = 0;
             if (Config::has("backend.{$groupString}")) {
                 $group = Config::get("backend.{$groupString}");
             }
             $insertData = array('slug' => $k, 'name' => $v, 'group_id' => $group, 'status' => 1);
             if ($item = Modules::create($insertData)) {
                 if ($item->save()) {
                     // // Insert Menu
                     // $menuInsert = array(
                     // 	'status'		=>	0,
                     // 	'name'			=>	$item->name,
                     // 	'module_id'		=>	$item->id,
                     // 	'slug'			=>	$item->slug.'/show-list',
                     // );
                     // Menus::create($menuInsert);
                     // Create Primary Permission
                     foreach ($primaryArray as $p) {
                         $primaryInsert = array('name' => $item->name . " " . $p, 'slug' => $item->slug . "-" . strtolower($p), 'module_id' => $item->id, 'group_id' => $group, 'action' => strtolower($p));
                         Permission::create($primaryInsert);
                     }
                 }
             }
         }
     }
     // REMOVE MODULE
     $diffRemove = array_diff($listModuleStore, $listModuleFile);
     if (!empty($diffRemove)) {
         foreach ($diffRemove as $k => $v) {
             $item = Modules::where(array('slug' => $k, 'name' => $v))->first();
             $deleteID = $item->id;
             if ($item->delete()) {
                 // Menus::where('module_id', $deleteID)->delete();
                 Permission::where('module_id', $deleteID)->delete();
             }
         }
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:67,代码来源:ModulesAdminController.php

示例6: isset

<div class="row">
	<?php 
global $Options;
$modules = Modules::get();
foreach (force_array($modules) as $_module) {
    if (isset($_module['application']['details']['namespace'])) {
        $module_namespace = $_module['application']['details']['namespace'];
        ?>
	<div class="col-lg-3">
   	<div class="box" id="#module-">
      	<div class="box-header">
         	<h3 class="box-title"><?php 
        echo isset($_module['application']['details']['name']) ? $_module['application']['details']['name'] : __('Tendoo Extension');
        ?>
</h3>
         </div>
         <div class="box-body" style="height:100px;"><?php 
        echo isset($_module['application']['details']['description']) ? $_module['application']['details']['description'] : '';
        ?>
 </div>
         <div class="box-footer">
           	<?php 
        echo 'v' . (isset($_module['application']['details']['version']) ? $_module['application']['details']['version'] : 0.1);
        ?>
             <div class="box-tools pull-right">
            <?php 
        if (isset($_module['application']['details']['main'])) {
            // if the module has a main file, it can be activated
            if (!Modules::is_active($module_namespace)) {
                ?>
					  <a href="<?php 
开发者ID:2329697501,项目名称:tendoo-cms,代码行数:31,代码来源:list-dom.php

示例7: check_modules

 /**
  * Modules Update Features
  **/
 function check_modules()
 {
     $modules = json_decode(file_get_content('https://raw.githubusercontent.com/Blair2004/tendoo-cms/3.0/modules.json'));
     $modules_status = force_array($this->options->get('modules_status'));
     foreach (Modules::get() as $namespace => $module) {
         // if current module is genuine
         if (in_array($namespace, array_keys($modules))) {
             // If a new version is available
             if (intval($module['version']) < $modules[$namespace]['version']) {
                 $modules_status[$namespace] = array('version' => $modules[$namespace]['version'], 'zip_url' => $modules[$namespace]['zip_url']);
             } else {
                 unset($modules_status[$namespace]);
                 // make sure already updated module is removed from "updatable modules"
             }
         }
     }
     $this->options->set('modules_status', $modules_status);
 }
开发者ID:eboominathan,项目名称:tendoo-cms,代码行数:21,代码来源:Update_model.php

示例8: render

 function render()
 {
     $listModuleFile = array();
     $listIgnores = array('dashboard', 'home', 'chat', 'search', '.', '..', '.DS_Store', '.svn');
     $primaryArray = array('Create', 'Read', 'Edit', 'Delete');
     $listFiles = array_diff(scandir($this->modulePath), $listIgnores);
     // GET LIST FILE IN FOLDER
     if (!empty($listFiles)) {
         foreach ($listFiles as $file) {
             $file = str_replace("_backend", "", $file);
             $fileName = ucwords(str_replace("_", " ", $file));
             $fileSlug = str_replace("_", "-", $file);
             $listModuleFile[$fileSlug] = $fileName;
         }
     }
     // GET LIST FILE IN DATABASE
     $listModuleStore = Modules::get()->toArray();
     $listModuleStore = array_column($listModuleStore, 'name', 'slug');
     // NEW MODULE
     $diffInsert = array_diff($listModuleFile, $listModuleStore);
     $insertData = array();
     if (!empty($diffInsert)) {
         foreach ($diffInsert as $k => $v) {
             $insertData = array('slug' => $k, 'name' => $v, 'status' => 1);
             if ($item = Modules::create($insertData)) {
                 if ($item->save()) {
                     // Insert Menu
                     $menuInsert = array('status' => 0, 'name' => $item->name, 'module_id' => $item->id, 'slug' => $item->slug . '/show-list');
                     Menus::create($menuInsert);
                     // Create Primary Permission
                     foreach ($primaryArray as $p) {
                         $primaryInsert = array('name' => $item->name . " " . $p, 'slug' => $item->slug . "-" . strtolower($p), 'module_id' => $item->id, 'action' => strtolower($p));
                         Permission::create($primaryInsert);
                     }
                 }
             }
         }
     }
     // REMOVE MODULE
     $diffRemove = array_diff($listModuleStore, $listModuleFile);
     if (!empty($diffRemove)) {
         foreach ($diffRemove as $k => $v) {
             $item = Modules::where(array('slug' => $k, 'name' => $v))->first();
             $deleteID = $item->id;
             if ($item->delete()) {
                 Menus::where('module_id', $deleteID)->delete();
                 Permission::where('module_id', $deleteID)->delete();
             }
         }
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:51,代码来源:MenuAdminController.php


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