public static function getLibrary() { if (!PageCache::$library) { $adapter = Config::get('concrete.cache.page.adapter'); $class = overrideable_core_class('Core\\Cache\\Page\\' . camelcase($adapter) . 'PageCache', DIRNAME_CLASSES . '/Cache/Page/' . camelcase($adapter) . 'PageCache.php'); PageCache::$library = new $class(); } return PageCache::$library; }
protected function getController() { try { $class = camelcase(substr($this->filename, 0, strrpos($this->filename, '.php'))); $cl = \Core::make(overrideable_core_class('Block\\ExternalForm\\Form\\Controller\\' . $class, DIRNAME_BLOCKS . '/external_form/form/controller/' . $this->filename)); $cl->bID = $this->bID; return $cl; } catch (\Exception $e) { } }
public function getController() { if (isset($this->controller)) { return $this->controller; } else { $class = overrideable_core_class('MenuItem\\' . camelcase($this->handle) . '\\Controller', DIRNAME_MENU_ITEMS . '/' . $this->handle . '/' . FILENAME_CONTROLLER, $this->pkgHandle); $this->setController(\Core::make($class, array($this))); return $this->controller; } }
public static function getByHandle($ptPublishTargetTypeHandle) { $db = Loader::db(); $r = $db->GetRow('select ptPublishTargetTypeID, ptPublishTargetTypeHandle, ptPublishTargetTypeName, pkgID from PageTypePublishTargetTypes where ptPublishTargetTypeHandle = ?', array($ptPublishTargetTypeHandle)); if (is_array($r) && $r['ptPublishTargetTypeHandle']) { $txt = Loader::helper('text'); $class = overrideable_core_class('Core\\Page\\Type\\PublishTarget\\Type\\' . $txt->camelcase($r['ptPublishTargetTypeHandle']) . 'Type', DIRNAME_CLASSES . '/Page/Type/PublishTarget/Type/' . $txt->camelcase($r['ptPublishTargetTypeHandle']) . '.php', PackageList::getHandle($r['pkgID'])); $sc = Core::make($class); $sc->setPropertiesFromArray($r); return $sc; } }
public static function getByHandle($scsHandle) { $db = Loader::db(); $r = $db->GetRow('select scsHandle, scsIsActive, pkgID, scsName from SystemContentEditorSnippets where scsHandle = ?', array($scsHandle)); if (is_array($r) && $r['scsHandle']) { $pkgHandle = false; if ($r['pkgID']) { $pkgHandle = PackageList::getHandle($r['pkgID']); } $class = overrideable_core_class('Core\\Editor\\' . camelcase($r['scsHandle']) . 'Snippet', DIRNAME_CLASSES . '/Editor/' . camelcase($r['scsHandle']) . 'Snippet.php', $pkgHandle); $sc = Core::make($class); $sc->setPropertiesFromArray($r); return $sc; } }
protected static function getClass($row) { $standardClass = '\\Concrete\\Core\\User\\Point\\Action\\Action'; if ($row['upaHasCustomClass']) { $handleClass = Core::make('helper/text')->camelcase($row['upaHandle']) . 'Action'; $pkgHandle = PackageList::getHandle($row['pkgID']); $customClass = overrideable_core_class('Core\\User\\Point\\Action\\' . $handleClass, DIRNAME_CLASSES . '/User/Point/Action/' . $handleClass . '.php', $pkgHandle); try { $upa = Core::make($customClass); } catch (\ReflectionException $e) { $upa = Core::make($standardClass); } } else { $upa = Core::make($standardClass); } return $upa; }
public function testUpgradedPackageSrcFiles() { $env = Environment::get(); $env->clearOverrideCache(); require 'fixtures/amazing_power.php'; $package = new \Concrete\Package\AmazingPower\Controller(); $loader = ClassLoader::getInstance(); $loader->registerPackage($package); $root = dirname(DIR_BASE_CORE . '../'); @mkdir($root . '/packages/amazing_power/src/ElectricState/Routing', 0777, true); @mkdir($root . '/packages/amazing_power/src/Concrete/Captcha', 0777, true); @copy(dirname(__FILE__) . '/fixtures/amazing_power/RouteHelper.php', $root . '/packages/amazing_power/src/ElectricState/Routing/RouteHelper.php'); @copy(dirname(__FILE__) . '/fixtures/amazing_power/AkismetController.php', $root . '/packages/amazing_power/src/Concrete/Captcha/AkismetController.php'); $class = overrideable_core_class('\\Captcha\\AkismetController', 'Captcha/AkismetController.php', $package->getPackageHandle()); $this->assertEquals('\\Concrete\\Package\\AmazingPower\\Captcha\\AkismetController', $class); $this->assertTrue(class_exists('\\Concrete\\Package\\AmazingPower\\Captcha\\AkismetController')); $this->assertTrue(class_exists('\\ElectricState\\AmazingPower\\Routing\\RouteHelper')); @unlink($root . '/packages/amazing_power/src/ElectricState/Routing/RouteHelper.php'); @unlink($root . '/packages/amazing_power/src/Concrete/Captcha/AkismetController.php'); @rmdir($root . '/packages/amazing_power/src/ElectricState/Routing'); @rmdir($root . '/packages/amazing_power/src/ElectricState'); @unlink($root . '/packages/amazing_power/src/Concrete/Captcha'); @unlink($root . '/packages/amazing_power/src/Concrete'); @unlink($root . '/packages/amazing_power/src'); @unlink($root . '/packages/amazing_power'); }
/** * Returns the controller class for the currently selected captcha library. * * @return mixed */ public function getController() { $class = overrideable_core_class('Core\\Antispam\\' . camelcase($this->saslHandle) . 'Controller', DIRNAME_CLASSES . '/Antispam/' . camelcase($this->saslHandle) . 'Controller.php', $this->getPackageHandle()); $app = Facade::getFacadeApplication(); $cl = $app->make($class); return $cl; }
public function getCustomInspector() { $name = camelcase($this->getCustomImporter()) . 'Inspector'; $class = overrideable_core_class('Core\\File\\Type\\Inspector\\' . $name, 'File/Type/Inspector/' . $name . '.php', $this->getPackageHandle()); $cl = Core::make($class); return $cl; }
protected function importAttributes(\SimpleXMLElement $sx) { $db = Database::connection(); if (isset($sx->attributekeys)) { foreach ($sx->attributekeys->attributekey as $ak) { $akc = AttributeKeyCategory::getByHandle($ak['category']); $akID = $db->GetOne('select akID from AttributeKeys where akHandle = ? and akCategoryID = ?', array($ak['handle'], $akc->getAttributeKeyCategoryID())); if (!$akID) { $txt = Core::make('helper/text'); $c1 = overrideable_core_class('\\Core\\Attribute\\Key\\' . $txt->camelcase($akc->getAttributeKeyCategoryHandle()) . 'Key', DIRNAME_CLASSES . '/Attribute/Key/' . $txt->camelcase($akc->getAttributeKeyCategoryHandle()) . 'Key.php', (string) $akc->getPackageHandle()); call_user_func(array($c1, 'import'), $ak); } } } }
/** * Get the inspector for this file type (if available). * * @return \Concrete\Core\File\Type\Inspector|null */ public function getCustomInspector() { $importer = $this->getCustomImporter(); if ($importer === '') { $result = null; } else { $name = camelcase($importer) . 'Inspector'; $class = overrideable_core_class('Core\\File\\Type\\Inspector\\' . $name, 'File/Type/Inspector/' . $name . '.php', $this->getPackageHandle()); $app = Application::getFacadeApplication(); $result = $app->make($class); } return $result; }
/** * Returns the controller class for the currently selected captcha library. */ public function getAccessEntityTypeClass() { $class = overrideable_core_class('Core\\Permission\\Access\\Entity\\' . Loader::helper('text')->camelcase($this->petHandle) . 'Entity', DIRNAME_CLASSES . '/Permission/Access/Entity/' . Loader::helper('text')->camelcase($this->petHandle) . 'Entity.php', $this->getPackageHandle()); return $class; }
protected static function getClassName($jHandle, $pkgHandle = null) { $class = overrideable_core_class('Job\\' . camelcase($jHandle), DIRNAME_JOBS . '/' . $jHandle . '.php', $pkgHandle); return $class; }
/** * Returns the controller class for the currently selected captcha library */ public function getController() { $class = overrideable_core_class('Core\\Captcha\\' . Loader::helper('text')->camelcase($this->sclHandle) . 'Controller', DIRNAME_CLASSES . '/Captcha/' . Loader::helper('text')->camelcase($this->sclHandle) . 'Controller.php', $this->getPackageHandle()); $cl = Core::make($class); return $cl; }
protected function importAttributes(\SimpleXMLElement $sx) { if (isset($sx->attributekeys)) { foreach ($sx->attributekeys->attributekey as $ak) { $akc = AttributeKeyCategory::getByHandle($ak['category']); $type = AttributeType::getByHandle($ak['type']); $txt = Loader::helper('text'); $c1 = overrideable_core_class('\\Core\\Attribute\\Key\\' . $txt->camelcase($akc->getAttributeKeyCategoryHandle()) . 'Key', DIRNAME_CLASSES . '/Attribute/Key/' . $txt->camelcase($akc->getAttributeKeyCategoryHandle()) . 'Key.php', (string) $akc->getPackageHandle()); $ak = call_user_func(array($c1, 'import'), $ak); } } }