• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP prev函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中prev函数的典型用法代码示例。如果您正苦于以下问题:PHP prev函数的具体用法?PHP prev怎么用?PHP prev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了prev函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getPostageAmount

 /**
  * @param $areaId
  * @param $weight
  *
  * @return mixed
  * @throws \Thelia\Exception\OrderException
  */
 public static function getPostageAmount($areaId, $weight)
 {
     $freeshipping = ColissimoFreeshippingQuery::create()->getLast();
     $postage = 0;
     if (!$freeshipping) {
         $prices = self::getPrices();
         /* check if Colissimo delivers the asked area */
         if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
             throw new DeliveryException(Translator::getInstance()->trans("Colissimo delivery unavailable for the delivery country", [], self::MESSAGE_DOMAIN));
         }
         $areaPrices = $prices[$areaId]["slices"];
         ksort($areaPrices);
         /* Check cart weight is below the maximum weight */
         end($areaPrices);
         $maxWeight = key($areaPrices);
         if ($weight > $maxWeight) {
             throw new DeliveryException(Translator::getInstance()->trans("Colissimo delivery unavailable for this cart weight (%weight kg)", array("%weight" => $weight), self::MESSAGE_DOMAIN));
         }
         $postage = current($areaPrices);
         while (prev($areaPrices)) {
             if ($weight > key($areaPrices)) {
                 break;
             }
             $postage = current($areaPrices);
         }
     }
     return $postage;
 }
开发者ID:Mertiozys,项目名称:Colissimo,代码行数:35,代码来源:Colissimo.php


示例2: getPostageAmount

 /**
  * @param $areaId
  * @param $weight
  *
  * @return mixed
  * @throws DeliveryException
  */
 public static function getPostageAmount($areaId, $weight)
 {
     $freeshipping = @(bool) ConfigQuery::read("predict_freeshipping");
     $postage = 0;
     if (!$freeshipping) {
         $prices = static::getPrices();
         /* check if Predict delivers the asked area */
         if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
             throw new DeliveryException("Predict delivery unavailable for the chosen delivery country");
         }
         $areaPrices = $prices[$areaId]["slices"];
         ksort($areaPrices);
         /* check this weight is not too much */
         end($areaPrices);
         $maxWeight = key($areaPrices);
         if ($weight > $maxWeight) {
             throw new DeliveryException(sprintf("Predict delivery unavailable for this cart weight (%s kg)", $weight));
         }
         $postage = current($areaPrices);
         while (prev($areaPrices)) {
             if ($weight > key($areaPrices)) {
                 break;
             }
             $postage = current($areaPrices);
         }
     }
     return $postage;
 }
开发者ID:lopes-vincent,项目名称:Predict,代码行数:35,代码来源:PricesQuery.php


示例3: getSourceText

 public function getSourceText()
 {
     if ($this->getDiffSource() == false) {
         $c = new Criteria();
         $c->add("source_id", $this->getSourceId());
         $source = DB_PageSourcePeer::instance()->selectOne($c);
         return $source->getText();
     } else {
         // select last revisions and sources.
         $q = "SELECT page_source.* FROM page_source, page_revision WHERE " . "page_revision.page_id =" . $this->getPageId() . " " . "AND page_revision.revision_id <= " . $this->getRevisionId() . " " . "AND (page_revision.flag_text = TRUE OR page_revision.flag_new = TRUE) " . "AND page_revision.source_id = page_source.source_id " . "ORDER BY page_revision.revision_id DESC " . "LIMIT " . ($this->getSinceFullSource() + 1);
         $c = new Criteria();
         $c->setExplicitQuery($q);
         $sources = DB_PageSourcePeer::instance()->select($c);
         // original source...
         $s = end($sources);
         $s0 = $s->getText();
         $differ = new ODiff();
         while ($s = prev($sources)) {
             $s0 = $differ->patchString($s0, $s->getText());
             if ($differ->getErrors() != null) {
                 return "Error processing the source - please report the problem to the support";
             }
         }
         return trim($s0);
     }
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:26,代码来源:DB_PageRevision.php


示例4: check_base

 /**
  * Check and correct URL
  * @param string $url
  * @return string
  */
 public function check_base($url, $options)
 {
     if (!is_string($url) || empty($url)) {
         return $url;
     }
     global $wp_rewrite;
     $base_defined = $options->base_defined;
     $permastruct = $wp_rewrite->get_extra_permastruct($options->get_tax_query());
     if ($permastruct) {
         $permastruct = explode('/', $permastruct);
         end($permastruct);
         $permastruct = prev($permastruct);
         if (false !== $permastruct) {
             $base_defined = $permastruct;
         }
     }
     $base_option = get_option($options->base_option);
     if (empty($base_option)) {
         $base_option = $options->base_defined;
     }
     if ($base_defined != $base_option) {
         $search = '/' . $base_defined . '/';
         $replace = '/' . $base_option . '/';
         $count = 1;
         $url = str_replace($search, $replace, $url, $count);
     }
     return $url;
 }
开发者ID:laishidua,项目名称:laishidua.com,代码行数:33,代码来源:MslsOptionsTaxTerm.php


示例5: __construct

 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $groupId = $params->additionalParamList['entityId'];
     $userId = OW::getUser()->getId();
     $service = GROUPS_BOL_Service::getInstance();
     $feedService = GROUPRSS_BOL_FeedService::getInstance();
     $whoCanAdd = OW::getConfig()->getValue('grouprss', 'actionMember');
     if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) {
         $this->setVisible(false);
         return;
     }
     $mypaths = explode("/", UTIL_Url::selfUrl());
     $groupId = strtolower(end($mypaths));
     if ($groupId == 'customize') {
         $groupId = strtolower(prev($mypaths));
     }
     if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) {
         $this->setVisible(false);
         return;
     }
     if ($whoCanAdd == 'both') {
         if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) {
             $this->setVisible(false);
             return;
         }
     }
     $this->assign('groupId', (int) $groupId);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:29,代码来源:manage_feeds_widget.php


