public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency instanceof Kwf_Assets_Dependency_File_Js && $dependency->getFileNameWithType() == 'ext2/src/core/EventManager.js') { return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_USES => array(new Kwf_Assets_Dependency_File_Js('kwf/Ext/ext-lang-en.js'))); } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency->getMimeType() == 'text/css') { if (strpos($dependency->getContentsSourceString(), 'el-breakpoint') === false) { return array(); } $contents = $dependency->getContents('en'); if (preg_match_all('#([^}{]*){[^}]*kwf-responsive-el-gt:\\s*([0-9]+)#', $contents, $m)) { $selectors = array(); foreach (array_keys($m[1]) as $k) { if (!isset($selectors[$m[1][$k]])) { $selectors[$m[1][$k]] = array(); } $selectors[$m[1][$k]][] = $m[2][$k]; } foreach ($selectors as $selector => $breakpoints) { $d = new Kwf_Assets_ResponsiveEl_JsDependency(trim($selector), $breakpoints, 'ResponsiveEl-' . $dependency->__toString()); $d->addDependency(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_COMMONJS, $this->_providerList->findDependency('kwf/responsive-el'), 'kwf/responsive-el'); $ret[] = $d; } return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret); } } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency instanceof Kwf_Assets_Dependency_File_Js && $dependency->getFileNameWithType() != 'kwf/Kwf_js/Utils/Element.js') { $deps = array(); $c = file_get_contents($dependency->getAbsoluteFileName()); if (preg_match('#^\\s*Kwf\\.Utils\\.ResponsiveEl\\(#m', $c)) { $deps[] = 'KwfResponsiveEl'; } if (preg_match('#^\\s*Kwf\\.on(Element)(Ready|Show|Hide|WidthChange)\\(#m', $c, $m)) { $deps[] = 'KwfOnReady'; } if (preg_match('#^\\s*Kwf\\.on(Content)(Ready)\\(#m', $c)) { $deps[] = 'KwfOnReadyCore'; } if (preg_match('#^\\s*Kwf\\.onJElement(Ready|Show|Hide|WidthChange)\\(#m', $c)) { $deps[] = 'KwfOnReadyJQuery'; } if (preg_match('#^\\s*Kwf\\.onComponentEvent\\(#m', $c)) { $deps[] = 'Kwf'; } $ret = array(); foreach ($deps as $i) { $d = $this->_providerList->findDependency($i); if (!$d) { throw new Kwf_Exception("Can't find dependency '{$i}'"); } $ret[] = $d; } return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret); } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { $deps = array(); if ($dependency->getMimeType() != 'text/javascript') { return $deps; } if ($dependency instanceof Kwf_Assets_Dependency_File) { $fileContents = file_get_contents($dependency->getAbsoluteFileName()); } else { $fileContents = $dependency->getContents('en'); } // remove comments to avoid dependencies from docs/examples $fileContents = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*' . '/!', '', $fileContents); if (preg_match_all('#^\\s*' . '// @require\\s+([a-zA-Z0-9\\./\\-_]+)\\s*$#m', $fileContents, $m)) { foreach ($m[1] as $f) { if (substr($f, -3) == '.js') { //ignore paths continue; } if ($f) { $d = $this->_providerList->findDependency($f); if (!$d) { throw new Kwf_Exception("Can't resolve dependency: require '{$f}' for {$dependency}"); } $deps[Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES][] = $d; } } } return $deps; }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency->getMimeType() != 'text/javascript' && $dependency->getMimeType() != 'text/javascript; defer') { return array(); } if (!$dependency->isCommonJsEntry()) { return array(); } $ret = array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_COMMONJS => $this->_parseDependencies($dependency)); return $ret; }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency->getContents('en') == 'A') { return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => array($this->_providerList->findDependency('B'))); } else { if ($dependency->getContents('en') == 'B') { return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_USES => array($this->_providerList->findDependency('C'))); } else { if ($dependency->getContents('en') == 'C') { return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => array($this->_providerList->findDependency('A'))); } } } }
public function __toString() { if ($this->_name) { return $this->_name; } return parent::__toString(); }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $contents, $mimeType, $defer) { parent::__construct($providerList); $this->_contents = $contents; $this->_mimeType = $mimeType; $this->_defer = $defer; }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $selector, $breakpoints, $dependencyName) { parent::__construct($providerList); $this->_selector = $selector; $this->_breakpoints = $breakpoints; $this->_dependencyName = $dependencyName; $this->setIsCommonJsEntry(true); }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $componentClass, array $componentDependencies, $isMaster, $dependencyName) { parent::__construct($providerList); $this->_componentClass = $componentClass; $this->_componentDependencies = $componentDependencies; $this->_isMaster = $isMaster; $this->_dependencyName = $dependencyName; }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency->getMimeType() == 'text/css') { $contents = $dependency->getContentsSourceString(); if (strpos($contents, '@include modernizr') === false) { return array(); } if (preg_match_all('#@include modernizr(-no)?\\(([a-z0-9]+)#i', $contents, $m)) { $ret = array(); foreach (array_keys($m[2]) as $k) { $test = trim($m[2][$k]); $ret[] = $this->_providerList->findDependency('Modernizr' . ucfirst($test)); } return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret); } } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if (!$dependency instanceof Kwf_Assets_Dependency_File_Js) { return array(); } if ($dependency->getFileNameWithType() == 'kwf/Kwf_js/Loader.js') { return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => array(new Kwf_Assets_Dependency_Dynamic_LoaderConfig($this->_providerList))); } $fileContents = file_get_contents($dependency->getAbsoluteFileName()); // remove comments to avoid dependencies from docs/examples $fileContents = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*' . '/!', '', $fileContents); if (preg_match('#Kwf\\.Loader\\.#', $fileContents)) { $d = $this->_providerList->findDependency('Kwf.Loader'); if (!$d) { throw new Kwf_Exception("Can't find dependency 'Kwf.Loader'"); } return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => array($d)); } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { if ($dependency->getMimeType() == 'text/css') { if (strpos($dependency->getContentsSourceString(), 'el-breakpoint') === false) { return array(); } $contents = $dependency->getContentsSourceString(); if (preg_match_all('#([^}{]*){([^}]*kwf-responsive-el-(gt|lt):[^}]*)}#', $contents, $m)) { $selectors = array(); foreach (array_keys($m[1]) as $k) { $selector = trim($m[1][$k]); if (!isset($selectors[$selector])) { $selectors[$selector] = array(); } $ruleContent = $m[2][$k]; if (preg_match_all('#kwf-responsive-el-(gt|lt):\\s*([0-9]+)#', $ruleContent, $m2)) { foreach (array_keys($m2[1]) as $k2) { $mode = $m2[1][$k]; $size = $m2[2][$k]; if ($mode == 'gt') { $selectors[$selector][] = $size; } else { if ($mode == 'lt') { $selectors[$selector][] = array('maxWidth' => $size, 'cls' => 'lt' . $size); } } } } } $selectorNum = 0; foreach ($selectors as $selector => $breakpoints) { $selectorNum++; $d = new Kwf_Assets_ResponsiveEl_JsDependency($this->_providerList, trim($selector), $breakpoints, 'ResponsiveEl-' . $dependency->__toString() . '-' . $selectorNum); $d->addDependency(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_COMMONJS, $this->_providerList->findDependency('kwf/responsive-el'), 'kwf/responsive-el'); $ret[] = $d; } return array(Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret); } } return array(); }
public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency) { $ret = array(); if ($dependency->getMimeType() == 'text/javascript' && $dependency instanceof Kwf_Assets_Dependency_File) { $fn = $dependency->getFileNameWithType(); $match = false; foreach ($this->_paths as $p) { if ($p == substr($fn, 0, strlen($p))) { $match = true; } } if ($match && substr($fn, -3) == '.js') { if (file_exists(substr($dependency->getAbsoluteFileName(), 0, -3) . '.css')) { $fnCss = substr($fn, 0, -3) . '.css'; $ret[Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES][] = new Kwf_Assets_Dependency_File_Css($this->_providerList, $fnCss); } if (file_exists(substr($dependency->getAbsoluteFileName(), 0, -3) . '.scss')) { $fnScss = substr($fn, 0, -3) . '.scss'; $ret[Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES][] = new Kwf_Assets_Dependency_File_Scss($this->_providerList, $fnScss); } } } return $ret; }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $fileNameWithType) { parent::__construct($providerList); if (substr($fileNameWithType, 0, 1) == '/') { throw new Kwf_Exception('Don\'t use absolute file names'); } if (!$fileNameWithType) { throw new Kwf_Exception("Invalid filename"); } $this->_fileName = $fileNameWithType; if (strpos($fileNameWithType, '\\') !== false) { throw new Kwf_Exception("Infalid filename, must not contain \\, use / instead"); } //check commented out, only required for debugging //if (!file_exists($this->getAbsoluteFileName())) { // throw new Kwf_Exception("File not found: '$this->_fileName' ('{$this->getAbsoluteFileName()}')"); //} }
public function getFilters() { return array_merge(parent::getFilters(), $this->_dep->getFilters()); }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $name, $path) { $this->_path = $path; $this->_name = $name; parent::__construct($providerList); }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $contents) { parent::__construct($providerList); $this->_contents = $contents; }
public function __construct(Kwf_Assets_Dependency_Abstract $dep) { $this->_dep = $dep; parent::__construct(); }
public function __construct($url) { $this->_url = $url; parent::__construct(); }
public function __construct(Kwf_Assets_ProviderList_Abstract $providerList, $url) { parent::__construct($providerList); $this->_url = $url; }