コード例 #1
0
 public function getLegacyKeyClass()
 {
     $class = camelcase($this->getCategoryEntity()->getAttributeKeyCategoryHandle());
     $prefix = $this->getCategoryEntity()->getPackageID() > 0 ? $this->getCategoryEntity()->getPackageHandle() : false;
     $class = core_class('Core\\Attribute\\Key\\' . $class . 'Key', $prefix);
     return $class;
 }
コード例 #2
0
ファイル: Category.php プロジェクト: ngreimel/kovent
 public function getPermissionKeyByID($pkID)
 {
     $txt = Loader::helper('text');
     $className = core_class('\\Core\\Permission\\Key\\' . \Core::make("helper/text")->camelcase($this->pkCategoryHandle) . 'Key', $this->getPackageHandle());
     $ak = call_user_func(array($className, 'getByID'), $pkID);
     return $ak;
 }
コード例 #3
0
ファイル: Category.php プロジェクト: ngreimel/kovent
 public function __call($method, $arguments)
 {
     $className = '\\Core\\Workflow\\Progress\\' . Loader::helper('text')->camelcase($this->wpCategoryHandle) . 'Progress';
     $pkHandle = $this->getPackageHandle();
     $class = core_class($className, $pkHandle);
     return call_user_func_array(array($class, $method), $arguments);
 }
コード例 #4
0
 /**
  * Load the AuthenticationTypeController into the AuthenticationType
  */
 protected function loadController()
 {
     $env = Environment::get();
     $r = $env->getRecord(DIRNAME_AUTHENTICATION . '/' . $this->authTypeHandle . '/' . FILENAME_CONTROLLER);
     $prefix = $r->override ? true : $this->getPackageHandle();
     $authTypeHandle = Core::make('helper/text')->camelcase($this->authTypeHandle);
     $class = core_class('Authentication\\' . $authTypeHandle . '\\Controller', $prefix);
     $this->controller = Core::make($class, array($this));
 }
コード例 #5
0
ファイル: Category.php プロジェクト: ppiedaderawnet/concrete5
 public function getWorkflowProgressCategoryClass()
 {
     $className = '\\Core\\Workflow\\Progress\\' . Loader::helper('text')->camelcase($this->wpCategoryHandle) . 'Progress';
     $pkHandle = $this->getPackageHandle();
     $class = core_class($className, $pkHandle);
     if (class_exists($class)) {
         $c = new $class();
         return $c;
     }
 }
コード例 #6
0
 public function testClassDefine()
 {
     $pt = $this->sl->make('\\Concrete\\Core\\Page\\Theme\\Theme');
     $this->assertTrue($pt instanceof \Concrete\Core\Page\Theme\Theme);
     $class1 = core_class('Core\\Page\\Theme\\Theme');
     $class2 = core_class('Core\\Page\\Theme\\RiverTheme', 'river_theme');
     $class3 = core_class('Core\\Page\\Theme\\Theme', true);
     $this->assertTrue($class1 == '\\Concrete\\Core\\Page\\Theme\\Theme', 'class1 == ' . $class1);
     $this->assertTrue($class2 == '\\Concrete\\Package\\RiverTheme\\Core\\Page\\Theme\\RiverTheme', 'class2 == ' . $class2);
     $this->assertTrue($class3 == '\\Application\\Core\\Page\\Theme\\Theme', 'class3 == ' . $class3);
 }
コード例 #7
0
 public function testCoreClassFunction()
 {
     $class = core_class('\\Block\\TestBlock\\Controller');
     $this->assertEquals('\\Concrete\\Block\\TestBlock\\Controller', $class);
     $class = core_class('\\Block\\TestBlock\\Controller', 'foo_bar');
     $this->assertEquals('\\Concrete\\Package\\FooBar\\Block\\TestBlock\\Controller', $class);
     $class = overrideable_core_class('\\Src\\Captcha\\AkismetController', '/foo', 'akismet');
     $this->assertEquals('\\Concrete\\Package\\Akismet\\Src\\Captcha\\AkismetController', $class);
     // now for the weird one.
     // We need to already have these files included so that the autoloader doesn't break
     require 'fixtures/FakeAkismetPackageController.php';
     require 'fixtures/FakeCalendarPackageController.php';
     $class = overrideable_core_class('\\Core\\Captcha\\AkismetController', '/foo', 'akismet');
     $this->assertEquals('\\Concrete\\Package\\Akismet\\Src\\Captcha\\AkismetController', $class);
     $class = core_class('Core\\Attribute\\Key\\EventKey', 'calendar');
     $this->assertEquals('\\Concrete\\Package\\Calendar\\Src\\Attribute\\Key\\EventKey', $class);
 }
