• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ContentController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testCustomSearchFormClassesToTest

 function testCustomSearchFormClassesToTest()
 {
     FulltextSearchable::enable('File');
     $page = new Page();
     $controller = new ContentController($page);
     $form = $controller->SearchForm();
     $this->assertEquals(array('File'), $form->getClassesToSearch());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:8,代码来源:ContentControllerSearchExtensionTest.php


示例2: testList

 public function testList()
 {
     $c = new ContentController();
     $model = $c->getModel('helloworlds');
     $worlds = $model->getItems();
     var_dump($worlds);
     $this->assertNotEmpty($worlds);
 }
开发者ID:uozuAho,项目名称:joomla25_helloworld,代码行数:8,代码来源:modelsHelloWorldsTest.php


示例3: handleInput

 /**
  *	Handles input, by calling according controller,
  *	an sets view depending on url.
  *	@return void
  */
 public function handleInput()
 {
     //Create database, get content catalog
     $db = new Database();
     $contentDAL = new contentDAL($db);
     $Catalog = new contentCatalog();
     $contentController = new ContentController($contentDAL, $Catalog);
     $contentCatalog = $contentController->getContent();
     //Handle login
     if ($this->navigationView->wantsToLogin()) {
         $login = new LoginController($this->users, $this->navigationView);
         $this->IsLoggedIn = $login->doLogin();
         if ($this->IsLoggedIn) {
             $this->navigationView->redirToAdmin();
         } else {
             $this->view = $login->getOutPut();
         }
     } else {
         if ($this->navigationView->wantsToUpload() && isset($_SESSION['user'])) {
             $this->view = new AdminView();
             $uploadController = new uploadController($this->view, $contentDAL, $this->users);
             $uploadController->doUpload();
         } else {
             if ($this->navigationView->wantsToReg()) {
                 $model = new RegFacade($this->userDAL);
                 $this->view = new RegView($this->navigationView);
                 $regControl = new RegisterController($model, $this->view);
                 $regControl->addUser();
                 $this->view = new RegView($this->navigationView);
             } else {
                 if ($this->navigationView->wantsToViewImage()) {
                     $this->view = new ImageView();
                     $imgController = new ImageController($this->view, $contentCatalog);
                     $imgController->getImage();
                 } else {
                     if ($this->navigationView->wantsToViewContent()) {
                         $commentView = new commentView();
                         $this->view = new ContentView($commentView);
                         $id = $this->view->getID();
                         $commentDAL = new commentDAL($db);
                         $commentController = new CommentController($commentView, $commentDAL);
                         $comments = $commentController->doComment($id);
                         $content = $contentController->getContentByID($id);
                         $this->view->createHTML($content, $comments);
                     } else {
                         $this->view = new galleryView();
                         $galController = new GalleryController($this->view);
                         $galController->doGallery($contentCatalog);
                     }
                 }
             }
         }
     }
 }
开发者ID:henceee,项目名称:1DV608_project,代码行数:59,代码来源:MasterController.php


示例4: testHasmethodBehaviour

	function testHasmethodBehaviour() {
		/* SiteTree should have all of the methods that Versioned has, because Versioned is listed in SiteTree's
		 * extensions */
		$st = new SiteTree();
		$cc = new ContentController($st);

		$this->assertTrue($st->hasMethod('publish'), "Test SiteTree has publish");
		$this->assertTrue($st->hasMethod('migrateVersion'), "Test SiteTree has migrateVersion");
		
		/* This relationship should be case-insensitive, too */
		$this->assertTrue($st->hasMethod('PuBliSh'), "Test SiteTree has PuBliSh");
		$this->assertTrue($st->hasMethod('MiGratEVersIOn'), "Test SiteTree has MiGratEVersIOn");
		
		/* In a similar manner, all of SiteTree's methods should be available on ContentController, because $failover is set */
		$this->assertTrue($cc->hasMethod('canView'), "Test ContentController has canView");
		$this->assertTrue($cc->hasMethod('linkorcurrent'), "Test ContentController has linkorcurrent");
		
		/* This 'method copying' is transitive, so all of Versioned's methods should be available on ContentControler.
		 * Once again, this is case-insensitive */
		$this->assertTrue($cc->hasMethod('MiGratEVersIOn'), "Test ContentController has MiGratEVersIOn");
		
		/* The above examples make use of SiteTree, Versioned and ContentController.  Let's test defineMethods() more
		 * directly, with some sample objects */
		$objs = array();
		$objs[] = new ObjectTest_T2();
		$objs[] = new ObjectTest_T2();
		$objs[] = new ObjectTest_T2();
		
		// All these methods should exist and return true
		$trueMethods = array('testMethod','otherMethod','someMethod','t1cMethod','normalMethod');
		
		foreach($objs as $i => $obj) {
			foreach($trueMethods as $method) {
				$methodU = strtoupper($method);
				$methodL = strtoupper($method);
				$this->assertTrue($obj->hasMethod($method), "Test that obj#$i has method $method");
				$this->assertTrue($obj->hasMethod($methodU), "Test that obj#$i has method $methodU");
				$this->assertTrue($obj->hasMethod($methodL), "Test that obj#$i has method $methodL");

				$this->assertTrue($obj->$method(), "Test that obj#$i can call method $method");
				$this->assertTrue($obj->$methodU(), "Test that obj#$i can call method $methodU");
				$this->assertTrue($obj->$methodL(), "Test that obj#$i can call method $methodL");
			}
			
			$this->assertTrue($obj->hasMethod('Wrapping'), "Test that obj#$i has method Wrapping");
			$this->assertTrue($obj->hasMethod('WRAPPING'), "Test that obj#$i has method WRAPPING");
			$this->assertTrue($obj->hasMethod('wrapping'), "Test that obj#$i has method wrapping");
			
			$this->assertEquals("Wrapping", $obj->Wrapping(), "Test that obj#$i can call method Wrapping");
			$this->assertEquals("Wrapping", $obj->WRAPPING(), "Test that obj#$i can call method WRAPPIGN");
			$this->assertEquals("Wrapping", $obj->wrapping(), "Test that obj#$i can call method wrapping");
		}
		
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:54,代码来源:ObjectTest.php


示例5: testCustomSearchFormClassesToTest

	function testCustomSearchFormClassesToTest() {
		FulltextSearchable::enable('File');
		
		$page = new Page();
		$page->URLSegment = 'whatever';
		$page->Content = 'oh really?';
		$page->write();
		$page->publish('Stage', 'Live'); 
		$controller = new ContentController($page);
		$form = $controller->SearchForm(); 
		
		if (get_class($form) == 'SearchForm') $this->assertEquals(array('File'), $form->getClassesToSearch());
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:13,代码来源:ContentControllerSearchExtensionTest.php


示例6: enable

 public static function enable($searchableClasses = array('SiteTree'))
 {
     // Chris Bolt, removed file
     // Chris Bolt add site tree extension
     SiteTree::add_extension('BoltSearchIndexedSiteTree');
     $defaultColumns = array('SiteTree' => '"Title","MenuTitle","Content","MetaDescription","SearchIndex"');
     if (!is_array($searchableClasses)) {
         $searchableClasses = array($searchableClasses);
     }
     foreach ($searchableClasses as $class) {
         if (!class_exists($class)) {
             continue;
         }
         if (isset($defaultColumns[$class])) {
             Config::inst()->update($class, 'create_table_options', array(MySQLSchemaManager::ID => 'ENGINE=MyISAM'));
             $class::add_extension("FulltextSearchable('{$defaultColumns[$class]}')");
         } else {
             throw new Exception("FulltextSearchable::enable() I don't know the default search columns for class '{$class}'");
         }
     }
     self::$searchable_classes = $searchableClasses;
     if (class_exists("ContentController")) {
         ContentController::add_extension("ContentControllerSearchExtension");
     }
 }
开发者ID:christopherbolt,项目名称:silverstripe-bolttools,代码行数:25,代码来源:BoltFulltextSearchable.php


示例7: module_controller_for_request

 public static function module_controller_for_request(ContentController $contentController, SS_HTTPRequest $request, $relationship = 'ContentModules')
 {
     $moduleURLSegment = $request->shift();
     if ($module = $contentController->data()->{$relationship}()->filter('URLSegment', $moduleURLSegment)->first()) {
         $controller = self::controller_for($module, $contentController);
         //backwards compatibility support for modules handling actions directly
         //should move to using controllers to handle actions
         if ($controller instanceof ModuleController) {
             return $controller->handleRequest($request, new DataModel());
         } else {
             $action = $request->shift();
             if ($controller->hasMethod($action)) {
                 return $controller->{$action}($request);
             }
         }
     }
 }
开发者ID:webtorque7,项目名称:inpage-modules,代码行数:17,代码来源:ModuleAsController.php


示例8: testChildrenOf

 /**
  * Tests {@link ContentController::ChildrenOf()}
  */
 public function testChildrenOf()
 {
     $controller = new ContentController();
     SiteTree::enable_nested_urls();
     $this->assertEquals(1, $controller->ChildrenOf('/')->Count());
     $this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
     $this->assertEquals(2, $controller->ChildrenOf('/home/second-level/')->Count());
     $this->assertEquals(0, $controller->ChildrenOf('/home/second-level/third-level/')->Count());
     SiteTree::disable_nested_urls();
     $this->assertEquals(1, $controller->ChildrenOf('/')->Count());
     $this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
     $this->assertEquals(2, $controller->ChildrenOf('/second-level/')->Count());
     $this->assertEquals(0, $controller->ChildrenOf('/third-level/')->Count());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:17,代码来源:ContentControllerTest.php


示例9: testChildrenOf

 /**
  * Tests {@link ContentController::ChildrenOf()}
  */
 public function testChildrenOf()
 {
     $controller = new ContentController();
     Config::inst()->update('SiteTree', 'nested_urls', true);
     $this->assertEquals(1, $controller->ChildrenOf('/')->Count());
     $this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
     $this->assertEquals(2, $controller->ChildrenOf('/home/second-level/')->Count());
     $this->assertEquals(0, $controller->ChildrenOf('/home/second-level/third-level/')->Count());
     SiteTree::config()->nested_urls = false;
     $this->assertEquals(1, $controller->ChildrenOf('/')->Count());
     $this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
     $this->assertEquals(2, $controller->ChildrenOf('/second-level/')->Count());
     $this->assertEquals(0, $controller->ChildrenOf('/third-level/')->Count());
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:17,代码来源:ContentControllerTest.php


示例10: testCurrentTheme

 /**
  * Tests for {@link SSViewer::current_theme()} for different behaviour
  * of user defined themes via {@link SiteConfig} and default theme
  * when no user themes are defined.
  */
 function testCurrentTheme()
 {
     $config = SiteConfig::current_site_config();
     $oldTheme = $config->Theme;
     $config->Theme = '';
     $config->write();
     SSViewer::set_theme('mytheme');
     $this->assertEquals('mytheme', SSViewer::current_theme(), 'Current theme is the default - user has not defined one');
     $config->Theme = 'myusertheme';
     $config->write();
     // Pretent to load the page
     $c = new ContentController();
     $c->init();
     $this->assertEquals('myusertheme', SSViewer::current_theme(), 'Current theme is a user defined one');
     // Set the theme back to the original
     $config->Theme = $oldTheme;
     $config->write();
 }
开发者ID:NARKOZ,项目名称:silverstripe-doc-restructuring,代码行数:23,代码来源:SSViewerTest.php


示例11: init

 public function init()
 {
     parent::init();
     // Import jquery and bootstrap js
     Requirements::javascript($this->ThemeDir() . "/js/libs/jquery.min.js");
     Requirements::javascript($this->ThemeDir() . "/js/libs/bootstrap.min.js");
 }
开发者ID:robb-j,项目名称:ss-boilerplate,代码行数:7,代码来源:Page.php


示例12: init

    public function init()
    {
        parent::init();
        Requirements::themedCSS('reset');
        Requirements::themedCSS('layout');
        Requirements::themedCSS('form');
        Requirements::themedCSS('typography');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
        Requirements::css('mysite/css/demo.css');
        Requirements::css('mysite/css/moduleSupport.css');
        Requirements::customScript(<<<JS
(function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-84547-17', 'auto', { 'allowLinker': true });
ga('require', 'linker');
ga('linker:autoLink', [
\t'www.silverstripe.com',
\t'www.silverstripe.org',
\t'addons.silverstripe.org',
\t'api.silverstripe.org',
\t'docs.silverstripe.org',
\t'userhelp.silverstripe.org',
\t'demo.silverstripe.org'
]);
ga('send', 'pageview');
JS
);
    }
开发者ID:mateusz,项目名称:demo.silverstripe.org,代码行数:31,代码来源:Page.php


示例13: init

 public function init()
 {
     parent::init();
     // Note: you should use SS template require tags inside your templates
     // instead of putting Requirements calls here.  However these are
     // included so that our older themes still work
     Requirements::themedCSS('layout');
     Requirements::themedCSS('comments');
     Requirements::themedCSS('typography');
     Requirements::themedCSS('form');
     Requirements::themedCSS('slick');
     if (!Cookie::get($StoryModeCookie)) {
         Cookie::set($StoryModeCookie, 'Normal');
     }
     if (!Cookie::get($StorySizeCookie)) {
         Cookie::set($StorySizeCookie, 'Normal');
     }
     // Increment page view counter
     $pagecounter = DataObject::get_one("PageCounter", "PageID='{$this->ID}'");
     if (!$pagecounter) {
         $pagecounter = new PageCounter();
         $pagecounter->PageID = $this->ID;
     }
     $pagecounter->Counter = $pagecounter->Counter + 1;
     $pagecounter->write();
 }
开发者ID:krissihall,项目名称:sm_ss,代码行数:26,代码来源:Page.php


示例14: init

 public function init()
 {
     parent::init();
     // You can include any CSS or JS required by your project here.
     // See: http://doc.silverstripe.org/framework/en/reference/requirements
     Requirements::css("https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");
 }
开发者ID:andrewandante,项目名称:blackdorisrovers,代码行数:7,代码来源:Page.php


示例15: init

	function init() {
		parent::init();
		
		Requirements::themedCSS("layout");
		Requirements::themedCSS("typography");
		Requirements::themedCSS("form");
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:7,代码来源:Page.php


示例16: init

    public function init()
    {
        parent::init();
        Requirements::themedCSS('reset');
        Requirements::themedCSS('layout');
        Requirements::themedCSS('form');
        Requirements::themedCSS('typography');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
        Requirements::css('mysite/css/demo.css');
        Requirements::css('mysite/css/moduleSupport.css');
        Requirements::customScript(<<<JS
var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-84547-11']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
JS
);
    }
开发者ID:newleeland,项目名称:demo.silverstripe.org,代码行数:26,代码来源:Page.php


示例17: init

 public function init()
 {
     parent::init();
     if (!$this->config()->service) {
         $this->httpError(404);
     }
     $this->setService($this->config()->service);
     $this->pageService = new StyleGuide\PageService($this);
     // redirect to the first action route
     if (!$this->request->param('Action')) {
         $page = $this->pageService->getPages()->first();
         $this->redirect($page->Link);
     }
     // if no template set on the action route then redirect to the first child
     if (!$this->request->param('ChildAction') && !$this->pageService->getTemplate()) {
         $page = $this->pageService->getActivePage();
         if (isset($page->Children)) {
             $childPage = $page->Children->first();
             $this->redirect($childPage->Link);
         }
     }
     // set the service
     $this->setRequirements();
     // load the fixture file
     $this->loadFixture();
 }
开发者ID:benmanu,项目名称:silverstripe-styleguide,代码行数:26,代码来源:StyleGuideController.php


示例18: init

 public function init()
 {
     parent::init();
     // Note: you should use SS template require tags inside your templates
     // instead of putting Requirements calls here.  However these are
     // included so that our older themes still work
     Requirements::css('themes/simple/css/homepage.css');
     Requirements::customScript('
             $("a.scroll-arrow").mousedown( function(e) {
                          e.preventDefault();              
           			var container = $(this).parent().attr("id");                              
                            var direction = $(this).is("#scroll-right") ? "+=" : "-=";
                            var totalWidth = -$(".row__inner").width();
                            $(".row__inner .tile").each(function() {
                                totalWidth += $(this).outerWidth(true);
                            });
                            
                            $("#"+ container + " .row__inner").animate({
                                scrollLeft: direction + Math.min(totalWidth, 3000)
                                
                            },{
                                duration: 2500,
                                easing: "swing", 
                                queue: false }
                            );
                        }).mouseup(function(e) {
                          $(".row__inner").stop();
            });');
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:29,代码来源:Page.php


示例19: __construct

 /**
  * Fake a Page_Controller by using that class as a failover
  */
 public function __construct($dataRecord = null)
 {
     if (class_exists('Page_Controller')) {
         $dataRecord = new Page_Controller($dataRecord);
     }
     parent::__construct($dataRecord);
 }
开发者ID:helpfulrobot,项目名称:betterbrief-silverstripe-opauth,代码行数:10,代码来源:OpauthController.php


示例20: init

    public function init()
    {
        parent::init();
        // Concatenate CSS
        Requirements::combine_files('style.css', array('mysite/css/layout.css', 'mysite/css/userstyles.css'));
        // Concatenate JavaScript
        Requirements::combine_files('scripts.js', array('mysite/javascript/lib/top-nav.js', 'mysite/javascript/vanilla.js'));
        // Google Analytics
        $config = SiteConfig::current_site_config();
        $google = $config->GACode;
        $gaJS = <<<JS
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o), m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
            ga('create', '{$google}', 'auto');
            ga('send', 'pageview');
JS;
        Requirements::customScript($gaJS);
    }
开发者ID:digi-brains,项目名称:Silver-Stream,代码行数:26,代码来源:Page.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ContentDistributionPlugin类代码示例发布时间:2022-05-23
下一篇:
PHP Content类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap