本文整理汇总了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();
}
}
}
}
示例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);
}
}
}
}
}
示例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());
}
示例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);
}
示例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());
}
}
示例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();
}
示例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);
}
}
}
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例11: getPackageObject
protected static function getPackageObject($pkgHandle) {
$pkg = false;
if ($pkgHandle) {
$pkg = Package::getByHandle($pkgHandle);
}
return $pkg;
}
示例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;
}
}
示例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());
}
示例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'));
}
示例15: getPackageObject
protected static function getPackageObject($pkgHandle)
{
$pkg = null;
if ($pkgHandle) {
$pkgHandle = (string) $pkgHandle;
$pkg = \Package::getByHandle($pkgHandle);
}
return $pkg;
}