本文整理汇总了PHP中strstr函数的典型用法代码示例。如果您正苦于以下问题:PHP strstr函数的具体用法?PHP strstr怎么用?PHP strstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _is_auth_success
/**
* [_is_auth_success 验证权限是否成功]
* @param [type] $auths [description]
* @return boolean [description]
*/
private function _is_auth_success($auths)
{
$route = Common::get_route();
//需权限
if (array_key_exists($route, $auths)) {
$user = isset($_SESSION[$this->login_in_session_name]) ? $_SESSION[$this->login_in_session_name] : NULL;
$user_role = isset($user['role']) ? $user['role'] : NULL;
//有权限
if (strstr($auths[$route], "|{$user_role}|")) {
return TRUE;
} else {
//有登录权限
if (strstr($auths[$route], "|1|")) {
//已登录
if (!empty($user)) {
return TRUE;
} else {
$this->error->output('NOTLOGIN_ERROR', array('script' => 'swal({title: "请登录后再进行操作",type: "warning",showCancelButton: true,confirmButtonColor: "#DD6B55",confirmButtonText: "注册/登录",closeOnConfirm: false},function () {showsign();});'));
}
}
//没有权限
$this->error->output('NOAUTH_ERROR', array('script' => 'window.location.href ="' . base_url() . '";'));
}
} else {
return TRUE;
}
}
开发者ID:897475686,项目名称:vc,代码行数:32,代码来源:auth_service.php
示例2: 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');
}
}
开发者ID:kazuohirai,项目名称:awayfromswag,代码行数:31,代码来源:ClassRouting.php
示例3: init
/**
* Prevent caching on dynamic pages.
*
* @access public
* @return void
*/
public function init()
{
if (false === ($wc_page_uris = get_transient('woocommerce_cache_excluded_uris'))) {
if (woocommerce_get_page_id('cart') < 1 || woocommerce_get_page_id('checkout') < 1 || woocommerce_get_page_id('myaccount') < 1) {
return;
}
$wc_page_uris = array();
$cart_page = get_post(woocommerce_get_page_id('cart'));
$checkout_page = get_post(woocommerce_get_page_id('checkout'));
$account_page = get_post(woocommerce_get_page_id('myaccount'));
$wc_page_uris[] = '/' . $cart_page->post_name;
$wc_page_uris[] = '/' . $checkout_page->post_name;
$wc_page_uris[] = '/' . $account_page->post_name;
$wc_page_uris[] = 'p=' . $cart_page->ID;
$wc_page_uris[] = 'p=' . $checkout_page->ID;
$wc_page_uris[] = 'p=' . $account_page->ID;
set_transient('woocommerce_cache_excluded_uris', $wc_page_uris);
}
if (is_array($wc_page_uris)) {
foreach ($wc_page_uris as $uri) {
if (strstr($_SERVER['REQUEST_URI'], $uri)) {
$this->nocache();
break;
}
}
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:33,代码来源:class-wc-cache-helper.php
示例4: table_column
/**
* Merge a table name and a column name if possible
*
* @param $table
* @param $column
* @return mixed
*/
function table_column($table, $column)
{
if (is_string($column) === false || strstr($column, '.') !== false) {
return $column;
}
return \DB::raw('`' . $table . '`' . '.' . ($column != '*' ? '`' . $column . '`' : $column));
}
开发者ID:Jchedev,项目名称:laravel-evolved,代码行数:14,代码来源:strings.php
示例5: __construct
/**
* Sets GET and POST into local properties
*/
public function __construct(&$conf = false)
{
// parse vars from URI
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
$qrystr = str_replace('r=', '', filter_var($_SERVER['QUERY_STRING']));
if (!strstr($qrystr, 'exe/')) {
$this->parseUri($qrystr);
} else {
$key = explode('/', $qrystr);
if (isset($key[1])) {
$this->_exe = $key[1];
}
}
unset($qrystr);
}
// vars from GET
if ($_GET) {
while (list($key, $value) = each($_GET)) {
if ($key != 'r') {
$this->{$key} = $value;
}
}
}
// vars from POST
if ($_POST) {
while (list($key, $value) = each($_POST)) {
$this->{$key} = $value;
}
}
// vars from FILES
if ($_FILES) {
$this->setFiles($conf);
}
}
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:37,代码来源:TlalokesRequest.php
示例6: expand_ranges
/**
* Assumes that value is not *, and creates an array of valid numbers that
* the string represents. Returns an array.
*/
function expand_ranges($str)
{
if (strstr($str, ",")) {
$arParts = explode(',', $str);
foreach ($arParts as $part) {
if (strstr($part, '-')) {
$arRange = explode('-', $part);
for ($i = $arRange[0]; $i <= $arRange[1]; $i++) {
$ret[] = $i;
}
} else {
$ret[] = $part;
}
}
} elseif (strstr($str, '-')) {
$arRange = explode('-', $str);
for ($i = $arRange[0]; $i <= $arRange[1]; $i++) {
$ret[] = $i;
}
} else {
$ret[] = $str;
}
$ret = array_unique($ret);
sort($ret);
return $ret;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:30,代码来源:class.parser.php
示例7: beforeFilter
public function beforeFilter()
{
$this->controller = $this->_registry->getController();
if (!strstr($this->request->contentType(), 'multipart/form-data')) {
$this->request->data = $this->request->input('json_decode', true);
}
}
开发者ID:pulse14,项目名称:cakephp-api,代码行数:7,代码来源:ApiRequestComponent.php
示例8: from_request
/**
* attempt to build up a request from what was passed to the server
*/
public static function from_request($http_method = NULL, $http_url = NULL, $parameters = NULL)
{
$scheme = !isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on" ? 'http' : 'https';
@$http_url or $http_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
@$http_method or $http_method = $_SERVER['REQUEST_METHOD'];
// We weren't handed any parameters, so let's find the ones relevant to
// this request.
// If you run XML-RPC or similar you should use this to provide your own
// parsed parameter-list
if (!$parameters) {
// Find request headers
$request_headers = OAuthUtil::get_headers();
// Parse the query-string to find GET parameters
$parameters = OAuthUtil::parse_parameters($_SERVER['QUERY_STRING']);
// It's a POST request of the proper content-type, so parse POST
// parameters and add those overriding any duplicates from GET
if ($http_method == "POST" && @strstr($request_headers["Content-Type"], "application/x-www-form-urlencoded")) {
$post_data = OAuthUtil::parse_parameters(file_get_contents(self::$POST_INPUT));
$parameters = array_merge($parameters, $post_data);
}
// We have a Authorization-header with OAuth data. Parse the header
// and add those overriding any duplicates from GET or POST
if (@substr($request_headers['Authorization'], 0, 6) == "OAuth ") {
$header_parameters = OAuthUtil::split_header($request_headers['Authorization']);
$parameters = array_merge($parameters, $header_parameters);
}
}
return new OAuthRequest($http_method, $http_url, $parameters);
}
开发者ID:knox2,项目名称:Pesapal,代码行数:32,代码来源:OAuthRequest.php
示例9: forge
/**
* Forge a new object based on a request.
* @param RequestInterface $request
* @return Response
*/
public static function forge(RequestInterface $request)
{
$headerSize = $request->getInfo(CURLINFO_HEADER_SIZE);
$response = $request->getRawResponse();
$content = strlen($response) === $headerSize ? '' : substr($response, $headerSize);
$rawHeaders = rtrim(substr($response, 0, $headerSize));
$headers = array();
foreach (preg_split('/(\\r?\\n)/', $rawHeaders) as $header) {
if ($header) {
$headers[] = $header;
} else {
$headers = array();
}
}
$headerBag = array();
$info = $request->getInfo();
$status = explode(' ', $headers[0]);
$status = explode('/', $status[0]);
unset($headers[0]);
foreach ($headers as $header) {
list($key, $value) = explode(': ', $header);
$headerBag[trim($key)] = trim($value);
}
$response = new static($content, $info['http_code'], $headerBag);
$response->setProtocolVersion($status[1]);
$response->setCharset(substr(strstr($response->headers->get('Content-Type'), '='), 1));
return $response;
}
开发者ID:hardwork2015,项目名称:cdp,代码行数:33,代码来源:Response.php
示例10: confirm_success
function confirm_success($ALERT)
{
global $PAGE, $this_page, $THEUSER;
$this_page = 'alertconfirmsucceeded';
$criteria = $ALERT->criteria_pretty(true);
$email = $ALERT->email();
$extra = null;
$PAGE->page_start();
$PAGE->stripe_start();
?>
<p>Your alert has been confirmed.</p>
<p>You will now receive email alerts for the following criteria:</p>
<ul><?php
echo $criteria;
?>
</ul>
<p>This is normally the day after, but could conceivably be later due to issues at our or parliament.uk's end.</p>
<?php
$extra = alert_confirmation_advert(array('email' => $email, 'pid' => strstr($ALERT->criteria(), 'speaker:')));
if ($extra) {
$extra = "advert={$extra}";
}
$PAGE->stripe_end();
$PAGE->page_end($extra);
}
开发者ID:bruno,项目名称:openaustralia-app,代码行数:25,代码来源:index.php
示例11: getParams
static function getParams(&$params)
{
$params->def('url', '');
$params->def('scrolling', 'auto');
$params->def('height', '200');
$params->def('height_auto', '0');
$params->def('width', '100%');
$params->def('add', '1');
$params->def('name', 'wrapper');
$url = $params->get('url');
if ($params->get('add')) {
// adds 'http://' if none is set
if (substr($url, 0, 1) == '/') {
// relative url in component. use server http_host.
$url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
} elseif (!strstr($url, 'http') && !strstr($url, 'https')) {
$url = 'http://' . $url;
} else {
$url = $url;
}
}
// auto height control
if ($params->def('height_auto')) {
$load = 'onload="iFrameHeight()"';
} else {
$load = '';
}
$params->set('load', $load);
$params->set('url', $url);
return $params;
}
开发者ID:carmerin,项目名称:cesae-web,代码行数:31,代码来源:helper.php
示例12: testReports
public function testReports()
{
$reports = FannieAPI::listModules('FannieReportPage', true);
$config = FannieConfig::factory();
$logger = new FannieLogger();
$op_db = $config->get('OP_DB');
$dbc = FannieDB::get($op_db);
$dbc->throwOnFailure(true);
foreach ($reports as $report_class) {
$obj = new $report_class();
$obj->setConfig($config);
$obj->setLogger($logger);
$dbc->selectDB($op_db);
$obj->setConnection($dbc);
$pre = $obj->preprocess();
$this->assertInternalType('boolean', $pre);
$auth = $obj->checkAuth();
$this->assertInternalType('boolean', $pre);
$html_form = $obj->form_content();
$this->assertNotEquals(0, strlen($html_form), 'Report form is empty for ' . $report_class);
$form = new \COREPOS\common\mvc\ValueContainer();
foreach ($obj->requiredFields() as $field) {
if (strstr($field, 'date')) {
$form->{$field} = date('Y-m-d');
} else {
$form->{$field} = 1;
}
}
$obj->setForm($form);
$preamble = $obj->report_description_content();
$this->assertInternalType('array', $preamble, 'Report did not return description content ' . $report_class);
$results = $obj->fetch_report_data();
$this->assertInternalType('array', $results, 'Report did not return results ' . $report_class);
}
}
开发者ID:phpsmith,项目名称:IS4C,代码行数:35,代码来源:PagesFannieTest.php
示例13: getRemoteInfo
function getRemoteInfo()
{
$proxy = "";
$IP = "";
if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy = $_SERVER["REMOTE_ADDR"];
} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$IP = getenv('HTTP_X_FORWARDED_FOR');
$proxy = getenv('REMOTE_ADDR');
} elseif (getenv('HTTP_CLIENT_IP')) {
$IP = getenv('HTTP_CLIENT_IP');
} else {
$IP = getenv('REMOTE_ADDR');
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
$RemoteInfo[0] = $IP;
$RemoteInfo[1] = @GetHostByAddr($IP);
$RemoteInfo[2] = $proxy;
return $RemoteInfo;
}
开发者ID:469306621,项目名称:Languages,代码行数:32,代码来源:get_remote_info.php
示例14: _login
protected function _login($user)
{
$this->session->set_userdata((array) $user);
//update login time
$this->db->where('id', $user->ID);
$this->db->update('user', array('last_login' => time()));
// send them back to where they came from, either the referer if they
// have one, or the flashdata
$referer = $this->input->server('HTTP_REFERER');
// Only allow the referrer to be on this site - this prevents a loop
// to Twitter after login, and other possible phishing attacks
$base = $this->config->item('base_url');
if (substr($referer, 0, strlen($base)) != $base) {
$referer = $base;
}
$to = $this->session->flashdata('url_after_login') ? $this->session->flashdata('url_after_login') : $referer;
// List different routes we don't want to reroute to
$bad_routes = $this->non_forward_urls;
foreach ($bad_routes as $route) {
if (strstr($to, $route)) {
redirect('user/main');
}
}
// our $to is good, so redirect
redirect($to);
}
开发者ID:jaytaph,项目名称:joind.in,代码行数:26,代码来源:AuthAbstract.php
示例15: theme_user
function theme_user($data)
{
include_once "theme.inc.php";
$content = '';
foreach ($data as $r) {
if (strstr($r['source'], '<')) {
$source = str_replace("<a ", '<a class="left microblog-item-position"', $r['source']);
} else {
$source = '<a class="left microblog-item-position">' . $r['source'] . '</a>';
}
$content .= '<div class="item" id="' . $r['tweet_id'] . '">
<div class="item-delete">
<a class="right"></a>
</div>
<div class="left item-pic">
<img alt="" width="50" height="50" src="' . $r['profile_image_url'] . '">
</div>
<div class="left item-content">
<div class="item-blog">
<a class="item-blog-name" target="_blank" href="' . BASE_URL . 'profile/' . $r['post_screenname'] . '">' . $r['post_screenname'] . '</a>:' . $r['content'] . '
</div>
<div class="item-other">
<span class="left item-time">' . time_tran($r['post_datetime']) . '</span>' . $source . '
<a class="right item-control last delete">
删除</a>
</div>
</div>
<div class="clear">
</div>
</div>';
}
echo $content;
}
开发者ID:soross,项目名称:0f523140-f3b3-4653-89b0-eb08c39940ad,代码行数:33,代码来源:user.inc.php
示例16: parse
function parse($data_str, $query)
{
$items = array('name' => 'Domain Name (UTF-8):', 'created' => 'Record created on', 'expires' => 'Record expires on', 'changed' => 'Record last updated on', 'status' => 'Record status:', 'handle' => 'Record ID:');
while (list($key, $val) = each($data_str['rawdata'])) {
$val = trim($val);
if ($val != '') {
if ($val == 'Domain servers in listed order:') {
while (list($key, $val) = each($data_str['rawdata'])) {
$val = trim($val);
if ($val == '') {
break;
}
$r['regrinfo']['domain']['nserver'][] = $val;
}
break;
}
reset($items);
while (list($field, $match) = each($items)) {
if (strstr($val, $match)) {
$r['regrinfo']['domain'][$field] = trim(substr($val, strlen($match)));
break;
}
}
}
}
if (isset($r['regrinfo']['domain'])) {
$r['regrinfo']['registered'] = 'yes';
} else {
$r['regrinfo']['registered'] = 'no';
}
$r['regyinfo'] = array('whois' => 'whois.nic.nu', 'referrer' => 'http://www.nunames.nu', 'registrar' => '.NU Domain, Ltd');
format_dates($r, 'dmy');
return $r;
}
开发者ID:evdevgit,项目名称:wpblock,代码行数:34,代码来源:whois.nu.php
示例17: get_network
function get_network()
{
$lines = file('/etc/network/interfaces');
foreach ($lines as $line_num => $line) {
$address = strstr($line, 'address');
if ($address) {
$address_arr = explode(" ", $address);
if ($address_arr['1'] != 'ether') {
$ipdata['ip_adress'] = $address_arr['1'];
}
}
//mask
$Mask = strstr($line, 'netmask');
if ($Mask) {
$Mask_arr = explode(" ", $Mask);
$ipdata['mask'] = $Mask_arr['1'];
}
//gateway
$gateway = strstr($line, 'gateway');
if ($gateway) {
$gateway_arr = explode(" ", $gateway);
$ipdata['gateway_id'] = $gateway_arr['1'];
//echo $gateway_id;
}
$macaddr = strstr($line, 'hwaddress');
if ($macaddr) {
$mac_arr = explode(" ", $macaddr);
$ipdata['mac'] = end($mac_arr);
}
}
return $ipdata;
}
开发者ID:Tiger66639,项目名称:NewRbox,代码行数:32,代码来源:common.inc.php
示例18: isMetadataTable
/**
* Checks a table name to see if it is a metadata table. A metadata table
* always ends in '__metadata'.
* @param string $tablename The name of the table to check.
* @returns boolean
*/
function isMetadataTable($tablename = null)
{
if (!isset($tablename)) {
$tablename = $this->tablename;
}
return strstr($tablename, '__metadata') == '__metadata';
}
开发者ID:minger11,项目名称:Pipeline,代码行数:13,代码来源:MetadataTool.php
示例19: checkBox
/**
* dijit.form.CheckBox
*
* @param int $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array $checkedOptions Should contain either two items, or the keys checkedValue and uncheckedValue
* @return string
*/
public function checkBox($id, $value = null, array $params = array(), array $attribs = array(), array $checkedOptions = null)
{
// Prepare the checkbox options
require_once 'Zend/View/Helper/FormCheckbox.php';
$checked = false;
if (isset($attribs['checked']) && $attribs['checked']) {
$checked = true;
} elseif (isset($attribs['checked'])) {
$checked = false;
}
$checkboxInfo = Zend_View_Helper_FormCheckbox::determineCheckboxInfo($value, $checked, $checkedOptions);
$attribs['checked'] = $checkboxInfo['checked'];
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs = $this->_prepareDijit($attribs, $params, 'element');
// strip options so they don't show up in markup
if (array_key_exists('options', $attribs)) {
unset($attribs['options']);
}
// and now we create it:
$html = '';
if (!strstr($id, '[]')) {
// hidden element for unchecked value
$html .= $this->_renderHiddenElement($id, $checkboxInfo['uncheckedValue']);
}
// and final element
$html .= $this->_createFormElement($id, $checkboxInfo['checkedValue'], $params, $attribs);
return $html;
}
开发者ID:c12g,项目名称:stratos-php,代码行数:40,代码来源:CheckBox.php
示例20: GenSQL
/**
* Generate SQL from Rule
* @param string $rule Rule to generate SQL for
* @return string
*/
function GenSQL($rule)
{
$tmp = explode(" ", $rule);
$tables = array();
foreach ($tmp as $opt) {
if (strstr($opt, '%') && strstr($opt, '.')) {
$tmpp = explode(".", $opt, 2);
$tmpp[0] = str_replace("%", "", $tmpp[0]);
$tables[] = mres(str_replace("(", "", $tmpp[0]));
$rule = str_replace($opt, $tmpp[0] . '.' . $tmpp[1], $rule);
}
}
$tables = array_unique($tables);
$x = sizeof($tables);
$i = 0;
$join = "";
while ($i < $x) {
if (isset($tables[$i + 1])) {
$join .= $tables[$i] . ".device_id = " . $tables[$i + 1] . ".device_id && ";
}
$i++;
}
$sql = "SELECT * FROM " . implode(",", $tables) . " WHERE (" . $join . "" . str_replace("(", "", $tables[0]) . ".device_id = ?) && (" . str_replace(array("%", "@", "!~", "~"), array("", "%", "NOT LIKE", "LIKE"), $rule) . ")";
return $sql;
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:30,代码来源:alerts.inc.php
注:本文中的strstr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论