コード例 #1
0
ファイル: seo.php プロジェクト: masteramuk/concrete5
 public function submit()
 {
     if ($this->validateAction()) {
         $nvc = $this->page->getVersionToModify();
         if ($this->asl->allowEditPaths()) {
             $data = array('cHandle' => $_POST['cHandle']);
             $nvc->update($data);
         }
         if ($this->asl->allowEditName()) {
             $data = array('cName' => $_POST['cName']);
             $nvc->update($data);
         }
         $as = AttributeSet::getByHandle('seo');
         $attributes = $as->getAttributeKeys();
         foreach ($attributes as $ak) {
             $ak->saveAttributeForm($nvc);
         }
         if ($this->request->request->get('sitemap') && $this->permissions->canApprovePageVersions() && \Config::get('concrete.misc.sitemap_approve_immediately')) {
             $pkr = new ApprovePageRequest();
             $u = new User();
             $pkr->setRequestedPage($this->page);
             $v = Version::get($this->page, "RECENT");
             $pkr->setRequestedVersionID($v->getVersionID());
             $pkr->setRequesterUserID($u->getUserID());
             $response = $pkr->trigger();
             $u->unloadCollectionEdit();
         }
         $r = new PageEditResponse($e);
         $r->setPage($this->page);
         $r->setTitle(t('Page Updated'));
         $r->setMessage(t('The SEO information has been saved.'));
         $r->outputJSON();
     }
 }
コード例 #2
0
 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);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: forums.php プロジェクト: katzueno/forums
 function get_forum_attributes()
 {
     $atSet = AttributeSet::getByHandle('forums');
     $atKeys = $atSet->getAttributeKeys();
     $banAtt = array('Forum Post', 'Forum Category', 'Pin Forum Post', 'Forum Image', 'Forum Email Address', 'Forum Name', 'Forum Post Approved');
     foreach ($atKeys as $ak) {
         if (!in_array($ak->getAttributeKeyName(), $banAtt)) {
             $forumAttributes[$ak->getAttributeKeyID()] = $ak->getAttributeKeyName();
         }
     }
     return $forumAttributes;
 }
コード例 #4
0
ファイル: ProblogPost.php プロジェクト: baardev/lbtb
 public static function saveData($p)
 {
     $blocks = $p->getBlocks('Main');
     foreach ($blocks as $b) {
         if ($b->getBlockTypeHandle() == 'content' || $b->getBlockTypeHandle() == 'core_page_type_composer_control_output') {
             $b->deleteBlock();
         }
     }
     Loader::model("attribute/categories/collection");
     $cak = CollectionAttributeKey::getByHandle('tags');
     $cak->saveAttributeForm($p);
     $cck = CollectionAttributeKey::getByHandle('meta_title');
     $cck->saveAttributeForm($p);
     $cck = CollectionAttributeKey::getByHandle('meta_description');
     $cck->saveAttributeForm($p);
     $cck = CollectionAttributeKey::getByHandle('meta_keywords');
     $cck->saveAttributeForm($p);
     $cck = CollectionAttributeKey::getByHandle('blog_category');
     $cck->saveAttributeForm($p);
     //$cnv = CollectionAttributeKey::getByHandle('exclude_nav');
     //$cnv->saveAttributeForm($p);
     $ct = CollectionAttributeKey::getByHandle('thumbnail');
     $ct->saveAttributeForm($p);
     $ca = CollectionAttributeKey::getByHandle('blog_author');
     $ca->saveAttributeForm($p);
     $set = AttributeSet::getByHandle('problog_additional_attributes');
     $setAttribs = $set->getAttributeKeys();
     if ($setAttribs) {
         foreach ($setAttribs as $ak) {
             $aksv = CollectionAttributeKey::getByHandle($ak->akHandle);
             $aksv->saveAttributeForm($p);
         }
     }
     $bt = BlockType::getByHandle('content');
     if (empty($_POST['blogBody'])) {
         $content = ' ';
     } else {
         $content = $_POST['blogBody'];
     }
     $data = array('content' => $content);
     $b = $p->addBlock($bt, 'Main', $data);
     $b->setCustomTemplate('blog_post');
     $b->setAbsoluteBlockDisplayOrder('1');
     $db = Loader::db();
     $pTemplate = $db->getOne("SELECT ptComposerFormLayoutSetControlID FROM PageTypeComposerOutputControls WHERE pTemplateID = ? AND ptID = ?", array($p->getPageTemplateID(), $p->getPageTypeID()));
     if ($pTemplate) {
         $db->Replace('PageTypeComposerOutputBlocks', array('cID' => $p->getCollectionID(), 'arHandle' => 'Main', 'cbDisplayOrder' => 0, 'ptComposerFormLayoutSetControlID' => $pTemplate, 'bID' => $b->getBlockID()), 'cID', true);
     }
     Events::fire('on_problog_submit', $p);
     $ba = Loader::helper('blog_actions');
     $ba->doSubscription($p);
     $p->reindex();
 }
