本文整理汇总了PHP中utf8_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_strtolower函数的具体用法?PHP utf8_strtolower怎么用?PHP utf8_strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_strtolower函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: autoTag
/**
* Inserts tag links into an HTML-formatted text.
*
* @param string $html
* @param array $tags
* @param array $options
* @return string
*/
public static function autoTag($html, array $tags, array &$options = array())
{
if (empty($tags)) {
return $html;
}
$html = strval($html);
$htmlNullified = utf8_strtolower($html);
$htmlNullified = preg_replace_callback('#<a[^>]+>.+?</a>#', array(__CLASS__, '_autoTag_nullifyHtmlCallback'), $htmlNullified);
$htmlNullified = preg_replace_callback('#<[^>]+>#', array(__CLASS__, '_autoTag_nullifyHtmlCallback'), $htmlNullified);
// prepare the options
$onceOnly = empty($options['onceOnly']) ? false : true;
$options['autoTagged'] = array();
// reset this
// sort tags with the longest one first
// since 1.0.3
usort($tags, array(__CLASS__, '_autoTag_sortTagsByLength'));
foreach ($tags as $tag) {
$offset = 0;
$tagText = utf8_strtolower($tag['tag']);
$tagLength = utf8_strlen($tagText);
while (true) {
$pos = utf8_strpos($htmlNullified, $tagText, $offset);
if ($pos !== false) {
// the tag has been found
if (self::_autoTag_hasValidCharacterAround($html, $pos, $tagText)) {
// and it has good surrounding characters
// start replacing
$displayText = utf8_substr($html, $pos, $tagLength);
$template = new XenForo_Template_Public('tinhte_xentag_bb_code_tag_tag');
$template->setParam('tag', $tag);
$template->setParam('displayText', $displayText);
$replacement = $template->render();
if (strlen($replacement) === 0) {
// in case template system hasn't been initialized
$replacement = sprintf('<a href="%s">%s</a>', XenForo_Link::buildPublicLink('tags', $tag), $displayText);
}
$html = utf8_substr_replace($html, $replacement, $pos, $tagLength);
$htmlNullified = utf8_substr_replace($htmlNullified, str_repeat('_', utf8_strlen($replacement)), $pos, $tagLength);
// sondh@2012-09-20
// keep track of the auto tagged tags
$options['autoTagged'][$tagText][$pos] = $replacement;
$offset = $pos + utf8_strlen($replacement);
if ($onceOnly) {
// auto link only once per tag
// break the loop now
break;
// while (true)
}
} else {
$offset = $pos + $tagLength;
}
} else {
// no match has been found, stop working with this tag
break;
// while (true)
}
}
}
return $html;
}
开发者ID:maitandat1507,项目名称:Tinhte_XenTag,代码行数:68,代码来源:Integration.php
示例2: standardise
private static function standardise($langtag)
{
$glue = ',';
$result = is_array($langtag) ? implode($glue, $langtag) : $langtag;
$result = utf8_strtolower(str_replace('_', '-', $result));
return is_array($langtag) ? explode($glue, $result) : $result;
}
开发者ID:ailurus1991,项目名称:MRBS,代码行数:7,代码来源:Locale.php
示例3: buildFilterString
private function buildFilterString($data = array())
{
$filter = "o.customer_id = " . $this->customer->getId();
if (isset($data['selected_items']) && count($data['selected_items'])) {
$filter = "op.order_product_id in (" . implode($data['selected_items'], ',') . ")";
} else {
if (!empty($data['filter_supplier'])) {
$filter .= ($filter ? " AND" : "") . " LCASE(s.name) LIKE '" . $this->getDb()->escape(utf8_strtolower($data['filter_supplier'])) . "%'";
}
if (!empty($data['filter_supplier_group'])) {
$filter .= ($filter ? " AND" : "") . " s.supplier_group_id = " . (int) $data['filter_supplier_group'];
}
if (!empty($data['filterItem'])) {
$filter .= " AND (\r\n op.model LIKE '%" . $this->getDb()->escape($data['filterItem']) . "%'\r\n OR op.name LIKE '%" . $this->getDb()->escape($data['filterItem']) . "%')";
}
if (!empty($data['filterOrderId'])) {
$filter .= " AND op.order_id = " . (int) $data['filterOrderId'];
}
if (!empty($data['filterOrderItemId'])) {
$filter .= ($filter ? " AND" : "") . " op.order_product_id = " . (int) $data['filterOrderItemId'];
}
if (!empty($data['filterProductId'])) {
$filter .= ($filter ? " AND" : "") . " op.product_id = " . (int) $data['filterProductId'];
}
if (!empty($data['filterStatusId'])) {
$filter .= ($filter ? " AND" : "") . " op.status_id IN (" . implode(', ', $data['filterStatusId']) . ")";
}
}
return $filter;
}
开发者ID:ralfeus,项目名称:moomi-daeri.com,代码行数:30,代码来源:order_item.php
示例4: generateHtmlRecurrence
public function generateHtmlRecurrence($days, $amount, $currency, $comment, array $data, XenForo_View $view)
{
$data[] = utf8_strtolower($currency);
$data[] = $amount;
$processorModel = $this->_getProcessorModel();
$itemId = $processorModel->generateItemId('bdshop', XenForo_Visitor::getInstance(), $data);
$processorNames = $processorModel->getProcessorNames();
$processors = array();
foreach ($processorNames as $processorId => $processorClass) {
$processors[$processorId] = bdPaygate_Processor_Abstract::create($processorClass);
}
$recurringInterval = false;
$recurringUnit = false;
if ($days > 0) {
if ($days % 360 == 0) {
$recurringInterval = $days / 365;
$recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_YEAR;
} elseif ($days % 30 == 0) {
$recurringInterval = $days / 30;
$recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_MONTH;
} else {
$recurringInterval = $days;
$recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_DAY;
}
}
return implode('', bdPaygate_Processor_Abstract::prepareForms($processors, $amount, $currency, $comment, $itemId, $recurringInterval, $recurringUnit, array(bdPaygate_Processor_Abstract::EXTRA_RETURN_URL => XenForo_Link::buildPublicLink('full:shop/thanks'))));
}
开发者ID:E2Dev,项目名称:bdPaygates,代码行数:27,代码来源:StockPricing.php
示例5: insert_field
public function insert_field($data = array())
{
$name = preg_replace("/[^a-zA-Z0-9_]/", "", utf8_strtolower(isset($data['lang']) ? $data['lang'] : $this->in->get('language')));
if (!$name || !strlen($name)) {
$data['name'] = (isset($data['fieldtype']) ? $data['fieldtype'] : $this->in->get('type')) . '_' . rand();
}
//End if a field with this name exists
$fields = $this->pdh->get('profile_fields', 'fields');
if ($fields[$name]) {
return false;
}
$options = array();
if ($this->in->get('type') == 'dropdown') {
$in_options_id = $this->in->getArray('option_id', 'string');
$in_options_lang = $this->in->getArray('option_lang', 'string');
foreach ($in_options_id as $key => $value) {
if ($value != "" && $in_options_lang[$key] != "") {
$options[$value] = $in_options_lang[$key];
}
}
}
$data = array('name' => isset($data['name']) ? $data['name'] : $name, 'fieldtype' => isset($data['fieldtype']) ? $data['fieldtype'] : $this->in->get('type'), 'category' => isset($data['category']) ? $data['category'] : $this->in->get('category'), 'language' => isset($data['lang']) ? $data['lang'] : $this->in->get('language'), 'size' => isset($data['size']) ? intval($data['size']) : $this->in->get('size', 3), 'options' => isset($data['option']) ? serialize($data['option']) : serialize($options), 'visible' => '1', 'image' => isset($data['image']) ? $data['image'] : $this->in->get('image'), 'undeletable' => $data['undeletable'] ? '1' : '0', 'enabled' => 1, 'custom' => $data['no_custom'] ? '0' : '1');
$sql = $this->db->query("INSERT INTO __member_profilefields :params", $data);
if (!$sql) {
return false;
}
$this->pdh->enqueue_hook('game_update');
return true;
}
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:29,代码来源:pdh_w_profile_fields.class.php
示例6: check_password
public function check_password($password, $hash, $strSalt = '', $boolUseHash = false, $strUsername = '')
{
if (sha1(utf8_strtolower($strUsername) . $password) == $hash) {
return true;
}
return false;
}
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:7,代码来源:smf2.bridge.class.php
示例7: getAttributesByAttributeGroupId
public function getAttributesByAttributeGroupId($data = array())
{
$sql = "SELECT *, (SELECT agd.name FROM " . DB_PREFIX . "attribute_group_description agd WHERE agd.attribute_group_id = a.attribute_group_id AND agd.language_id = '" . (int) $this->config->get('config_language_id') . "') AS attribute_group FROM " . DB_PREFIX . "attribute a LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE ad.language_id = '" . (int) $this->config->get('config_language_id') . "'";
if (!empty($data['filter_name'])) {
$sql .= " AND LCASE(ad.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
if (!empty($data['filter_attribute_group_id'])) {
$sql .= " AND a.attribute_group_id = '" . $this->db->escape($data['filter_attribute_group_id']) . "'";
}
$sort_data = array('ad.name', 'attribute_group', 'a.sort_order');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY ad.name";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:rebdog,项目名称:opencart,代码行数:32,代码来源:attribute.php
示例8: getDownloads
public function getDownloads($data = array())
{
$sql = "SELECT * FROM " . DB_PREFIX . "download d LEFT JOIN " . DB_PREFIX . "download_description dd ON (d.download_id = dd.download_id) WHERE dd.language_id = '" . (int) $this->config->get('config_language_id') . "'";
if (!empty($data['filter_name'])) {
$sql .= " AND LCASE(dd.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
$sort_data = array('dd.name', 'd.remaining');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY dd.name";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:rempong,项目名称:opencart,代码行数:29,代码来源:download.php
示例9: login
public function login($email, $password, $customer_id = false)
{
//+mod by yp
//+mod by yp start
if (!$email && !$password && !$customer_id) {
return false;
}
if ($customer_id !== false && preg_match("/^\\d+\$/", $customer_id)) {
$affiliate_query = $this->db->query("SELECT " . DB_PREFIX . "affiliate.* FROM " . DB_PREFIX . "affiliate, " . DB_PREFIX . "accc_customer_affiliate WHERE " . DB_PREFIX . "accc_customer_affiliate.affiliate_id=" . DB_PREFIX . "affiliate.affiliate_id AND " . DB_PREFIX . "accc_customer_affiliate.customer_id = '" . (int) $customer_id . "' AND " . DB_PREFIX . "affiliate.status = '1' AND " . DB_PREFIX . "affiliate.approved = '1' LIMIT 1");
} else {
//+mod by yp end
$affiliate_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "affiliate WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1' AND approved = '1'");
}
//+mod by yp
if ($affiliate_query->num_rows) {
$this->_set_own_tracking();
}
//+mod by yp
if ($affiliate_query->num_rows) {
$this->session->data['affiliate_id'] = $affiliate_query->row['affiliate_id'];
$this->affiliate_id = $affiliate_query->row['affiliate_id'];
$this->firstname = $affiliate_query->row['firstname'];
$this->lastname = $affiliate_query->row['lastname'];
$this->email = $affiliate_query->row['email'];
$this->telephone = $affiliate_query->row['telephone'];
$this->fax = $affiliate_query->row['fax'];
$this->code = $affiliate_query->row['code'];
return true;
} else {
return false;
}
}
开发者ID:pedrocones,项目名称:store,代码行数:32,代码来源:affiliate.php
示例10: login
public function login($email, $password, $override = false)
{
if ($override) {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1'");
} else {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1' AND approved = '1'");
}
if ($customer_query->num_rows) {
$this->session->data['customer_id'] = $customer_query->row['customer_id'];
$this->customer_id = $customer_query->row['customer_id'];
$this->firstname = $customer_query->row['firstname'];
$this->lastname = $customer_query->row['lastname'];
$this->customer_group_id = $customer_query->row['customer_group_id'];
$this->email = $customer_query->row['email'];
$this->telephone = $customer_query->row['telephone'];
$this->fax = $customer_query->row['fax'];
$this->newsletter = $customer_query->row['newsletter'];
$this->address_id = $customer_query->row['address_id'];
$this->folder_name = $customer_query->row['folder_name'];
$this->custom_field = $customer_query->row['custom_field'];
$this->db->query("UPDATE " . DB_PREFIX . "customer SET ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE customer_id = '" . (int) $this->customer_id . "'");
return true;
} else {
return false;
}
}
开发者ID:hutdast,项目名称:rip,代码行数:26,代码来源:customer.php
示例11: handle
function handle($match, $state, $pos, &$handler)
{
$data = array('task' => array(), 'state' => $state);
switch ($state) {
case DOKU_LEXER_ENTER:
$match = trim(substr($match, 3, -1));
if (preg_match('/\\b(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\b/', $match, $grep)) {
$data['task']['date'] = $grep[1];
$match = trim(str_replace($data['task']['date'], '', $match));
}
if ($match !== '') {
//FIXME call $auth->cleanUser()
$data['task']['user'] = $match;
}
$ReWriter = new Doku_Handler_Nest($handler->CallWriter, 'plugin_do_do');
$handler->CallWriter =& $ReWriter;
$handler->addPluginCall('do_do', $data, $state, $pos, $match);
break;
case DOKU_LEXER_UNMATCHED:
$handler->_addCall('cdata', array($match), $pos);
break;
case DOKU_LEXER_EXIT:
global $ID;
$data['task']['text'] = trim(strip_tags(p_render('xhtml', array_slice($handler->CallWriter->calls, 1), $ignoreme)));
$data['task']['md5'] = md5(utf8_strtolower(preg_replace('/\\s/', '', $data['task']['text'])) . $ID);
// Add missing data from ENTER and EXIT to the other
$handler->CallWriter->calls[0][1][1]['task'] += $data['task'];
$data['task'] += $handler->CallWriter->calls[0][1][1]['task'];
$handler->addPluginCall('do_do', $data, $state, $pos, $match);
$handler->CallWriter->process();
$ReWriter =& $handler->CallWriter;
$handler->CallWriter =& $ReWriter->CallWriter;
}
return false;
}
开发者ID:rauschen,项目名称:do,代码行数:35,代码来源:do.php
示例12: getImage
public function getImage()
{
//filemanger library for file type error
include 'include/mime_type_lib.php';
$this->data = $this->load->language('filemanager/filemanager');
$this->load->model('tool/image');
$json = array();
if ($this->request->server['HTTPS']) {
$server = HTTPS_CATALOG;
} else {
$server = HTTP_CATALOG;
}
$filename = basename(html_entity_decode($this->request->get['image_url'], ENT_QUOTES, 'UTF-8'));
// Validate the filename length
if (utf8_strlen($filename) < 3 || utf8_strlen($filename) > 255) {
$json['error'] = $this->data['error_filename'];
}
// Allowed file extension types
$allowed = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg');
if (!in_array(utf8_strtolower(utf8_substr(strrchr($filename, '.'), 1)), $allowed)) {
$json['error'] = $this->data['error_file_type'];
}
$filetype = get_file_mime_type($filename);
// Allowed file mime types
$allowed = array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif');
if (!in_array($filetype, $allowed)) {
$json['error'] = $this->data['error_file_type'];
}
if (!$json && $this->request->get['image_url']) {
$json = array('thumb' => $this->model_tool_image->resize(utf8_substr($this->request->get['image_url'], utf8_strlen($server . 'image/')), 100, 100), 'path' => utf8_substr($this->request->get['image_url'], utf8_strlen($server . 'image/')), 'href' => $this->request->get['image_url']);
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
开发者ID:ecmscart,项目名称:ecmscart-v1.3,代码行数:34,代码来源:filemanager.php
示例13: handle
function handle()
{
if (!is_array($_REQUEST['d']) || !checkSecurityToken()) {
return;
}
$sqlite = $this->dthlp->_getDB();
if (!$sqlite) {
return false;
}
$sqlite->query("BEGIN TRANSACTION");
if (!$sqlite->query("DELETE FROM aliases")) {
$sqlite->query('ROLLBACK TRANSACTION');
return;
}
foreach ($_REQUEST['d'] as $row) {
$row = array_map('trim', $row);
$row['name'] = utf8_strtolower($row['name']);
$row['name'] = rtrim($row['name'], 's');
if (!$row['name']) {
continue;
}
// Clean enum
$arr = preg_split('/\\s*,\\s*/', $row['enum']);
$arr = array_unique($arr);
asort($arr);
$row['enum'] = implode(', ', $arr);
if (!$sqlite->query("INSERT INTO aliases (name, type, prefix, postfix, enum)\n VALUES (?,?,?,?,?)", $row)) {
$sqlite->query('ROLLBACK TRANSACTION');
return;
}
}
$sqlite->query("COMMIT TRANSACTION");
}
开发者ID:stretchyboy,项目名称:dokuwiki-plugin-data,代码行数:33,代码来源:aliases.php
示例14: getTabs
public function getTabs($data = array())
{
$sql = "SELECT * FROM " . DB_PREFIX . "tab t LEFT JOIN " . DB_PREFIX . "tab_description td ON (t.tab_id = td.tab_id) WHERE td.language_id = '" . (int) $this->config->get('config_language_id') . "'";
if (!empty($data['filter_name']) and trim($data['filter_name'], ' ') != '') {
$sql .= " AND LCASE(td.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
$sort_data = array('td.name', 't.sort_order');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY td.name";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:29,代码来源:tab.php
示例15: getOptions
public function getOptions($data = array())
{
$sql = "SELECT * FROM `" . DB_PREFIX . "option` o LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE od.language_id = '" . (int) $this->config->get('config_language_id') . "'";
if (isset($data['filter_name']) && !is_null($data['filter_name'])) {
$sql .= " AND LCASE(od.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
$sort_data = array('od.name', 'o.type', 'o.sort_order');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY od.name";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:rebdog,项目名称:opencart,代码行数:29,代码来源:option.php
示例16: getManufacturers
public function getManufacturers($data = array())
{
$sql = "SELECT * FROM " . DB_PREFIX . "manufacturer";
if (!empty($data['filter_name'])) {
$sql .= " WHERE LCASE(name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
$sort_data = array('name', 'sort_order');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY name";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:rempong,项目名称:opencart,代码行数:29,代码来源:manufacturer.php
示例17: _getTagMatchUsers
protected function _getTagMatchUsers(array $matches)
{
$usersByMatch = parent::_getTagMatchUsers($matches);
if (bdTagMe_Option::get('groupTag')) {
$engine = bdTagMe_Engine::getInstance();
$taggableUserGroups = $engine->getTaggableUserGroups();
$matchesToLower = array();
foreach ($matches as $key => $match) {
$matchesToLower[$key] = utf8_strtolower($match[1][0]);
}
$userGroupTitlesToLower = array();
foreach ($taggableUserGroups as $taggableUserGroup) {
$userGroupTitlesToLower[$taggableUserGroup['user_group_id']] = utf8_strtolower($taggableUserGroup['title']);
}
$changedMatchKeys = array();
foreach ($userGroupTitlesToLower as $userGroupId => $userGroupTitleToLower) {
foreach ($matchesToLower as $matchKey => $matchToLower) {
if (strpos($userGroupTitleToLower, $matchToLower) === 0) {
$userGroupInfo = array('user_id' => 'ug_' . $userGroupId, 'username' => $taggableUserGroups[$userGroupId]['title'], 'lower' => $userGroupTitleToLower, 'user_group_id' => $userGroupId);
$usersByMatch[$matchKey][$userGroupInfo['user_id']] = $userGroupInfo;
$changedMatchKeys[$matchKey] = true;
}
}
}
foreach (array_keys($changedMatchKeys) as $matchKey) {
uasort($usersByMatch[$matchKey], array(__CLASS__, 'sortByLowerLength'));
}
}
return $usersByMatch;
}
开发者ID:maitandat1507,项目名称:bdTagMe,代码行数:30,代码来源:UserTagging.php
示例18: getNews
public function getNews($data = array())
{
$sql = "SELECT * FROM " . DB_PREFIX . "news n LEFT JOIN " . DB_PREFIX . "news_description nd ON (n.news_id = nd.news_id) LEFT JOIN " . DB_PREFIX . "news_to_store n2s ON (n.news_id = n2s.news_id) WHERE nd.language_id = '" . (int) $this->config->get('config_language_id') . "' AND n2s.store_id = '" . (int) $this->config->get('config_store_id') . "' AND n.status = '1'";
if (!empty($data['filter_name'])) {
$sql .= " AND LCASE(nd.title) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "%'";
}
$sort_data = array('nd.title', 'nd.description', 'n.date_added', 'n.viewed', 'n.status');
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY n.date_added";
}
if (isset($data['order']) && $data['order'] == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}
if ($data['limit'] < 1) {
$data['limit'] = 20;
}
$sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
}
$query = $this->db->query($sql);
return $query->rows;
}
开发者ID:vandao,项目名称:vlpower,代码行数:29,代码来源:news.php
示例19: actionBdtagmeFind
public function actionBdtagmeFind()
{
if (bdTagMe_Option::get('reorder')) {
/** @var bdTagMe_XenForo_Model_User $userModel */
$userModel = $this->_getUserModel();
$userModel->bdTagMe_setOrderByMemberActivity(true);
}
$response = parent::actionFind();
if ($response instanceof XenForo_ControllerResponse_View) {
$users =& $response->params['users'];
$q = utf8_strtolower($this->_input->filterSingle('q', XenForo_Input::STRING));
if (!empty($q) and bdTagMe_Option::get('groupTag')) {
$userGroups = bdTagMe_Engine::getInstance()->getTaggableUserGroups();
$userGroupTitlesToLower = array();
foreach ($userGroups as $userGroup) {
$userGroupTitlesToLower[$userGroup['user_group_id']] = utf8_strtolower($userGroup['title']);
}
foreach ($userGroupTitlesToLower as $userGroupId => $userGroupTitleToLower) {
if (strpos($userGroupTitleToLower, $q) === 0) {
// run extra check to eliminate users with matching username with this user group
foreach (array_keys($users) as $userId) {
if (utf8_strtolower($users[$userId]['username']) == $userGroupTitleToLower) {
unset($users[$userId]);
}
}
array_unshift($users, array('user_id' => -1, 'username' => $userGroups[$userGroupId]['title'], 'gravatar' => bdTagMe_Option::get('userGroupGravatar')));
}
}
}
}
return $response;
}
开发者ID:maitandat1507,项目名称:bdTagMe,代码行数:32,代码来源:Member.php
示例20: login
public function login($email, $password, $override = false)
{
if ($override) {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1'");
} else {
$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1' AND approved = '1'");
}
if ($customer_query->num_rows) {
// Create customer login cookie if HTTPS
if ($this->config->get('config_secure')) {
if ($this->request->isSecure()) {
// Create a cookie and restrict it to HTTPS pages
$this->session->data['customer_cookie'] = hash_rand('md5');
setcookie('customer', $this->session->data['customer_cookie'], 0, '/', '', true, true);
} else {
return false;
}
}
// Regenerate session id
$this->session->regenerateId();
// Token used to protect account functions against CSRF
$this->setToken();
$this->session->data['customer_id'] = $customer_query->row['customer_id'];
$this->session->data['customer_login_time'] = time();
if ($customer_query->row['cart'] && is_string($customer_query->row['cart'])) {
$cart = unserialize($customer_query->row['cart']);
foreach ($cart as $key => $value) {
if (!array_key_exists($key, $this->session->data['cart'])) {
$this->session->data['cart'][$key] = $value;
} else {
$this->session->data['cart'][$key] += $value;
}
}
}
if ($customer_query->row['wishlist'] && is_string($customer_query->row['wishlist'])) {
if (!isset($this->session->data['wishlist'])) {
$this->session->data['wishlist'] = array();
}
$wishlist = unserialize($customer_query->row['wishlist']);
foreach ($wishlist as $product_id) {
if (!in_array($product_id, $this->session->data['wishlist'])) {
$this->session->data['wishlist'][] = $product_id;
}
}
}
$this->customer_id = $customer_query->row['customer_id'];
$this->firstname = $customer_query->row['firstname'];
$this->lastname = $customer_query->row['lastname'];
$this->email = $customer_query->row['email'];
$this->telephone = $customer_query->row['telephone'];
$this->fax = $customer_query->row['fax'];
$this->newsletter = $customer_query->row['newsletter'];
$this->customer_group_id = $customer_query->row['customer_group_id'];
$this->address_id = $customer_query->row['address_id'];
$this->db->query("UPDATE " . DB_PREFIX . "customer SET ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE customer_id = '" . (int) $this->customer_id . "'");
return true;
} else {
return false;
}
}
开发者ID:xanderwp,项目名称:opencart-ce,代码行数:60,代码来源:customer.php
注:本文中的utf8_strtolower函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论