コード例 #1
0
ファイル: users.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Display an image.
  *
  * @param   string	$src  The source of the image
  *
  * @return  string  A <img> element if the specified file exists, otherwise, a null string
  *
  * @since   2.5
  */
 public static function image($src)
 {
     $src = preg_replace('#[^A-Z0-9\\-_\\./]#i', '', $src);
     $file = JPATH_SITE . '/' . $src;
     \Hubzero\Filesystem\Util::checkPath($file);
     if (!file_exists($file)) {
         return '';
     }
     return '<img src="' . Request::root() . $src . '" alt="" />';
 }
コード例 #2
0
ファイル: component.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  * @since   1.6
  */
 protected function populateState()
 {
     // Set the component (option) we are dealing with.
     $component = Request::getCmd('component');
     $this->setState('component.option', $component);
     // Set an alternative path for the configuration file.
     if ($path = Request::getString('path')) {
         $path = Filesystem::cleanPath($path);
         \Hubzero\Filesystem\Util::checkPath(PATH_ROOT . DS . $path);
         $this->setState('component.path', $path);
     }
 }