Exemplo n.º 1
0
 public static function generateXfcpClass($clazz, $realClazz, DevHelper_Config_Base $config)
 {
     $ghostClazz = str_replace($config->getClassPrefix(), $config->getClassPrefix() . '_DevHelper_XFCP', $clazz);
     $ghostPath = DevHelper_Generator_File::getClassPath($ghostClazz);
     if (file_exists($ghostPath)) {
         // ghost file exists, yay!
         return true;
     }
     $ghostContents = "<?php\n\nclass XFCP_{$clazz} extends {$realClazz}\n{\n}\n";
     return DevHelper_Generator_File::filePutContents($ghostPath, $ghostContents);
 }
Exemplo n.º 2
0
 public static function getFieldName(DevHelper_Config_Base $config, $name, $ignoreDash = false)
 {
     if ($ignoreDash or strpos($name, '_') === false) {
         return strtolower($config->getPrefix() . '_' . $name);
     } else {
         return strtolower($name);
     }
 }
Exemplo n.º 3
0
 public function saveAddOnConfig($addOn, DevHelper_Config_Base $config)
 {
     $className = DevHelper_Generator_File::getClassName($addOn['addon_id'], 'DevHelper_Config');
     DevHelper_Generator_File::write($className, $config->outputSelf());
 }
Exemplo n.º 4
0
 public static function generateHashesFile(array $addOn, DevHelper_Config_Base $config, array $directories)
 {
     $hashes = array();
     /** @var XenForo_Application $application */
     $application = XenForo_Application::getInstance();
     $root = rtrim(realpath($application->getRootDir()), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $excludes = $config->getExportExcludes();
     foreach ($directories as $key => $directory) {
         $directoryHashes = XenForo_Helper_Hash::hashDirectory($directory, array('.php', '.js'));
         foreach ($directoryHashes as $filePath => $hash) {
             if (strpos($filePath, 'DevHelper') === false and strpos($filePath, 'FileSums') === false) {
                 $relative = str_replace($root, '', $filePath);
                 $excluded = false;
                 foreach ($excludes as $exclude) {
                     if (strpos($relative, $exclude) === 0) {
                         $excluded = true;
                         break;
                     }
                 }
                 if ($excluded) {
                     continue;
                 }
                 $hashes[$relative] = $hash;
             }
         }
     }
     $fileSumsClassName = self::getClassName($addOn['addon_id'], 'FileSums', $config);
     $fileSumsContents = XenForo_Helper_Hash::getHashClassCode($fileSumsClassName, $hashes);
     self::writeClass($fileSumsClassName, $fileSumsContents);
 }