本文整理汇总了PHP中strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP strtolower函数的具体用法?PHP strtolower怎么用?PHP strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strtolower函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateRoute
/**
* Add all the routes in the router in parameter
* @param $router Router
*/
public function generateRoute(Router $router)
{
foreach ($this->classes as $class) {
$classMethods = get_class_methods($this->namespace . $class . 'Controller');
$rc = new \ReflectionClass($this->namespace . $class . 'Controller');
$parent = $rc->getParentClass();
$parent = get_class_methods($parent->name);
$className = $this->namespace . $class . 'Controller';
foreach ($classMethods as $methodName) {
if (in_array($methodName, $parent) || $methodName == 'index') {
continue;
} else {
foreach (Router::getSupportedHttpMethods() as $httpMethod) {
if (strstr($methodName, $httpMethod)) {
continue 2;
}
if (in_array($methodName . $httpMethod, $classMethods)) {
$router->add('/' . strtolower($class) . '/' . $methodName, new $className(), $methodName . $httpMethod, $httpMethod);
unset($classMethods[$methodName . $httpMethod]);
}
}
$router->add('/' . strtolower($class) . '/' . $methodName, new $className(), $methodName);
}
}
$router->add('/' . strtolower($class), new $className(), 'index');
}
}
示例2: openseadragon
/**
* Return a OpenSeadragon image viewer for the provided files.
*
* @param File|array $files A File record or an array of File records.
* @param int $width The width of the image viewer in pixels.
* @param int $height The height of the image viewer in pixels.
* @return string|null
*/
public function openseadragon($files)
{
if (!is_array($files)) {
$files = array($files);
}
// Filter out invalid images.
$images = array();
$imageNames = array();
foreach ($files as $file) {
// A valid image must be a File record.
if (!$file instanceof File) {
continue;
}
// A valid image must have a supported extension.
$extension = pathinfo($file->original_filename, PATHINFO_EXTENSION);
if (!in_array(strtolower($extension), $this->_supportedExtensions)) {
continue;
}
$images[] = $file;
$imageNames[explode(".", $file->filename)[0]] = openseadragon_dimensions($file, 'original');
}
// Return if there are no valid images.
if (!$images) {
return;
}
return $this->view->partial('common/openseadragon.php', array('images' => $images, 'imageNames' => $imageNames));
}
示例3: addnew
function addnew()
{
if ($_POST) {
$image = $_FILES['logo'];
$image_name = $image['name'];
$image_tmp = $image['tmp_name'];
$image_size = $image['size'];
$error = $image['error'];
$file_ext = explode('.', $image_name);
$file_ext = strtolower(end($file_ext));
$allowed_ext = array('jpg', 'jpeg', 'bmp', 'png', 'gif');
$file_on_server = '';
if (in_array($file_ext, $allowed_ext)) {
if ($error === 0) {
if ($image_size < 3145728) {
$file_on_server = uniqid() . '.' . $file_ext;
$destination = './brand_img/' . $file_on_server;
move_uploaded_file($image_tmp, $destination);
}
}
}
$values = array('name' => $this->input->post('name'), 'description' => $this->input->post('desc'), 'logo' => $file_on_server, 'is_active' => 1);
if ($this->brand->create($values)) {
$this->session->set_flashdata('message', 'New Brand added successfully');
} else {
$this->session->set_flashdata('errormessage', 'Oops! Something went wrong!!');
}
redirect(base_url() . 'brands/');
}
$this->load->helper('form');
$this->load->view('includes/header', array('title' => 'Add Brand'));
$this->load->view('brand/new_brand');
$this->load->view('includes/footer');
}
示例4: getLinkDefsInFieldMeta
/**
* Get link definition defined in 'fields' metadata. In linkDefs can be used as value (e.g. "type": "hasChildren") and/or variables (e.g. "entityName":"{entity}"). Variables should be defined into fieldDefs (in 'entityDefs' metadata).
*
* @param string $entityName
* @param array $fieldDef
* @param array $linkFieldDefsByType
* @return array | null
*/
public function getLinkDefsInFieldMeta($entityName, $fieldDef, array $linkFieldDefsByType = null)
{
if (!isset($fieldDefsByType)) {
$fieldDefsByType = $this->getFieldDefsByType($fieldDef);
if (!isset($fieldDefsByType['linkDefs'])) {
return null;
}
$linkFieldDefsByType = $fieldDefsByType['linkDefs'];
}
foreach ($linkFieldDefsByType as $paramName => &$paramValue) {
if (preg_match('/{(.*?)}/', $paramValue, $matches)) {
if (in_array($matches[1], array_keys($fieldDef))) {
$value = $fieldDef[$matches[1]];
} else {
if (strtolower($matches[1]) == 'entity') {
$value = $entityName;
}
}
if (isset($value)) {
$paramValue = str_replace('{' . $matches[1] . '}', $value, $paramValue);
}
}
}
return $linkFieldDefsByType;
}
示例5: calculateGFRResult
function calculateGFRResult()
{
$tmpArr = array();
$tmpArr[] = date('Y-m-d H:i:s');
//observation time
$tmpArr[] = 'GFR (CALC)';
//desc
$gender = NSDR::populate($this->_patientId . "::com.clearhealth.person.displayGender");
$crea = NSDR::populate($this->_patientId . "::com.clearhealth.labResults[populate(@description=CREA)]");
$genderFactor = null;
$creaValue = null;
$personAge = null;
$raceFactor = 1;
switch ($gender[key($gender)]) {
case 'M':
$genderFactor = 1;
break;
case 'F':
$genderFactor = 0.742;
break;
}
if ((int) strtotime($crea['observation_time']) >= strtotime('now - 60 days') && strtolower($crea[key($crea)]['units']) == 'mg/dl') {
$creaValue = $crea[key($crea)]['value'];
}
$person = new Person();
$person->personId = $this->_patientId;
$person->populate();
if ($person->age > 0) {
$personAge = $person->age;
}
$personStat = new PatientStatistics();
$personStat->personId = $this->_patientId;
$personStat->populate();
if ($personStat->race == "AFAM") {
$raceFactor = 1.21;
}
$gfrValue = "INC";
if ($personAge > 0 && $creaValue > 0) {
$gfrValue = "" . (int) round(pow($creaValue, -1.154) * pow($personAge, -0.203) * $genderFactor * $raceFactor * 186);
}
trigger_error("gfr:: " . $gfrValue, E_USER_NOTICE);
$tmpArr[] = $gfrValue;
// lab value
$tmpArr[] = 'mL/min/1.73 m2';
//units
$tmpArr[] = '';
//ref range
$tmpArr[] = '';
//abnormal
$tmpArr[] = 'F';
//status
$tmpArr[] = date('Y-m-d H:i:s') . '::' . '0';
// observationTime::(boolean)normal; 0 = abnormal, 1 = normal
$tmpArr[] = '0';
//sign
//$this->_calcLabResults[uniqid()] = $tmpArr;
$this->_calcLabResults[1] = $tmpArr;
// temporarily set index to one(1) to be able to include in selected lab results
return $tmpArr;
}
示例6: autoMagic
/**
* @param EveApiReadWriteInterface $data
* @param EveApiRetrieverInterface $retrievers
* @param EveApiPreserverInterface $preservers
* @param int $interval
*
* @throws LogicException
*/
public function autoMagic(EveApiReadWriteInterface $data, EveApiRetrieverInterface $retrievers, EveApiPreserverInterface $preservers, $interval)
{
$this->getLogger()->debug(sprintf('Starting autoMagic for %1$s/%2$s', $this->getSectionName(), $this->getApiName()));
/**
* Update Industry Jobs History
*/
$class = new IndustryJobsHistory($this->getPdo(), $this->getLogger(), $this->getCsq());
$class->autoMagic($data, $retrievers, $preservers, $interval);
$active = $this->getActiveCharacters();
if (0 === count($active)) {
$this->getLogger()->info('No active characters found');
return;
}
foreach ($active as $char) {
$data->setEveApiSectionName(strtolower($this->getSectionName()))->setEveApiName($this->getApiName());
if ($this->cacheNotExpired($this->getApiName(), $this->getSectionName(), $char['characterID'])) {
continue;
}
$data->setEveApiArguments($char)->setEveApiXml();
if (!$this->oneShot($data, $retrievers, $preservers, $interval)) {
continue;
}
$this->updateCachedUntil($data->getEveApiXml(), $interval, $char['characterID']);
}
}
示例7: prompt_bool_input
public static function prompt_bool_input($question, $default = true, $question_id = 'UNKNOWN')
{
// Prompt user for yes/no question
/*if BATCH MODE
{
switch($question_id)
{
default:
$auto_answer = 'true';
break;
}
$answer = pts_strings::string_bool($auto_answer);
}*/
$question .= ' (' . ($default == true ? 'Y/n' : 'y/N') . '): ';
do {
pts_client::$display->generic_prompt($question);
$input = strtolower(pts_user_io::read_user_input());
} while ($input != 'y' && $input != 'n' && $input != '');
switch ($input) {
case 'y':
$answer = true;
break;
case 'n':
$answer = false;
break;
default:
$answer = $default;
break;
}
return $answer;
}
示例8: makeApiCall
/**
* Execute API Call
*
* @param string $apiCall API Call
* @param string $method Http Method
* @param array $parameters API call parameters
*
* @return array
*/
public static function makeApiCall($apiCall, $method = 'GET', $parameters = array())
{
self::getHttp();
$apiEndpoint = NenoSettings::get('api_server_url');
$licenseCode = NenoSettings::get('license_code');
$response = null;
$responseStatus = false;
if (!empty($apiEndpoint) && !empty($licenseCode)) {
$method = strtolower($method);
if (method_exists(self::$httpClient, $method)) {
if ($method === 'get') {
if (!empty($parameters)) {
$query = implode('/', $parameters);
$apiCall = $apiCall . '/' . $query;
}
$apiResponse = self::$httpClient->{$method}($apiEndpoint . $apiCall, array('Authorization' => $licenseCode));
} else {
$apiResponse = self::$httpClient->{$method}($apiEndpoint . $apiCall, json_encode($parameters), array('Content-Type' => 'application/json', 'Authorization' => $licenseCode));
}
/* @var $apiResponse JHttpResponse */
$data = $apiResponse->body;
if ($apiResponse->headers['Content-Type'] === 'application/json') {
$data = json_decode($data, true);
}
$response = $data;
if ($apiResponse->code == 200) {
$responseStatus = true;
}
}
}
return array($responseStatus, $response);
}
示例9: db
function db($dbhost, $dbuser, $dbpw, $dbname = '', $dbcharset = 'utf8', $pconnect = 0)
{
if ($pconnect) {
if (!($this->mlink = @mysql_pconnect($dbhost, $dbuser, $dbpw))) {
$this->halt('Can not connect to MySQL');
}
} else {
if (!($this->mlink = @mysql_connect($dbhost, $dbuser, $dbpw))) {
$this->halt('Can not connect to MySQL');
}
}
if ($this->version() > '4.1') {
if ('utf-8' == strtolower($dbcharset)) {
$dbcharset = 'utf8';
}
if ($dbcharset) {
mysql_query("SET character_set_connection={$dbcharset}, character_set_results={$dbcharset}, character_set_client=binary", $this->mlink);
}
if ($this->version() > '5.0.1') {
mysql_query("SET sql_mode=''", $this->mlink);
}
}
if ($dbname) {
mysql_select_db($dbname, $this->mlink);
}
}
示例10: __construct
function __construct()
{
parent::__construct();
$this->module=strtolower(get_class());
$this->load->model('Mtintuc');
$this->load->library('pagination');
}
示例11: loadController
function loadController($class)
{
if (file_exists(CONTROLLERS_DIR . DS . strtolower($class) . '.php')) {
require_once CONTROLLERS_DIR . DS . strtolower($class) . '.php';
}
return;
}
示例12: lostpasswordAction
public function lostpasswordAction()
{
$username = $this->_getParam("username");
if ($username) {
$user = User::getByName($username);
if (!$user instanceof User) {
$this->view->error = "user unknown";
} else {
if ($user->isActive()) {
if ($user->getEmail()) {
$token = Pimcore_Tool_Authentication::generateToken($username, $user->getPassword(), MCRYPT_TRIPLEDES, MCRYPT_MODE_ECB);
$protocol = "http://";
if (strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "https") === 0) {
$protocol = "https://";
}
$uri = $protocol . $_SERVER['SERVER_NAME'];
$loginUrl = $uri . "/admin/login/login/?username=" . $username . "&token=" . $token;
try {
$mail = Pimcore_Tool::getMail(array($user->getEmail()), "Pimcore lost password service");
$mail->setBodyText("Login to pimcore and change your password using the following link. This temporary login link will expire in 30 minutes: \r\n\r\n" . $loginUrl);
$mail->send();
$this->view->success = true;
} catch (Exception $e) {
$this->view->error = "could not send email";
}
} else {
$this->view->error = "user has no email address";
}
} else {
$this->view->error = "user inactive";
}
}
}
}
示例13: processTagName
private function processTagName($name)
{
$name = strtolower($name);
$name = $name == 'col' ? 'td' : $name;
$name = $name == 'row' ? 'tr' : $name;
return $name;
}
示例14: authenticate
public function authenticate($user_)
{
if (!isset($this->login)) {
return false;
}
return strtolower($this->login) == strtolower($user_->getAttribute('login'));
}
示例15: __construct
function __construct()
{
// Extract the query from the tag chunk
if (($sql = ee()->TMPL->fetch_param('sql')) === FALSE) {
return FALSE;
}
// Rudimentary check to see if it's a SELECT query, most definitely not
// bulletproof
if (substr(strtolower(trim($sql)), 0, 6) != 'select') {
return FALSE;
}
$query = ee()->db->query($sql);
$results = $query->result_array();
if ($query->num_rows() == 0) {
return $this->return_data = ee()->TMPL->no_results();
}
// Start up pagination
ee()->load->library('pagination');
$pagination = ee()->pagination->create();
ee()->TMPL->tagdata = $pagination->prepare(ee()->TMPL->tagdata);
$per_page = ee()->TMPL->fetch_param('limit', 0);
// Disable pagination if the limit parameter isn't set
if (empty($per_page)) {
$pagination->paginate = FALSE;
}
if ($pagination->paginate) {
$pagination->build($query->num_rows(), $per_page);
$results = array_slice($results, $pagination->offset, $pagination->per_page);
}
$this->return_data = ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array_values($results));
if ($pagination->paginate === TRUE) {
$this->return_data = $pagination->render($this->return_data);
}
}