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


PHP Table::factory方法代码示例

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


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

示例1: testEmailOnNewIsTrueWhenPreferenceSet

 public function testEmailOnNewIsTrueWhenPreferenceSet()
 {
     $comment = Table::factory('Comments')->read(3);
     $this->assertTrue($comment->emailOnNew());
     $comment = Table::factory('Comments')->read(4);
     $this->assertTrue($comment->emailOnNew());
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:7,代码来源:CommentTest.php

示例2: index

 public function index()
 {
     if ($this->request->isGet()) {
         $this->assign("columns", Table::factory('Contacts')->getColumns());
     }
     if ($this->request->isPost()) {
         $contact = Table::factory('Contacts')->newObject();
         if ($contact->setValues($this->request->getPost())) {
             // all good. add, and stuff
             $contact->save();
             $address = Settings::getValue("contact.address");
             $subject = "Enquiry via paynedigital.com";
             $from = $contact->name . " <" . $contact->email . ">";
             $email = Email::factory();
             $email->setFrom($from);
             $email->setTo($address);
             $email->setSubject($subject);
             $email->setBody($this->fetchTemplate("emails/contact", array("query" => $contact->content, "name" => $contact->name)));
             $email->send();
             if (!$this->request->isAjax()) {
                 $this->setFlash("contact_thanks");
                 return $this->redirectAction("thanks");
             }
         } else {
             $this->setErrors($contact->getErrors());
         }
     }
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:28,代码来源:contact.php

示例3: index

 public function index()
 {
     $articles = Table::factory('Posts')->findRecent(10);
     $this->assign('articles', $articles);
     $this->response->addHeader('Content-Type', 'text/xml; charset=utf-8');
     return $this->render("index");
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:7,代码来源:feed.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     Utils::reset();
     Utils::setCurrentDate("2011-09-19 00:00:00");
     $this->table = Table::factory("Posts");
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:7,代码来源:PostsTest.php

示例5: generateUniqueIdentifier

 public function generateUniqueIdentifier()
 {
     do {
         $identifier = $this->generateIdentifier();
     } while (Table::factory("Previews")->findByIdentifier($identifier) !== false);
     return $identifier;
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:7,代码来源:previews.php

示例6: do_redirect

 public function do_redirect()
 {
     $link = Table::factory('Shortlinks')->findByUrl($this->getMatch('url'));
     if ($link == null) {
         throw new CoreException('Redirect URL not found', CoreException::PATH_REJECTED);
     }
     return $this->redirect($link->redirect_url);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:8,代码来源:shortlinks.php

示例7: index

 public function index()
 {
     $posts = Table::factory('Posts')->findAllForTagOrTitle($this->request->getVar('q'));
     $query = $this->request->getVar('q');
     if ($query !== null && trim($query) != "") {
         $this->assign('search_query', $this->request->getVar('q'));
     }
     $this->assign('posts', $posts);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:9,代码来源:search.php

示例8: getRelatedPosts

 public function getRelatedPosts()
 {
     return Table::factory('RelatedPosts')->findAll(array("post_id" => $this->getId()));
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:4,代码来源:posts.php

示例9: content

 /**
  * Get pages contents
  *
  * @return string
  */
 public static function content($slug = '')
 {
     if (!empty($slug)) {
         $page = Table::factory('pages')->select('[slug="' . $slug . '"]', null);
         if (!empty($page)) {
             $content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
             $content = Filter::apply('content', $content);
             return $content;
         } else {
             return '';
         }
     } else {
         return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:20,代码来源:pages.plugin.php

示例10: delete_related_post

 public function delete_related_post()
 {
     $related = Table::factory('RelatedPosts')->read($this->getMatch('related_post_id'));
     if ($related == false || $related->post_id != $this->post->getId()) {
         return $this->redirectAction("index", "You cannot perform this action");
     }
     $related->delete();
     return $this->redirectAction("index", "Relation Deleted");
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:9,代码来源:admin.php

示例11: getAllPosts

 /**
  * NB this INCLUDES posts which have been deleted or not yet published
  */
 public function getAllPosts()
 {
     return Table::factory('Posts')->findAll(array("user_id" => $this->getId()));
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:7,代码来源:users.php

示例12: assignArchive

 protected function assignArchive()
 {
     $archive = Table::factory('Posts')->findMonthsWithPublishedPosts();
     $this->assign('archive', $archive);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:5,代码来源:blog.php

示例13: testGetTweetUrlWithRecentArticle

 public function testGetTweetUrlWithRecentArticle()
 {
     $post = Table::factory('Posts')->newObject();
     $post->setValues(array("published" => "01/03/2013 00:00:00", "url" => "test-article"));
     $this->assertEquals("articles/2013/03/test-article", $post->getTweetUrl());
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:6,代码来源:PostTest.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->table = Table::factory("Users");
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:5,代码来源:UsersTest.php

示例15: testScriptBlockAddsContentWhenProvided

 public function testScriptBlockAddsContentWhenProvided()
 {
     $this->request->dispatch("/articles/2011/09/this-is-a-test-post");
     $this->assertBodyHasContents("<script type=\"text/javascript\" src=\"/foo/bar.js\"></script>", Table::factory('Posts')->read(3)->script_block);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:5,代码来源:BlogControllerTest.php


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