예제 #1
0
파일: Scrape.php 프로젝트: vNative/vnative
 protected function _fetch()
 {
     $html = $this->_html();
     $allWordsArray = str_word_count(strip_tags($html), 1);
     $allWordsArray = Helper::clean($allWordsArray);
     $allWordsArray = Helper::removeCommonWords($allWordsArray);
     return ArrayMethods::clean($allWordsArray);
 }
예제 #2
0
파일: inspector.php 프로젝트: soanni/mvc
 protected function _parse($comment)
 {
     $meta = array();
     $pattern = "(@[a-zA-Z]+\\s*[a-zA-Z0-9, ()_]*)";
     $matches = StringMethods::match($comment, $pattern);
     if ($matches != null) {
         foreach ($matches as $match) {
             $parts = ArrayMethods::clean(ArrayMethods::trim(StringMethods::split($match, "[\\s]", 2)));
             $meta[$parts[0]] = true;
             if (sizeof($parts) > 1) {
                 $meta[$parts[0]] = ArrayMethods::clean(ArrayMethods::trim(StringMethods::split($parts[1], ",")));
             }
         }
     }
     return $meta;
 }
예제 #3
0
 /**
  * De-construct a template string into tags and text using 
  * Implementation\match()
  * @param  string $source Template string to be broken up
  * @return array
  */
 protected function _array($source)
 {
     $parts = array();
     $tags = array();
     $all = array();
     $type = null;
     $delimiter = null;
     while ($source) {
         //Evaluate a source string to determine if it
         // matches a tag or a statement
         $match = $this->_implementation->match($source);
         $type = $match['type'];
         $delimiter = $match['delimiter'];
         $opener = strpos($source, $type['opener']);
         $closer = strpos($source, $type['closer']) + strlen($type['closer']);
         // If there is an opener the string is a tag
         if ($opener !== false) {
             $parts[] = substr($source, 0, $opener);
             $tags[] = substr($source, $opener, $closer - $opener);
             $source = substr($source, $closer);
         } else {
             $parts[] = $source;
             $source = "";
         }
     }
     foreach ($parts as $i => $part) {
         $all[] = $part;
         if (isset($tags[$i])) {
             $all[] = $tags[$i];
         }
     }
     return array('text' => ArrayMethods::clean($parts), 'tags' => ArrayMethods::clean($tags), 'all' => ArrayMethods::clean($all));
 }
예제 #4
0
 /**
  * Deconstructs a template string into arrays of tags, text, and a combination of the two.
  * @param type $source
  * @return type
  */
 protected function _array($source)
 {
     $parts = array();
     $tags = array();
     $all = array();
     $type = null;
     $delimiter = null;
     while ($source) {
         $match = $this->_implementation->match($source);
         $type = $match["type"];
         $delimiter = $match["delimiter"];
         $opener = strpos($source, $type["opener"]);
         $closer = strpos($source, $type["closer"]) + strlen($type["closer"]);
         if ($opener !== false) {
             $parts[] = substr($source, 0, $opener);
             $tags[] = substr($source, $opener, $closer - $opener);
             $source = substr($source, $closer);
         } else {
             $parts[] = $source;
             $source = "";
         }
     }
     foreach ($parts as $i => $part) {
         $all[] = $part;
         if (isset($tags[$i])) {
             $all[] = $tags[$i];
         }
     }
     return array("text" => ArrayMethods::clean($parts), "tags" => ArrayMethods::clean($tags), "all" => ArrayMethods::clean($all));
 }
예제 #5
0
파일: apikey.php 프로젝트: vNative/vnative
 public function updateIps()
 {
     $request = RequestMethods::post('ips');
     $ips = ArrayMethods::clean($request);
     $this->_ips = $ips;
 }