private function createRowTag($widget, $input, opTheme $theme)
 {
     $linkUrl = sfContext::getInstance()->getConfiguration()->generateAppUrl('pc_frontend', array('sf_route' => 'skin_preview', 'theme_name' => $theme->getThemeDirName()), true);
     $linkTag = '<a href="' . $linkUrl . '" target="_blank">' . sfContext::getInstance()->getI18n()->__('Preview') . '</a>';
     if (0 === strpos($theme->getThemeURI(), 'http', 0)) {
         $themeName = '<a href="' . $theme->getThemeURI() . '" target="_blank">' . $theme->getThemeName() . '</a>';
     } else {
         $themeName = $theme->getThemeName();
     }
     if (0 === strpos($theme->getAuthorURI(), 'http', 0)) {
         $author = '<a href="' . $theme->getAuthorURI() . '" target="_blank">' . $theme->getAuthor() . '</a>';
     } else {
         $author = $theme->getAuthor();
     }
     $rowContents = array('button' => $input['input'], 'name' => $themeName, 'author' => $author, 'version' => $theme->getVersion(), 'description' => $theme->getDescription(), 'link' => $linkTag);
     $rowContentTag = '';
     foreach ($rowContents as $content) {
         $rowContentTag .= $widget->renderContentTag('td', $content);
     }
     return $widget->renderContentTag('tr', $rowContentTag);
 }
 /**
  * Get all of the theme list that have been installed.
  *
  * @return array all of theme list that have been installed.
  */
 public function getThemes()
 {
     $allDirNames = $this->_getAllDirectoryNames();
     $validDirNames = array();
     $invalidDirNames = array();
     // validate the directory names
     foreach ($allDirNames as $dirName) {
         // validate the directory names is Alphanumeric
         if (preg_match("/^[a-zA-Z0-9_-]+\$/", $dirName)) {
             $validDirNames[] = $dirName;
         } else {
             $invalidDirNames[] = $dirName;
         }
     }
     $themeObjects = array();
     $notExistsMainCssDirNames = array();
     // validate the directory names has main.css
     foreach ($validDirNames as $dirName) {
         //it is not treated as a theme directory that there is no main.css
         $mainCssPath = $this->getThemePath() . '/' . $dirName . '/css/main.css';
         if (file_exists($mainCssPath)) {
             $themeObj = new opTheme($dirName);
             if (null != $themeObj->getThemeName() && null != $themeObj->getAuthor()) {
                 $themeObjects[$dirName] = new opTheme($dirName);
             } else {
                 $notExistsMainCssDirNames[] = $dirName;
             }
         } else {
             $notExistsMainCssDirNames[] = $dirName;
         }
     }
     $notThemeDirNames = array('invalid' => $invalidDirNames, 'maincss' => $notExistsMainCssDirNames);
     return array('valid' => $themeObjects, 'invalid' => $notThemeDirNames);
 }