当前位置: 首页>>代码示例>>PHP>>正文


PHP Parser::get_parse_chain方法代码示例

本文整理汇总了PHP中Parser::get_parse_chain方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::get_parse_chain方法的具体用法?PHP Parser::get_parse_chain怎么用?PHP Parser::get_parse_chain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


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

示例1: testParsers

 function testParsers()
 {
     /* inputs and expected outputs */
     $input_output = array('WillNotMatchAnythingEver' => array());
     $chain = Parser::get_parse_chain();
     foreach ($input_output as $input => $output) {
         $actual = $output;
         foreach ($chain as $class) {
             $obj = new $class();
             $chk = $obj->check($input);
             $this->assertInternalType('boolean', $chk);
             if ($chk) {
                 $actual = $obj->parse($input);
                 break;
             }
         }
         $this->assertEquals($output, $actual);
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:19,代码来源:ParsersTest.php

示例2: get_preparse_chain

 /**
   Gather preparse modules
   @return array of Parser class names
 
   Scan the preparse directory for module files.
   Return an array of available modules.
 */
 public static function get_preparse_chain()
 {
     return Parser::get_parse_chain('PreParser');
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:11,代码来源:PreParser.php

示例3: preprocess

 function preprocess()
 {
     $this->display = "";
     $sd = MiscLib::scaleObject();
     $entered = "";
     if (isset($_REQUEST["reginput"])) {
         $entered = strtoupper(trim($_REQUEST["reginput"]));
     }
     if (substr($entered, -2) == "CL") {
         $entered = "CL";
     }
     if ($entered == "RI") {
         $entered = CoreLocal::get("strEntered");
     }
     if (CoreLocal::get("msgrepeat") == 1 && $entered != "CL") {
         $entered = CoreLocal::get("strRemembered");
         CoreLocal::set('strRemembered', '');
     }
     CoreLocal::set("strEntered", $entered);
     $json = array();
     if ($entered != "") {
         if (in_array("Paycards", CoreLocal::get("PluginList"))) {
             /* this breaks the model a bit, but I'm putting
              * putting the CC parser first manually to minimize
              * code that potentially handles the PAN */
             if (CoreLocal::get("PaycardsCashierFacing") == "1" && substr($entered, 0, 9) == "PANCACHE:") {
                 /* cashier-facing device behavior; run card immediately */
                 $entered = substr($entered, 9);
                 CoreLocal::set("CachePanEncBlock", $entered);
             }
             $pe = new paycardEntered();
             if ($pe->check($entered)) {
                 $valid = $pe->parse($entered);
                 $entered = "PAYCARD";
                 CoreLocal::set("strEntered", "");
                 $json = $valid;
             }
             CoreLocal::set("quantity", 0);
             CoreLocal::set("multiple", 0);
         }
         /* FIRST PARSE CHAIN:
          * Objects belong in the first parse chain if they
          * modify the entered string, but do not process it
          * This chain should be used for checking prefixes/suffixes
          * to set up appropriate session variables.
          */
         $parser_lib_path = $this->page_url . "parser-class-lib/";
         if (!is_array(CoreLocal::get("preparse_chain"))) {
             CoreLocal::set("preparse_chain", PreParser::get_preparse_chain());
         }
         foreach (CoreLocal::get("preparse_chain") as $cn) {
             if (!class_exists($cn)) {
                 continue;
             }
             $p = new $cn();
             if ($p->check($entered)) {
                 $entered = $p->parse($entered);
             }
             if (!$entered || $entered == "") {
                 break;
             }
         }
         if ($entered != "" && $entered != "PAYCARD") {
             /* 
              * SECOND PARSE CHAIN
              * these parser objects should process any input
              * completely. The return value of parse() determines
              * whether to call lastpage() [list the items on screen]
              */
             if (!is_array(CoreLocal::get("parse_chain"))) {
                 CoreLocal::set("parse_chain", Parser::get_parse_chain());
             }
             $result = False;
             foreach (CoreLocal::get("parse_chain") as $cn) {
                 if (!class_exists($cn)) {
                     continue;
                 }
                 $p = new $cn();
                 if ($p->check($entered)) {
                     $result = $p->parse($entered);
                     break;
                 }
             }
             if ($result && is_array($result)) {
                 // postparse chain: modify result
                 if (!is_array(CoreLocal::get("postparse_chain"))) {
                     CoreLocal::set("postparse_chain", PostParser::getPostParseChain());
                 }
                 foreach (CoreLocal::get('postparse_chain') as $class) {
                     if (!class_exists($class)) {
                         continue;
                     }
                     $obj = new $class();
                     $result = $obj->parse($result);
                 }
                 $json = $result;
                 if (isset($result['udpmsg']) && $result['udpmsg'] !== False) {
                     if (is_object($sd)) {
                         $sd->WriteToScale($result['udpmsg']);
                     }
//.........这里部分代码省略.........
开发者ID:phpsmith,项目名称:IS4C,代码行数:101,代码来源:pos2.php

示例4: foreach

     if ($p->check($entered)) {
         $entered = $p->parse($entered);
     }
     if (!$entered || $entered == "") {
         break;
     }
 }
 if ($entered != "" && $entered != "PAYCARD") {
     /* 
      * SECOND PARSE CHAIN
      * these parser objects should process any input
      * completely. The return value of parse() determines
      * whether to call lastpage() [list the items on screen]
      */
     if (!is_array(CoreLocal::get("parse_chain"))) {
         CoreLocal::set("parse_chain", Parser::get_parse_chain());
     }
     $result = False;
     foreach (CoreLocal::get("parse_chain") as $cn) {
         if (!class_exists($cn)) {
             continue;
         }
         $p = new $cn();
         if ($p->check($entered)) {
             $result = $p->parse($entered);
             break;
         }
     }
     if ($result && is_array($result)) {
         // postparse chain: modify result
         if (!is_array(CoreLocal::get("postparse_chain"))) {
开发者ID:phpsmith,项目名称:IS4C,代码行数:31,代码来源:ajax-parser.php


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