本文整理汇总了PHP中Kwf_Component_Data_Root::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Component_Data_Root::reset方法的具体用法?PHP Kwf_Component_Data_Root::reset怎么用?PHP Kwf_Component_Data_Root::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwf_Component_Data_Root
的用法示例。
在下文中一共展示了Kwf_Component_Data_Root::reset方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
protected final function _process()
{
$filename = $this->_root->filename;
Kwf_Events_ModelObserver::getInstance()->process();
Kwf_Component_Data_Root::reset();
$this->_root = Kwf_Component_Data_Root::getInstance();
$this->_root->setFilename($filename);
}
示例2: testSerializeEn
public function testSerializeEn()
{
$c = $this->_root->getComponentById('root-en_directory_1');
$s = $c->kwfSerialize();
unset($c);
Kwf_Component_Data_Root::reset();
$c = Kwf_Component_Data::kwfUnserialize($s);
$this->assertEquals($c->componentId, 'root-en_directory_1');
}
示例3: tearDown
public function tearDown()
{
Kwf_Events_ModelObserver::getInstance()->setSkipFnF(true);
Kwf_Component_Data_Root::reset();
Kwf_Component_Cache::clearInstance();
Kwf_Model_Abstract::clearInstances();
Kwf_Events_Dispatcher::clearCache();
Kwf_Events_Subscriber::clearInstances();
Kwf_Component_PagesMetaModel::clearInstance();
Kwf_Trl::getInstance()->unsetTrlElements();
}
示例4: testAddPage
public function testAddPage()
{
$page = $this->_root->getComponentById(1);
$page->render(true, true);
Kwf_Component_Data_Root::reset();
$row = $this->_root->getGenerator('page')->getModel()->createRow(array('pos' => 3, 'visible' => true, 'name' => 'f5', 'filename' => 'f5', 'parent_id' => 'root', 'component' => 'empty', 'is_home' => false, 'device_visible' => 'onlyShowOnMobile', 'hide' => false, 'custom_filename' => null));
$row->save();
$this->_process();
$html = $page->render(true, true);
$this->assertEquals(1, substr_count($html, 'hideOnMobile'));
$this->assertEquals(1, substr_count($html, 'onlyShowOnMobile'));
}
示例5: duplicate
/**
* Recursively duplicate components
*
* You need to call afterDuplicate afterwards!
*/
public static function duplicate(Kwf_Component_Data $source, Kwf_Component_Data $parentTarget, Zend_ProgressBar $progressBar = null)
{
$new = $source->generator->duplicateChild($source, $parentTarget, $progressBar);
if (!$new) {
throw new Kwf_Exception("Failed duplicating '{$source->componentId}'");
}
Kwf_Component_Generator_Abstract::clearInstances();
Kwf_Component_Data_Root::reset();
//TODO: schöner wär ein flag bei den komponenten ob es diese fkt im admin
//gibt und dann für alle admins aufrufen
//ändern sobald es für mehrere benötigt wird
Kwc_Root_TrlRoot_Chained_Admin::duplicated($source, $new);
return $new;
}
示例6: testCached
public function testCached()
{
Kwf_Benchmark::enable();
Kwf_Benchmark::reset();
$d = Kwf_Registry::get('testDomain');
$c = $this->_root->getPageByUrl("http://{$d}/foo", null);
//uncached
$this->assertEquals('1', $c->componentId);
$this->assertEquals(1, Kwf_Benchmark::getCounterValue('componentDatas'));
$this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
Kwf_Component_Data_Root::reset();
Kwf_Component_Data_Root::setComponentClass('Kwf_Component_Cache_UrlClearCache_Root');
$this->_root = Kwf_Component_Data_Root::getInstance();
Kwf_Benchmark::reset();
$c = $this->_root->getPageByUrl("http://{$d}/foo", null);
//cached
$this->assertEquals('1', $c->componentId);
$this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('componentDatas'));
$this->assertEquals(1, Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
}
示例7: _afterSave
protected function _afterSave()
{
parent::_afterSave();
Kwf_Component_Data_Root::reset();
Kwf_Component_Generator_Abstract::clearInstances();
}
示例8: _executeUpdatesAction
private function _executeUpdatesAction($method)
{
$ret = true;
foreach ($this->_updates as $update) {
Kwf_Model_Abstract::clearInstances();
//wegen eventueller meta-data-caches die sich geändert haben
Kwf_Component_Generator_Abstract::clearInstances();
Kwf_Component_Data_Root::reset();
if ($this->_progressBar && $method == 'update') {
$this->_progressBar->next(1, $update->getUniqueName());
}
$e = false;
try {
if (!$this->_verbose) {
ob_start();
//update script should not output anything, if it still does discard it
}
$update->{$method}();
if (!$this->_verbose) {
ob_end_clean();
}
} catch (Exception $e) {
if (!$this->_verbose) {
ob_end_clean();
}
if ($this->_debug) {
throw $e;
}
$this->_errors[] = array('name' => $update->getUniqueName(), 'message' => $e->getMessage());
if ($this->_verbose) {
echo "\n[31mError:[0m\n";
echo $e->getMessage() . "\n\n";
flush();
}
$ret = false;
}
}
return $ret;
}
示例9: testHideInMenu
public function testHideInMenu()
{
$page = $this->_root->getComponentById(1);
$html = $page->render(true, true);
$this->assertEquals(2, substr_count($html, '<li'));
$this->assertEquals(2, substr_count($html, 'f1'));
$this->assertEquals(2, substr_count($html, 'f4'));
Kwf_Component_Data_Root::reset();
$row = $this->_root->getGenerator('page')->getModel()->getRow(1);
$row->hide = true;
$row->save();
$this->_process();
$html = $page->render(true, true);
$this->assertEquals(1, substr_count($html, '<li'));
$this->assertEquals(2, substr_count($html, 'f4'));
$row = $this->_root->getGenerator('page')->getModel()->getRow(1);
$row->hide = false;
$row->save();
$this->_process();
$html = $page->render(true, true);
$this->assertEquals(2, substr_count($html, '<li'));
$this->assertEquals(2, substr_count($html, 'f1'));
$this->assertEquals(2, substr_count($html, 'f4'));
}
示例10: testMakePageVisibleFromTop
public function testMakePageVisibleFromTop()
{
$this->_root->getComponentById('1')->render(true, true);
$this->_root->getComponentById('3')->render(true, true);
$this->_root->getComponentById('4')->render(true, true);
Kwf_Component_Data_Root::reset();
$m = Kwf_Model_Abstract::getInstance('Kwf_Component_Cache_MenuHasContent_Category_PagesModel');
$row = $m->getRow(2);
$row->visible = true;
$row->save();
$this->_process();
$html = $this->_root->getComponentById('1')->render(true, true);
$this->assertContains('menuTopHasContent', $html);
$this->assertContains('menuMainHasContent', $html);
$html = $this->_root->getComponentById('3')->render(true, true);
$this->assertContains('menuTopHasContent', $html);
$this->assertContains('menuMainHasContent', $html);
$html = $this->_root->getComponentById('4')->render(true, true);
$this->assertContains('menuTopHasContent', $html);
$this->assertContains('menuMainHasContent', $html);
}
示例11: testClearOutputCache
public function testClearOutputCache()
{
$c = $this->_root->getComponentById('1600');
$this->assertEquals(Kwf_Media::DONT_HASH_TYPE_PREFIX . '{width}-76b7ff', $c->getComponent()->getBaseType());
Kwf_Media::clearCache('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '16-76b7ff');
Kwc_Basic_Image_FixDimensionComponent::$getMediaOutputCalled = 0;
Kwf_Media::getOutput('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '16-76b7ff');
$this->assertEquals(1, Kwc_Basic_Image_FixDimensionComponent::$getMediaOutputCalled);
Kwf_Media::getOutput('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '16-76b7ff');
$this->assertEquals(1, Kwc_Basic_Image_FixDimensionComponent::$getMediaOutputCalled);
Kwf_Media::clearCache('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '16-76b7ff');
Kwf_Media::getOutput('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '16-76b7ff');
$this->assertEquals(2, Kwc_Basic_Image_FixDimensionComponent::$getMediaOutputCalled);
$row = Kwf_Model_Abstract::getInstance('Kwc_Basic_Image_TestModel')->getRow('1600');
$row->kwf_upload_id = 2;
$row->save();
Kwf_Events_ModelObserver::getInstance()->process();
Kwf_Component_Data_Root::reset();
Kwf_Media::getOutput('Kwc_Basic_Image_FixDimensionComponent', '1600', Kwf_Media::DONT_HASH_TYPE_PREFIX . '100-76b7ff');
$this->assertEquals(3, Kwc_Basic_Image_FixDimensionComponent::$getMediaOutputCalled);
}