本文整理汇总了PHP中right函数的典型用法代码示例。如果您正苦于以下问题:PHP right函数的具体用法?PHP right怎么用?PHP right使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了right函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoloadEvents
function autoloadEvents($class)
{
if (strToLower(right($class, 5)) !== 'event') {
return;
}
require_once jailpath(DIAMONDMVC_ROOT . '/classes/events', strToLower(substr($class, 0, strlen($class) - 5)) . '.php');
}
示例2: mainAutoLoader
function mainAutoLoader($class)
{
// Exceptions werden leicht besonders behandelt.
if (right($class, 9) === 'Exception') {
$file = DIAMONDMVC_ROOT . "/exceptions/{$class}.php";
} else {
$class = strToLower($class);
if (left($class, 10) === 'controller' and $class !== 'controller') {
$class = substr($class, 10);
$file = DIAMONDMVC_ROOT . "/controllers/{$class}.php";
} else {
if (left($class, 5) === 'model' and $class !== 'model') {
$class = substr($class, 5);
$file = DIAMONDMVC_ROOT . "/models/{$class}.php";
} else {
if (left($class, 6) === 'module' and $class !== 'module') {
$class = substr($class, 6);
$file = DIAMONDMVC_ROOT . "/modules/{$class}/{$class}.php";
} else {
$file = DIAMONDMVC_ROOT . "/lib/class_{$class}.php";
}
}
}
}
if (file_exists($file)) {
include_once $file;
}
}
示例3: extractColors
function extractColors($Hexa)
{
if (strlen($Hexa) != 6) {
return array(0, 0, 0);
}
$R = hexdec(left($Hexa, 2));
$G = hexdec(mid($Hexa, 3, 2));
$B = hexdec(right($Hexa, 2));
return array($R, $G, $B);
}
示例4: __construct
function __construct($mask, $ts = 0, $setby = "")
{
if ($ts == 0) {
$ts = time();
}
$ex_pos = strpos($mask, '!');
$at_pos = strpos($mask, '@');
$ident = substr($mask, $ex_pos, $at_pos - $ex_pos);
if (strlen($ident) > IDENT_LEN) {
$mask = substr($mask, 0, $ex_pos) . '!*' . right($ident, IDENT_LEN) . '@' . substr($mask, $at_pos);
}
$this->mask = $mask;
$this->setby = $setby;
$this->ts = $ts;
}
示例5: textFormat
function textFormat($arrayData, $maxchar)
{
$maxchar = 40;
$text = '';
foreach ($arrayData as $key => $val) {
$newval = number_format($val, 0, '', '.');
$space = $maxchar - (strlen($key) + strlen($newval) + 2);
$text .= left($key, strlen($key));
$text .= str_repeat(" ", $space);
$text .= right($newval, strlen($newval));
$text .= ",-";
$text .= "\r\n";
}
return $text;
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Absent $absentModel, Product $productModel)
{
if (!right('Alerts')) {
abort(404);
}
if (isset($_POST['save'])) {
//pr($_POST);
$currentAbsents = $absentModel->getAbsentsList();
foreach ($_POST['fields'] as $key => $element) {
//если стоит галка Выполенно
if (isset($element['done'])) {
//удаляем дату у товаров
$productModel->deleteAbsent($element['old_absent']);
//удаляем уведомление
$absentModel->deleteAbsent($element['old_absent']);
} else {
//если меняем дату уведомления
if ($element['new_absent'] != $element['old_absent']) {
//меняем дату у товаров
$productModel->changeAbsent($element['old_absent'], $element['new_absent']);
//если уведомление с такой датой уже есть
if ($currentAbsents->search($element['new_absent']) !== false) {
if (!empty($element['note'])) {
//меняем комментарий
$absentModel->updateAbsent($element['new_absent'], array('note' => $element['note']));
}
//удаляем старое уведомление
$absentModel->deleteAbsent($element['old_absent']);
} else {
//просто меняем дату и коммент
$absentModel->updateAbsent($element['old_absent'], array('absent' => $element['new_absent'], 'note' => $element['note']));
}
} else {
//если написан комментарий
if (!empty($element['note'])) {
//меняем комментарий
$absentModel->updateAbsent($element['new_absent'], array('note' => $element['note']));
}
}
}
}
$absents = $productModel->getAbsentsList();
$absentModel->addAbsentsList($absents);
Session::flash('message', GetMessages("SUCCESS_UPDATE"));
return redirect($_SERVER['HTTP_REFERER']);
}
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request, Note $noteModel, History $historyModel)
{
if (right('AddNewPublicNote')) {
if (strlen($_POST['notification']) > 0) {
$noteModel->addNote($_POST['notification']);
$historyModel->saveHistory('create_note');
Session::flash('message', GetMessages("ADD_NEW_NOTE_MESSAGE"));
return redirect()->route('note.index');
} else {
Session::flash('message', GetMessages("EMPTY_NOTE_MESSAGE"));
return redirect()->route('note.index');
}
} else {
Session::flash('message', GetMessages("NO_RIGHTS"));
return redirect($_SERVER['HTTP_REFERER']);
}
}
示例8: fixNickHostMask
function fixNickHostMask($mask)
{
$ex_pos = strpos($mask, '!');
$at_pos = strpos($mask, '@');
if ($at_pos === false) {
$mask = '*@' . $mask;
$at_pos = 1;
}
if ($ex_pos === false) {
$mask = '*!' . $mask;
$ex_pos = 1;
$at_pos = strpos($mask, '@');
}
$ident = substr($mask, $ex_pos + 1, $at_pos - $ex_pos - 1);
if (strlen($ident) > IDENT_LEN) {
$mask = substr($mask, 0, $ex_pos) . '!*' . right($ident, IDENT_LEN - 1) . substr($mask, $at_pos);
}
return $mask;
}
示例9: getHtmlValue
function getHtmlValue($content, $sType)
{
$i = '';
$endStr = '';
$s = '';
$labelName = '';
$startLabel = '';
$endLabel = '';
$LCaseEndStr = '';
$paramName = '';
$startLabel = '<';
$endLabel = '>';
for ($i = 1; $i <= len($content); $i++) {
$s = mid($content, $i, 1);
$endStr = mid($content, $i, -1);
if ($s == '<') {
if (inStr($endStr, '>') > 0) {
$s = mid($endStr, 1, inStr($endStr, '>'));
$i = $i + len($s) - 1;
$s = mid($s, 2, len($s) - 2);
$s = PHPTrim($s);
if (right($s, 1) == '/') {
$s = PHPTrim(left($s, len($s) - 1));
}
$endStr = right($endStr, len($endStr) - len($s) - 2);
//最后字符减去当前标签 -2是因为它有<>二个字符
//注意之前放在labelName下面
$labelName = mid($s, 1, inStr($s . ' ', ' ') - 1);
$labelName = lCase($labelName);
if ($labelName == 'title' && $sType == 'webtitle') {
$LCaseEndStr = lCase($endStr);
if (inStr($LCaseEndStr, '</title>') > 0) {
$s = mid($endStr, 1, inStr($LCaseEndStr, '</title>') - 1);
} else {
$s = '';
}
$getHtmlValue = $s;
return @$getHtmlValue;
} else {
if ($labelName == 'meta' && ($sType == 'webkeywords' || $sType == 'webdescription')) {
$LCaseEndStr = lCase($endStr);
$paramName = PHPTrim(lCase(getParamValue($s, 'name')));
if ('web' . $paramName == $sType) {
$getHtmlValue = getParamValue($s, 'content');
return @$getHtmlValue;
}
}
}
}
}
}
$getHtmlValue = '';
return @$getHtmlValue;
}
示例10: handleDoubleQuotation
function handleDoubleQuotation($s)
{
$NewS = '';
$NewS = PHPTrim($s);
if (left($NewS, 1) == '"' && right($NewS, 1) == '"') {
$s = mid($NewS, 2, len($NewS) - 2);
}
$handleDoubleQuotation = $s;
return @$handleDoubleQuotation;
}
示例11: fdecimal
public function fdecimal($conteudo = '', $qt = 2, $tp = 1)
{
if (!$conteudo) {
$conteudo = 0;
}
if ($tp == 1) {
$conteudo = number_format($conteudo, $qt, ',', '.');
} elseif ($tp == 3) {
$conteudo = number_format($conteudo, $qt, '.', '');
} elseif ($tp == 4) {
//retira pontos e virgulas, deixa somente números
$conteudo = number_format($conteudo, $qt, '', '');
} else {
$conteudo = left($conteudo, strlen($conteudo) - $qt) . "," . right($conteudo, $qt);
}
return $conteudo;
}
示例12: right
<?php
include "system.php";
$action = $_GET['action'];
if (!isset($action) || $action == 'create') {
include "../simantz/class/pchart/pChart/pData.class";
include "../simantz/class/pchart/pChart/pChart.class";
//$oriyear= date("Y",time());
//$orimonth=date("m",time());
//$oriyear=2008;
//$orimonth=8;
$orimonth = right(left(getDateSession(), 7), 2);
$oriyear = left(getDateSession(), 4);
$p = array();
$arrtotalamt = array();
//$period1=$period->getPeriodID($year,$month);
for ($i = 5; $i >= 0; $i--) {
$year = $oriyear;
$month = $orimonth - $i;
if ($month <= 0) {
$month = $month + 12;
$year = $year - 1;
}
if (strlen($month) == 1) {
$month = "0" . $month;
}
//$period1=$period->getPeriodID($year,$month);
$curperiodname = $year . '-' . $month;
array_push($p, $year . '-' . $month);
$sql = "SELECT '{$curperiodname}',coalesce(sum(localamt),0) as totalamt\n FROM sim_bpartner_quotation q\n where q.iscomplete=1 and left(CAST( q.document_date AS CHAR),7)='{$curperiodname}'\n group by left(CAST( q.document_date AS CHAR),7)";
$query = $xoopsDB->query($sql);
示例13: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Label $labelModel, Request $request, Purchase $purchaseModel, User $userModel, Product $productModel, History $historyModel)
{
if (isset($_POST['update_template'])) {
//pr($_POST);
if (isset($_POST['col']) and !empty($_POST['col'])) {
$fields = serialize($_POST['col']);
} else {
$fields = null;
}
if (!empty($_POST['name_template'])) {
$template_name = $_POST['name_template'];
} elseif (isset($_POST['selected_name_template']) and !empty($_POST['selected_name_template'])) {
$template_name = $_POST['selected_name_template'];
} else {
$template_name = 'По умолчанию';
}
$template_id = $userModel->checkTemplates($template_name, 'products');
if ($template_id != null) {
$res = array('fields' => $fields);
$userModel->updateTemplate($res, $template_id, 'products');
} else {
//добавляем шаблон
$res = array('type' => 'products', 'user_id' => Auth::User()->id, 'template' => $template_name, 'fields' => $fields);
$userModel->addTemplates($res, 'products');
}
Session::flash('message', GetMessages("SUCCESS_SETTINGS_SAVE"));
return redirect($_SERVER['HTTP_REFERER']);
}
if (isset($_POST['delete_template'])) {
$userModel->deleteTemplate($_POST['selected_name_template'], 'products');
Session::flash('message', GetMessages("SUCCESS_TEMPLATE_DELETE"));
return redirect($_SERVER['HTTP_REFERER']);
}
if (isset($_POST['select_template'])) {
$userModel->updateUser(Auth::User()->id, array('template_prod_id' => $_POST['selected_name_template']));
Session::flash('message', GetMessages("SUCCESS_SETTINGS_SAVE"));
return redirect($_SERVER['HTTP_REFERER']);
}
if (isset($_POST['search_button'])) {
//pr($_POST);
if (strlen($_POST['search_field']) > 0) {
return redirect()->route('product.search.index', ['string' => $_POST['search_field']]);
} else {
return redirect($_SERVER['HTTP_REFERER']);
}
}
if (isset($_POST['update_products'])) {
if (!right('EditProduct')) {
abort(404);
}
unset($_POST['update_products']);
unset($_POST['_token']);
$res = array();
$reViewAbsents = false;
//pr($_POST);
foreach ($_POST as $element) {
if (array_key_exists('check', $element)) {
unset($element['check']);
$childs = false;
if (isset($element['childs'])) {
$childs = unserialize($productModel->where('id', $element['id'])->pluck('childs'));
}
//status
!isset($element['status']['new']) ? $element['status']['new'] = 0 : ($element['status']['new'] = 1);
if ($element['status']['new'] != $element['status']['old']) {
$res[$element['id']]['products.status'] = $element['status']['new'];
}
//name
if ($element['name']['new'] != $element['name']['old']) {
$res[$element['id']]['products.name'] = trim($element['name']['new']);
}
//monitoring_name
if ($element['monitoring_name']['new'] != $element['monitoring_name']['old']) {
$res[$element['id']]['products.monitoring_name'] = trim($element['monitoring_name']['new']);
}
//absent
if ($element['absent']['new'] != $element['absent']['old']) {
if (empty($element['absent']['new'])) {
$res[$element['id']]['products.absent'] = null;
} else {
$res[$element['id']]['products.absent'] = trim($element['absent']['new']);
}
$reViewAbsents = true;
}
//article
if ($element['article']['new'] != $element['article']['old']) {
$res[$element['id']]['products.article'] = trim($element['article']['new']);
}
//in_stock
!isset($element['in_stock']['new']) ? $element['in_stock']['new'] = 0 : ($element['in_stock']['new'] = 1);
if ($element['in_stock']['new'] != $element['in_stock']['old']) {
$res[$element['id']]['products.in_stock'] = $element['in_stock']['new'];
}
//flag
//.........这里部分代码省略.........
示例14: getCaiSortCountPage
function getCaiSortCountPage($content)
{
$i = '';
$s = '';
$getCaiSortCountPage = '';
$content = delHtml($content);
$content = handleNumber($content);
for ($i = 1; $i <= 30; $i++) {
$s = mid($content, 1, len($i));
if ($s == cStr($i)) {
$getCaiSortCountPage = $i;
//Call Echo(i,s)
$content = right($content, len($content) - len($i));
}
}
return @$getCaiSortCountPage;
}
示例15: handleWithWebSiteList
function handleWithWebSiteList($httpurl, $urllist)
{
$website = '';
$splstr = '';
$url = '';
$c = '';
$urlWebsite = '';
$s = '';
$website = lCase(getWebSite($httpurl));
$splstr = aspSplit($urllist, vbCrlf());
foreach ($splstr as $key => $url) {
if ($url != '') {
if (right($url, 1) != '/' && inStr($url, '?') == false) {
$s = mid($url, inStrRev($url, '/'), -1);
//call echo("s",s)
if ((inStr($s, '.') == false || inStr($s, '.com') > 0 || inStr($s, '.cn') > 0 || inStr($s, '.net') > 0) && inStr($s, '@') == false) {
$url = $url . '/';
}
//call echo("url",url)
}
$urlWebsite = lCase(getWebSite($url));
if ($website == $urlWebsite && inStr(vbCrlf() . $c . vbCrlf(), vbCrlf() . $url . vbCrlf()) == false) {
if ($c != '') {
$c = $c . vbCrlf();
}
$c = $c . $url;
}
}
}
$handleWithWebSiteList = $c;
return @$handleWithWebSiteList;
}