本文整理汇总了PHP中app::uses方法的典型用法代码示例。如果您正苦于以下问题:PHP app::uses方法的具体用法?PHP app::uses怎么用?PHP app::uses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::uses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
<?php
app::uses('Component', 'Controller');
App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
class UploadComponent extends Component
{
public function upload($data = null, $file_path, $allowed)
{
if (!empty($data)) {
$file_tmp_name = $data['tmp_name'];
$file_path_abs = $file_path . DS . String::uuid() . '.' . substr(strrchr($data['name'], '.'), 1);
if (!in_array(substr(strrchr($data['name'], '.'), 1), $allowed)) {
return False;
} else {
$dir = new Folder($file_path, true, 0755);
move_uploaded_file($file_tmp_name, $file_path_abs);
return $file_path_abs;
}
}
}
}
示例2:
* Copyright 2010 - 2012, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010 - 2012, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('UsersController', 'Users.Controller');
App::uses('User', 'Users.Model');
App::uses('AuthComponent', 'Controller/Component');
App::uses('CookieComponent', 'Controller/Component');
App::uses('SessionComponent', 'Controller/Component');
App::uses('RememberMeComponent', 'Users.Controller/Component');
App::uses('Security', 'Utility');
app::uses('CakeEmail', 'Network/Email');
/**
* TestUsersController
*
* @package users
* @subpackage users.tests.controllers
*/
class TestUsersController extends UsersController
{
/**
* Name
*
* @var string
*/
public $name = 'Users';
/**
示例3: index
<?php
app::uses('AppController', 'Controller');
/**
* Class LogWatchersController
*
* @property LogWatcher $LogWatcher
*
* @author Jelmer Dröge <jelmer@avolans.nl>
*/
class LogWatchersController extends AppController
{
/**
* An overview of all the logs as well as the page where the log is loaded
*
* @throws NotFoundException
* @throws MethodNotAllowedException
*/
public function index()
{
if ($this->request->is('post') && ($log = $this->request->data('LogWatcher.log'))) {
if (!$this->request->query('json')) {
$this->redirect(array('log' => $log, '#' => 'bottom'));
}
}
# if the default layout is overwritten..
if (!($this->layout = Configure::read('LogWatcher.layout'))) {
$this->layout = 'LogWatcher.default';
}
# get all the logfile names
$logFiles = $this->LogWatcher->getLogFiles();
示例4: app
}
/* Show username */
if (isset($_SESSION['s']['user'])) {
$this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
$this->tpl->setVar('logout_txt', $this->lng('logout_txt'));
/* Show search field only for normal users, not mail users */
if (stristr($_SESSION['s']['user']['username'], '@')) {
$this->tpl->setVar('usertype', 'mailuser');
} else {
$this->tpl->setVar('usertype', 'normaluser');
}
}
/* Global Search */
$this->tpl->setVar('globalsearch_resultslimit_of_txt', $this->lng('globalsearch_resultslimit_of_txt'));
$this->tpl->setVar('globalsearch_resultslimit_results_txt', $this->lng('globalsearch_resultslimit_results_txt'));
$this->tpl->setVar('globalsearch_noresults_text_txt', $this->lng('globalsearch_noresults_text_txt'));
$this->tpl->setVar('globalsearch_noresults_limit_txt', $this->lng('globalsearch_noresults_limit_txt'));
$this->tpl->setVar('globalsearch_searchfield_watermark_txt', $this->lng('globalsearch_searchfield_watermark_txt'));
}
}
// end class
//** Initialize application (app) object
//* possible future = new app($conf);
$app = new app();
// load and enable PHP Intrusion Detection System (PHPIDS)
$ids_security_config = $app->getconf->get_security_config('ids');
if (is_dir(ISPC_CLASS_PATH . '/IDS') && $ids_security_config['ids_enabled'] == 'yes') {
$app->uses('ids');
$app->ids->start();
}
unset($ids_security_config);
示例5: setup
<?php
/**
* This Behavior will automatically create & relate a UserGroup to any Model
*
* This Behavior manages two Models.
* 1) A "main model" / the belongsTo model - the model whose creation will also create a user group
* 2) A "group members model" / the hasMany model - the model that represents the members of the main model
*
* @todo This needs to use the User.id of the User that is being added to the thing.. not the User.Id of the current logged in User
*/
app::uses('UserGroup', 'Users.Model');
class UserGroupableBehavior extends ModelBehavior
{
public $settings = array();
public $foreignKeyToDeleteFrom = null;
/**
*
* @param Model $Model
* @param array $settings
*/
public function setup(Model $Model, $settings = array())
{
// settings go here
$this->settings[$Model->alias] = $settings;
if (isset($this->settings[$Model->alias]['hasMany'])) {
// our main $Model hasOne UserGroup
$Model->bindModel(array('hasOne' => array('UserGroup' => array('className' => 'Users.UserGroup', 'foreignKey' => 'foreign_key', 'conditions' => array('UserGroup.model' => $Model->alias), 'dependent' => true))), false);
}
}
/**
示例6:
* (例)$request->is('admin')
* $request->is('smartphone')
* $request->is(array('smartphone', 'mobile')) // OR
* $request->isAll(array('smartphone', 'page_display')) // AND
*
* baserCMS : Based Website Development Project <http://basercms.net>
* Copyright 2008 - 2015, baserCMS Users Community <http://sites.google.com/site/baserusers/>
*
* @copyright Copyright 2008 - 2015, baserCMS Users Community
* @link http://basercms.net baserCMS Project
* @package Baser.Routing.Filter
* @since baserCMS v 3.1.0-beta
* @license http://basercms.net/license/index.html
*/
app::uses('BcAgent', 'Lib');
app::uses('DispatcherFilter', 'Routing');
/**
* Class BcRequestFilter
*/
class BcRequestFilter extends DispatcherFilter
{
/**
* Default priority for all methods in this filter
* This filter should run before the request gets parsed by router
* @var int
*/
public $priority = 6;
/**
* beforeDispatch Event
*
* @param CakeEvent $event イベント
示例7: isUnicoLoginAtivo
<?php
/**
*
* Copyright [2016] - Civis Gestão Inteligente
* Este arquivo é parte do programa Civis Estratégia
* O civis estratégia é um software livre, você pode redistribuí-lo e/ou modificá-lo dentro dos termos da Licença Pública Geral GNU como publicada pela Fundação do Software Livre (FSF) na versão 2 da Licença.
* Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA, sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/GPL em português para maiores detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "licença GPL.odt", junto com este programa. Se não encontrar,
* Acesse o Portal do Software Público Brasileiro no endereço www.softwarepublico.gov.br ou escreva para a Fundação do Software Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
app::uses("Pessoa", "Model");
class Usuario extends AppModel
{
/**
* Validation rules
*
* @var array
*/
public $validate = array("login" => array("Obrigatório" => array("rule" => "notEmpty", "message" => "Campo login é obrigatório"), 'between' => array('rule' => array('between', 4, 100), 'message' => 'Login deve conter entre 4 e 100 caracteres'), "Unico" => array("rule" => "isUnicoLoginAtivo", "message" => "Login inválido, favor informe outro.")), 'senha' => array('Obrigatório' => array('rule' => 'notEmpty', 'message' => 'Campo senha é obrigatório', 'on' => 'create'), 'Tamanho Mínimo' => array('rule' => array('minLength', 6), 'message' => 'Senha deve ter no mínimo 6 caracteres', 'allowEmpty' => true), 'Match Passwords' => array('rule' => 'matchPasswords', 'message' => 'Confirmação de senha inválida')), "confirmacao_senha" => array("Obrigatório" => array("rule" => "notEmpty", "message" => "Confirme sua senha", "on" => "create")), 'perfil_id' => array('Obrigatório' => array('rule' => array('notempty'), 'message' => 'Campo Grupo é obrigatório')), 'cargo_id' => array('Obrigatório' => array('rule' => array('notempty'), 'message' => 'Campo Cargo é obrigatório')), 'vinculo_id' => array('Obrigatório' => array('rule' => array('notempty'), 'message' => 'Campo Vínculo é obrigatório')), 'setor_id' => array('Obrigatório' => array('rule' => array('notempty'), 'message' => 'Campo Setor é obrigatório')), 'chefe' => array('Obrigatório' => array('rule' => array('notempty'), 'message' => 'Campo Chefia é obrigatório')));
public function isUnicoLoginAtivo($data)
{
if ($this->id) {
$conditions["Usuario.id != "] = $this->id;
}
$conditions["Usuario.login"] = strtolower($data["login"]);
return !(bool) $this->find("first", array("conditions" => $conditions));
}
public function matchPasswords($data)
{
示例8: startup
<?php
App::uses('Component', 'Controller');
app::uses('ComponentCollection', 'Controller/Component');
App::uses('AppController', 'Controller');
App::uses('CroogoTestCase', 'TestSuite');
app::uses('CroogoComponent', 'Controller/Component');
class MockCroogoComponent extends CroogoComponent
{
public function startup(Controller $controller)
{
$this->_controller = $controller;
$this->_CroogoPlugin = new CroogoPlugin();
$this->_CroogoPlugin->Setting->writeConfiguration();
}
}
class CroogoTestController extends AppController
{
}
class CroogoComponentTest extends CroogoTestCase
{
public $fixtures = array('app.aco', 'app.aro', 'app.aros_aco', 'plugin.settings.setting', 'plugin.menus.menu', 'plugin.menus.link', 'plugin.users.role', 'plugin.taxonomy.type', 'plugin.taxonomy.vocabulary', 'plugin.taxonomy.types_vocabulary');
public function setUp()
{
parent::setUp();
$this->Controller = new CroogoTestController(new CakeRequest(), new CakeResponse());
$this->Controller->constructClasses();
$this->Controller->Croogo = new MockCroogoComponent($this->Controller->Components);
$this->Controller->Components->unload('Blocks');
$this->Controller->Components->unload('Menus');
$this->Controller->Components->set('Croogo', $this->Controller->Croogo);
示例9: __construct
<?php
/**
* Inspired by http://stackoverflow.com/questions/207817/converting-a-google-search-query-to-a-postgresql-tsquery
* @author Peter Bailey
* @author Stephen Cuppett
*/
app::uses('QueryPhrase', 'PgUtils.Lib');
class QueryExpression
{
protected $mode;
protected $phrases = array();
protected $subExpressions = array();
protected $parent;
public function __construct($parent = null, $or = false, $exclusion = false)
{
$this->parent = $parent;
$this->mode = ($or ? QueryPhrase::MODE_OR : QueryPhrase::MODE_AND) | ($exclusion ? QueryPhrase::MODE_EXCLUDE : 0);
}
public function initiateSubExpression($or = false, $exclusion = false)
{
$expression = new self($this, $or, $exclusion);
$this->subExpressions[] = $expression;
return $expression;
}
public function getMode()
{
return $this->mode;
}
public function getPhrases()
{
示例10: __construct
<?php
/**
* Inspired by http://stackoverflow.com/questions/207817/converting-a-google-search-query-to-a-postgresql-tsquery
* @author Peter Bailey
* @author Stephen Cuppett
*/
app::uses('IParser', 'PgUtils.Lib');
app::uses('QueryExpression', 'PgUtils.Lib');
class QueryParser implements IParser
{
protected $lexer;
public function __construct(ILexer $lexer)
{
$this->lexer = $lexer;
}
public function parse($input)
{
$tokens = $this->lexer->getTokens($input);
$expression = new QueryExpression();
foreach ($tokens as $token) {
$expression = $this->processToken($token, $expression);
}
// Unwind the stack of subexpressions
while ($expression->getParentExpression() != $expression) {
$expression = $expression->getParentExpression();
}
return $expression;
}
protected function processToken($token, QueryExpression $expression)
{
示例11: getTokens
<?php
/**
* Inspired by http://stackoverflow.com/questions/207817/converting-a-google-search-query-to-a-postgresql-tsquery
* @author Peter Bailey
* @author Stephen Cuppett
*/
app::uses('ILexer', 'PgUtils.Lib');
class QueryLexer implements ILexer
{
const trimmables = " \t\n\r\v-";
private $delimit_symbols = array('<', '>', ':', '-', '+');
private $join_words = array('', 'and', 'or');
public function getTokens($str)
{
$tokenStack = array();
$chars = str_split($str);
$in_quotes = false;
$holding_string = '';
foreach ($chars as $char) {
// The end of a subgroup.
// Ending any current string and identifying the delimiter.
if ($char == ')' && !$in_quotes) {
if ($holding_string != '') {
$tokenStack[] = $holding_string;
$holding_string = '';
}
$tokenStack[] = $char;
continue;
}
// The beginning of a subgroup.
示例12: getLogFiles
<?php
app::uses('AppModel', 'Model');
App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
/**
* Class LogWatcher
*
* @author Jelmer Dröge <jelmer@avolans.nl>
*/
class LogWatcher extends AppModel
{
public $useTable = false;
/**
* Get all the logfiles accessible and whitelisted
*
* @return array
*/
public function getLogFiles()
{
$dir = new Folder(Configure::read('LogWatcher.logDir'));
# if a whitelist is set, only show those
if ($whitelist = Configure::read('LogWatcher.whitelist')) {
$allowed = implode('|', $whitelist);
} else {
$allowed = '.*';
}
$logs = $dir->find($allowed . '\\.log');
foreach ($logs as &$log) {
$log = substr($log, 0, -4);
}
示例13: array
<?php
/**
* This helper adds the ability to make tables easier and faster
*
* @copyright Copyright (c) Avolans (http://avolans.nl)
* @link http://github.com/JelmerD Github JelmerD
* @package app.View.Helper
* @version 1.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*
* @author Jelmer Dröge <jelmer@avolans.nl>
*/
app::uses('AppHelper', 'View/Helper');
/**
* Class TableHelper
*
* @package app.View.Helper
* @property HtmlHelper $Html
*/
class TableHelper extends AppHelper
{
/**
* Helpers we use
*
* @var array
*/
public $helpers = array('Html');
/**
* Settings you can parse to the helper
*
示例14:
/**
* テーマモデル
*
* baserCMS : Based Website Development Project <http://basercms.net>
* Copyright 2008 - 2015, baserCMS Users Community <http://sites.google.com/site/baserusers/>
*
* @copyright Copyright 2008 - 2015, baserCMS Users Community
* @link http://basercms.net baserCMS Project
* @package Baser.Model
* @since baserCMS v 0.1.0
* @license http://basercms.net/license/index.html
*/
/**
* Include files
*/
app::uses('BcThemeConfigReader', 'Configure');
/**
* テーマモデル
*
* @package Baser.Model
*/
class Theme extends AppModel
{
/**
* クラス名
*
* @var string
*/
public $name = 'Theme';
/**
* テーブル
示例15: __construct
<?php
app::uses('AppHelper', 'View/Helper');
app::uses('HtmlHelper', 'View/Helper');
/**
* Class MustacheHelper
*
* @author Jelmer Dröge <jelmer@avolans.nl>
*/
class MustacheHelper extends AppHelper
{
/**
* @var Mustache_Engine
*/
public $Engine;
/**
* @var array
*/
private $__templateCache = array('name' => false, 'template' => null);
public function __construct(View $View, $settings = array())
{
parent::__construct($View, $settings);
if (class_exists('Mustache_Autoloader', false) === false) {
App::import('Vendor', 'Mustache_Autoloader', array('file' => 'mustache' . DS . 'mustache' . DS . 'src' . DS . 'Mustache' . DS . 'Autoloader.php'));
Mustache_Autoloader::register();
$this->Engine = new Mustache_Engine();
}
}
/**
* @param $name
* @param array $context