コード例 #1
0
ファイル: File.php プロジェクト: dextercowley/jissues
 /**
  * Constructor
  *
  * @param   Application  $application  The Application
  * @param   string       $key          The file's key in $_FILES superglobal
  *
  * @since   1.0
  */
 public function __construct(Application $application, $key = 'files')
 {
     $this->application = $application;
     $storage = new FileSystem(JPATH_THEMES . '/' . $this->application->get('system.upload_dir') . '/' . $this->application->getProject()->project_id);
     if (is_array($_FILES[$key])) {
         $_FILES[$key]['name'] = $_FILES[$key]['name'][0];
         $_FILES[$key]['error'] = $_FILES[$key]['error'][0];
         $_FILES[$key]['tmp_name'] = $_FILES[$key]['tmp_name'][0];
     }
     parent::__construct($key, $storage);
     $this->setValidations();
 }
コード例 #2
0
ファイル: TrackerDebugger.php プロジェクト: joomlla/jissues
    /**
     * Get the navigation bar.
     *
     * @return  array
     *
     * @since   1.0
     */
    private function getNavigation()
    {
        $navigation = array();
        // OK, here comes some very beautiful CSS !!
        // It's kinda "hidden" here, so evil template designers won't find it :P
        $navigation[] = '
		<style>
			div#debugBar { background-color: #eee; }
			div#debugBar a:hover { background-color: #ddd; }
			div#debugBar a:active { background-color: #ccc; }
			pre.dbQuery { background-color: #333; color: white; font-weight: bold; }
			span.dbgTable { color: yellow; }
			span.dbgCommand { color: lime; }
			span.dbgOperator { color: red; }
			div:target { border: 2px dashed orange; padding: 5px; transition:all 0.5s ease;}
			body { margin-bottom: 50px; }
		</style>
		';
        $navigation[] = '<div class="navbar navbar-fixed-bottom" id="debugBar">';
        $navigation[] = '<a class="brand" href="#top" class="hasTooltip" title="' . g11n3t('Go up') . '">' . '&nbsp;<i class="icon icon-joomla"></i></a>';
        $navigation[] = '<ul class="nav">';
        if ($this->application->get('debug.database')) {
            $count = count($this->getLog('db'));
            $navigation[] = '<li class="hasTooltip"' . ' title="' . sprintf(g11n4t('One database query', '%d database queries', $count), $count) . '">' . '<a href="#dbgDatabase"><i class="icon icon-database"></i> ' . $this->getBadge($count) . '</a></li>';
        }
        if ($this->application->get('debug.system')) {
            $profile = $this->getProfile();
            $navigation[] = '<li class="hasTooltip"' . ' title="' . g11n3t('Profile') . '">' . '<a href="#dbgProfile"><i class="icon icon-lightning"></i> ' . sprintf('%s MB', $this->getBadge(number_format($profile->peak / 1000000, 2))) . ' ' . sprintf('%s ms', $this->getBadge(number_format($profile->time * 1000))) . '</a></li>';
        }
        if ($this->application->get('debug.language')) {
            $info = $this->getLanguageStringsInfo();
            $badge = $this->getBadge($info->untranslateds, [1 => 'badge-warning']);
            $count = count(g11n::getEvents());
            $navigation[] = '<li class="hasTooltip"' . ' title="' . sprintf(g11n4t('One untranslated string of %2$d', '%1$d untranslated strings of %2$d', $info->untranslateds), $info->untranslateds, $info->total) . '">' . '<a href="#dbgLanguageStrings"><i class="icon icon-question-sign"></i>  ' . $badge . '/' . $this->getBadge($info->total) . '</a></li>';
            $navigation[] = '<li class="hasTooltip"' . ' title="' . sprintf(g11n4t('One language file loaded', '%d language files loaded', $count), $count) . '">' . '<a href="#dbgLanguageFiles"><i class="icon icon-file-word"></i> ' . $this->getBadge($count) . '</a></li>';
        }
        if ($this->application->get('debug.system')) {
            $user = $this->application->getUser();
            $project = $this->application->getProject();
            $title = $project ? $project->title : g11n3t('No Project');
            // Add build commit if available
            $buildHref = '#';
            if (file_exists(JPATH_ROOT . '/current_SHA')) {
                $build = trim(file_get_contents(JPATH_ROOT . '/current_SHA'));
                preg_match('/-g([0-9a-z]+)/', $build, $matches);
                $buildHref = $matches ? 'https://github.com/joomla/jissues/commit/' . $matches[1] : '#';
            } else {
                $composer = json_decode(trim(file_get_contents(JPATH_ROOT . '/composer.json')));
                $build = $composer->version;
            }
            $navigation[] = '<li class="hasTooltip"' . ' title="' . g11n3t('User') . '">' . '<a href="#dbgUser"><i class="icon icon-user"></i> <span class="badge">' . ($user && $user->username ? $user->username : g11n3t('Guest')) . '</span></a></li>';
            $navigation[] = '<li class="hasTooltip"' . ' title="' . g11n3t('Project') . '">' . '<a href="#dbgProject"><i class="icon icon-cube"></i> <span class="badge">' . $title . '</span></a></li>';
            // Display the build to admins
            if ($this->application->getUser()->isAdmin) {
                $navigation[] = '<li class="hasTooltip"' . ' title="' . g11n3t('Build') . '">' . '<a href="' . $buildHref . '"><i class="icon icon-broadcast"></i> <span class="badge">' . $build . '</span></a></li>';
            }
        }
        $navigation[] = '</ul>';
        $navigation[] = '</div>';
        return $navigation;
    }