コード例 #8
0
ファイル: Entity.php プロジェクト: ppiedaderawnet/concrete5
 public static final function getByID($peID)
 {
     $obj = CacheLocal::getEntry('permission_access_entity', $peID);
     if ($obj instanceof PermissionAccessEntity) {
         return $obj;
     }
     $db = Database::connection();
     $r = $db->GetRow('select petID, peID from PermissionAccessEntities where peID = ?', array($peID));
     if (is_array($r)) {
         $pt = Type::getByID($r['petID']);
         if (!is_object($pt)) {
             return false;
         }
         $class = '\\Core\\Permission\\Access\\Entity\\' . Core::make('helper/text')->camelcase($pt->getAccessEntityTypeHandle()) . 'Entity';
         $class = core_class($class, $pt->getPackageHandle());
         $obj = Core::make($class);
         $r['petHandle'] = $pt->getAccessEntityTypeHandle();
         $obj->setPropertiesFromArray($r);
         $obj->load();
     }
     CacheLocal::set('permission_access_entity', $peID, $obj);
     return $obj;
 }
コード例 #9
0
ファイル: Type.php プロジェクト: ppiedaderawnet/concrete5
 public function renderComposerOutputForm($page = null, $targetPage = null)
 {
     $env = \Environment::get();
     $elementController = $env->getRecord(DIRNAME_CONTROLLERS . '/element/page_type/composer/form/output/form/' . $this->getPageTypeHandle() . '.php', $this->getPackageHandle());
     $element = $env->getRecord(DIRNAME_ELEMENTS . '/' . DIRNAME_PAGE_TYPES . '/composer/form/output/form/' . $this->getPageTypeHandle() . '.php', $this->getPackageHandle());
     if ($elementController->exists()) {
         $elementController = core_class('Controller\\Element\\PageType\\Composer\\Form\\Output\\Form\\' . camelcase($this->getPageTypeHandle()), $this->getPackageHandle());
         $elementController = \Core::make($elementController);
         $elementController->setPageTypeObject($this);
         if (is_object($page)) {
             $elementController->setPageObject($page);
         }
         if (is_object($targetPage)) {
             $elementController->setTargetPageObject($targetPage);
         }
         $elementController->setPackageHandle($this->getPackageHandle());
         $elementController->render();
     } else {
         if ($element->exists()) {
             $pagetype = $this;
             include $element->file;
         } else {
             Loader::element('page_types/composer/form/output/form', array('pagetype' => $this, 'page' => $page, 'targetPage' => $targetPage));
         }
     }
 }
コード例 #10
0
ファイル: BlockType.php プロジェクト: ceko/concrete5-1
 /**
  * Return the class file that this BlockType uses
  *
  * @return string
  */
 public static function getBlockTypeMappedClass($btHandle, $pkgHandle = false)
 {
     $env = Environment::get();
     $txt = Loader::helper('text');
     $r = $env->getRecord(DIRNAME_BLOCKS . '/' . $btHandle . '/' . FILENAME_CONTROLLER);
     // Replace $pkgHandle if overridden via environment
     $r->pkgHandle and $pkgHandle = $r->pkgHandle;
     $prefix = $r->override ? true : $pkgHandle;
     $class = core_class('Block\\' . $txt->camelcase($btHandle) . '\\Controller', $prefix);
     return $class;
 }
