/** * Configuration method. * @param Opt_Class $tpl */ public function configure(Opt_Class $tpl) { $tpl->parser = 'Opt_Parser_Html'; $tpl->useExpressionNamespaces = false; $tpl->register(Opt_Class::OPT_NAMESPACE, 'ns1'); $tpl->register(Opt_Class::PHP_FUNCTION, 'ecf', 'Package_Parser_HtmlTest::testEcf'); }
/** * Configuration method. * @param Opt_Class $tpl */ public function configure(Opt_Class $tpl) { $tpl->parser = 'Opt_Parser_Html'; $tpl->backwardCompatibility = true; $tpl->register(Opt_Class::OPT_COMPONENT, 'opt:myComponent', 'Extra_Mock_Component'); $tpl->register(Opt_Class::OPT_BLOCK, 'opt:myBlock', 'Extra_Mock_Block'); }
/** * Configuration method. * @param Opt_Class $tpl */ public function configure(Opt_Class $tpl) { if ($this->_type == 0) { $tpl->parser = 'Opt_Parser_Html'; } else { $tpl->parser = 'Opt_Parser_Xml'; } $tpl->register(Opt_Class::MODIFIER, 'a', 'Extra_Mock_Modifier::modifier'); $tpl->register(Opt_Class::MODIFIER, 'r', 'Extra_Mock_Modifier::modifier'); $tpl->register(Opt_Class::MODIFIER, 'p', 'htmlspecialchars'); $tpl->register(Opt_Class::MODIFIER, 'b', null); }
protected function setUp() { $tpl = new Opt_Class(); $tpl->sourceDir = 'test://templates/'; $tpl->compileDir = CPL_DIR; $tpl->compileMode = Opt_Class::CM_REBUILD; $tpl->stripWhitespaces = false; $tpl->prologRequired = true; $tpl->register(Opt_Class::OPT_COMPONENT, 'opt:myComponent', 'myComponent'); $tpl->register(Opt_Class::OPT_BLOCK, 'opt:myBlock', 'myBlock'); $tpl->setup(); $this->tpl = $tpl; Opt_View::clear(); }
/** * Configuration method. * @param Opt_Class $tpl */ public function configure(Opt_Class $tpl) { if ($this->_type == 0) { $tpl->parser = 'Opt_Parser_Html'; } else { $tpl->parser = 'Opt_Parser_Xml'; } $tpl->register(Opt_Class::EXPR_ENGINE, 'test', 'Extra_Mock_Expression'); }
/** * @covers Opt_Class::register */ public function testRegisterInstruction() { $this->_tpl->register(Opt_Class::OPT_INSTRUCTION, 'Foo'); $this->_tpl->register(Opt_Class::OPT_INSTRUCTION, 'Bar', 'Bar_Joe'); $out = $this->_tpl->_getList('_instructions'); $this->assertArrayHasKey('Foo', $out); $this->assertContains('Opt_Instruction_Foo', $out); $this->assertArrayHasKey('Bar', $out); $this->assertContains('Bar_Joe', $out); return true; }
protected function setUp() { $tpl = new Opt_Class(); $tpl->sourceDir = 'test://templates/'; $tpl->compileDir = CPL_DIR; $tpl->compileMode = Opt_Class::CM_REBUILD; $tpl->stripWhitespaces = false; $tpl->prologRequired = true; $tpl->register(Opt_Class::OPT_FORMAT, 'Test'); $tpl->setup(); $this->tpl = $tpl; }
protected function setUp() { $tpl = new Opt_Class(); $tpl->sourceDir = '/'; $tpl->sourceDir = './templates/'; $tpl->compileDir = './templates_c/'; $tpl->escape = false; $tpl->register(Opt_Class::PHP_FUNCTION, '_', '_'); $tpl->register(Opt_Class::PHP_FUNCTION, 'foo', 'foo'); $tpl->register(Opt_Class::PHP_FUNCTION, 'bar', 'bar'); $tpl->register(Opt_Class::PHP_FUNCTION, 'joe', 'joe'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lol', 'lol'); $tpl->register(Opt_Class::PHP_FUNCTION, 'funct', 'funct'); $tpl->register(Opt_Class::PHP_FUNCTION, 'rotfl', 'rotfl'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao1', '#1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao2', '#2,1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao3', '#3,1,2:null#lmao'); $tpl->register(Opt_Class::PHP_CLASS, 'class', '_class'); $tpl->register(Opt_Class::PHP_CLASS, 'e', 'e'); $tpl->register(Opt_Class::PHP_CLASS, 'u', 'u'); $tpl->register(Opt_Class::PHP_CLASS, 'a', 'a'); Opl_Registry::register('opl_translate', new tl()); $tpl->setup(); $this->tpl = $tpl; $this->cpl = new Opt_Compiler_Class($tpl); }
foreach ($this->getValue() as $name => $value) { $results[] = array('name' => $name, 'value' => $value); } $view->results = $results; } } // end GeneralForm; try { $tpl = new Opt_Class(); $opf = new Opf_Class($tpl); $tpl->sourceDir = './templates/'; $tpl->compileDir = './templates_c/'; $tpl->compileMode = Opt_Class::CM_REBUILD; $tpl->stripWhitespaces = false; $tpl->gzipCompression = false; $tpl->register(Opt_Class::PHP_FUNCTION, 'dump', 'var_dump'); $tpl->setup(); $translate = new Opc_Translate(new Opc_Translate_Adapter_Ini(array('directory' => './lang/'))); $translate->setLanguage('en'); $opf->setTranslationInterface($translate); $view = new Opt_View('situation_5.tpl'); $view->devFile = 'situation_5.php'; $form = new GeneralForm('form5'); $form->setView($view); $form->execute(); $output = new Opt_Output_Http(); $output->render($view); } catch (Exception $e) { var_dump($e); } catch (Opl_Exception $exception) { $handler = new Opl_ErrorHandler();
/** * Configures the test case. */ public function setUp() { $tpl = new Opt_Class(); $tpl->sourceDir = '/'; $tpl->sourceDir = 'php://memory'; $tpl->compileDir = dirname(__FILE__) . '/../../Cache/'; $tpl->escape = false; $tpl->allowArrays = true; $tpl->allowObjects = true; $tpl->allowObjectCreation = true; $tpl->register(Opt_Class::PHP_FUNCTION, '_', '_'); $tpl->register(Opt_Class::PHP_FUNCTION, 'foo', 'foo'); $tpl->register(Opt_Class::PHP_FUNCTION, 'bar', 'bar'); $tpl->register(Opt_Class::PHP_FUNCTION, 'joe', 'joe'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lol', 'lol'); $tpl->register(Opt_Class::PHP_FUNCTION, 'funct', 'funct'); $tpl->register(Opt_Class::PHP_FUNCTION, 'rotfl', 'rotfl'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao1', '#1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao2', '#2,1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao3', '#3,1,2:null#lmao'); $tpl->register(Opt_Class::PHP_CLASS, 'class', '_class'); $tpl->register(Opt_Class::PHP_CLASS, 'e', 'e'); $tpl->register(Opt_Class::PHP_CLASS, 'u', 'u'); $tpl->register(Opt_Class::PHP_CLASS, 'a', 'a'); Opl_Registry::register('opl_translate', $this->getMock('Opl_Translation_Interface')); $tpl->setup(); $this->tpl = $tpl; $this->cpl = new Opt_Compiler_Class($tpl); }
Opl_Loader::register(); Opl_Registry::setState('opl_extended_errors', true); if (!file_exists('./config.php')) { die('Please create the config.php file from config.sample.php!'); } require './config.php'; require './includes/forms.php'; require './components/base.php'; require './components/input.php'; require './components/textarea.php'; try { $tpl = new Opt_Class(); // Load the configuration $tpl->loadConfig($config['opt']); // Register the components $tpl->register(Opt_Class::OPT_COMPONENT, 'opt:input', 'InputComponent'); $tpl->register(Opt_Class::OPT_COMPONENT, 'opt:textarea', 'TextareaComponent'); $tpl->setup(); Opt_View::assignGlobal('baseHref', $config['script']['baseHref']); // Connect to the database. $pdo = new PDO($config['db']['dsn'], $config['db']['user'], $config['db']['password']); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->query('SET NAMES `' . $config['db']['charset'] . '`'); // Load and execute the action. $action = 'list'; if (isset($_GET['action']) && ctype_alpha($_GET['action'])) { $action = $_GET['action']; } require './actions/' . $action . '.php'; $view = action($pdo, $config); // Render the returned view to the browser.
/** * Configuration method. * @param Opt_Class $tpl */ public function configure(Opt_Class $tpl) { $tpl->parser = 'Opt_Parser_Xml'; $tpl->useExpressionNamespaces = false; $tpl->register(Opt_Class::OPT_NAMESPACE, 'ns1'); }
/** * Creates a new instance of OPF. * * @param Opt_Class $opt Open Power Template instance. */ public function __construct(Opt_Class $opt) { Opl_Registry::set('opf', $this); $opt->register(Opt_Class::OPT_NAMESPACE, 'opf'); $opt->register(Opt_Class::OPT_INSTRUCTION, 'Form', 'Opf_View_Instruction_Form'); $opt->register(Opt_Class::OPT_FORMAT, 'Form', 'Opf_View_Format_Form'); $opt->register(Opt_Class::OPT_FORMAT, 'Design', 'Opf_View_Format_Design'); $opt->register(Opt_Class::OPT_FORMAT, 'FormRepeater', 'Opf_View_Format_FormRepeater'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:input', 'Opf_Widget_Input'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:textarea', 'Opf_Widget_Textarea'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:password', 'Opf_Widget_Password'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:yesno', 'Opf_Widget_Yesno'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:select', 'Opf_Widget_Select'); $opt->register(Opt_Class::OPT_COMPONENT, 'opf:collection', 'Opf_Widget_Collection'); Opt_View::setFormatGlobal('design', 'Design', false); }