本文整理匯總了PHP中WindUtility::lcfirst方法的典型用法代碼示例。如果您正苦於以下問題:PHP WindUtility::lcfirst方法的具體用法?PHP WindUtility::lcfirst怎麽用?PHP WindUtility::lcfirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WindUtility
的用法示例。
在下文中一共展示了WindUtility::lcfirst方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __call
/**
* 重載了魔術方法__call
*
* 當類的方法訪問不到時調用該方法,在這裏的實現是配置類屬性對象的延遲加載策略
* <code>
* //延遲訪問某個屬性,當使用這種方式調用時該方法被調用,並訪問該類中的$_delayAttributes屬性,並創建該屬性對象並返回
* $this->_getMethodName();
* </code>
* @param string $methodName
* @param array $args
* @return mixed
*/
public function __call($methodName, $args)
{
$_prefix = substr($methodName, 0, 4);
$_propertyName = substr($methodName, 4);
$_propertyName = WindUtility::lcfirst($_propertyName);
if ($_prefix == '_get') {
if (!$this->{$_propertyName} && isset($this->_delayAttributes[$_propertyName])) {
$_property = $this->_delayAttributes[$_propertyName];
$_value = null;
if (isset($_property['value'])) {
$_value = $_property['value'];
} elseif (isset($_property['ref'])) {
$_value = Wind::getApp()->getWindFactory()->getInstance($_property['ref'], $args);
} elseif (isset($_property['path'])) {
$_className = Wind::import($_property['path']);
$_value = WindFactory::createInstance($_className, $args);
}
$this->{$_propertyName} = $_value;
/*unset($this->delayAttributes[$_propertyName]);*/
}
return $this->{$_propertyName};
} elseif ($_prefix == '_set') {
$this->{$_propertyName} = $args[0];
}
}
示例2: preHandle
public function preHandle()
{
if (!$this->form) {
return null;
}
$className = Wind::import($this->form);
$form = WindFactory::createInstance($className);
$methods = get_class_methods($form);
foreach ($methods as $method) {
if (0 !== strpos($method, 'set') || '' == ($_tmp = substr($method, 3))) {
continue;
}
if (null === ($input = $this->getRequest()->getRequest(WindUtility::lcfirst($_tmp), null))) {
continue;
}
call_user_func_array(array($form, $method), array($input));
}
$form->validate();
$this->getRequest()->setAttribute($form, WindUtility::lcfirst($className));
$this->sendError($form->getErrorAction(), $form->getErrors());
}
示例3: generateSimpleHook
/**
* 生成簡單鉤子
*
* @param unknown_type $hookname
*/
public function generateSimpleHook($hookname)
{
$hookInfo = Wekit::load('hook.PwHooks')->fetchByName($hookname);
list($description, $doc) = explode("\r\n", $hookInfo['document']);
if (!$doc) {
return new PwError('APPCENTER:generate.unsupport.hook');
}
preg_match_all('/\\$[a-zA-Z_][a-zA-Z0-9_]*/', $doc, $matches);
$param = implode(', ', $matches[0]);
$doc = str_replace("\n", "\n\t * ", $doc);
$this->baseDir = Wind::getRealDir('EXT:' . $this->alias);
$manifest = Wind::getComponent('configParser')->parse($this->baseDir . '/Manifest.xml');
$thing = substr($hookname, 2);
$classname = $this->_ucwords($this->alias . '_' . $thing) . 'Do';
$method = WindUtility::lcfirst($this->_ucwords($this->alias)) . 'Do';
$hook = array('app_' . $this->alias => array('class' => 'EXT:' . $this->alias . '.service.srv.' . $classname, 'loadway' => 'load', 'method' => $method, 'description' => 'this is another ' . $hookname));
$manifest['inject-services'][$hookname] = $hook;
Wind::import('WIND:parser.WindXmlParser');
$parser = new WindXmlParser();
$manifest = str_replace('><', ">\n\t<", $parser->parseToXml(array('manifest' => $manifest), Wind::getApp()->getResponse()->getCharset()));
if (!WindFile::write($this->baseDir . '/Manifest.xml', $manifest)) {
return new PwError('APPCENTER:generate.copy.fail');
}
$class = WindFile::read(dirname($this->defaultDir) . '/simplehook');
$class = strtr($class, array('{{method}}' => $method, '{{classname}}' => $classname, '{{document}}' => $doc, '{{param}}' => $param, '{{classname}}' => $classname, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website, '{{description}}' => $description));
WindFolder::mkRecur($this->baseDir . '/service/srv/');
if (!WindFile::write($this->baseDir . '/service/srv/' . $classname . '.php', $class)) {
return new PwError('APPCENTER:generate.copy.fail');
}
}