当前位置: 首页>>代码示例>>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;未经允许,请勿转载。