Exemplo n.º 1
0
 /**
  * Get the package handle (or false if it's a core library).
  *
  * @return string|false
  */
 public function getPackageHandle()
 {
     if (!isset($this->pkgHandle)) {
         $this->pkgHandle = $this->pkgID ? PackageList::getHandle($this->pkgID) : false;
     }
     return $this->pkgHandle;
 }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 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']);
         }
         $txt = Loader::helper('text');
         $class = '\\Concrete\\Core\\Editor\\' . $txt->camelcase($r['scsHandle']) . 'Snippet';
         $sc = Core::make($class);
         $sc->setPropertiesFromArray($r);
         return $sc;
     }
 }
Exemplo n.º 5
0
 public function getPackageHandle()
 {
     return PackageList::getHandle($this->pkgID);
 }
Exemplo n.º 6
0
 public function getPackageHandle()
 {
     return \Concrete\Core\Package\PackageList::getHandle($this->pkgID);
 }
Exemplo n.º 7
0
 /**
  * @param int $akID
  * @return Key|false Returns an attribute key for the matching ID,
  * false if no key exists for the category with the given ID
  */
 public function getAttributeKeyByID($akID)
 {
     $txt = Core::make('helper/text');
     $prefix = $this->pkgID > 0 ? PackageList::getHandle($this->pkgID) : false;
     $akCategoryHandle = $txt->camelcase($this->akCategoryHandle);
     $className = core_class('Core\\Attribute\\Key\\' . $akCategoryHandle . 'Key', $prefix);
     $ak = call_user_func(array($className, 'getByID'), $akID);
     return $ak;
 }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 public static function getJobObjByHandle($jHandle = '', $jobData = array())
 {
     $jcl = static::jobClassLocations();
     $pkgHandle = null;
     //check for the job file in the various locations
     $db = Loader::db();
     $pkgID = $db->GetOne('select pkgID from Jobs where jHandle = ?', $jHandle);
     if ($pkgID > 0) {
         $pkgHandle = PackageList::getHandle($pkgID);
         if ($pkgHandle) {
             $jcl[] = DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JOBS;
             $jcl[] = DIR_PACKAGES_CORE . '/' . $pkgHandle . '/' . DIRNAME_JOBS;
         }
     }
     foreach ($jcl as $jobClassLocation) {
         //load the file & class, then run the job
         $path = $jobClassLocation . '/' . $jHandle . '.php';
         if (file_exists($path)) {
             $className = static::getClassName($jHandle, $pkgHandle);
             $j = Core::make($className);
             $j->jHandle = $jHandle;
             if (intval($jobData['jID']) > 0) {
                 $j->setPropertiesFromArray($jobData);
             }
             return $j;
         }
     }
     return NULL;
 }
Exemplo n.º 10
0
 /**
  * Return the first existing file path in this order:
  *  - /models/authentication/types/HANDLE
  *  - /packages/PKGHANDLE/authentication/types/HANDLE
  *  - /concrete/models/authentication/types/HANDLE
  *  - /concrete/core/models/authentication/types/HANDLE
  *
  * @param string $_file The filename you want.
  * @return string This will return false if the file is not found.
  */
 protected function mapAuthenticationTypeFilePath($_file)
 {
     $atHandle = $this->getAuthenticationTypeHandle();
     $env = Environment::get();
     $pkgHandle = PackageList::getHandle($this->pkgID);
     $r = $env->getRecord(implode('/', array(DIRNAME_AUTHENTICATION, $atHandle, $_file)), $pkgHandle);
     return $r;
 }