本文整理汇总了PHP中Nette\Utils\Strings::firstUpper方法的典型用法代码示例。如果您正苦于以下问题:PHP Strings::firstUpper方法的具体用法?PHP Strings::firstUpper怎么用?PHP Strings::firstUpper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Utils\Strings
的用法示例。
在下文中一共展示了Strings::firstUpper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChangeDescription
public function getChangeDescription()
{
if ($this->count === 1) {
return $this->changeInfos[0]->getChangeDescription();
}
return Strings::firstUpper(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} term-meta";
}
示例2: __construct
/**
* @param Task $task
* @param \SimpleXMLElement|null $pmml
* @param DatabaseFactory $databaseFactory
* @param PreprocessingFactory $preprocessingFactory
* @param string $appVersion =''
*/
public function __construct(Task $task, \SimpleXMLElement $pmml = null, DatabaseFactory $databaseFactory, PreprocessingFactory $preprocessingFactory, $appVersion = '')
{
if ($task instanceof Task) {
$this->task = $task;
$this->miner = $task->miner;
}
$this->appVersion = $appVersion;
if (!empty($pmml)) {
if ($pmml instanceof \SimpleXMLElement) {
$this->pmml = $pmml;
} elseif (is_string($pmml)) {
$this->pmml = simplexml_load_string($pmml);
}
}
if (!$pmml instanceof \SimpleXMLElement) {
$this->prepareBlankPmml();
}
$this->appendTaskInfo();
$this->databaseFactory = $databaseFactory;
$this->preprocessingFactory = $preprocessingFactory;
$connectivesArr = Cedent::getConnectives();
foreach ($connectivesArr as $connective) {
$this->connectivesArr[$connective] = Strings::firstUpper($connective);
}
}
示例3: annotationBeautify
/**
* @param string $name
* @return string
*/
public function annotationBeautify($name)
{
if (isset($this->rename[$name])) {
$name = $this->rename[$name];
}
return Nette\Utils\Strings::firstUpper($name);
}
示例4: checkDimension
/**
* Check value of dimension
*
* @param int|string $dimension
* @param string $type
*/
private function checkDimension($dimension, $type)
{
// dimension must be number or percent
if (Validators::is($dimension, 'string') && !Validators::isNumeric($dimension) && !Strings::endsWith($dimension, '%')) {
$msg = sprintf('Dimension of %s has unexpected format, "%s" given.', $type, $dimension);
throw new InvalidArgumentException($msg);
}
// dimension cannot be negative number
if ((int) $dimension < 0) {
$msg = sprintf('Dimension of %s must be greater than 0, "%s" given.', $type, $dimension);
throw new InvalidArgumentException($msg);
}
// cannot be generate new image greater than 200 % of original image
// is number
$originDimension = $this->image->{'get' . Strings::firstUpper($type)}();
if (Validators::isNumeric($dimension) && $dimension > $originDimension * 2) {
$msg = sprintf('Required %s cannot be greater than 200 percent of original, "%s" required and "%s" is original.', $type, $dimension, $originDimension);
throw new InvalidArgumentException($msg);
}
// is percent
if (Strings::endsWith($dimension, '%') && (int) $dimension > 200) {
$msg = sprintf('Required %s cannot be greater than 200 percent of original, "%s" required.', $type, $dimension);
throw new InvalidArgumentException($msg);
}
}
示例5: getChangeDescription
public function getChangeDescription()
{
$verb = "Edited";
$subject = "term-meta '{$this->metaKey}'";
$rest = "for term '{$this->termName}'";
if ($this->getAction() === "create" || $this->getAction() === "delete") {
$verb = Strings::firstUpper(StringUtils::verbToPastTense($this->getAction()));
}
return sprintf("%s %s %s", $verb, $subject, $rest);
}
示例6: loadCategories
private function loadCategories()
{
try {
$categories = $this->categoryFacade->findAll();
foreach ($categories->items as $category) {
$this->categories[$category->id] = Strings::firstUpper($category->name);
}
} catch (EntitiesNotFoundException $ex) {
\Tracy\Debugger::log($ex);
}
}
示例7: signalReceived
/**
* @param string
*/
public function signalReceived($signal)
{
$methodName = sprintf('handle%s', \Nette\Utils\Strings::firstUpper($signal));
if (!method_exists($this, $methodName)) {
throw new \Nette\Application\UI\BadSignalException(sprintf('Method %s does not exist', $methodName));
}
$presenterComponentReflection = new PresenterComponentReflection(get_called_class());
$methodReflection = $presenterComponentReflection->getMethod($methodName);
$args = $presenterComponentReflection->combineArgs($methodReflection, $this->params);
$methodReflection->invokeArgs($this, $args);
}
示例8: create
/**
* @param \App\type $id
* @return \App\PresenterLinkSettings
*/
public function create($id)
{
$item = $this->menuItemDataSource->get($id, function (Selection $context) {
$pageKey = ':menu_has_presenter.presenter.code';
$context->select('section.module, menu.section_id, menu.name');
$context->select("{$pageKey}");
$context->where("{$pageKey} IS NOT NULL");
});
$module = Strings::capitalize($item->module);
$presenter = Strings::firstUpper($item->code);
return $this->presenterLinkSettingsFactory->create(":{$module}:{$presenter}:", []);
}
示例9: getChangeDescription
public function getChangeDescription()
{
$taxonomy = $this->getTaxonomyName();
switch ($this->getAction()) {
case "create":
return "New {$taxonomy} '{$this->termName}'";
case "delete":
return "Deleted {$taxonomy} '{$this->termName}'";
case "rename":
return Strings::firstUpper($taxonomy) . " '{$this->oldTermName}' renamed to '{$this->termName}'";
}
return "Edited {$taxonomy} '{$this->termName}'";
}
示例10: __construct
/**
* Constructor
*/
public function __construct()
{
// get wordpress database object (no injection sorry!
global $wpdb;
// variables
$this->database = $wpdb;
$this->settings = new \SimpleSubscribe\Settings(SUBSCRIBE_KEY);
$this->settingsAll = $this->settings->getSettings();
// we get the table name from class name
preg_match('#Repository(\\w+)$#', get_class($this), $class);
$tablePreName = \Nette\Utils\Strings::contains($class[1], 'Subscribers') ? $class[1] : 'Subscribers' . $class[1];
$this->tableName = $this->database->prefix . Utils::camelCaseToUnderscore($tablePreName);
$this->tableSingleName = \Nette\Utils\Strings::firstUpper($class[1]);
$this->count = $this->count();
}
示例11: match
/**
* Maps HTTP request to a Request object.
* @param \Nette\Http\IRequest $httpRequest
* @return \Nette\Application\Request|NULL
*/
public function match(IRequest $httpRequest)
{
$url = $httpRequest->getUrl();
$basePath = Strings::replace($url->getBasePath(), '/\\//', '\\/');
$cleanPath = Strings::replace($url->getPath(), "/^{$basePath}/");
$path = Strings::replace($this->getPath(), '/\\//', '\\/');
$pathRexExp = empty($path) ? "/^.+\$/" : "/^{$path}\\/.*\$/";
if (!Strings::match($cleanPath, $pathRexExp)) {
return NULL;
}
$cleanPath = Strings::replace($cleanPath, '/^' . $path . '\\//');
$params = array();
$path = $cleanPath;
$params['action'] = $this->detectAction($httpRequest);
$frags = explode('/', $path);
// Resource ID.
if (count($frags) % 2 === 0) {
$params['id'] = array_pop($frags);
} elseif ($params['action'] == 'read' && $this->useReadAllAction) {
$params['action'] = 'readAll';
}
$presenterName = Strings::firstUpper(array_pop($frags));
// Allow to use URLs like domain.tld/presenter.format.
$formats = join('|', array_keys($this->formats));
if (Strings::match($presenterName, "/.+\\.({$formats})\$/")) {
list($presenterName, $format) = explode('.', $presenterName);
}
// Associations.
$assoc = array();
if (count($frags) > 0 && count($frags) % 2 === 0) {
foreach ($frags as $k => $f) {
if ($k % 2 !== 0) {
continue;
}
$assoc[$f] = $frags[$k + 1];
}
}
$params['format'] = $this->detectFormat($httpRequest);
$params['associations'] = $assoc;
$params['data'] = $this->readInput();
$params['query'] = $httpRequest->getQuery();
$presenterName = empty($this->module) ? $presenterName : $this->module . ':' . $presenterName;
$appRequest = new Request($presenterName, $httpRequest->getMethod(), $params);
return $appRequest;
}
示例12: createComponentSearchForm
protected function createComponentSearchForm()
{
$form = new \Nette\Forms\BootstrapPHForm();
$form->setTranslator($this->presenter->translator->domain('dictionary.main'));
$form->setMethod("GET");
$form->getElementPrototype()->class = "form-inline";
$form->getElementPrototype()->role = 'form';
$form->getElementPrototype()->autocomplete = 'off';
$form->addHidden('idr', 'ID:');
$form->addText('src')->setAttribute("class", "form-control")->setAttribute("placeholder", \Nette\Utils\Strings::firstUpper("src"));
$form->addText("priceFrom")->setAttribute("style", "width: 50px;");
$form->addText("priceTo")->setAttribute("style", "width: 50px;");
$form->addText("brand");
if ($this->getParameter("id")) {
$form->setDefaults(array("idr" => $this->presenter->getParameter("id")));
}
$form->addSubmit('submitm', 'dictionary.main.Search')->setAttribute("class", "btn btn-info btn-lg");
$form->onSuccess[] = $this->searchFormSucceeded;
return $form;
}
示例13: getChangeDescription
public function getChangeDescription()
{
$verb = "Edited";
$subject = "post-meta '{$this->metaKey}'";
$rest = "for {$this->postType} '{$this->postTitle}'";
if ($this->metaKey === "_thumbnail_id") {
// featured image
$verb = "Changed";
$subject = "featured image";
if ($this->getAction() === "create") {
$verb = "Set";
}
if ($this->getAction() === "delete") {
$verb = "Removed";
}
} elseif ($this->getAction() === "create" || $this->getAction() === "delete") {
$verb = Strings::firstUpper(StringUtils::verbToPastTense($this->getAction()));
}
return sprintf("%s %s %s", $verb, $subject, $rest);
}
示例14: match
public function match(IRequest $httpRequest)
{
$url = $httpRequest->getUrl();
$basePath = Strings::replace($url->getBasePath(), '/\\//', '\\/');
$cleanPath = Strings::replace($url->getPath(), "/^" . $basePath . "/");
$path = Strings::replace($this->_getPath(), '/\\//', '\\/');
$pathRexExp = empty($path) ? "/^.+\$/" : "/^" . $path . "\\/.*\$/";
if (!Strings::match($cleanPath, $pathRexExp)) {
return;
}
$params = $httpRequest->getQuery();
// Get presenter action
if (!isset($params['action']) || empty($params['action'])) {
$params['action'] = $this->_detectAction($httpRequest);
}
$frags = explode('/', Strings::replace($cleanPath, '/^' . $path . '\\//'));
$resource = Strings::firstUpper($frags[0]);
// Set 'id' parameter if not custom action
if (isset($frags[1]) && $this->_isApiAction($params['action'])) {
$params['id'] = $frags[1];
}
return new Request(empty($this->module) ? $resource : $this->module . ':' . $resource, $httpRequest->getMethod(), $params);
}
示例15: __call
/**
* Render method hook
*
* @param string $func
* @param array $args
* @return mixed|void
*/
public function __call($func, $args = [])
{
if (Nette\Utils\Strings::startsWith($func, 'render')) {
// Fix array-in-array when passing parameters from template
// See http://forum.nette.org/cs/21090-makro-control-obaluje-pojmenovane-parametry-polem (in czech)
$tmp = @array_reduce($args, 'array_merge', []);
// @ - intentionally
if ($tmp === NULL) {
$tmp = $args;
}
// Capitalize and validate view syntax
$this->view = Nette\Utils\Strings::firstUpper($this->view);
$this->checkView();
// Call view and render methods
$render = Nette\Utils\Strings::substring($func, 6);
$this->callViewRender($render, $tmp);
// Life cycle
if ($this instanceof IHasControlLifeCycle) {
return $this->run($render, $tmp);
}
}
return parent::__call($func, $args);
}