コード例 #1
0
 /**
  * create Font via Python with FontForge
  *
  * @param int $fontUid
  * @param object $currentFont
  * @return array
  */
 public static function createFont($fontUid, $currentFont)
 {
     // general vars
     $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fontawesomeplus']);
     $pathToPythonBin = escapeshellarg($extConf['pathToPython']);
     $pathToScript = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fontawesomeplus') . 'Resources/Private/Python/fontawesomeplus.py';
     $iconRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
     $iconReferences = $iconRepository->findByRelation('tx_fontawesomeplus_domain_model_font', 'icons', $fontUid);
     $svgArray = array();
     foreach ($iconReferences as $key => $value) {
         $svgArray[$key] = PATH_site . 'fileadmin' . $value->getIdentifier();
     }
     $unicodeArray = array();
     $i = hexdec(self::HEXADECIMAL);
     foreach ($svgArray as $key => $value) {
         $unicodeArray[$key] = $i . ',uni' . dechex($i);
         $i++;
     }
     $fontPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fontawesomeplus') . 'Resources/Public/Contrib/' . self::FACONTRIB . '/fonts/fontawesome-webfont.svg';
     $fontForgeArray = CommandUtility::escapeShellArgument(json_encode(array_combine($svgArray, $unicodeArray), JSON_UNESCAPED_SLASHES));
     $fontName = strtolower(preg_replace(array('/\\s+/', '/[^a-zA-Z0-9]/'), array('-', ''), $currentFont->getTitle()));
     $comment = CommandUtility::escapeShellArgument(str_replace(array("\r\n", "\n", "\r"), ' ', $currentFont->getDescription()));
     $copyright = CommandUtility::escapeShellArgument('netweiser');
     $version = CommandUtility::escapeShellArgument($currentFont->getVersion());
     GeneralUtility::mkdir_deep(PATH_site . 'fileadmin/' . $currentFont->getDestination(), $fontName . '/fonts/');
     $savedir = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $fontName . '/fonts/';
     CommandUtility::exec("{$pathToPythonBin} {$pathToScript} {$fontPath} {$fontForgeArray} {$fontName} {$comment} {$copyright} {$version} {$savedir} 2>&1", $feedback, $returnCode);
     if ((int) $returnCode !== 0) {
         return $feedback;
     }
 }
コード例 #2
0
ファイル: Action.php プロジェクト: ksecor/civicrm
 /**
  * returns the user to the top of the user context stack.
  *
  * @return void
  * @access public
  */
 function popUserContext()
 {
     $session =& CRM_Core_Session::singleton();
     $config =& CRM_Core_Config::singleton();
     // check if destination is set, if so goto destination
     $destination = $this->_stateMachine->getDestination();
     if ($destination) {
         $destination = urldecode($destination);
     } else {
         $destination = $session->popUserContext();
         if (empty($destination)) {
             $destination = $config->userFrameworkBaseURL;
         }
     }
     CRM_Utils_System::redirect($destination);
 }
コード例 #3
0
ファイル: StateMachine.php プロジェクト: hyebahi/civicrm-core
 /**
  * @return mixed
  */
 public function getDestination()
 {
     return $this->_controller->getDestination();
 }
コード例 #4
0
 /**
  * create SCSS
  *
  * @param int $fontUid
  * @param object $currentFont
  * @return void
  */
 public static function createScss($fontUid, $currentFont)
 {
     $fontName = strtolower(preg_replace(array('/\\s+/', '/[^a-zA-Z0-9]/'), array('-', ''), $currentFont->getTitle()));
     $originalPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fontawesomeplus') . 'Resources/Public/Contrib/' . self::FACONTRIB;
     $destinationPath = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $fontName . '/scss/';
     $newIconsArray = static::buildIconsArray($fontUid);
     $fontComment = 'License)' . LF . ' *  ' . LF . ' *  Extended with TYPO3 EXT:fontawesomeplus <*****@*****.**>' . LF . ' *  ' . $fontName . ' Version: ' . $currentFont->getVersion() . LF . ' *';
     GeneralUtility::mkdir_deep(PATH_site . 'fileadmin/' . $currentFont->getDestination(), $fontName . '/scss/');
     $scssFiles = GeneralUtility::getFilesInDir($originalPath . '/scss/', 'scss');
     foreach ($scssFiles as $scssFile) {
         copy($originalPath . '/scss/' . $scssFile, $destinationPath . str_replace('font-awesome', $fontName, $scssFile));
     }
     $renderScss = str_replace('License)', $fontComment, GeneralUtility::getUrl($destinationPath . $fontName . '.scss'));
     GeneralUtility::writeFile($destinationPath . $fontName . '.scss', $renderScss);
     $coreScss = str_replace('FontAwesome', ucwords($fontName), GeneralUtility::getUrl($destinationPath . self::SCSS_CORE));
     GeneralUtility::writeFile($destinationPath . self::SCSS_CORE, $coreScss);
     $iconsScss = GeneralUtility::getUrl($destinationPath . self::SCSS_ICONS);
     foreach ($newIconsArray as $newIcon) {
         $iconsScss .= '.#{$fa-css-prefix}-' . $newIcon['class'] . ':before { content: $fa-var-' . $newIcon['class'] . '; }' . LF;
     }
     GeneralUtility::writeFile($destinationPath . self::SCSS_ICONS, $iconsScss);
     $mixinsScss = str_replace('FontAwesome', ucwords($fontName), GeneralUtility::getUrl($destinationPath . self::SCSS_MIXINS));
     GeneralUtility::writeFile($destinationPath . self::SCSS_MIXINS, $mixinsScss);
     $pathScss = static::replaceStrings($fontName, $currentFont, GeneralUtility::getUrl($destinationPath . self::SCSS_PATH));
     GeneralUtility::writeFile($destinationPath . self::SCSS_PATH, $pathScss);
     $variablesScss = GeneralUtility::getUrl($destinationPath . self::SCSS_VARIABLES);
     foreach ($newIconsArray as $newIcon) {
         $variablesScss .= '$fa-var-' . $newIcon['class'] . ': "\\' . $newIcon['unicode'] . '";' . LF;
     }
     GeneralUtility::writeFile($destinationPath . self::SCSS_VARIABLES, $variablesScss);
 }
コード例 #5
0
 /**
  * delete zip file
  *
  * @param object $currentFont
  * @return bool $result
  */
 public static function deleteZip($currentFont, $filename)
 {
     $filePath = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $filename;
     $result = unlink($filePath);
     return $result;
 }