當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Package::getByHandle方法代碼示例

本文整理匯總了PHP中Package::getByHandle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Package::getByHandle方法的具體用法?PHP Package::getByHandle怎麽用?PHP Package::getByHandle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Package的用法示例。


在下文中一共展示了Package::getByHandle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 public function update($pkgHandle = false)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         if ($pkgHandle) {
             $tests = Package::testForInstall($pkgHandle, false);
             if (is_array($tests)) {
                 $tests = Package::mapError($tests);
                 $this->set('error', $tests);
             } else {
                 $p = Package::getByHandle($pkgHandle);
                 try {
                     $p->upgradeCoreData();
                     $p->upgrade();
                     $this->set('message', t('The package has been updated successfully.'));
                 } catch (Exception $e) {
                     $this->set('error', $e);
                 }
             }
         } else {
             $mi = Marketplace::getInstance();
             if ($mi->isConnected()) {
                 Marketplace::checkPackageUpdates();
             }
         }
     }
 }
開發者ID:VonUniGE,項目名稱:concrete5-1,代碼行數:27,代碼來源:install.php

示例2: execute

 public function execute(Batch $batch)
 {
     $keys = $batch->getObjectCollection('attribute_key');
     /**
      * @var AttributeKey
      */
     if (!$keys) {
         return;
     }
     foreach ($keys->getKeys() as $key) {
         if (!$key->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($key->getPackage()) {
                 $pkg = \Package::getByHandle($key->getPackage());
             }
             $category = $key->getCategory();
             if (is_object($category)) {
                 $publisher = $category->getPublisher();
                 $o = $publisher->publish($key, $pkg);
                 $typePublisher = $key->getTypePublisher();
                 if (is_object($typePublisher)) {
                     $typePublisher->publish($key, $o);
                 }
             }
         }
     }
 }
開發者ID:motoki1199,項目名稱:addon_migration_tool,代碼行數:27,代碼來源:CreateAttributesRoutine.php

