本文整理匯總了PHP中Inflector::Humanize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::Humanize方法的具體用法?PHP Inflector::Humanize怎麽用?PHP Inflector::Humanize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::Humanize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _runTest
/**
* Executes the tests depending on $testToRun
*/
function _runTest()
{
// Need to set some get variables as TestManager depends on them
if (in_array($this->testToRun['section'], $this->plugins)) {
$_GET['plugin'] = $this->testToRun['section'];
} elseif (in_array(Inflector::Humanize($this->testToRun['section']), $this->plugins)) {
$_GET['plugin'] = Inflector::Humanize($this->testToRun['section']);
} elseif ($this->testToRun['section'] == 'app') {
$_GET['app'] = true;
}
if ($this->testToRun['area'] == 'all') {
TestManager::runAllTests(new TextReporter());
return;
} elseif ($this->testToRun['area'] == 'group') {
$_GET['group'] == $this->testToRun['file'];
if (isset($_GET['app'])) {
TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, new TextReporter());
} elseif (isset($_GET['plugin'])) {
TestManager::runGroupTest(ucfirst($_GET['group']), APP . 'plugins' . DS . $_GET['plugin'] . DS . 'tests' . DS . 'groups', new TextReporter());
} else {
TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, new TextReporter());
}
return;
} else {
$_GET['case'] = 'cases' . DS . $this->testToRun['type'] . DS . $this->testToRun['file'] . '.test.php';
TestManager::runTestCase($_GET['case'], new TextReporter());
return;
}
}
示例2: _missing_table
public function _missing_table($table = null)
{
$tableNotExist = array();
$tables = array('departments', 'branches', 'designations', 'users', 'employees', 'supplier_registrations', 'products', 'benchmarks');
foreach ($tables as $table) {
$modelName = null;
$modelName .= Inflector::Classify($table);
$this->loadModel($modelName);
$this->{$modelName}->recursive = -1;
$tableExist = $this->{$modelName}->find('first', array('conditions' => array('publish' => 1)));
if (empty($tableExist)) {
$tableNotExist[] = $table;
}
}
if (empty($tableNotExist)) {
return true;
} else {
$this->set('tableNotExist', $tableNotExist);
}
$this->set($tableNotExist);
$this->set('install', true);
if ($tableNotExist[0] == 'benchmarks') {
$getLink = Router::url('/', true) . $tableNotExist[0];
} else {
$getLink = Router::url('/', true) . $tableNotExist[0] . '/lists';
}
$this->Session->setFlash('Please add details for <h4>' . Inflector::Humanize($tableNotExist[0]) . ' <a href="' . $getLink . '" class="btn btn-sm btn-success">Add new</a></h4>
before you start using the application.You can also import these records if you have them ready. <br />
<strong>Please not that you will have to publish records which you are importing before you can access those records.</strong>
<br />List of required tables are Departments, Branches, Designations, Users, Employees, Suppliers, Devices, Products, Benchmarks');
if (!in_array($this->params->controller, $tables, true)) {
if ($tableNotExist[0] == '/benchmarks') {
$this->redirect(array('controller' => $tableNotExist[0], 'action' => 'index'));
} else {
$this->redirect(array('controller' => $tableNotExist[0], 'action' => 'index'));
}
}
}
示例3: __setGetVars
/**
* Sets some get vars needed for TestManager
*
* @return void
* @access private
*/
function __setGetVars()
{
if (in_array($this->category, $this->plugins)) {
$_GET['plugin'] = $this->category;
} elseif (in_array(Inflector::Humanize($this->category), $this->plugins)) {
$_GET['plugin'] = Inflector::Humanize($this->category);
} elseif ($this->category == 'app') {
$_GET['app'] = true;
}
if ($this->type == 'group') {
$_GET['group'] = true;
}
}
示例4: go
function go($Plugin, $confirmed = false, $stuffList = array(), $excludeList = array())
{
$this->plugin = $Plugin;
$this->PluginName = Inflector::Camelize($Plugin);
// Plugin App controller handled seperately
array_push($excludeList, 'plugins' . DS . $this->plugin . DS . $this->plugin . '_app_controller.php');
// Include the components used to download the plugin, in the hope that other's might do the same :)
array_push($stuffList, APP . 'controllers' . DS . 'components' . DS . 'download_plugin.php');
array_push($stuffList, APP . 'controllers' . DS . 'components' . DS . 'zip.php');
uses("Folder");
if ($confirmed == false) {
$this->controller->viewPath = '_generic';
$this->controller->layout = 'flash';
$this->controller->set('pause', 5);
$this->controller->set('url', '/' . $this->PluginName . '/' . $this->controller->name . '/' . $this->controller->action . '/confirmed');
$this->controller->set('message', 'Your download will begin in 5 seconds.');
$this->controller->set('pluginUnderscore', $Plugin);
$this->controller->set('pluginCamel', $this->PluginName);
$this->controller->set('plugin', Inflector::Humanize($Plugin));
$date = $this->getLastUpdated($Plugin, $stuffList);
$this->controller->set('last_updated', $date);
$this->controller->render('download');
die;
}
$Folder = new Folder(APP . "plugins" . DS . $this->plugin . DS);
$FileList = $Folder->findRecursive();
$pattern = "@//--Private[^\\@]*//--Private End@U";
// include adapated app controller
$pluginApp = file_get_contents(APP . 'plugins' . DS . $this->plugin . DS . $this->plugin . '_app_controller.php');
$pluginApp = r("<?php", "<?php\r\ninclude('noswad_controller.php');", $pluginApp);
$pluginApp = r("extends AppController", "extends NoswadController", $pluginApp);
$pluginApp = preg_replace($pattern, '', $pluginApp);
$this->Zip->addData($pluginApp, 'plugins' . DS . $this->plugin . DS . $this->plugin . '_app_controller.php');
// include every file from the stuff list, but put it in the plugin unless it's from the webroot
foreach ($stuffList as $file) {
if (strstr($file, APP_DIR)) {
$relativePath = substr($file, strlen(APP));
$relativePath = 'plugins' . DS . $this->plugin . DS . $relativePath;
} else {
$relativePath = "webroot" . DS . substr($file, strlen(WWW_ROOT));
}
if (!in_array($relativePath, $excludeList) && file_exists($file)) {
$addedFiles[] = $relativePath;
$FileContents = file_get_contents($file);
$FileContents = preg_replace($pattern, '', $FileContents);
$this->Zip->addData($FileContents, $relativePath);
/*
$this->Zip->addFile(
$file,
$relativePath
);
*/
}
}
// include every file from the plugin
foreach ($FileList as $file) {
$relativePath = substr($file, strlen(APP));
if (!in_array($relativePath, $excludeList) && file_exists($file)) {
$addedFiles[] = $relativePath;
$FileContents = file_get_contents($file);
$FileContents = preg_replace($pattern, '', $FileContents);
$this->Zip->addData($FileContents, $relativePath);
/*
$this->Zip->addFile(
$file,
$relativePath
);
*/
}
}
// include every file from the generic include folder
if ($this->genericPath) {
$Folder = new Folder($this->genericPath);
$FileList = $Folder->findRecursive();
foreach ($FileList as $file) {
$relativePath = substr($file, strlen($this->genericPath));
if ($relativePath != 'read_me.txt') {
$relativePath = 'plugins' . DS . $this->plugin . DS . $relativePath;
}
if (!in_array($relativePath, $addedFiles)) {
// Allow for overriding of included content
$this->Zip->addFile($file, $relativePath);
}
}
}
$this->Zip->forceDownload($this->PluginName . '.zip');
}