sanitize() public method

sanitize the alias
Since: 2.2.0
public sanitize ( string $alias = null ) : string
$alias string alias for routes and users
return string
Ejemplo n.º 1
0
 /**
  * testAlias
  *
  * @since 2.2.0
  *
  * @param string $alias
  * @param string $expect
  *
  * @dataProvider providerAlias
  */
 public function testAlias($alias = null, $expect = null)
 {
     /* setup */
     $filter = new Filter\Alias();
     /* actual */
     $actual = $filter->sanitize($alias);
     /* compare */
     $this->assertEquals($expect, $actual);
 }
Ejemplo n.º 2
0
 /**
  * adminNotificationStart
  *
  * @since 2.2.0
  */
 public static function adminNotificationStart()
 {
     $output = '';
     $aliasFilter = new Filter\Alias();
     $urlVersion = 'http://service.redaxscript.com/version/' . $aliasFilter->sanitize(Language::get('version', '_package'));
     $urlNews = 'http://service.redaxscript.com/news';
     /* get contents */
     $contentsVersion = file_get_contents($urlVersion);
     $contentsNews = file_get_contents($urlNews);
     /* collect version output */
     if ($contentsVersion) {
         $output = $contentsVersion;
     }
     /* collect news output */
     if ($contentsNews) {
         $output .= $contentsNews;
     }
     echo $output;
 }
Ejemplo n.º 3
0
 /**
  * adminPanelNotification
  *
  * @since 3.0.0
  *
  * @return array
  */
 public static function adminPanelNotification()
 {
     $output = [];
     $reader = new Reader();
     $aliasFilter = new Filter\Alias();
     $version = $aliasFilter->sanitize(Language::get('version', '_package'));
     /* load result */
     $urlVersion = 'http://service.redaxscript.com/version/' . $version;
     $urlNews = 'http://service.redaxscript.com/news/' . $version;
     $resultVersion = $reader->loadJSON($urlVersion)->getArray();
     $resultNews = $reader->loadJSON($urlNews)->getArray();
     /* merge as needed */
     if (is_array($resultVersion)) {
         $output = array_merge_recursive($output, $resultVersion);
     }
     if (is_array($resultNews)) {
         $output = array_merge_recursive($output, $resultNews);
     }
     return $output;
 }