示例6: format

 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         switch ($id) {
             case T_NAMESPACE:
                 if ($this->rightUsefulTokenIs(T_NS_SEPARATOR)) {
                     break;
                 }
                 $this->appendCode($text);
                 list($foundId, $foundText) = $this->printAndStopAt([ST_CURLY_OPEN, ST_SEMI_COLON]);
                 if (ST_CURLY_OPEN == $foundId) {
                     $this->appendCode($foundText);
                     $this->printCurlyBlock();
                 } elseif (ST_SEMI_COLON == $foundId) {
                     $this->appendCode(ST_CURLY_OPEN);
                     list($foundId, $foundText) = $this->printAndStopAt([T_NAMESPACE, T_CLOSE_TAG]);
                     if (T_CLOSE_TAG == $foundId) {
                         return $source;
                     }
                     $this->appendCode($this->getCrlf() . ST_CURLY_CLOSE . $this->getCrlf());
                     prev($this->tkns);
                     continue;
                 }
                 break;
             default:
                 $this->appendCode($text);
         }
     }
     return $this->code;
 }
开发者ID:studiokiwik,项目名称:php.tools,代码行数:34,代码来源:EncapsulateNamespaces.php


示例7: loadData

 /**
  * Load the data
  */
 private function loadData()
 {
     // get the current page id
     $pageId = $this->getContainer()->get('page')->getId();
     $navigation = FrontendNavigation::getNavigation();
     $pageInfo = FrontendNavigation::getPageInfo($pageId);
     $this->navigation = array();
     if (isset($navigation['page'][$pageInfo['parent_id']])) {
         $pages = $navigation['page'][$pageInfo['parent_id']];
         // store
         $pagesPrev = $pages;
         $pagesNext = $pages;
         // check for current id
         foreach ($pagesNext as $key => $value) {
             if ((int) $key != (int) $pageId) {
                 // go to next pointer in array
                 next($pagesNext);
                 next($pagesPrev);
             } else {
                 break;
             }
         }
         // get previous page
         $this->navigation['previous'] = prev($pagesPrev);
         // get next page
         $this->navigation['next'] = next($pagesNext);
         // get parent page
         $this->navigation['parent'] = FrontendNavigation::getPageInfo($pageInfo['parent_id']);
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:33,代码来源:PreviousNextNavigation.php


示例8: prev

 public function prev()
 {
     if (!prev($this->filters)) {
         end($this->filters);
     }
     return current($this->filters);
 }
开发者ID:p-m-d,项目名称:infiltrate,代码行数:7,代码来源:FilterCollection.php


示例9: processCliOptions

 /**
  * Processes command line options.
  *
  * @param array $options
  * @return \ApiGen\Config
  */
 public function processCliOptions(array $options)
 {
     while ($option = current($options)) {
         if (preg_match('~^--([a-z][-a-z]*[a-z])(?:=(.+))?$~', $option, $matches) || preg_match('~^-([a-z])=?(.*)~', $option, $matches)) {
             $name = $matches[1];
             if (!empty($matches[2])) {
                 $value = $matches[2];
             } else {
                 $next = next($options);
                 if (false === $next || '-' === $next[0]) {
                     prev($options);
                     $value = '';
                 } else {
                     $value = $next;
                 }
             }
             $this->options[$name][] = $value;
         }
         next($options);
     }
     $this->options = array_map(function ($value) {
         return 1 === count($value) ? $value[0] : $value;
     }, $this->options);
     // Compatibility with ApiGen 1.0
     foreach (array('config', 'source', 'destination') as $option) {
         if (isset($this->options[$option[0]]) && !isset($this->options[$option])) {
             $this->options[$option] = $this->options[$option[0]];
         }
         unset($this->options[$option[0]]);
     }
     return $this;
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:38,代码来源:Config.php


示例10: examineStateChange

 public function examineStateChange(&$sToken, ParseState $aParseState)
 {
     if ($sToken !== 'TABLE' and $sToken !== 'TABLES') {
         return false;
     }
     $aParseState->arrTree[] = $sToken;
     $sOriToken = $sToken;
     // IF NOT EXISTS
     $arrTokenList = array('IF', 'NOT', 'EXISTS');
     while (1) {
         $sToken = next($aParseState->arrTokenList);
         if (empty($arrTokenList) or array_shift($arrTokenList) !== $sToken) {
             break;
         }
         $aParseState->arrTree[] = $sToken;
     }
     // 到头了, table/tables 后面没有内容
     if ($sToken === false) {
         prev($aParseState->arrTokenList);
         array_pop($aParseState->arrTree);
         $sToken = $sOriToken;
         return false;
     } else {
         if (strtolower($sToken) === 'status') {
             $aParseState->arrTree[] = $sToken;
             $sToken = next($aParseState->arrTokenList);
         }
     }
     // 遇到 TABLE ,检查下一个token 是否是有效的表名
     // $sToken = next($aParseState->arrTokenList) ;
     return parent::examineStateChange($sToken, $aParseState);
 }
开发者ID:JeCat,项目名称:framework,代码行数:32,代码来源:TableKeywordParser.php


示例11: process

 public function process()
 {
     $f = $this->modx->getOption(xPDO::OPT_CACHE_PATH) . 'logs/error.log';
     $content = '';
     $tooLarge = false;
     $size = 0;
     $empty = true;
     if (file_exists($f)) {
         $size = round(@filesize($f) / 1000 / 1000, 2);
         $content = @file_get_contents($f);
         if ($size > 1) {
             $tooLarge = true;
             $lines = preg_split('/\\r\\n?|\\n/', $content);
             $content = end($lines);
             for ($i = 1; $i < $this->getProperty('last', 10); $i++) {
                 $content = prev($lines) . "\n" . $content;
             }
         }
         unset($lines);
     }
     if (mb_strlen(trim($content)) > 0 || $tooLarge) {
         $empty = false;
     }
     $connector_url = $this->modx->getOption('assets_url') . 'components/controlerrorlog/connector.php';
     $la = array('name' => $f, 'log' => $content, 'tooLarge' => $tooLarge, 'size' => $size, 'empty' => $empty, 'last' => $this->getProperty('last'), 'connector_url' => $connector_url);
     return $this->success('', $la);
 }
开发者ID:vierkantemeter,项目名称:controlErrorLog,代码行数:27,代码来源:get.class.php


示例12: solution

function solution($A)
{
    // we sort array $A in ascending order from minimum to maximum integer; if closest integers
    // don't fullfill triangular conditions, farther integers will not fulfill it also
    // index association is not maintained because rule 0 ≤ P < Q < R < N is not important;
    // namely the following rules cover every possible combination:
    // A[P] + A[Q] > A[R]
    // A[Q] + A[R] > A[P]
    // A[R] + A[P] > A[Q]
    sort($A);
    $N = count($A);
    $arrayEnd = false;
    // while we haven't reached array end
    while (!$arrayEnd) {
        $P = key($A);
        // advance the internal array pointer of an array
        next($A);
        $Q = key($A);
        next($A);
        $R = key($A);
        // if $Q and $R exist, we haven't reached array $A end
        if ($Q !== NULL && $R !== NULL) {
            // rewind the internal array pointer 1 place back
            prev($A);
            // if triangular conditions are matched
            if ($A[$P] + $A[$Q] > $A[$R] && $A[$Q] + $A[$R] > $A[$P] && $A[$R] + $A[$P] > $A[$Q]) {
                return 1;
            }
        } else {
            $arrayEnd = true;
        }
    }
    return 0;
}
开发者ID:mgd-php,项目名称:php-codility,代码行数:34,代码来源:Triangle.php


示例13: postProcessSignOff

 public function postProcessSignOff()
 {
     if ($this->checkObjectClassTypeCorrect("SignOff") == true) {
         $signOff = end($this->stack);
         // get the previous object of the stack
         $currentRecord = prev($this->stack);
         // reset stack pointer to end
         end($this->stack);
         // Signing off of the wrong type of record, this is an error! Log it and continue
         if ($currentRecord->getRegistryEntryType() !== Constants::REGISTRY_ENTRY_TYPE_INCOMING) {
             $this->logger->warn('The following RegistryEntry has been signedOff, but it is not specified as Incoming (' . Constants . REGISTRY_ENTRY_TYPE_INCOMING . '). The actual RegistryEntry is ' . $currentRecord . ' while the signOff is ' . $signOff . ' This message is coming from ' . __METHOD__);
             $this->errorsEncountered = true;
             $this->numberErrorsEncountered++;
         }
         if (isset($this->listOfRegistryEntryIncoming[$currentRecord->getSystemId()])) {
             unset($this->listOfRegistryEntryIncoming[$currentRecord->getSystemId()]);
         } else {
             $this->logger->warn('Encountered a sigoff for the following RegistryEntry, but am not expecting this RegistryEntry. The actual RegistryEntry is ' . $currentRecord . ' while the signOff is ' . $signOff . ' This message is coming from ' . __METHOD__);
             $this->errorsEncountered = true;
             $this->numberErrorsEncountered++;
         }
         $this->logger->trace('Post process SignOff. Method (' . __METHOD__ . ')' . $signOff);
     } else {
         throw new Exception(Constants::STACK_ERROR . __METHOD__ . ". Expected SignOff found " . get_class(end($this->stack)));
     }
 }
开发者ID:HaakonME,项目名称:noark5-validator,代码行数:26,代码来源:AllIncomingRegistryEntrySignedOff.php


示例14: prev

 /**
  * @return bool, moves the internal array pointer backward one place.
  *                  Returns true, or false if there is no more element before the current pointer.
  */
 public function prev()
 {
     if (false !== prev($this->array)) {
         return true;
     }
     return false;
 }
开发者ID:lingtalfi,项目名称:TokenFun,代码行数:11,代码来源:TokenArrayIterator.php


示例15: parseArguments

 /**
  * Processes and returns command line arguments.
  *
  * @param array $argv Command line arguments
  * @return array
  * @todo Throw exception if an unexpected argument is found
  */
 public function parseArguments(array $argv)
 {
     $options = array();
     while ($argument = current($argv)) {
         if (preg_match('~^--([a-z][-a-z]*[a-z])(?:=(.+))?$~', $argument, $matches) || preg_match('~^-([a-z])=?(.*)~', $argument, $matches)) {
             $name = $matches[1];
             if (!empty($matches[2])) {
                 $value = $matches[2];
             } else {
                 $next = next($argv);
                 if (false === $next || '-' === $next[0]) {
                     prev($argv);
                     $value = '';
                 } else {
                     $value = $next;
                 }
             }
             $options[$name][] = $value;
         }
         next($argv);
     }
     $options = array_map(function ($value) {
         return 1 === count($value) ? $value[0] : $value;
     }, $options);
     return $options;
 }
开发者ID:memopower,项目名称:cakephp-api-docs,代码行数:33,代码来源:ConsoleParser.php


示例16: foo

function foo(&$state)
{
    $contentDict = end($state);
    for ($contentDict = end($state); $contentDict !== false; $contentDict = prev($state)) {
        echo key($state) . " => " . current($state) . "\n";
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:bug35022.php


示例17: so_remove_all_menus

function so_remove_all_menus()
{
    global $menu, $submenu, $user_ID;
    $the_user = new WP_User($user_ID);
    $valid_page = "admin.php?page=contact-form-7/admin/admin.php";
    // only contactform7 is allowed
    $restricted = array('index.php', 'edit.php', 'categories.php', 'upload.php', 'link-manager.php', 'edit-pages.php', 'edit-comments.php', 'themes.php', 'plugins.php', 'users.php', 'profile.php', 'tools.php', 'options-general.php');
    $restricted_str = 'widgets.php';
    end($menu);
    while (prev($menu)) {
        $menu_item = $menu[key($menu)];
        $restricted_str .= '|' . $menu_item[2];
        if (in_array($menu_item[2], $restricted)) {
            $submenu_item = $submenu[$menu_item[2]];
            if ($submenu_item != NULL) {
                $tmp = $submenu_item;
                $max = array_pop(array_keys($tmp));
                for ($i = $max; $i > 0; $i -= 5) {
                    if ($submenu_item[$i] != NULL) {
                        $restricted_str .= '|' . $submenu[$menu_item[2]][$i][2];
                        unset($submenu[$menu_item[2]][$i]);
                    }
                }
            }
            unset($menu[key($menu)]);
        }
    }
    $result = preg_match('/(.*?)\\/wp-admin\\/?(' . $restricted_str . ')??((' . $restricted_str . '){1})(.*?)/', $_SERVER['REQUEST_URI']);
    if ($result != 0 && $result != FALSE) {
        wp_redirect(get_option('siteurl') . '/wp-admin/' . $valid_page);
        exit(0);
    }
}
开发者ID:SpiritPixels,项目名称:Code-Snippets,代码行数:33,代码来源:disable-sidebar-menus-4functions.php


示例18: start

 public function start()
 {
     $migrations = $this->migration->find_migrations();
     $versions = array_map('intval', array_keys($migrations));
     $db_version = intval($this->migration->get_db_version());
     end($versions);
     while ($version = prev($versions)) {
         if ($version !== $db_version) {
             break;
         }
     }
     if ($version + $db_version <= 0) {
         return $this->note("Can't rollback anymore");
     } else {
         $version === FALSE && ($version = 0);
         $this->text('Migrating database <info>DOWN</info> to version ' . '<comment>' . $version . '</comment> from <comment>' . $db_version . '</comment>');
         $case = 'reverting';
         $signal = '--';
     }
     $this->newLine();
     $this->text('<info>' . $signal . '</info> ' . $case);
     $time_start = microtime(true);
     $this->migration->version($version);
     $time_end = microtime(true);
     list($query_exec_time, $exec_queries) = $this->measureQueries($this->migration->db->queries);
     $this->summary($signal, $time_start, $time_end, $query_exec_time, $exec_queries);
 }
开发者ID:davidsosavaldes,项目名称:Craftsman,代码行数:27,代码来源:Rollback.php


示例19: getDisplayValue

 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($tree, $record = false, $recordInstance = false, $rawText = false)
 {
     $template = $this->get('field')->getFieldParams();
     $name = Vtiger_Cache::get('TreeData' . $template, $tree);
     if ($name) {
         return $name;
     }
     $adb = PearDatabase::getInstance();
     $result = $adb->pquery('SELECT * FROM vtiger_trees_templates_data WHERE templateid = ? AND tree = ?', [$template, $tree]);
     $parentName = '';
     $module = $this->get('field')->getModuleName();
     $name = false;
     if ($adb->num_rows($result)) {
         if ($adb->query_result_raw($result, 0, 'depth') > 0) {
             $parenttrre = $adb->query_result_raw($result, 0, 'parenttrre');
             $pieces = explode('::', $parenttrre);
             end($pieces);
             $parent = prev($pieces);
             $result2 = $adb->pquery('SELECT name FROM vtiger_trees_templates_data WHERE templateid = ? AND tree = ?', [$template, $parent]);
             $parentName = $adb->query_result_raw($result2, 0, 'name');
             $parentName = '(' . vtranslate($parentName, $module) . ') ';
         }
         $name = $parentName . vtranslate($adb->query_result($result, 0, 'name'), $module);
     }
     Vtiger_Cache::set('TreeData' . $template, $tree, $name);
     return $name;
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:32,代码来源:Tree.php


示例20: _get_prev_item

  function _get_prev_item(&$items, $current_id)
  {
    reset($items);
    $prev = array();

    foreach(array_keys($items) as $id)
      if ($current_id == $items[$id]['id'])
      {
        break;
      }
      else
      {
        next($items);
      }

    if (($item = prev($items)) !== false)
      return $item;
    else
      return array();

    if (!$prev)
      return array();
    if($prev['id'] == $current_id)
      return array();
    return $prev;
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:presentation_datasource.class.php



注:本文中的prev函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP previous_comments_link函数代码示例发布时间:2022-05-15
下一篇:
PHP prettyprint_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap