当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::onAfterWrite方法代码示例

本文整理汇总了PHP中Page::onAfterWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::onAfterWrite方法的具体用法?PHP Page::onAfterWrite怎么用?PHP Page::onAfterWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Page的用法示例。


在下文中一共展示了Page::onAfterWrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     if ($this->isInsert) {
         $blog = new BlogHolder();
         $blog->ParentID = $this->ID;
         $blog->Title = "News";
         $blog->ShowInMenus = false;
         $blog->write();
         $blog->publish('Stage', 'Live');
         $calendar = new Calendar();
         $calendar->ParentID = $this->ID;
         $calendar->Title = "Calendar";
         $calendar->ShowInMenus = false;
         $calendar->write();
         $calendar->publish('Stage', 'Live');
         $leaders = new ScoutGroupLeaders();
         $leaders->ParentID = $this->ID;
         $leaders->Title = "Leaders";
         $leaders->ShowInMenus = false;
         $leaders->write();
         $leaders->publish('Stage', 'Live');
     }
     $this->isInsert = false;
 }
开发者ID:helpfulrobot,项目名称:phpboyscout-silverstripe-scouts,代码行数:25,代码来源:ScoutGroup.php

示例2: onAfterWrite

 function onAfterWrite()
 {
     if ($this->ID) {
         $this->checkFolder();
     }
     parent::onAfterWrite();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:ImageGalleryPage.php

示例3: onAfterWrite

 /**
  * Updates the Image.ExifDate database column of image objects when page is saved
  *
  * @return void
  */
 function onAfterWrite()
 {
     parent::onAfterWrite();
     // update Image.ExifDate database fields of all images assigned to actual page if image sort option is set "4:ExifDate"
     // Todo: execute DB update on URL request instead page write to avoid timing issues when dealing with lots of big images
     if (cwsFolderGalleryPage_Controller::getImageSortOption() == "ExifDate") {
         cwsFolderGalleryImageExtension::writeExifDates($this->AlbumFolderID);
     }
 }
开发者ID:helpfulrobot,项目名称:cwsoft-silverstripe-foldergallery,代码行数:14,代码来源:cwsFolderGalleryPage.php

示例4: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     $path = Director::baseFolder() . "/.htaccess";
     $curr_data = @file($path);
     //Silverstripe is bad and should feel bad
     $page = DataObject::get_by_id('BlogPage', $this->ID, false);
     $extra = $page->BlogURL ? "RewriteCond %{REQUEST_URI} !^/" . $page->BlogURL : "";
     $new_file = array();
     // first remove any blog redirect already in the file
     $remove_keys = array();
     foreach ($curr_data as $key => $line) {
         if (trim($line) == "### Blog Redirect ###") {
             $remove_keys[] = $key;
             $remove_keys[] = $key + 1;
         }
     }
     foreach ($remove_keys as $key) {
         unset($curr_data[$key]);
     }
     $ss_line = 0;
     foreach ($curr_data as $line) {
         if (trim($line) == "### SILVERSTRIPE START ###") {
             $start = true;
         }
         if ($start && trim($line) == "RewriteCond %{REQUEST_FILENAME} !-f") {
             $inside = true;
         }
         if (trim($line) == "### SILVERSTRIPE END ###") {
             $inside = false;
         }
         if ($inside) {
             $new_file[] = trim("### Blog Redirect ###");
             $new_file[] = trim($extra);
             $inside = false;
         }
         $new_file[] = trim($line);
     }
     $h = @fopen($path, "w");
     fwrite($h, implode("\n", $new_file));
     @fclose($h);
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-basepages,代码行数:42,代码来源:BlogPage.php

示例5: onAfterWrite

 public function onAfterWrite()
 {
     if ($this->isChanged('ID')) {
         $section = new MemberProfileFieldsSection();
         $section->ParentID = $this->ID;
         $section->write();
     }
     parent::onAfterWrite();
 }
开发者ID:SilbinaryWolf,项目名称:silverstripe-memberprofiles,代码行数:9,代码来源:MemberProfilePage.php

示例6: onAfterWrite

 /**
  * {@inheritdoc}
  *
  * Sets blog relationship on all categories and tags assigned to this post.
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     foreach ($this->Categories() as $category) {
         /**
          * @var BlogCategory $category
          */
         $category->BlogID = $this->ParentID;
         $category->write();
     }
     foreach ($this->Tags() as $tag) {
         /**
          * @var BlogTag $tag
          */
         $tag->BlogID = $this->ParentID;
         $tag->write();
     }
 }
开发者ID:javabrett,项目名称:silverstripe-blog,代码行数:23,代码来源:BlogPost.php

示例7: onAfterWrite

 public function onAfterWrite()
 {
     Multisites::inst()->build();
     parent::onAfterWrite();
 }
开发者ID:silverstripe-australia,项目名称:silverstripe-multisites,代码行数:5,代码来源:Site.php