コード例 #11
0
ファイル: Type.php プロジェクト: ppiedaderawnet/concrete5
 public function getController()
 {
     // Note, you can't cache this against the type class itself –it needs to return
     // a new instance every time because sometimes attribute specific keys get
     // bound to the controller and then if it caches against type the wrong controller
     // key combination gets returned with this call.
     //if (!isset($this->controller)) {
     $env = \Environment::get();
     $r = $env->getRecord(DIRNAME_ATTRIBUTES . '/' . $this->atHandle . '/' . FILENAME_CONTROLLER);
     $prefix = $r->override ? true : $this->getPackageHandle();
     $atHandle = \Core::make('helper/text')->camelcase($this->atHandle);
     $class = core_class('Attribute\\' . $atHandle . '\\Controller', $prefix);
     $controller = \Core::make($class);
     $controller->setAttributeType($this);
     return $controller;
 }
コード例 #12
0
ファイル: Workflow.php プロジェクト: WillemAnchor/concrete5
 public static function getByID($wfID)
 {
     $db = Loader::db();
     $r = $db->GetRow('select WorkflowTypes.wftHandle, WorkflowTypes.pkgID from Workflows inner join WorkflowTypes on Workflows.wftID = WorkflowTypes.wftID where Workflows.wfID = ?', array($wfID));
     if ($r['wftHandle']) {
         $class = '\\Core\\Workflow\\' . Loader::helper('text')->camelcase($r['wftHandle']) . 'Workflow';
         if ($r['pkgID']) {
             $pkg = Package::getByID($r['pkgID']);
             $prefix = $pkg->getPackageHandle();
         }
         $class = core_class($class, $prefix);
         $obj = Core::make($class);
         $obj->load($wfID);
         if ($obj->getWorkflowID() > 0) {
             $obj->loadDetails();
             return $obj;
         }
     }
 }
コード例 #13
0
ファイル: Category.php プロジェクト: ppiedaderawnet/concrete5
 public function getPermissionKeyClass()
 {
     $className = core_class('\\Core\\Permission\\Key\\' . Core::make("helper/text")->camelcase($this->pkCategoryHandle) . 'Key', $this->getPackageHandle());
     return $className;
 }
コード例 #14
0
ファイル: Progress.php プロジェクト: digideskio/concrete5
 public static function getByID($wpID)
 {
     $db = Database::connection();
     $r = $db->fetchAssoc('select WorkflowProgress.*, WorkflowProgressCategories.wpCategoryHandle, WorkflowProgressCategories.pkgID from WorkflowProgress inner join WorkflowProgressCategories on WorkflowProgress.wpCategoryID = WorkflowProgressCategories.wpCategoryID where wpID  = ?', array($wpID));
     if (!is_array($r) || !$r['wpID']) {
         return false;
     }
     $class = '\\Core\\Workflow\\Progress\\' . Core::make('helper/text')->camelcase($r['wpCategoryHandle']) . 'Progress';
     if ($r['pkgID']) {
         $pkgHandle = PackageList::getHandle($r['pkgID']);
     }
     $class = core_class($class, $pkgHandle);
     $wp = Core::make($class);
     $wp->setPropertiesFromArray($r);
     $wp->loadDetails();
     return $wp;
 }
コード例 #15
0
ファイル: Category.php プロジェクト: ceko/concrete5-1
 /**
  * @param string $akCategoryHandle The handle string for the category
  * @param int $akCategoryAllowSets This should be an attribute Category::ASET_ALLOW_* constant
  * @param bool|\Package $pkg The package object that the category belongs to, false if it does not belong to a package
  * @return self|null Returns the category object if it was added successfully, or null if it failed to be added
  */
 public static function add($akCategoryHandle, $akCategoryAllowSets = 0, $pkg = false)
 {
     $pkgID = null;
     if (is_object($pkg)) {
         $pkgID = $pkg->getPackageID();
     }
     Database::connection()->executeQuery('INSERT INTO AttributeKeyCategories (akCategoryHandle, akCategoryAllowSets, pkgID) values (?, ?, ?)', array($akCategoryHandle, $akCategoryAllowSets, $pkgID));
     $id = Database::connection()->lastInsertId();
     $txt = Core::make('helper/text');
     $prefix = $pkgID > 0 ? $pkg->getPackageHandle() : false;
     $class = core_class('Core\\Attribute\\Key\\' . $txt->camelcase($akCategoryHandle) . 'Key', $prefix);
     /** @var \Concrete\Core\Attribute\Key\Key $obj This is really a specific category key object*/
     $obj = new $class();
     $obj->createIndexedSearchTable();
     return static::getByID($id);
 }
