Example #1
0
 public static function getJsWp()
 {
     $dop_dir = DOP_DIR;
     $name = Config::$wp['name'];
     $type = Config::$wp['type'] == 'theme' ? 'themes' : 'plugins';
     foreach (AssetsConfig::js() as $js) {
         if ($js[0] == '/') {
             echo "<script type='text/javascript' src='{$js}'></script>";
         } else {
             echo "<script type='text/javascript' src='wp-content/{$type}/{$name}{$dop_dir}/assets/{$js}'></script>";
         }
     }
 }
Example #2
0
 public static function init($configFilePath)
 {
     $configFilePath = realpath($configFilePath);
     if (!file_exists($configFilePath)) {
         throw new ConfigException("can't load config from {$configFilePath}");
     }
     $config = (require $configFilePath);
     $config['path']['serverRoot'] = rtrim(realpath($config['path']['serverRoot']), DIRECTORY_SEPARATOR);
     if ($config['path']['serverRoot'] === false) {
         throw new AssetsException('Error config for server root path.');
     }
     $config['path']['fonts'] = self::_parsePath('fonts', $config['path']);
     $config['path']['images'] = self::_parsePath('images', $config['path']);
     $config['path']['javascripts'] = self::_parsePath('javascripts', $config['path']);
     $config['path']['stylesheets'] = self::_parsePath('stylesheets', $config['path']);
     AssetLoader::init($config['path']['serverRoot'], $config['path']['javascripts'], $config['path']['stylesheets']);
     self::$_config = $config;
 }