示例8: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     // Don't do this stuff when we're publishing
     if (!$this->extension_instances['Versioned']->migratingVersion) {
         if ($this->isChanged('CopyContentFromID') && $this->CopyContentFromID != 0 && $this instanceof VirtualPage) {
             $this->updateImageTracking();
         }
     }
     // Check if page type has changed to a non-virtual page.
     // Caution: Relies on the fact that the current instance is still of the old page type.
     if ($this->isChanged('ClassName', 2)) {
         $changed = $this->getChangedFields();
         $classBefore = $changed['ClassName']['before'];
         $classAfter = $changed['ClassName']['after'];
         if ($classBefore != $classAfter) {
             // Remove all database rows for the old page type to avoid inconsistent data retrieval.
             // TODO This should apply to all page type changes, not only on VirtualPage - but needs
             // more comprehensive testing as its a destructive operation
             $removedTables = array_diff(ClassInfo::dataClassesFor($classBefore), ClassInfo::dataClassesFor($classAfter));
             if ($removedTables) {
                 foreach ($removedTables as $removedTable) {
                     // Note: *_versions records are left intact
                     foreach (array('', 'Live') as $stage) {
                         if ($stage) {
                             $removedTable = "{$removedTable}_{$stage}";
                         }
                         DB::prepared_query("DELETE FROM \"{$removedTable}\" WHERE \"ID\" = ?", array($this->ID));
                     }
                 }
             }
             // Also publish the change immediately to avoid inconsistent behaviour between
             // a non-virtual draft and a virtual live record (e.g. republishing the original record
             // shouldn't republish the - now unrelated - changes on the ex-VirtualPage draft).
             // Copies all stage fields to live as well.
             // @todo Update get_one to support parameterised queries
             $source = DataObject::get_by_id("SiteTree", $this->CopyContentFromID);
             $this->copyFrom($source);
             $this->publish('Stage', 'Live');
             // Change reference on instance (as well as removing the underlying database tables)
             $this->CopyContentFromID = 0;
         }
     }
 }
开发者ID:antons-,项目名称:silverstripe-cms,代码行数:44,代码来源:VirtualPage.php

示例9: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     // Don't do this stuff when we're publishing
     if (!$this->extension_instances['Versioned']->migratingVersion) {
         if ($this->isChanged('CopyContentFromID') && $this->CopyContentFromID != 0 && $this instanceof VirtualPage) {
             $this->updateImageTracking();
         }
     }
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:10,代码来源:VirtualPage.php

示例10: onAfterWrite

 /**
  * (non-PHPdoc)
  *
  * @see SiteTree::onBeforeWrite()
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     // Skip on publishing
     if (Versioned::get_live_stage() == Versioned::current_stage()) {
         return;
     }
     // Update the values of all fields added from editable field
     if ($this->ID && $this->many_many('Fields') && ($pageFields = $this->getEditableFields())) {
         foreach ($pageFields as $pageField) {
             // Set submitted value into the field
             $field = $pageField->getFormField();
             if (!$field) {
                 continue;
             }
             $field->setValue($this->{$pageField->Name});
             // Extra fields to be saved
             $value = $field->Value();
             $sort = $pageField->Sort;
             $group = $pageField->Group;
             // Clone the editable field object
             // Remove the current saved one
             $pageFields->remove($pageField);
             // Add the clone with the new extra data
             $pageFields->add($pageField, ['Value' => $value, 'Sort' => $sort, 'Group' => $group]);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:satrun77-configurablepage,代码行数:33,代码来源:ConfigurablePage.php

示例11: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     $this->RetrieveCampaigns();
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-smartchimp,代码行数:5,代码来源:SmartChimpSignupPage.php

示例12: onAfterWrite

 public function onAfterWrite()
 {
     $this->addMemberAccountFields($this);
     parent::onAfterWrite();
 }
开发者ID:helpfulrobot,项目名称:zucchi-membermanagement,代码行数:5,代码来源:MembersAccountPage.php

示例13: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     // Don't do this stuff when we're publishing
     if (!$this->extension_instances['Versioned']->migratingVersion) {
         if ($this->isChanged('CopyContentFromID') && $this->CopyContentFromID != 0 && $this instanceof VirtualPage) {
             $this->updateImageTracking();
         }
     }
     FormResponse::add("\$('Form_EditForm').reloadIfSetTo({$this->ID});", $this->ID . "_VirtualPage_onAfterWrite");
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:11,代码来源:VirtualPage.php

示例14: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     if ($this->ImageID) {
         if ($normalImage = Image::get()->exclude(array("ClassName" => "Product_Image"))->byID($this->ImageID)) {
             $normalImage = $normalImage->newClassInstance("Product_Image");
             $normalImage->write();
         }
     }
 }
开发者ID:abhibavishi,项目名称:silverstripe-ecommerce,代码行数:10,代码来源:ProductGroup.php

示例15: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     // Update TreePosition for all children
     $this->updateChildTreePositions(false);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-knowledgebase,代码行数:6,代码来源:KnowledgeBasePage.php


注:本文中的Page::onAfterWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。