コード例 #16
0
ファイル: Key.php プロジェクト: digideskio/concrete5
 protected static function load($key, $loadBy = 'pkID')
 {
     $db = Database::connection();
     $txt = Core::make('helper/text');
     $r = $db->GetRow('select pkID, pkName, pkDescription, pkHandle, pkCategoryHandle, pkCanTriggerWorkflow, pkHasCustomClass, PermissionKeys.pkCategoryID, PermissionKeyCategories.pkgID from PermissionKeys inner join PermissionKeyCategories on PermissionKeyCategories.pkCategoryID = PermissionKeys.pkCategoryID where ' . $loadBy . ' = ?', array($key));
     $class = '\\Core\\Permission\\Key\\' . $txt->camelcase($r['pkCategoryHandle']) . 'Key';
     if (!is_array($r) && !$r['pkID']) {
         return false;
     }
     if ($r['pkHasCustomClass']) {
         $class = '\\Core\\Permission\\Key\\' . $txt->camelcase($r['pkHandle'] . '_' . $r['pkCategoryHandle']) . 'Key';
     }
     $pkgHandle = null;
     if ($r['pkgID']) {
         $pkgHandle = PackageList::getHandle($r['pkgID']);
     }
     $class = core_class($class, $pkgHandle);
     $pk = Core::make($class);
     $pk->setPropertiesFromArray($r);
     return $pk;
 }
コード例 #17
0
ファイル: Key.php プロジェクト: jkoudys/concrete5
 /**
  * Updates an attribute key.
  */
 public function update($args)
 {
     $prevHandle = $this->getAttributeKeyHandle();
     extract($args);
     if (!isset($akHandle)) {
         throw new ErrorException('No attribute key handle set.');
     }
     if (!isset($akName)) {
         throw new ErrorException('No Attribute Key name set.');
     }
     $akIsSearchable = intval($akIsSearchable);
     $akIsSearchableIndexed = intval($akIsSearchableIndexed);
     $db = Loader::db();
     $akCategoryHandle = $db->GetOne("select akCategoryHandle from AttributeKeyCategories inner join AttributeKeys on AttributeKeys.akCategoryID = AttributeKeyCategories.akCategoryID where akID = ?", $this->getAttributeKeyID());
     $a = array($akHandle, $akName, $akIsSearchable, $akIsSearchableIndexed, $this->getAttributeKeyID());
     $r = $db->query("update AttributeKeys set akHandle = ?, akName = ?, akIsSearchable = ?, akIsSearchableIndexed = ? where akID = ?", $a);
     $category = AttributeKeyCategory::getByID($this->akCategoryID);
     switch ($category->allowAttributeSets()) {
         case AttributeKeyCategory::ASET_ALLOW_SINGLE:
             if (isset($asID) && $asID > 0) {
                 $as = AttributeSet::getByID($asID);
                 if (!$this->inAttributeSet($as) && is_object($as)) {
                     $this->clearAttributeSets();
                     $this->setAttributeSet($as);
                 }
             } else {
                 // clear set
                 $this->clearAttributeSets();
             }
             break;
     }
     if ($r) {
         $txt = Loader::helper('text');
         $pkgID = $category->getPackageID();
         $prefix = $pkgID > 0 ? $category->getPackageHandle() : false;
         $className = core_class('Core\\Attribute\\Key\\' . $txt->camelcase($akCategoryHandle) . 'Key', $prefix);
         $ak = Core::make($className);
         $ak->load($this->getAttributeKeyID());
         $at = $ak->getAttributeType();
         $cnt = $at->getController();
         $cnt->setAttributeKey($ak);
         $cnt->saveKey($args);
         $ak->updateSearchIndex($prevHandle);
         return $ak;
     }
 }
