本文整理汇总了PHP中stripos函数的典型用法代码示例。如果您正苦于以下问题:PHP stripos函数的具体用法?PHP stripos怎么用?PHP stripos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IsStrongCondition
public function IsStrongCondition()
{
if (stripos($this->Conditions, " or ") !== false) {
return true;
}
return false;
}
示例2: getListQuery
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery()
{
$db = $this->getDbo();
/** @var $db JDatabaseMySQLi */
// Create a new query object.
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.id, a.record_date, a.votes, a.item_id, ' . 'b.title, ' . 'c.name'));
$query->from($db->quoteName('#__uideas_votes') . ' AS a');
$query->innerJoin($db->quoteName('#__uideas_items') . ' AS b ON a.item_id = b.id');
$query->leftJoin($db->quoteName('#__users') . ' AS c ON a.user_id = c.id');
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = ' . (int) substr($search, 3));
} else {
$escaped = $db->escape($search, true);
$quoted = $db->quote("%" . $escaped . "%", false);
$query->where('b.title LIKE ' . $quoted, "OR");
$query->where('c.name LIKE ' . $quoted);
}
}
// Add the list ordering clause.
$orderString = $this->getOrderString();
$query->order($db->escape($orderString));
return $query;
}
示例3: saveInternalEncoding
/**
* Alter the Environment Internal Encoding if it is not utf-8
*
* @return void
*/
protected function saveInternalEncoding()
{
$this->encoding = mb_internal_encoding();
if (stripos($this->encoding, 'utf-8') === false) {
mb_internal_encoding('UTF-8');
}
}
示例4: getReferencableEntities
/**
* Implements EntityReferenceHandler::getReferencableEntities().
*/
public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0)
{
$settings = $this->field['settings']['handler_settings'];
$include_space = $settings['include_space'];
$all_groups = oa_core_get_all_groups();
$groups = array_map(create_function('$group', 'return $group->title;'), $all_groups);
$group_options = array();
$count = 0;
foreach ($groups as $nid => $group_name) {
$count++;
if (!$match || stripos($group_name, $match) !== FALSE) {
$group_options[$nid] = $group_name;
}
if ($limit && $count == $limit) {
break;
}
}
if ($space_id = oa_core_get_space_context()) {
// Bring current group to front.
if (!empty($group_options[$space_id])) {
$group_options = array($space_id => t('!name (current)', array('!name' => $group_options[$space_id]))) + $group_options;
} elseif ($include_space) {
$group_options = array($space_id => t('- All space members -')) + $group_options;
}
}
return array(OA_GROUP_TYPE => $group_options);
}
示例5: getListQuery
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
/** @var $db JDatabaseDriver */
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select($this->getState('list.select', 'a.id, a.name, a.code, a.code4, a.latitude, a.longitude, a.timezone'));
$query->from($db->quoteName('#__crowdf_countries', 'a'));
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = ' . (int) substr($search, 3));
} else {
$escaped = $db->escape($search, true);
$quoted = $db->quote("%" . $escaped . "%", false);
$query->where('a.name LIKE ' . $quoted);
}
}
// Add the list ordering clause.
$orderString = $this->getOrderString();
$query->order($db->escape($orderString));
return $query;
}
示例6: getListQuery
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select("u.*");
$query->from("#__bt_user_fields AS u");
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('u.id = ' . (int) substr($search, 3));
} else {
$search = $db->Quote('%' . $db->escape($search, true) . '%');
$query->where('(u.name LIKE ' . $search . ' OR u.type LIKE ' . $search . ')');
}
}
$fieldtype = $this->getState('filter.fieldtype');
if (!empty($fieldtype)) {
$query->where(' u.type ="' . $fieldtype . '"');
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('u.published = ' . (int) $published);
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'u.ordering') {
$orderCol = 'u.ordering';
}
$query->order($db->escape($orderCol . ' ' . $orderDirn));
$query->order($db->escape($orderCol . ' ' . $orderDirn));
return $query;
}
示例7: __construct
/**
* Constructor.
*
* @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
*/
public function __construct($classLoader)
{
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
if ($this->wasFinder) {
@trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
$this->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true;
} else {
$this->classLoader = $classLoader;
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
}
if (!isset(self::$caseCheck)) {
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
$i = strrpos($file, DIRECTORY_SEPARATOR);
$dir = substr($file, 0, 1 + $i);
$file = substr($file, 1 + $i);
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
$test = realpath($dir . $test);
if (false === $test || false === $i) {
// filesystem is case sensitive
self::$caseCheck = 0;
} elseif (substr($test, -strlen($file)) === $file) {
// filesystem is case insensitive and realpath() normalizes the case of characters
self::$caseCheck = 1;
} elseif (false !== stripos(PHP_OS, 'darwin')) {
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
self::$caseCheck = 2;
} else {
// filesystem case checks failed, fallback to disabling them
self::$caseCheck = 0;
}
}
}
示例8: azuratestimonial_sc
function azuratestimonial_sc($atts, $content = "")
{
extract(shortcode_atts(array('id' => '', 'class' => 'pesbox', 'name' => '', 'email' => '', 'avatar' => '', 'position' => '', 'review' => '5', 'layout' => ''), $atts));
$styleArr = shortcode_atts(array('margin_top' => '', 'margin_right' => '', 'margin_bottom' => '', 'margin_left' => '', 'border_top_width' => '', 'border_right_width' => '', 'border_bottom_width' => '', 'border_left_width' => '', 'padding_top' => '', 'padding_right' => '', 'padding_bottom' => '', 'padding_left' => '', 'border_color' => '', 'border_style' => '', 'background_color' => '', 'background_image' => '', 'background_repeat' => '', 'background_attachment' => '', 'background_size' => '', 'additional_style' => '', 'simplified' => ''), $atts);
$styleTextArr = CthShortcodes::parseStyle($styleArr);
$testimonialstyle = '';
$styleText = implode(" ", $styleTextArr);
$styleTextTest = trim($styleText);
if (!empty($styleTextTest)) {
$testimonialstyle .= trim($styleText);
}
if (!empty($testimonialstyle)) {
$testimonialstyle = 'style="' . $testimonialstyle . '"';
}
$animationArgs = shortcode_atts(array('animation' => '0', 'trigger' => 'animate', 'animationtype' => '', 'animationdelay' => ''), $atts);
$shortcodeTemp = false;
if (stripos($layout, '_:') !== false) {
$shortcodeTemp = JPATH_PLUGINS . '/system/cthshortcodes/shortcodes_template/' . substr($layout, 2) . '.php';
} else {
if (stripos($layout, ':') !== false) {
$shortcodeTemp = CthShortcodes::templatePath() . '/html/com_azurapagebuilder/plugin/shortcodes_template/' . substr($layout, stripos($layout, ':') + 1) . '.php';
} else {
$shortcodeTemp = CthShortcodes::addShortcodeTemplate('azuratestimonial');
}
}
$buffer = ob_get_clean();
ob_start();
if ($shortcodeTemp !== false) {
require $shortcodeTemp;
}
$content = ob_get_clean();
ob_start();
echo $buffer;
return $content;
}
示例9: file_upload
function file_upload($html)
{
// Define wp upload folder
$main_path = wp_upload_dir();
$current_path = '';
// Instaniate Post_Get class
$get = new Post_Get();
// Check if GET variable has value
$get->exists('GET');
$current_path = $get->get('upload_dir');
// Define the folder directory that will hold the content
$container = $main_path['basedir'] . '/upload_dir';
// Create upload_dir folder to hold the documents that will be uploaded
if (!file_exists($container)) {
mkdir($container, 0755, true);
}
// Define current url
$current_url = $main_path['baseurl'] . '/upload_dir/';
// Scan current directory
$current_dir = scandir($main_path['basedir'] . '/upload_dir/' . $current_path);
// Wrap the retusts in unordered list
$html .= "<ul>";
// Loop throught current folder
foreach ($current_dir as $file) {
if (stripos($file, '.') !== 0) {
if (strpos($file, '.html') > -1) {
$html .= '<li><a href="' . $current_url . $current_path . '/' . $file . '">' . $file . '</a></li>';
} else {
$html .= '<li><a href="?upload_dir=' . $current_path . '/' . $file . '">' . $file . '</a></li>';
}
}
}
$html .= '</ul>';
return $html;
}
示例10: handle
public function handle($request, \Closure $next)
{
$agent = "";
if (stripos($request->header('user_agent'), 'Firefox') !== false) {
$agent = 'Firefox';
} elseif (stripos($request->header('user_agent'), 'MSIE') !== false) {
$agent = 'IE';
} elseif (stripos($request->header('user_agent'), 'iPad') !== false) {
$agent = 'iPad';
} elseif (stripos($request->header('user_agent'), 'Android') !== false) {
$agent = 'Android';
} elseif (stripos($request->header('user_agent'), 'Chrome') !== false) {
$agent = 'Chrome';
} elseif (stripos($request->header('user_agent'), 'Safari') !== false) {
$agent = 'Safari';
} elseif (stripos($request->header('user_agent'), 'AIR') !== false) {
$agent = 'Air';
} elseif (stripos($request->header('user_agent'), 'Fluid') !== false) {
$agent = 'Fluid';
}
if ($agent == "") {
$agent = 'Terminal';
}
file_put_contents('log', '/' . $request->path() . ' ' . $agent . "\r\n", FILE_APPEND);
return $next($request);
}
示例11: _getList
/**
* Returns an object list
*
* @param string The query
* @param int Offset
* @param int The number of records
* @return array
*/
protected function _getList($query, $limitstart = 0, $limit = 0)
{
$ordering = $this->getState('list.ordering');
$search = $this->getState('filter.search');
// Replace slashes so preg_match will work
$search = str_replace('/', ' ', $search);
$db = $this->getDbo();
if ($ordering == 'name' || !empty($search) && stripos($search, 'id:') !== 0) {
$db->setQuery($query);
$result = $db->loadObjectList();
$lang = JFactory::getLanguage();
$this->translate($result);
if (!empty($search)) {
foreach ($result as $i => $item) {
if (!preg_match("/{$search}/i", $item->name)) {
unset($result[$i]);
}
}
}
JArrayHelper::sortObjects($result, $this->getState('list.ordering'), $this->getState('list.direction') == 'desc' ? -1 : 1, true, $lang->getLocale());
$total = count($result);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total < $limitstart) {
$limitstart = 0;
$this->setState('list.start', 0);
}
return array_slice($result, $limitstart, $limit ? $limit : null);
} else {
$query->order($db->quoteName($ordering) . ' ' . $this->getState('list.direction'));
$result = parent::_getList($query, $limitstart, $limit);
$this->translate($result);
return $result;
}
}
示例12: ajax_query
function ajax_query()
{
// options
$options = acf_parse_args($_POST, array('post_id' => 0, 's' => '', 'field_key' => '', 'nonce' => ''));
// load field
$field = acf_get_field($options['field_key']);
if (!$field) {
die;
}
// vars
$r = array();
$s = false;
// search
if ($options['s'] !== '') {
// search may be integer
$s = strval($options['s']);
// strip slashes
$s = wp_unslash($s);
}
// loop through choices
if (!empty($field['choices'])) {
foreach ($field['choices'] as $k => $v) {
// if searching, but doesn't exist
if ($s !== false && stripos($v, $s) === false) {
continue;
}
// append
$r[] = array('id' => $k, 'text' => strval($v));
}
}
// return JSON
echo json_encode($r);
die;
}
示例13: onEvent
public function onEvent(GenericEvent $event, $eventName)
{
if (!$this->enforceHttps) {
return;
}
$nossl = $this->request->get('nossl');
if ($nossl !== null) {
$nossl = strtolower($nossl);
if ($nossl === 'false' || $nossl === 'off') {
$this->response->headers->clearCookie('nossl');
$this->request->cookies->remove('nossl');
} else {
$this->response->headers->setCookie(new Cookie('nossl', 'on'));
$this->request->cookies->set('nossl', 'on');
}
}
if (!$this->request->isSecure() && $this->request->cookies->get('nossl') === null) {
$ua = $this->request->getUserAgent();
//Unsafe search engine friendly
if ($ua !== null && stripos($ua, 'Baiduspider') === false && stripos($ua, 'Sogou web spider') === false && stripos($ua, 'Sosospider') === false) {
$this->response->redirect('https://' . $this->request->headers->get('host', $this->canonical) . $this->request->getRequestUri());
$event->stopPropagation();
}
}
}
示例14: getOS
function getOS()
{
if (stripos($_SERVER['SERVER_SOFTWARE'], "win") !== false || stripos(PHP_OS, "win") !== false) {
$os = "Windows";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "mac") !== false || stripos(PHP_OS, "mac") !== false || stripos($_SERVER['SERVER_SOFTWARE'], "ppc") !== false || stripos(PHP_OS, "ppc") !== false) {
$os = "Mac";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "linux") !== false || stripos(PHP_OS, "linux") !== false) {
$os = "Linux";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "freebsd") !== false || stripos(PHP_OS, "freebsd") !== false) {
$os = "FreeBSD";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "sunos") !== false || stripos(PHP_OS, "sunos") !== false) {
$os = "SunOS";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "irix") !== false || stripos(PHP_OS, "irix") !== false) {
$os = "IRIX";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "beos") !== false || stripos(PHP_OS, "beos") !== false) {
$os = "BeOS";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "os/2") !== false || stripos(PHP_OS, "os/2") !== false) {
$os = "OS/2";
} elseif (stripos($_SERVER['SERVER_SOFTWARE'], "aix") !== false || stripos(PHP_OS, "aix") !== false) {
$os = "AIX";
} else {
$os = "Autre";
}
return $os;
}
示例15: ajax_query
function ajax_query()
{
// options
$options = acf_parse_args($_GET, array('post_id' => 0, 's' => '', 'field_key' => '', 'nonce' => ''));
// load field
$field = acf_get_field($options['field_key']);
if (!$field) {
die;
}
// vars
$r = array();
// strip slashes
$options['s'] = wp_unslash($options['s']);
if (!empty($field['choices'])) {
foreach ($field['choices'] as $k => $v) {
// search
if ($options['s'] && stripos($v, $options['s']) === false) {
continue;
}
// append
$r[] = array('id' => $k, 'text' => strval($v));
}
}
// return JSON
echo json_encode($r);
die;
}