Exemple #1
0
 protected function execute(array $arguments)
 {
     if (isset($arguments[0]) && Str::isUrl($arguments[0]) && ($wf_id = (int) $GLOBALS['workflow_id'])) {
         WorkflowRepository::component_result($wf_id, 'image-view', $arguments[0]);
         return '';
     }
     throw new InvalidArgumentException('strings invalid');
 }
Exemple #2
0
 protected function execute(array $arguments)
 {
     if (isset($arguments[0]) && Str::isUrl($arguments[0])) {
         global $di, $config;
         $check = $di->get('db')->prepare('SELECT * FROM fun_short_url WHERE url=? LIMIT 1');
         $check->execute([$arguments[0]]);
         $url = $check->fetch();
         if ($url) {
             $flag = $url['hash_id'];
         } else {
             $flag = Str::random(8);
             $insert = $di->get('db')->prepare('INSERT INTO fun_short_url (hash_id, url) VALUES (?, ?)');
             $insert->execute([$flag, $arguments[0]]);
         }
         return $config->application->domain . '/url/' . $flag;
     }
     throw new InvalidArgumentException('strings invalid');
 }
Exemple #3
0
 protected function execute(array $arguments)
 {
     if (isset($arguments[0]) && Str::isUrl($arguments[0])) {
         $url = 'error';
         preg_match('/\\/url\\/([a-zA-Z]+)$/', $arguments[0], $flag);
         if (isset($flag[1])) {
             global $di;
             $check = $di->get('db')->prepare('SELECT * FROM fun_short_url WHERE hash_id=? LIMIT 1');
             $check->execute([$flag[1]]);
             $url_res = $check->fetch();
             if ($url_res) {
                 $url = $url_res['url'];
             }
         }
         return $url;
     }
     throw new InvalidArgumentException('strings invalid');
 }
Exemple #4
0
 public function testIsUrl()
 {
     $this->assertTrue(Str::isUrl("http://www.xx.com"));
 }