示例3: view

 public function view()
 {
     $uh = Loader::helper('concrete/urls');
     $bt = BlockType::getByHandle('switch_language');
     Loader::model('section', 'multilingual');
     $ml = MultilingualSection::getList();
     $c = Page::getCurrentPage();
     $al = MultilingualSection::getBySectionOfSite($c);
     $languages = array();
     $locale = ACTIVE_LOCALE;
     if (is_object($al)) {
         $locale = $al->getLanguage();
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
     if (is_object($al)) {
         $this->set('activeLanguage', $al->getCollectionID());
     }
     $pkg = Package::getByHandle('multilingual');
     $mdl = Loader::helper('default_language', 'multilingual');
     $this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
     $this->set('cID', $c->getCollectionID());
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:27,代碼來源:controller.php

示例4: activate_files

 public function activate_files($ptID)
 {
     try {
         Loader::model("collection_types");
         $pt = PageTheme::getByID($ptID);
         $txt = Loader::helper('text');
         if (!is_array($this->post('pageTypes'))) {
             throw new Exception(t("You must specify at least one template to make into a page type."));
         }
         $pkg = false;
         $pkgHandle = $pt->getPackageHandle();
         if ($pkgHandle) {
             $pkg = Package::getByHandle($pkgHandle);
         }
         foreach ($this->post('pageTypes') as $ptHandle) {
             $data['ctName'] = $txt->unhandle($ptHandle);
             $data['ctHandle'] = $ptHandle;
             $ct = CollectionType::add($data, $pkg);
         }
         $this->set('message', t('Files in the theme were activated successfully.'));
     } catch (Exception $e) {
         $this->set('error', $e);
     }
     $this->view($ptID);
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:25,代碼來源:inspect.php

示例5: downloadUpdate

	public function downloadUpdate() {
		// backup the old package
		$pkg = Package::getByHandle($this->getHandle());
		$r = $pkg->backup();
		if (is_array($r)) {
			return $r;
		}

		$fileURL = $this->getRemoteFileURL();
		if (empty($fileURL)) {
			return array(Package::E_PACKAGE_NOT_FOUND);
		}

		$file = Marketplace::downloadRemoteFile($this->getRemoteFileURL());
		if (empty($file) || $file == Package::E_PACKAGE_DOWNLOAD) {
			return array(Package::E_PACKAGE_DOWNLOAD);
		} else if ($file == Package::E_PACKAGE_SAVE) {
			return array($file);
		}
			
		try {
			Loader::model('package_archive');
			$am = new PackageArchive($this->getHandle());
			$am->install($file, true);
		} catch (Exception $e) {
			return array($e->getMessage());
		}

	}
開發者ID:rii-J,項目名稱:concrete5-de,代碼行數:29,代碼來源:marketplace_remote_item.php

示例6: do_update

	public function do_update($pkgHandle = false) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			if ($pkgHandle) {
				$tests = Package::testForInstall($pkgHandle, false);
				if (is_array($tests)) {
					$tests = Package::mapError($tests);
					$this->set('error', $tests);
				} else {
					$p = Package::getByHandle($pkgHandle);
					$currentLocale = Localization::activeLocale();
					if ($currentLocale != 'en_US') {
						// Prevent the database records being stored in wrong language
						Localization::changeLocale('en_US');
					}
					try {
						$p->upgradeCoreData();
						if ($currentLocale != 'en_US') {
							Localization::changeLocale($currentLocale);
						}
						$p->upgrade();
						$this->set('message', t('The package has been updated successfully.'));
					} catch(Exception $e) {
						$this->set('error', $e);
					}
				}
			}
		}
		$this->view();
	}
開發者ID:nveid,項目名稱:concrete5,代碼行數:30,代碼來源:update.php

示例7: execute

 public function execute(Batch $batch)
 {
     $sets = $batch->getObjectCollection('attribute_set');
     if (!$sets) {
         return;
     }
     foreach ($sets->getSets() as $set) {
         $akc = Category::getByHandle($set->getCategory());
         if (!$set->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($set->getPackage()) {
                 $pkg = \Package::getByHandle($set->getPackage());
             }
             $setObject = $akc->addSet($set->getHandle(), $set->getName(), $pkg, intval($set->getIsLocked()));
         } else {
             $setObject = \Concrete\Core\Attribute\Set::getByHandle($set->getHandle());
         }
         if (is_object($setObject)) {
             $attributes = $set->getAttributes();
             foreach ($attributes as $handle) {
                 $ak = $akc->getAttributeKeyByHandle($handle);
                 if (is_object($ak)) {
                     $setObject->addKey($ak);
                 }
             }
         }
     }
 }
開發者ID:motoki1199,項目名稱:addon_migration_tool,代碼行數:28,代碼來源:CreateAttributeSetsRoutine.php

示例8: upgrade

 public function upgrade()
 {
     parent::upgrade();
     $pkg = Package::getByHandle($this->pkgHandle);
     //@todo write conversion from lang to locale
     //1.0 - 1.1 changed languaage to locale
     $db = Loader::db();
     // update the MultilingualSections table
     $rows = $db->getAll("SELECT * FROM MultilingualSections");
     if (is_array($rows) && count($rows)) {
         foreach ($rows as $r) {
             if (strlen($r['msLanguage']) && !strlen($r['msLocale'])) {
                 $locale = $r['msLanguage'] . (strlen($r['msIcon']) ? "_" . $r['msIcon'] : "");
                 $db->query("UPDATE MultilingualSections SET msLocale = ? WHERE cID = ?", array($locale, $r['cID']));
             }
         }
     }
     // install job
     Loader::model('job');
     $jb = Job::installByPackage('generate_multilingual_sitemap', $pkg);
     // update the MultilingualPageRelations table
     $hasLocales = $db->getOne("SELECT COUNT(msLocale) FROM MultilingualSections WHERE LENGTH(msLocale)");
     if (!$hasLocales) {
         $query = "UPDATE MultilingualPageRelations mpr, MultilingualSections \n\t\t\t\tSET mpr.mpLocale = MultilingualSections.msLocale\n\t\t\t\tWHERE mpr.mpLanguage = MultilingualSections.msLanguage";
         $db->query($query);
     }
     // 1.1.2
     $ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy');
     if (!is_object($ak)) {
         CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg);
     }
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:32,代碼來源:controller.php

示例9: view

 public function view()
 {
     $pkg = Package::getByHandle('theme_creator');
     $html = loader::helper('html');
     $this->addHeaderItem($html->javascript('theme_creator', 'theme_creator'));
     $this->set('pkg', $pkg);
 }
開發者ID:notzen,項目名稱:Concrete5-Wordpress-Theme-Importer,代碼行數:7,代碼來源:controller.php

示例10: installAttributeType

 protected function installAttributeType($pkg)
 {
     $attributeHandle = 'related_pages';
     \Loader::model('attribute/categories/collection');
     AttributeType::add($attributeHandle, t('Related Pages'), \Package::getByHandle($this->pkgHandle));
     AttributeKeyCategory::getByHandle('collection')->associateAttributeKeyType(AttributeType::getByHandle($attributeHandle));
 }
開發者ID:YumpDigital,項目名稱:concrete5-package-related-pages,代碼行數:7,代碼來源:controller.php

示例11: getPackageObject

	protected static function getPackageObject($pkgHandle) {
		$pkg = false;
		if ($pkgHandle) {
			$pkg = Package::getByHandle($pkgHandle);
		}
		return $pkg;		
	}
開發者ID:nveid,項目名稱:concrete5,代碼行數:7,代碼來源:importer.php

示例12: precheck

 function precheck()
 {
     $pk = Package::getByHandle('problog');
     if (!$pk) {
         throw new Exception(t('You must have <a href="http://www.concrete5.org/marketplace/addons/problog/">ProBlog</a> installed prior to installing this addon.'));
         exit;
     }
 }
開發者ID:pranastae,項目名稱:problog_importer,代碼行數:8,代碼來源:controller.php

示例13: view

 public function view()
 {
     $urls = Loader::helper('concrete/urls');
     $pkg = Package::getByHandle(FRONTEND_DEVELOPER_PACKAGE_HANDLE);
     $this->set("pkg", $pkg);
     $this->set("url", $urls);
     $this->set("bID", $this->bID);
     $this->set("filesets", $this->getBuildFileSets());
 }
開發者ID:holyshared,項目名稱:developer-package,代碼行數:9,代碼來源:controller.php

示例14: install

 public function install()
 {
     $pkg = parent::install();
     $pkgh = Package::getByHandle('page_selector_attribute');
     Loader::model('attribute/categories/collection');
     $col = AttributeKeyCategory::getByHandle('collection');
     $pageselector = AttributeType::add('page_selector', t('Page Selector'), $pkgh);
     $col->associateAttributeKeyType(AttributeType::getByHandle('page_selector'));
 }
開發者ID:WillemAnchor,項目名稱:page_selector_attribute,代碼行數:9,代碼來源:controller.php

示例15: getPackageObject

 protected static function getPackageObject($pkgHandle)
 {
     $pkg = null;
     if ($pkgHandle) {
         $pkgHandle = (string) $pkgHandle;
         $pkg = \Package::getByHandle($pkgHandle);
     }
     return $pkg;
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:9,代碼來源:AbstractRoutine.php


注:本文中的Package::getByHandle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。