示例#1
0
 public function indexAction()
 {
     // $this->view->disable();
     $userAgent = $this->request->getUserAgent();
     $ipaddress = $this->request->getClientAddress(true);
     echo 'Browser: ' . UtilityHelper::getBrowserInfo($userAgent) . '<br />';
     echo 'OS: ' . UtilityHelper::getOSInfo($userAgent) . '<br />';
     echo 'IPAddress: ' . $ipaddress;
 }
示例#2
0
 public function slugAction()
 {
     if ($this->request->isPost()) {
         $text = $this->request->getPost('name');
         echo UtilityHelper::String2Slug($text);
         exit;
         $text = strtolower($text);
         $entities_match = array(' ', '--', '&quot;', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{', '}', '|', ':', '"', '<', '>', '?', '[', ']', '\\', ';', "'", ',', '.', '/', '*', '+', '~', '`', '=');
         $entities_replace = array('-', '-', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
         $text = str_replace($entities_match, $entities_replace, $text);
         $text = @ereg_replace('(--)+', '', $text);
         $text = @ereg_replace('(-)$', '', $text);
         echo $text;
     }
 }
 public function indexAction()
 {
     $this->view->disable();
     $url = 'https://www.blognone.com/atom.xml';
     $variable = file_get_contents($url);
     $variable = simplexml_load_string($variable);
     // show get RSS Feed
     foreach ($variable->channel->item as $value) {
         $title = $value->title;
         $slug = UtilityHelper::String2Slug($title);
         $content = strip_tags($value->description);
         echo "title: {$title}<br />";
         echo "slug: {$slug}<br />";
         // echo "content: $content<br />";
         echo 'tag: ';
         $i = 0;
         foreach ($value->category as $category) {
             echo $i != 0 ? ',' . $category : $category;
             $i++;
         }
         echo '<hr />';
     }
 }