本文整理汇总了PHP中Y类的典型用法代码示例。如果您正苦于以下问题:PHP Y类的具体用法?PHP Y怎么用?PHP Y使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Y类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test
function test()
{
$a = X::foo();
$a();
$a = Y::foo();
$a();
$a = X::bar();
$a();
$a = Y::bar();
$a();
$x = new X();
$a = $x->bar();
$a();
$x = new Y();
$a = $x->bar();
$a();
$a = X::bar_nonstatic();
$a();
$a = Y::bar_nonstatic();
$a();
$x = new X();
$a = $x->bar_nonstatic();
$a();
$x = new Y();
$a = $x->bar_nonstatic();
$a();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:late_bound_class.php
示例2: f
function f()
{
$y = new Y();
$y->foo();
static::g();
$y->foo();
self::g();
Y::foo() && static::g();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:1876.php
示例3: test
function test()
{
$x = new X();
$c = $x->f();
var_dump($c(true));
$y = new Y();
$c = $y->f();
var_dump($c("foo"));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:closure_clone_2.php
示例4: test
function test($str)
{
X::bar($str);
(new X())->bar($str);
Y::bar($str);
(new Y())->bar($str);
}
开发者ID:ezoic,项目名称:hhvm,代码行数:7,代码来源:strings_with_colons.php
示例5: flushUploadDir
public function flushUploadDir()
{
$session = new CHttpSession();
$session->open();
$folder = $_SERVER['DOCUMENT_ROOT'] . '/upload/tmp/' . $session->SessionID;
Y::recursiveRemDir($folder);
}
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:7,代码来源:Controller.php
示例6: instance
/**
* 连接数据库
*
* @param string $dbFlag 数据库配置命名空间
*/
public static function instance($dbFlag = '')
{
if (empty($dbFlag)) {
throw new DbException('Empty param: dbFlag');
}
if (!isset(Y::$app->db[$dbFlag])) {
throw new InvalidConfigException('Unknow db config: ' . $dbFlag);
}
if (!isset(static::$_links[$dbFlag]) || null === static::$_links[$dbFlag]) {
$config = Y::$app->db[$dbFlag];
$dsn = $config['dsn'];
$driver = static::getDriverName($dsn);
$dbClass = static::$_dbNamespace . '\\' . $driver . '\\Db';
$dbFile = Y::namespaceTranslate($dbClass);
if (!is_file($dbFile)) {
throw new FileNotFoundException('The Classfile: ' . $dbFile . ' not found');
}
try {
static::$_links[$dbFlag] = new $dbClass($dsn, $config['username'], $config['password']);
static::$_links[$dbFlag]->initConnection($config);
} catch (PDOException $e) {
static::$_links[$dbFlag] = null;
throw new DbException('Failed to connect to database');
}
}
return static::$_links[$dbFlag];
}
开发者ID:yulipu,项目名称:yframework,代码行数:32,代码来源:DbFactory.php
示例7: __construct
public function __construct(&$config)
{
$this->cachePath = isset($config['cachePath']) ? Y::getPathAlias($config['cachePath']) : Y::getPathAlias($this->cachePath);
if (!is_dir($this->cachePath)) {
FileHelper::createDirectory($this->cachePath);
}
}
开发者ID:yulipu,项目名称:yframework,代码行数:7,代码来源:Cache.php
示例8: recursiveRemDir
function recursiveRemDir($directory, $empty = FALSE)
{
if (substr($directory, -1) == '/') {
$directory = substr($directory, 0, -1);
}
if (!file_exists($directory) || !is_dir($directory)) {
return FALSE;
} elseif (is_readable($directory)) {
$handle = opendir($directory);
while (FALSE !== ($item = readdir($handle))) {
if ($item != '.' && $item != '..') {
$path = $directory . '/' . $item;
if (is_dir($path)) {
Y::recursiveRemDir($path);
} else {
unlink($path);
}
}
}
closedir($handle);
if ($empty == FALSE) {
if (!rmdir($directory)) {
return FALSE;
}
}
}
return TRUE;
}
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:28,代码来源:Y.php
示例9: actionUpdate
public function actionUpdate($dir, $fileName)
{
if (isset($_POST['fileContent'])) {
FileSystem::write('./'.$dir.'/'.$fileName, $_POST['fileContent'], 'w');
Y::end();
}
$content = '';
$info = FileSystem::getInfo('./'.$dir.'/'.$fileName, array('name', 'ext'));
if (in_array($info['ext'], array('js', 'css'))) {
if (substr($dir, 0, 2) == 'js' || substr($dir, 0, 3) == 'css') {
$content = FileSystem::read('./'.$dir.'/'.$fileName);
}
}
$output = $this->renderPartial('fileDetails', array(
'fileName' => $fileName,
'content' => $content,
'type' => $info['ext'] == 'css' ? 'css' : 'javascript',
'filePath' => './'.$dir.'/'.$fileName
), true);
Y::tab('Содержимое файла', $output);
$output = Y::getTabs('cssFileForm', true);
Y::clientScript()->render($output);
echo CHtml::tag('div', array(), $output);
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:28,代码来源:FilesController.php
示例10: actionAdmin
public function actionAdmin($catPk, $opts = array())
{
$cat = Category::model()->findByPk($catPk);
$model = $this->loadModel($catPk, null, 'search');
$this->ajaxSetNextValue('published', $model, 'published', array(BaseDataType::PUBLISHED, BaseDataType::NOT_PUBLISHED));
$model->unsetAttributes(); // clear any default values
$model = $model->current($cat);
if (isset($_GET[get_class($model)]))
$model->attributes=$_GET[get_class($model)];
$opts['model'] = $model;
$opts['cat'] = $cat;
$opts['columns'] = array();
$opts = Y::hooks()->cmsAdminGetGridColumns($this, &$opts);
if (isset($_GET['ajax'])) {
$this->renderPartial('admingrid',$opts);
} else {
$this->render('admin',$opts);
}
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:26,代码来源:DataTypesController.php
示例11: actionRecovery
/**
* Recovery password
*/
public function actionRecovery () {
$form = new UserRecoveryForm;
if (Y::userId()) {
$this->redirect(Y::module()->returnUrl);
Y::end();
}
$email = isset($_GET['email']) ? $_GET['email'] : '';
$activkey = isset($_GET['activkey']) ? $_GET['activkey'] : '';
if ($email&&$activkey) { //get new pass
$find = User::model()->notsafe()->findByAttributes(array('email'=>$email));
if(isset($find)&&$find->activkey==$activkey) {
$form2 = new UserChangePassword;
if(isset($_POST['UserChangePassword'])) {
$form2->attributes=$_POST['UserChangePassword'];
if($form2->validate()) {
$find->password = UserModule::encrypting($form2->password);
if ($find->status==0) {
$find->status = 1;
}
$find->save();
Y::flash('recoveryMessage',Users::t("New password is saved."));
$this->redirect(Y::module()->recoveryUrl);
}
}
$this->render('changepassword',array('form'=>$form2));
} else {
Y::flash('recoveryMessage',Users::t("Incorrect recovery link."));
$this->redirect(Y::module()->recoveryUrl);
}
} else { //send email
if(isset($_POST['UserRecoveryForm'])) {
$form->attributes=$_POST['UserRecoveryForm'];
if($form->validate()) {
$user = User::model()->notsafe()->findbyPk($form->user_id);
$user->activkey = Y::module()->encrypting(microtime().$user->password);
$user->save();
$activation_url = 'http://' . $_SERVER['HTTP_HOST'].$this->siteUrl('user/recovery',array("activkey" => $user->activkey, "email" => urldecode($user->email)));
$subject = Users::t("You have requested the password recovery site {site_name}",
array(
'{site_name}'=>Yii::app()->name,
));
$message = Users::t("You have requested the password recovery site {site_name}. To receive a new password, go to {activation_url}.",
array(
'{site_name}'=>Yii::app()->name,
'{activation_url}'=>$activation_url,
));
UserModule::sendMail($user->email,$subject,$message);
Y::flash('recoveryMessage',Users::t("Please check your email. An instructions was sent to your email address."));
$this->refresh();
}
}
$this->render('recovery',array('form'=>$form));
}
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:63,代码来源:RecoveryController.php
示例12: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
if (strpos($this->username,"@")) {
$user=User::model()->notsafe()->findByAttributes(array('email'=>$this->username));
} else {
$user=User::model()->notsafe()->findByAttributes(array('username'=>$this->username));
}
if($user===null)
if (strpos($this->username,"@")) {
$this->errorCode=self::ERROR_EMAIL_INVALID;
} else {
$this->errorCode=self::ERROR_USERNAME_INVALID;
}
else if(Y::module('users')->encrypting($this->password)!==$user->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else if($user->status==0&&Y::module('users')->loginNotActiv==false)
$this->errorCode=self::ERROR_STATUS_NOTACTIV;
else if($user->status==-1)
$this->errorCode=self::ERROR_STATUS_BAN;
else {
$this->_id=$user->id;
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:34,代码来源:UserIdentity.php
示例13: getListView
public function getListView(&$criteria, $return = false)
{
$dp = new EActiveDataProvider(get_class($this->model), array(
'criteria' => $criteria,
//'pagination' => $this->settings['pagination'],
));
//default params
$params = array(
'dataProvider'=>$dp,
'pager'=>array(
'id'=>$this->widgetModel->pk.'Pager', 'class'=>'LinkPager', 'htmlOptions'=>array('class'=>'pager'),
'cssFile'=>Yii::app()->baseUrl.'/css/pager.css'
),
'ajaxUpdate'=>true,
'template'=>$this->render('listTemplate', array(), true),
'afterAjaxUpdate' => ModelFactory::getAfterAjaxUpdateFunction($this->category->type),
'beforeAjaxUpdate' => ModelFactory::getBeforeAjaxUpdateFunction($this->category->type),
'category' => $this->category,
'contextWidget' => $this
);
try {
$res = Y::controller()->widget('ListView', $params, true);
} catch (CException $e) {
Y::dump($e->__toString());
}
if ($return)
return $res;
else
echo $res;
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:33,代码来源:ImageGalleryWidget.php
示例14: __construct
public function __construct($config)
{
$this->logPath = isset($config['logPath']) ? Y::getPathAlias($config['logPath']) : Y::getPathAlias($this->logPath);
$this->logFile = $this->generateTimeLogFile();
if (!is_dir($this->logPath)) {
FileHelper::createDirectory($this->logPath);
}
}
开发者ID:yulipu,项目名称:yframework,代码行数:8,代码来源:Target.php
示例15: relations
/**
* @return array relational rules.
*/
public function relations()
{
$relations = array(
'profile'=>array(self::HAS_ONE, 'Profile', 'user_id'),
);
if (isset(Y::module('users')->relations)) $relations = array_merge($relations,Y::module('users')->relations);
return $relations;
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:11,代码来源:User.php
示例16: createPageUrl
public function createPageUrl($controller,$page)
{
$params=$this->params===null ? $_GET : $this->params;
if($page>0) // page 0 is the default
$params[$this->pageVar]=$page+1;
else
unset($params[$this->pageVar]);
return Y::url($this->route,$params);
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:9,代码来源:Pagination.php
示例17: init
public function init()
{
parent::init();
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
Y::clientScript()->registerScriptFile($this->scriptPath.'/js/cms/asc.js');
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:9,代码来源:AdminModule.php
示例18: getHasChanged
/**
* @return boolean whether the dependency has changed.
*/
public function getHasChanged()
{
$tags = array_map(function($i) { return FileCache::PREFIX.$i; }, $this->tags);
$values = Y::cache()->mget($tags);
foreach ($values as $value) {
if ((integer)$value > $this->timestamp) { return true; }
}
return false;
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:14,代码来源:Tags.php
示例19: run
public function run()
{
$model = Holes::model()->count(array('condition' => 'PREMODERATED=1'));
$all = $model;
$model = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="inprogress"'));
$ingibdd = $model;
$model = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="fixed"'));
$fixed = $model;
$this->registerCoreScripts();
$this->render($this->itemview, array('all' => Y::declOfNum($all, array('дефект', 'дефекта', 'дефектов')), 'ingibdd' => $ingibdd, 'fixed' => $fixed));
}
开发者ID:nikel303,项目名称:RosYama.2,代码行数:11,代码来源:collectionWidget.php
示例20: registerScritps
public function registerScritps()
{
$options = empty($this->options) ? '' : CJavaScript::encode($this->options);
Y::clientScript()
->registerScript($this->getId().'-form-submit', "
$(document).ready(function(){
$('#{$this->getId()}').tabs({$options});
});
")
->registerScriptFile('');
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:11,代码来源:ExtTabs.php
注:本文中的Y类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论