コード例 #18
0
ファイル: Theme.php プロジェクト: ppiedaderawnet/concrete5
 /**
  * @param string $where
  * @param array  $args
  *
  * @return \Concrete\Core\Page\Theme\Theme|null
  */
 protected static function populateThemeQuery($where, $args)
 {
     $db = Loader::db();
     $row = $db->GetRow("select pThemeID, pThemeHandle, pThemeDescription, pkgID, pThemeName, pThemeHasCustomClass from PageThemes where {$where}", $args);
     $env = Environment::get();
     $pl = null;
     if (!empty($row)) {
         $standardClass = '\\Concrete\\Core\\Page\\Theme\\Theme';
         if ($row['pThemeHasCustomClass']) {
             $pkgHandle = PackageList::getHandle($row['pkgID']);
             $r = $env->getRecord(DIRNAME_THEMES . '/' . $row['pThemeHandle'] . '/' . FILENAME_THEMES_CLASS, $pkgHandle);
             $prefix = $r->override ? true : $pkgHandle;
             $customClass = core_class('Theme\\' . Loader::helper('text')->camelcase($row['pThemeHandle']) . '\\PageTheme', $prefix);
             try {
                 $pl = Core::make($customClass);
             } catch (\ReflectionException $e) {
                 $pl = Core::make($standardClass);
             }
         } else {
             $pl = Core::make($standardClass);
         }
         $pl->setPropertiesFromArray($row);
         $pkgHandle = $pl->getPackageHandle();
         $pl->pThemeDirectory = $env->getPath(DIRNAME_THEMES . '/' . $row['pThemeHandle'], $pkgHandle);
         $pl->pThemeURL = $env->getURL(DIRNAME_THEMES . '/' . $row['pThemeHandle'], $pkgHandle);
     }
     return $pl;
 }
コード例 #19
0
ファイル: Page.php プロジェクト: robertdamoc/concrete5
 /**
  * @return PageController
  */
 public function getPageController()
 {
     if (!isset($this->controller)) {
         $env = Environment::get();
         if ($this->getPageTypeID() > 0) {
             $pt = $this->getPageTypeObject();
             $ptHandle = $pt->getPageTypeHandle();
             $r = $env->getRecord(DIRNAME_CONTROLLERS . '/' . DIRNAME_PAGE_TYPES . '/' . $ptHandle . '.php', $pt->getPackageHandle());
             $prefix = $r->override ? true : $pt->getPackageHandle();
             $class = core_class('Controller\\PageType\\' . camelcase($ptHandle), $prefix);
         } elseif ($this->isGeneratedCollection()) {
             $file = $this->getCollectionFilename();
             if (strpos($file, '/' . FILENAME_COLLECTION_VIEW) !== false) {
                 $path = substr($file, 0, strpos($file, '/' . FILENAME_COLLECTION_VIEW));
             } else {
                 $path = substr($file, 0, strpos($file, '.php'));
             }
             $r = $env->getRecord(DIRNAME_CONTROLLERS . '/' . DIRNAME_PAGE_CONTROLLERS . $path . '.php', $this->getPackageHandle());
             $prefix = $r->override ? true : $this->getPackageHandle();
             $class = core_class('Controller\\SinglePage\\' . str_replace('/', '\\', camelcase($path, true)), $prefix);
         }
         if (isset($class) && class_exists($class)) {
             $this->controller = Core::make($class, array($this));
         } else {
             $this->controller = Core::make('\\PageController', array($this));
         }
     }
     return $this->controller;
 }
コード例 #20
0
ファイル: helpers.php プロジェクト: ppiedaderawnet/concrete5
function overrideable_core_class($class, $path, $pkgHandle = null)
{
    $env = \Environment::get();
    // First, check to see if the class we're trying to override is in the Core namespace
    if (substr($class, 0, 5) == "Core\\") {
        // If so, we first check to see if application/src/Concrete/This/Stuff exists
        // So let's strip DIRNAME_CLASSES off the front, place /Concrete/ between DIRNAME_CLASSES
        // and the rest of the path.
        $newPath = substr($path, strlen(DIRNAME_CLASSES));
        $newPath = DIRNAME_CLASSES . DIRECTORY_SEPARATOR . 'Concrete' . $newPath;
        $r = $env->getRecord($newPath);
        if ($r->override) {
            return core_class($class, true);
        }
    }
    $r = $env->getRecord($path);
    $prefix = $r->override ? true : $pkgHandle;
    return core_class($class, $prefix);
}
コード例 #21
0
ファイル: Type.php プロジェクト: kreativmind/concrete5-5.7.0
 /**
  * @return \Concrete\Core\File\StorageLocation\Configuration\ConfigurationInterface
  */
 public function getConfigurationObject()
 {
     $class = core_class('\\Core\\File\\StorageLocation\\Configuration\\' . camelcase($this->getHandle()) . 'Configuration', $this->getPackageHandle());
     return Core::make($class);
 }
