Changeset 1014:65b07a8688ca
- Timestamp:
- 11/14/12 22:47:48 (13 years ago)
- Branch:
- twig
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1001 r1014 69 69 70 70 71 72 $page = new dcAdminPage($core);73 71 74 72 $form = new dcForm($core,'post','post.php'); … … 314 312 } 315 313 316 $ctx = $page->getContext(); 317 $ctx 314 $core->page->getContext() 318 315 ->jsDatePicker() 319 316 ->jsToolBar() … … 324 321 ->jsConfirmClose('entry-form','comment-form'); 325 322 326 echo $ page->render('post.html.twig',array(323 echo $core->page->render('post.html.twig',array( 327 324 'edit_size'=> $core->auth->getOption('edit_size'))); 328 325 ?> -
inc/admin/class.dc.admincontext.php
r1001 r1014 1 1 <?php 2 3 2 4 3 class dcAdminContext extends Twig_Extension { … … 23 22 } 24 23 } 25 $this->blog = array( 26 'url' => $core->blog->url, 27 'name' => $core->blog->name 28 ); 24 $this->blog = array(); 25 if ($this->core->auth->blog_count) { // no blog on auth.php 26 $this->blog = array( 27 'url' => $core->blog->url, 28 'name' => $core->blog->name 29 ); 30 } 29 31 } 30 32 … … 430 432 431 433 } 432 433 class dcAdminPage {434 protected $loader;435 protected $twig;436 protected $context;437 protected $core;438 439 public function __construct($core) {440 $this->core = $core;441 $this->loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/default-templates');442 files::makeDir(dirname(DC_TPL_CACHE.'/admtpl'),true);443 $core->twig = new Twig_Environment (444 $this->loader,445 array(446 'cache' => DC_TPL_CACHE.'/admtpl',447 //'debug' => true,448 'auto_reload' => true449 ));450 //$core->twig->addExtension(new Twig_Extensions_Extension_Debug());451 $core->twig->addExtension(new Twig_Extension_Optimizer(0));452 $core->twig->addExtension(new dcFormExtension($GLOBALS['core']));453 $this->context = new dcAdminContext($GLOBALS['core']);454 $core->twig->addExtension($this->context);455 $core->twig->clearCacheFiles();456 }457 458 public function getContext() {459 return $this->context;460 }461 462 public function getTwig() {463 return $this->twig;464 }465 public function render($name,array $context = array()) {466 $tpl = $this->core->twig->loadTemplate($name);467 468 return $tpl->render($context);469 470 }471 }472 473 474 434 ?> -
inc/admin/class.dc.form.php
r992 r1014 145 145 $this->action = $action; 146 146 $this->fields = array(); 147 $this->core-> twig->getExtension('dc_form')->addForm($this);147 $this->core->page->getExtension('dc_form')->addForm($this); 148 148 } 149 149 -
inc/core/class.dc.twig.page.php
r1012 r1014 4 4 class dcTwigPage extends Twig_Environment 5 5 { 6 protected $core; // not in use by now6 protected $core; 7 7 protected $context = null; 8 8 … … 34 34 35 35 # Add form helper 36 $this->addExtension(new dcFormExtension( ));36 $this->addExtension(new dcFormExtension($core)); 37 37 38 38 $this->clearCacheFiles(); -
inc/prepend.php
r1012 r1014 53 53 $__autoload['rsExtUser'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 54 54 55 56 $__autoload['dcAdminPage'] = dirname(__FILE__).'/admin/class.dc.adminpage.php'; 57 $__autoload['dcAdminContext'] = dirname(__FILE__).'/admin/class.dc.adminpage.php'; 55 $__autoload['dcAdminContext'] = dirname(__FILE__).'/admin/class.dc.admincontext.php'; 58 56 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php'; 59 57 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php'; … … 87 85 require TWIG_PATH.'/Autoloader.php'; 88 86 Twig_Autoloader::register(); 87 89 88 /* ------------------------------------------------------------------------------------------- */ 90 89
Note: See TracChangeset
for help on using the changeset viewer.