本文整理汇总了PHP中low函数的典型用法代码示例。如果您正苦于以下问题:PHP low函数的具体用法?PHP low怎么用?PHP low使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了low函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mode
function mode($mode = 'full')
{
if (in_array($mode, array('full', 'lite'))) {
$this->Session->write("Acl.Mode", low($mode));
}
$this->redirect($this->referer('/' . $this->PluginName . '/acos'));
}
示例2: beforeFilter
function beforeFilter()
{
/*
if ( !isset($this->params['lang']) && !$this->Session->check('langSes') ) {
$this->params['lang'] = $defaultLang;
$this->Session->write('langSes',$defaultLang);
} elseif ( !isset($this->params['lang']) && $this->Session->check('langSes') ) {
$this->params['lang'] = $this->Session->read('langSes');
}
Configure::write('Config.language', $this->params['lang']);
$this->Session->write('langSes',$this->params['lang']);
*/
if (isset($this->Auth)) {
if ($this->viewPath == 'pages' && $this->params['action'] != 'admin_index') {
$this->Auth->allow('*');
} else {
$this->Auth->authorize = 'controller';
if (in_array(low($this->params['controller']), $this->publicControllers)) {
//$this->Auth->allow('*');
$this->Auth->deny('pages/admin_index');
}
}
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
}
}
示例3: merge
/**
* This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference
* to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge)
* but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
*
* Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters into arrays.
*
* @param array $arr1 Array to be merged
* @param array $arr2 Array to merge with
* @return array Merged array
* @access public
*/
function merge($arr1, $arr2 = null)
{
$args = func_get_args();
if (is_a($this, 'set')) {
$backtrace = debug_backtrace();
$previousCall = low($backtrace[1]['class'] . '::' . $backtrace[1]['function']);
if ($previousCall != 'set::merge') {
$r =& $this->value;
array_unshift($args, null);
}
}
if (!isset($r)) {
$r = (array) current($args);
}
while (($arg = next($args)) !== false) {
if (is_a($arg, 'set')) {
$arg = $arg->get();
}
foreach ((array) $arg as $key => $val) {
if (is_array($val) && isset($r[$key]) && is_array($r[$key])) {
$r[$key] = Set::merge($r[$key], $val);
} elseif (is_int($key)) {
$r[] = $val;
} else {
$r[$key] = $val;
}
}
}
return $r;
}
示例4: afterFind
function afterFind(&$Model, $results, $primary)
{
if ($this->__settings[$Model->name]['countchild_enabled'] === false) {
return $results;
}
foreach ($results as $key => $val) {
/* Loop results */
if (!is_array($val)) {
continue;
/* Should never happen */
}
foreach ($val as $k => $v) {
if ($k == $Model->name) {
/* This is the parent dataset to populate, so skip */
continue;
}
if (empty($v)) {
$results[$key][$Model->name][low($k) . $this->__settings[$Model->name]['count_field_suffix']] = 0;
} elseif (!isset($v[0])) {
/* HasOne relationship */
$results[$key][$Model->name][low($k) . $this->__settings[$Model->name]['count_field_suffix']] = 1;
} else {
/* HasMany relationship */
$results[$key][$Model->name][low($k) . $this->__settings[$Model->name]['count_field_suffix']] = count($v);
}
}
}
$this->__settings[$Model->name]['countchild_enabled'] = false;
return $results;
}
示例5: slug
/**
* Returns a string with all spaces converted to $replacement and non word characters removed.
*
* @param string $string
* @param string $replacement
* @return string
* @static
*/
static function slug($string, $replacement = '-')
{
$string = trim($string);
$map = array('/à|á|å|â|ä/' => 'a', '/è|é|ê|ẽ|ë/' => 'e', '/ì|í|î/' => 'i', '/ò|ó|ô|ø/' => 'o', '/ù|ú|ů|û/' => 'u', '/ç|č/' => 'c', '/ñ|ň/' => 'n', '/ľ/' => 'l', '/ý/' => 'y', '/ť/' => 't', '/ž/' => 'z', '/š/' => 's', '/æ/' => 'ae', '/ö/' => 'oe', '/ü/' => 'ue', '/Ä/' => 'Ae', '/Ü/' => 'Ue', '/Ö/' => 'Oe', '/ß/' => 'ss', '/[^\\w\\s]/' => ' ', '/\\s+/' => $replacement, String::insert('/^[:replacement]+|[:replacement]+$/', array('replacement' => preg_quote($replacement, '/'))) => '');
$string = preg_replace(array_keys($map), array_values($map), $string);
return low($string);
}
示例6: beforeFilter
function beforeFilter()
{
$defaultLang = Configure::read('Languages.default');
//debug(env('HTTP_ACCEPT_LANGUAGE'));
if (!isset($this->params['lang']) && !$this->Session->check('langSes')) {
$this->params['lang'] = $defaultLang;
$this->Session->write('langSes', $defaultLang);
} elseif (!isset($this->params['lang']) && $this->Session->check('langSes')) {
$this->params['lang'] = $this->Session->read('langSes');
//$this->Session->write('testSes', 'case2');
}
//debug(Configure::read('Config.language'));
//debug(Configure::version());
Configure::write('Config.language', $this->params['lang']);
$this->Session->write('langSes', $this->params['lang']);
if ($this->name != 'App' && !in_array($this->params['lang'], Configure::read('Languages.all'))) {
unset($this->params['lang']);
$this->Session->del('langSes');
$this->Session->setFlash(__('Whoops, not a valid language.', true));
$this->redirect('/', 301, true);
}
if (isset($this->Auth)) {
if ($this->viewPath == 'pages' && $this->params['action'] != 'admin_index') {
$this->Auth->allow('*');
} else {
$this->Auth->authorize = 'controller';
if (in_array(low($this->params['controller']), $this->publicControllers)) {
//$this->Auth->allow('*');
$this->Auth->deny('pages/admin_index');
}
}
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
}
}
示例7: validateTitle
function validateTitle($value)
{
if (!empty($value) && strpos(low($value['title']), 'title-') === 0) {
return true;
}
return false;
}
示例8: beforeFilter
function beforeFilter()
{
// Do not continue if there is an indication of a previous successful installation
if (file_exists(APP . 'do_not_remove')) {
$this->redirect(array('controller' => 'home', 'action' => 'index'));
}
$this->checkPreReqs();
if (!empty($this->data)) {
$this->Installer->data = $this->data;
}
// auto-calculate the total number of steps using some convention magic
$steps = count(array_filter(get_class_methods('InstallerController'), array($this, "__getSteps")));
$this->action = low($this->action);
switch ($this->action) {
case 'setup_db':
$this->pageTitle = "Database Setup";
$step = 1;
break;
case 'setup_auth':
$this->pageTitle = "Authentication";
$step = 2;
break;
case 'thanks':
$this->pageTitle = "Installation Complete!";
return;
case $this->redirect(array('action' => 'setup_db')):
}
// set the right set of form validation rules for the current step
$this->Installer->step($step);
$this->pageTitle .= " [{$step}/{$steps}]";
$this->set('submit', $step < $steps ? 'Next >>' : 'Finish');
$this->set('url', array('url' => array('controller' => 'installer', 'action' => $this->action)));
$this->set(compact('step', 'steps'));
}
示例9: season
function season($indoor)
{
// The configuration settings values have "0" for the year, to facilitate form input
$today = date('0-m-d');
$today_wrap = date('1-m-d');
// Build the list of applicable seasons
$seasons = Configure::read('options.season');
unset($seasons['None']);
if (empty($seasons)) {
return 'None';
}
foreach (array_keys($seasons) as $season) {
$season_indoor = Configure::read("season_is_indoor.{$season}");
if ($indoor != $season_indoor) {
unset($seasons[$season]);
}
}
// Create array of which season follows which
$seasons = array_values($seasons);
$seasons_shift = $seasons;
array_push($seasons_shift, array_shift($seasons_shift));
$next = array_combine($seasons, $seasons_shift);
// Look for the season that has started without the next one starting
foreach ($next as $a => $b) {
$start = Configure::read('organization.' . Inflector::slug(low($a)) . '_start');
$end = Configure::read('organization.' . Inflector::slug(low($b)) . '_start');
// Check for a season that wraps past the end of the year
if ($start > $end) {
$end[0] = '1';
}
if ($today >= $start && $today < $end || $today_wrap >= $start && $today_wrap < $end) {
return $a;
}
}
}
示例10: beforeFilter
function beforeFilter()
{
if (isset($this->Auth)) {
if (is_null($this->Auth->User())) {
$cookie = $this->Cookie->read('Auth.User');
if (!is_null($cookie)) {
//debug($cookie);
if ($this->Auth->login($cookie)) {
// Clear auth message, just in case we use it.
$this->Session->del('Message.auth');
$this->redirect('/users/index');
} else {
// Delete invalid Cookie
$this->Cookie->del('Auth.User');
}
}
}
if ($this->viewPath == 'pages') {
$this->Auth->allow('*');
} else {
$this->Auth->authorize = 'controller';
if (in_array(low($this->params['controller']), $this->publicControllers)) {
$this->Auth->allow('*');
}
}
}
}
示例11: initialize
/**
* Controllers initialize function.
*/
function initialize(&$controller, $settings = array())
{
$this->Controller =& $controller;
$settings = array_merge(array(), (array) $settings);
$this->modelName = $this->Controller->modelClass;
$this->prettyModelName = low(Inflector::humanize(Inflector::underscore(Inflector::pluralize($this->modelName))));
}
示例12: hiddenField
function hiddenField($name, $type, $value)
{
$output = '';
if ($name && $type) {
$output = $this->html->input($type, array('type' => 'hidden', 'id' => low($name), 'value' => $value)) . '<br/>';
}
return $this->output($output);
}
示例13: _getMainMenu
function _getMainMenu()
{
$conditions = array('Group.name' => low($this->auth['User']['TYPE']));
$this->loadModel('Group');
$this->Group->Behaviors->attach('Containable');
$this->Group->contain('Link.parent_id IS NULL');
$group = $this->Group->find('first', array('conditions' => $conditions));
return $group['Link'];
}
示例14: _checkAccess
function _checkAccess($aro, $aco)
{
$access = $this->Acl->check($aro, low($aco), $action = "*");
if ($access === false) {
return false;
} else {
return true;
}
}
示例15: main
function main()
{
$this->imagePath = WWW_ROOT . 'img' . DS . 'blog' . DS;
$fileListContent = '';
$posts = $this->Blogpost->find('all');
foreach ($posts as $post) {
//$this->Blogpost->id = $post['Blogpost']['id'];
unset($post['Blogpost']['slug']);
unset($post['Blogpost']['title']);
unset($post['Blogpost']['user_id']);
unset($post['Blogpost']['created']);
unset($post['Blogpost']['deleted']);
$subject = $post['Blogpost']['description'];
preg_match_all('@<img[^>]*src="([^"]*)"[^>]*>@Usi', $subject, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $img) {
$oldPath = $img;
$newPath = $this->imagePath . basename($img);
$wwwPath = '/img/blog/' . basename($img);
if (preg_match('/img/blog/', $img)) {
//that link already fixed
continue;
}
if (!preg_match('bpong.com', $img) && !preg_match('http://', $img)) {
//it's relative path. Let's deal with it separetely
if ($img[0] == '.') {
$img = $this->bpongPath . ltrim($img, '.');
} elseif ($img[0] == '/') {
$img = $this->bpongPath . $img;
} else {
$img = $this->bpongPath . '/' . $img;
}
}
if (!@copy($img, $newPath)) {
$errors = error_get_last();
$this->out("COPY ERROR: " . $errors['message']);
$this->out("FILE:" . $oldPath);
$key = $this->in('Change dp path anyway?', array('y', 'n', 'q'), 'y');
if (low($key) == 'y') {
$post['Blogpost']['description'] = str_replace($oldPath, $wwwPath, $post['Blogpost']['description']);
$fileListContent .= $oldPath . "\n\r";
} elseif (low($key) == 'q') {
exit;
}
} else {
$this->out($img . "\n\r COPY TO \n\r" . $newPath);
$post['Blogpost']['description'] = str_replace($oldPath, $wwwPath, $post['Blogpost']['description']);
}
}
$this->Blogpost->save($post);
}
//$this->out(pr($matches));
//$this->Blogpost->save($post);
}
$this->createFile(WWW_ROOT . 'files.txt', $fileListContent);
}