コード例 #5
0
ファイル: seo.php プロジェクト: meixelsberger/concrete5-5.7.0
 public function submit()
 {
     if ($this->validateAction()) {
         $nvc = $this->page->getVersionToModify();
         if ($this->asl->allowEditPaths()) {
             $data = array('cHandle' => $_POST['cHandle']);
             $nvc->update($data);
         }
         $as = AttributeSet::getByHandle('seo');
         $attributes = $as->getAttributeKeys();
         foreach ($attributes as $ak) {
             $ak->saveAttributeForm($nvc);
         }
         $r = new PageEditResponse($e);
         $r->setPage($this->page);
         $r->setTitle(t('Page Updated'));
         $r->setMessage(t('The SEO information has been saved.'));
         $r->outputJSON();
     }
     exit;
 }
コード例 #6
0
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributesets)) {
         foreach ($sx->attributesets->attributeset as $as) {
             $set = \Concrete\Core\Attribute\Set::getByHandle((string) $as['handle']);
             $akc = \Concrete\Core\Attribute\Key\Category::getByHandle($as['category']);
             $controller = $akc->getController();
             $manager = $controller->getSetManager();
             if (!is_object($set)) {
                 $pkg = static::getPackageObject($as['package']);
                 $set = $manager->addSet((string) $as['handle'], (string) $as['name'], $pkg, $as['locked']);
             }
             foreach ($as->children() as $ask) {
                 $ak = $controller->getAttributeKeyByHandle((string) $ask['handle']);
                 if (is_object($ak)) {
                     $manager->addKey($set, $ak);
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Category.php プロジェクト: ceko/concrete5-1
 /**
  * @param string $asHandle
  * @return AttributeSet Returns an AttributeSet object for the current category or null if no set exists with that handle
  */
 public function getAttributeSetByHandle($asHandle)
 {
     $attributeSet = AttributeSet::getByHandle($asHandle, $this->akCategoryID);
     return $attributeSet;
 }
コード例 #8
0
 protected function importAttributeSets(\SimpleXMLElement $sx)
 {
     if (isset($sx->attributesets)) {
         foreach ($sx->attributesets->attributeset as $as) {
             $set = \Concrete\Core\Attribute\Set::getByHandle((string) $as['handle']);
             $akc = AttributeKeyCategory::getByHandle($as['category']);
             if (!is_object($set)) {
                 $pkg = static::getPackageObject($as['package']);
                 $set = $akc->addSet((string) $as['handle'], (string) $as['name'], $pkg, $as['locked']);
             }
             foreach ($as->children() as $ask) {
                 $ak = $akc->getAttributeKeyByHandle((string) $ask['handle']);
                 if (is_object($ak)) {
                     $set->addKey($ak);
                 }
             }
         }
     }
 }
コード例 #9
0
ファイル: page.php プロジェクト: ceko/concrete5-1
<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Attribute\Set as AttributeSet;
$cp = new Permissions($c);
$pk = PermissionKey::getByHandle('edit_page_properties');
$pk->setPermissionObject($c);
$asl = $pk->getMyAssignment();
$seoSet = AttributeSet::getByHandle('seo');
?>
<section>
    <header><?php 
echo t('Page Settings');
?>
</header>
    <?php 
if ($cp->canEditPageContents() || $cp->canEditPageTheme() || $cp->canEditPageProperties() || $cp->canEditPageTemplate()) {
    ?>

    <menu class="ccm-panel-page-basics">
        <?php 
    $pagetype = PageType::getByID($c->getPageTypeID());
    if (is_object($pagetype) && $cp->canEditPageContents()) {
        ?>
            <li>
                <a href="#" data-launch-panel-detail="page-composer"
                   data-panel-detail-url="<?php 
        echo URL::to('/ccm/system/panels/details/page/composer');
        ?>
"
                   data-panel-transition="fade">
コード例 #10
0
ファイル: Field.php プロジェクト: ExchangeCore/razor-commerce
 public function set($setHandle)
 {
     $set = AttributeSet::getByHandle($setHandle);
     $akc = AttributeKeyCategory::getByHandle($this->category);
     $ak = $akc->getAttributeKeyByHandle($this->handle);
     if (!is_object($ak)) {
         return false;
     }
     $set->addKey($ak);
     return true;
 }
コード例 #11
0
 public function skipItem()
 {
     $set = \Concrete\Core\Attribute\Set::getByHandle($this->object->getHandle());
     return is_object($set);
 }
コード例 #12
0
ファイル: controller.php プロジェクト: baardev/lbtb
 public function install_pb_attributes($pkg)
 {
     $eaku = AttributeKeyCategory::getByHandle('collection');
     $eaku->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
     $evset = $eaku->addSet('problog', t('ProBlog'), $pkg);
     $bset = AttributeSet::getByHandle('problog_additional_attributes');
     if (!is_object($bset)) {
         $bset = $eaku->addSet('problog_additional_attributes', t('ProBlog Additional Attributes'), $pkg);
     }
     $userpicker = AttributeType::getByHandle('user_picker');
     if (!is_object($userpicker) || !intval($userpicker->getAttributeTypeID())) {
         $userpicker = AttributeType::add('user_picker', tc('AttributeTypeName', 'User Picker'), $pkg);
         $eaku->associateAttributeKeyType($userpicker);
     }
     $multiuserpicker = AttributeType::getByHandle('multi_user_picker');
     if (!is_object($multiuserpicker) || !intval($multiuserpicker->getAttributeTypeID())) {
         $multiuserpicker = AttributeType::add('multi_user_picker', tc('AttributeTypeName', 'Multi User Picker'), $pkg);
         $eaku->associateAttributeKeyType($multiuserpicker);
     }
     $posttotwitter = AttributeType::getByHandle('post_to_twitter');
     if (!is_object($posttotwitter) || !intval($posttotwitter->getAttributeTypeID())) {
         $posttotwitter = AttributeType::add('post_to_twitter', tc('AttributeTypeName', 'Post To Twitter'), $pkg);
         $eaku->associateAttributeKeyType($posttotwitter);
     }
     $subscribe = AttributeType::getByHandle('subscribe');
     if (!is_object($subscribe) || !intval($subscribe->getAttributeTypeID())) {
         $subscribe = AttributeType::add('subscribe', tc('AttributeTypeName', 'Subscribe'), $pkg);
         $eaku->associateAttributeKeyType($subscribe);
     }
     $composeroptmizer = AttributeType::getByHandle('composer_optimizer');
     if (!is_object($composeroptmizer) || !intval($composeroptmizer->getAttributeTypeID())) {
         $composeroptmizer = AttributeType::add('composer_optimizer', tc('AttributeTypeName', 'ProBlog Optimizer'), $pkg);
         $eaku->associateAttributeKeyType($composeroptmizer);
     }
     $blogauth = CollectionAttributeKey::getByHandle('blog_author');
     if (!is_object($blogauth)) {
         CollectionAttributeKey::add($userpicker, array('akHandle' => 'blog_author', 'akName' => t('Blog Author')), $pkg)->setAttributeSet($evset);
     }
     $checkn = AttributeType::getByHandle('boolean');
     $blogsec = CollectionAttributeKey::getByHandle('blog_section');
     if (!is_object($blogsec)) {
         CollectionAttributeKey::add($checkn, array('akHandle' => 'blog_section', 'akName' => t('Blog Section'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1), $pkg)->setAttributeSet($evset);
     }
     $checkn = AttributeType::getByHandle('boolean');
     $cannonpage = CollectionAttributeKey::getByHandle('is_canonical_page');
     if (!is_object($cannonpage)) {
         CollectionAttributeKey::add($checkn, array('akHandle' => 'is_canonical_page', 'akName' => t('Is Canonical Page'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1), $pkg)->setAttributeSet($evset);
     }
     $pulln = AttributeType::getByHandle('select');
     $blogcat = CollectionAttributeKey::getByHandle('blog_category');
     if (!is_object($blogcat)) {
         CollectionAttributeKey::add($pulln, array('akHandle' => 'blog_category', 'akName' => t('Blog Category'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowOtherValues' => true), $pkg)->setAttributeSet($evset);
     }
     $blogtag = CollectionAttributeKey::getByHandle('tags');
     if (!is_object($blogtag)) {
         CollectionAttributeKey::add($pulln, array('akHandle' => 'tags', 'akName' => t('Tags'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowMultipleValues' => true, 'akSelectAllowOtherValues' => true), $pkg)->setAttributeSet($evset);
     } else {
         $blogtag->update(array('akHandle' => 'tags', 'akName' => t('Tags'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akSelectAllowMultipleValues' => true, 'akSelectAllowOtherValues' => true));
     }
     $imagen = AttributeType::getByHandle('image_file');
     $blogthum = CollectionAttributeKey::getByHandle('thumbnail');
     if (!is_object($blogthum)) {
         CollectionAttributeKey::add($imagen, array('akHandle' => 'thumbnail', 'akName' => t('Thumbnail Image')), $pkg)->setAttributeSet($evset);
     }
     $send_subscribe = CollectionAttributeKey::getByHandle('send_subscription');
     if (!is_object($send_subscribe)) {
         CollectionAttributeKey::add($subscribe, array('akHandle' => 'send_subscription', 'akName' => t('Send To Subscribers')), $pkg)->setAttributeSet($evset);
     }
     $postBlogToTwitter = CollectionAttributeKey::getByHandle('post_to_twitter');
     if (!is_object($postBlogToTwitter)) {
         CollectionAttributeKey::add($posttotwitter, array('akHandle' => 'post_to_twitter', 'akName' => t('Post To Twitter')), $pkg)->setAttributeSet($evset);
     }
     $composerBlogOptimizer = CollectionAttributeKey::getByHandle('composer_optimizer');
     if (!is_object($composerBlogOptimizer)) {
         CollectionAttributeKey::add($composeroptmizer, array('akHandle' => 'composer_optimizer', 'akName' => t('ProBlog Optimizer')), $pkg)->setAttributeSet($evset);
     }
     $users = CollectionAttributeKey::getByHandle('subscription');
     if (!is_object($users)) {
         $users = array('akHandle' => 'subscription', 'akName' => 'Subscribed Members', 'akIsSearchable' => 0, 'akIsSearchableIndexed' => 0, 'akIsAutoCreated' => 1, 'akIsEditable' => 1);
         $users = CollectionAttributeKey::add($multiuserpicker, $users, $pkg);
     }
 }