コード例 #22
0
ファイル: Group.php プロジェクト: ppiedaderawnet/concrete5
 public function getGroupAutomationControllerClass()
 {
     $ts = \Core::make('helper/text');
     $env = \Environment::get();
     $r = $env->getRecord(DIRNAME_CLASSES . '/User/Group/AutomatedGroup/' . camelcase($ts->handle($this->getGroupName())) . '.php');
     $prefix = $r->override ? true : $this->getPackageHandle();
     $class = core_class('\\Core\\User\\Group\\AutomatedGroup\\' . camelcase($ts->handle($this->getGroupName())), $prefix);
     return $class;
 }
コード例 #23
0
 protected function getController()
 {
     return core_class($this->provider->getElementController(), $this->provider->getPackageHandle());
 }
コード例 #24
0
ファイル: Access.php プロジェクト: WillemAnchor/concrete5
 public static function getByID($paID, PermissionKey $pk, $checkPA = true)
 {
     $cache = Core::make('cache/request');
     $identifier = sprintf('permission/access/%s/%s', $pk->getPermissionKeyID(), $paID);
     $item = $cache->getItem($identifier);
     if (!$item->isMiss()) {
         return $item->get();
     }
     $db = Database::connection();
     $handle = $pk->getPermissionKeyCategoryHandle();
     if ($pk->permissionKeyHasCustomClass()) {
         $handle = $pk->getPermissionKeyHandle() . '_' . $handle;
     }
     $class = '\\Core\\Permission\\Access\\' . Core::make('helper/text')->camelcase($handle) . 'Access';
     $class = core_class($class, $pk->getPackageHandle());
     $obj = null;
     if ($checkPA) {
         $row = $db->GetRow('select paID, paIsInUse from PermissionAccess where paID = ?', array($paID));
         if ($row && $row['paID']) {
             $obj = Core::make($class);
             $obj->setPropertiesFromArray($row);
         }
     } else {
         // we got here from an assignment object so we already know its in use.
         $obj = Core::make($class);
         $obj->paID = $paID;
         $obj->paIsInUse = true;
     }
     if (isset($obj)) {
         $obj->setPermissionKey($pk);
     }
     $item->set($obj);
     return $obj;
 }
コード例 #25
0
 /**
  * Returns the controller class for the currently selected captcha library
  */
 public function getController()
 {
     $class = core_class('Core\\Antispam\\' . Concrete::make('helper/text')->camelcase($this->saslHandle) . 'Controller', $this->getPackageHandle());
     $cl = Core::make($class);
     return $cl;
 }
コード例 #26
0
ファイル: helpers.php プロジェクト: ceko/concrete5-1
function overrideable_core_class($class, $path, $pkgHandle = null)
{
    $env = \Environment::get();
    $r = $env->getRecord($path);
    $prefix = $r->override ? true : $pkgHandle;
    return core_class($class, $prefix);
}
コード例 #27
0
ファイル: Type.php プロジェクト: robertdamoc/concrete5
 public function loadController()
 {
     $env = Environment::get();
     $r = $env->getRecord(DIRNAME_ATTRIBUTES . '/' . $this->atHandle . '/' . FILENAME_CONTROLLER);
     $prefix = $r->override ? true : $this->getPackageHandle();
     $atHandle = Core::make('helper/text')->camelcase($this->atHandle);
     $class = core_class('Attribute\\' . $atHandle . '\\Controller', $prefix);
     $this->controller = Core::make($class, array($this));
 }
コード例 #28
0
ファイル: Job.php プロジェクト: meixelsberger/concrete5-5.7.0
 protected static function getClassName($jHandle, $pkgHandle = null)
 {
     $class = core_class('Job\\' . camelcase($jHandle), $pkgHandle);
     return $class;
 }