本文整理汇总了PHP中HTML_Template_Flexy类的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_Flexy类的具体用法?PHP HTML_Template_Flexy怎么用?PHP HTML_Template_Flexy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML_Template_Flexy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getHTML
public function getHTML($small = false)
{
global $install, $sql;
include_once "HTML/Template/Flexy.php";
$config = new Configuracion($sql);
$this->data->TITLE = $config->get("Nombre del Sitio");
$map = $config->get("Coordenadas del Mapa");
$marker = $config->get("Coordenadas del Marcador");
if ($map) {
$map = split(",", $map);
$this->data->MAP = "<script>\nvar lat = " . $map[0] . ";\nvar lon = " . $map[1] . ";\n</script>";
}
if ($marker) {
$marker = split(",", $marker);
$this->data->MARKER = "<script>\nvar latMarker = " . $marker[0] . ";\nvar lonMarker = " . $marker[1] . ";\n</script>";
}
$options = array('compileDir' => $install . '/tmp', 'templateDir' => $install . '/template');
if ($small) {
$template = "content.small.html";
} else {
$template = $this->data->data["TEMPLATECON"];
$cursor = $sql->readDB("TEMPLATE", "ID______TEM={$template}");
$res = $cursor->fetch_assoc();
$template = $res["FILE____TEM"];
}
$output = new HTML_Template_Flexy($options);
$output->compile($template);
return $output->bufferedOutputObject($this->data);
}
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:29,代码来源:Contenido.php
示例2: compileAll
function compileAll($options, $files = array())
{
// loop through
$dh = opendir(dirname(__FILE__) . '/templates/');
while (false !== ($file = readdir($dh))) {
if ($file[0] == '.') {
continue;
}
if (is_dir(dirname(__FILE__) . '/templates/' . $file)) {
continue;
}
// skip if not listed in files (and it's an array)
if ($files && !in_array($file, $files)) {
continue;
}
$x = new HTML_Template_Flexy($options);
echo "compile {$file} \n";
$res = $x->compile($file);
if ($res !== true) {
echo "Compile failure: " . $res->toString() . "\n";
}
}
}
开发者ID:ranvis,项目名称:HTML_Template_Flexy,代码行数:23,代码来源:test.php
示例3: compilefile
function compilefile($file, $data = array(), $options = array(), $elements = array())
{
$options = $options + array('templateDir' => dirname(__FILE__) . '/templates', 'forceCompile' => true, 'fatalError' => HTML_TEMPLATE_FLEXY_ERROR_RETURN, 'url_rewrite' => 'images/:/myproject/images/', 'compileDir' => dirname(__FILE__) . '/results1');
// basic options..
echo "\n\n===Compiling {$file}===\n\n";
$options['compileDir'] = dirname(__FILE__) . '/results1';
$x = new HTML_Template_Flexy($options);
$res = $x->compile($file);
if ($res !== true) {
echo "===Compile failure==\n" . $res->toString() . "\n";
return;
}
echo "\n\n===Compiled file: {$file}===\n";
echo file_get_contents($x->compiledTemplate);
if (!empty($options['show_elements'])) {
print_r($x->getElements());
}
if (!empty($options['show_words'])) {
print_r(unserialize(file_get_contents($x->gettextStringsFile)));
}
echo "\n\n===With data file: {$file}===\n";
$data = (object) $data;
$x->outputObject($data, $elements);
}
开发者ID:ranvis,项目名称:HTML_Template_Flexy,代码行数:24,代码来源:testsuite.php
示例4: outputBody
function outputBody()
{
if ($this->timer) {
$this->timer->setMarker(__CLASS__ . '::outputBody - start');
}
$ff = HTML_FlexyFramework::get();
$proj = $ff->project;
// DB_DataObject::debugLevel(1);
$m = DB_DAtaObject::factory('Builder_modules');
$m->get('name', $proj);
//var_dump($m->path);exit;
// needs to modify the template directory??
// use the builder_module == app name
// look for part with same name.
if (empty($ff->Pman_Builder['from_filesystem'])) {
$template_engine = new HTML_Template_Flexy(array('templateDir' => $m->path));
} else {
$template_engine = new HTML_Template_Flexy();
}
$template_engine->debug = 1;
//print_R($template_engine);
$template_engine->compile($this->template);
if ($this->elements) {
/* BC crap! */
$this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements, $this->errors);
}
$template_engine->elements = $this->elements;
if ($this->timer) {
$this->timer->setMarker(__CLASS__ . '::outputBody - render template');
}
//DB_DataObject::debugLevel(1);
$template_engine->outputObject($this, $this->elements);
if ($this->timer) {
$this->timer->setMarker(__CLASS__ . '::outputBody - end');
}
}
开发者ID:roojs,项目名称:Pman.Builder,代码行数:36,代码来源:Preview.php
示例5: applyFilters
/**
* actually it will only be used to apply the pre and post filters
*
* @access public
* @version 01/12/10
* @author Alan Knowles <[email protected]>
* @param string $input the string to filter
* @param array $prefix the subset of methods to use.
* @return string the filtered string
*/
function applyFilters($input, $prefix = "", $negate = FALSE)
{
$this->flexy->debug("APPLY FILTER {$prefix}<BR>");
$filters = $this->options['filters'];
$this->flexy->debug(serialize($filters) . "<BR>");
foreach ($filters as $filtername) {
$class = "HTML_Template_Flexy_Compiler_Regex_{$filtername}";
require_once "HTML/Template/Flexy/Compiler/Regex/{$filtername}.php";
if (!class_exists($class)) {
return HTML_Template_Flexy::staticRaiseError("Failed to load filter {$filter}", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
}
if (!@$this->filter_objects[$class]) {
$this->filter_objects[$class] = new $class();
$this->filter_objects[$class]->_set_engine($this);
}
$filter =& $this->filter_objects[$class];
$methods = get_class_methods($class);
$this->flexy->debug("METHODS:");
$this->flexy->debug(serialize($methods) . "<BR>");
foreach ($methods as $method) {
if ($method[0] == "_") {
continue;
// private
}
if ($method == $class) {
continue;
// constructor
}
$this->flexy->debug("TEST: {$negate} {$prefix} : {$method}");
if ($negate && preg_match($prefix, $method)) {
continue;
}
if (!$negate && !preg_match($prefix, $method)) {
continue;
}
$this->flexy->debug("APPLYING {$filtername} {$method}<BR>");
$input = $filter->{$method}($input);
}
}
return $input;
}
开发者ID:q32p,项目名称:emst,代码行数:51,代码来源:Regex.php
示例6: stdClass
<?php
$tpl = new stdClass();
include_once "common.php";
require_once "HTML/Template/Flexy.php";
include_once "sesion.php";
$table = "RESERVA";
$tpl->variablesJavascript = "<script type='text/javascript'>";
$local = $_SESSION['local'];
$tpl->variablesJavascript .= "var local = '" . $local . "';\n";
$tpl->MAPA = "";
$cursor = $sql->readDB("LOCAL", "CODIGO__LOC='{$local}'");
if ($cursor && $cursor->num_rows > 0) {
if ($data = $cursor->fetch_assoc()) {
$tpl->MAPA = $data['PLANO___LOC'];
}
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("selecciona-mesa.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:23,代码来源:selecciona-mesa.php
示例7: _loadPlugins
/**
* Load the plugins, and lookup which one provides the required method
*
*
* @param string Name
*
* @return string|PEAR_Error the class that provides it.
* @access private
*/
function _loadPlugins($name)
{
// name can be:
// ahref = maps to {class_prefix}_ahref::ahref
$this->plugins = array();
if (empty($this->plugins)) {
foreach ($this->flexy->options['plugins'] as $cname => $file) {
if (!is_int($cname)) {
include_once $file;
$this->plugins[$cname] = new $cname();
$this->plugins[$cname]->flexy =& $this->flexy;
continue;
}
$cname = $file;
require_once 'HTML/Template/Flexy/Plugin/' . $cname . '.php';
$class = "HTML_Template_Flexy_Plugin_{$cname}";
$this->plugins[$class] = new $class();
$this->plugins[$class]->flexy =& $this->flexy;
}
}
foreach ($this->plugins as $class => $o) {
//echo "checking :". get_class($o). ":: $name\n";
if (is_callable(array($o, $name), true)) {
return $class;
}
}
return HTML_Template_Flexy::raiseError("could not find plugin with method: '{$name}'");
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:37,代码来源:Plugin.php
示例8: ic2_loadconfig
// 設定読み込み
$ini = ic2_loadconfig();
if ($ini['Viewer']['cache'] && file_exists($_conf['iv2_cache_db_path'])) {
$viewer_cache_exists = true;
} else {
$viewer_cache_exists = false;
}
// データベースに接続
$db = DB::connect($ini['General']['dsn']);
if (DB::isError($db)) {
p2die($db->getMessage());
}
// テンプレートエンジン初期化
$_flexy_options =& PEAR5::getStaticProperty('HTML_Template_Flexy', 'options');
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ImageCache2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy();
// }}}
// {{{ データベース操作・ファイル削除
if (isset($_POST['action'])) {
switch ($_POST['action']) {
// 画像を削除する
case 'dropZero':
case 'dropAborn':
if ($_POST['action'] == 'dropZero') {
// ランク=0 の画像を削除する
$where = $db->quoteIdentifier('rank') . ' = 0';
if (isset($_POST['dropZeroLimit'])) {
// 取得した期間を限定
switch ($_POST['dropZeroSelectTime']) {
case '24hours':
$expires = 86400;
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:ic2_manager.php
示例9: functionToString
/**
* Handler for User defined functions in templates..
* <flexy:function name="xxxxx">.... </flexy:block> // equivilant to function xxxxx() {
* <flexy:function call="{xxxxx}">.... </flexy:block> // equivilant to function {$xxxxx}() {
* <flexy:function call="xxxxx">.... </flexy:block> // equivilant to function {$xxxxx}() {
*
* This will not handle nested blocks initially!! (and may cause even more problems with
* if /foreach stuff..!!
*
* @param object token to convert into a element.
* @access public
*/
function functionToString($element)
{
if ($arg = $element->getAttribute('NAME')) {
// this is a really kludgy way of doing this!!!
// hopefully the new Template Package will have a sweeter method..
$GLOBALS['_HTML_TEMPLATE_FLEXY']['prefixOutput'] .= $this->compiler->appendPHP("\nfunction _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this) {\n") . $element->compileChildren($this->compiler) . $this->compiler->appendPHP("\n}\n");
return '';
}
if (!isset($element->ucAttributes['CALL'])) {
return HTML_Template_Flexy::raiseError(' tag flexy:function needs an argument call or name' . " Error on Line {$element->line} <{$element->tag}>", null, HTML_TEMPLATE_FLEXY_ERROR_DIE);
}
// call is a stirng : nice and simple..
if (is_string($element->ucAttributes['CALL'])) {
$arg = $element->getAttribute('CALL');
return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$arg})) " . " _html_template_flexy_compiler_standard_flexy_{$arg}(\$t,\$this);");
}
// we make a big assumption here.. - it should really be error checked..
// that the {xxx} element is item 1 in the list...
$e = $element->ucAttributes['CALL'][1];
$add = $e->toVar($e->value);
if (is_a($add, 'PEAR_Error')) {
return $add;
}
return $this->compiler->appendPHP("if (function_exists('_html_template_flexy_compiler_standard_flexy_'.{$add})) " . "call_user_func_array('_html_template_flexy_compiler_standard_flexy_'.{$add},array(\$t,\$this));");
}
开发者ID:villos,项目名称:tree_admin,代码行数:37,代码来源:Flexy.php
示例10: toStringTag
/**
* HTML_Template_Flexy_Token_Tag toString
*
* @param object HTML_Template_Flexy_Token_Tag
*
* @return string string to build a template
* @access public
* @see toString*
*/
function toStringTag($element)
{
$original = $element->getAttribute('ALT');
// techncially only input type=(submit|button|input) alt=.. applies, but we may
// as well translate any occurance...
if (($element->tag == 'IMG' || $element->tag == 'INPUT') && is_string($original) && strlen($original)) {
$this->addStringToGettext($original);
$quote = $element->ucAttributes['ALT'][0];
$element->ucAttributes['ALT'] = $quote . $this->flexy->translateString($original) . $quote;
}
$original = $element->getAttribute('TITLE');
if (is_string($original) && strlen($original)) {
$this->addStringToGettext($original);
$quote = $element->ucAttributes['TITLE'][0];
$element->ucAttributes['TITLE'] = $quote . $this->flexy->translateString($original) . $quote;
}
if (strpos($element->tag, ':') === false) {
$namespace = 'Tag';
} else {
$bits = explode(':', $element->tag);
$namespace = $bits[0];
}
if ($namespace[0] == '/') {
$namespace = substr($namespace, 1);
}
if (empty($this->tagHandlers[$namespace])) {
require_once 'HTML/Template/Flexy/Compiler/Flexy/Tag.php';
$this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Flexy_Tag::factory($namespace, $this);
if (!$this->tagHandlers[$namespace]) {
return HTML_Template_Flexy::staticRaiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
}
}
return $this->tagHandlers[$namespace]->toString($element);
}
开发者ID:q32p,项目名称:emst,代码行数:43,代码来源:Flexy.php
示例11: array
$urlsPriority = array();
$base = "http://" . $_SERVER['HTTP_HOST'];
$urls = array();
$urlsPriority[] = $base;
$cursor = $sql->readDB("CATEGORIA", "ESTADO__CAT='A'");
while ($row = $cursor->fetch_assoc()) {
$url = url_slug($row['NOMBRE__CAT']);
if ($row['PADRE___CAT'] == '-1') {
$urlsPriority[] = $base . "/" . $url;
} else {
$urls[] = $base . "/" . $url;
}
}
if ($cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'")) {
while ($row = $cursor->fetch_assoc()) {
if (!empty($row['TITULO__CON'])) {
$url = url_slug($row['TITULO__CON']);
} else {
$url = "contenido=" . $row["ID______CON"];
}
$urls[] = $base . "/" . $url;
}
}
$tpl->PRIORITY = $urlsPriority;
$tpl->URLS = $urls;
$tpl->DATE = date(DATE_ATOM);
//*
$output = new HTML_Template_Flexy(array('templateDir' => $install . "/template", 'compileDir' => $install . '/tmp'));
$output->compile("sitemap.xml");
$output->outputObject($tpl);
//*/
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:sitemap.php
示例12: display
/**
* output a template (optionally with flexy object & element.)
*
* @param string name of flexy template.
* @param object object as per HTML_Template_Flexy:outputObject
* @param array elements array as per HTML_Template_Flexy:outputObject
*
* @return none
* @access public
*/
function display($templatename, $object = null, $elements = array())
{
// some standard stuff available to a smarty template..
$this->vars['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME'];
$o = PEAR::getStaticProperty('HTML_Template_Flexy', 'options');
require_once 'HTML/Template/Flexy.php';
$t = new HTML_Template_Flexy();
$t->compile($templatename);
$object = $object !== null ? $object : new StdClass();
foreach ($this->vars as $k => $v) {
$object->{$k} = $v;
}
$t->outputObject($object, $elements);
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:24,代码来源:SmartyAPI.php
示例13: str_replace
}
$curDate .= " 00:00:00";
$tpl->FECHA = str_replace(' 00:00:00', '', $curDate);
$cursor = $sql->con->query($q = "SELECT * FROM RESERVA LEFT JOIN CLIENTE ON RUTCLIENRES=RUT_____CLI LEFT JOIN MESA ON MESA____RES=ID______MES LEFT JOIN PEDIDO ON RESERVA_PED=CODIGO__RES LEFT JOIN ESTADO_PEDIDO ON ESTADO__PED=ID______EPE WHERE FECHA___RES BETWEEN '" . $curDate . "' AND DATE_ADD('" . $curDate . "', INTERVAL 1 DAY) {$cond} ORDER BY APELLIDOCLI ASC,FECHA___RES DESC");
// /*AND NOW() BETWEEN FECHA___RES AND DATE_SUB(FECHA___RES, INTERVAL -DURACIONRES HOUR)*/
if ($cursor && $cursor->num_rows > 0) {
while ($row = $cursor->fetch_assoc()) {
$hora = split(" ", $row['FECHA___RES'])[1];
$estado = $row['ESTADO__PED'] < 6 ? !empty($row['ESTADO__PED']) ? 'En Curso' : 'Reservada' : 'Finalizada';
$tpl->RESERVA[$row['CODIGO__RES']] = array("link" => $row['CODIGO__RES'], "mesa" => $row['NUMERO__MES'], "cliente" => $row['RUT_____CLI'] ? $row['APELLIDOCLI'] . ", " . $row['NOMBRE__CLI'] : "Cliente sin Registro", "hora" => $hora, "estado" => $row['DESCRIPCEPE'], "class" => 'reserva-' . $row['ID______EPE']);
}
}
}
$tpl->variablesJavascript .= "</script>";
$options = array('compileDir' => './tmp', 'templateDir' => './templates');
$output = new HTML_Template_Flexy($options);
$output->compile("reservas.html");
$tpl->CONTENT = $output->bufferedOutputObject($tpl);
include_once "container.php";
function codigo()
{
global $sql;
$charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$key = '';
for ($i = 0; $i < 12; $i++) {
$key .= $charset[mt_rand(0, strlen($charset) - 1)];
}
$cursor = $sql->readDB("RESERVA", "CODIGO__RES='" . $key . "'");
if ($cursor && $cursor->num_rows > 0) {
return codigo();
} else {
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:reservas.php
示例14: while
$cursor = $sql->readDB("CONTENIDO", "ESTADO__CON='A'");
while ($row = $cursor->fetch_assoc()) {
if (url_slug($row['TITULO__CON']) == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
if ("contenido=" . $row["ID______CON"] == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
}
$cursor = $sql->readDB("CATEGORIA");
while ($row = $cursor->fetch_assoc()) {
if (url_slug($row['NOMBRE__CAT']) == substr($_SERVER['REQUEST_URI'], 1)) {
$error = false;
}
}
if (!$error) {
Header("HTTP/1.0 200 OK");
$_REQUEST['bufferedHTML'] = true;
$_REQUEST['what'] = substr($_SERVER['REQUEST_URI'], 1);
include_once "getContent.php";
$content = $retval['html'];
$content .= "<script>var error = true; var passedURL = '" . substr($_SERVER['REQUEST_URI'], 1) . "';</script>";
include_once "container.php";
exit;
}
$options = array('templateDir' => $install . "/template", 'compileDir' => $install . "/tmp");
$object = new HTML_Template_Flexy($options);
$object->compile("error.html");
$content = $object->bufferedOutputObject($tpl);
$content .= "<script>var error = true; var passedURL = 'home';</script>";
include_once "container.php";
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:31,代码来源:error.php
示例15: toStringTag
/**
* HTML_Template_Flexy_Token_Tag toString
*
* @param object HTML_Template_Flexy_Token_Tag
*
* @return string string to build a template
* @access public
* @see toString*
*/
function toStringTag($element)
{
if (strpos($element->tag, ':') === false) {
$namespace = 'Tag';
} else {
$bits = explode(':', $element->tag);
$namespace = $bits[0];
}
if ($namespace[0] == '/') {
$namespace = substr($namespace, 1);
}
if (empty($this->tagHandlers[$namespace])) {
require_once 'HTML/Template/Flexy/Compiler/Standard/Tag.php';
$this->tagHandlers[$namespace] =& HTML_Template_Flexy_Compiler_Standard_Tag::factory($namespace, $this);
if (!$this->tagHandlers[$namespace]) {
return HTML_Template_Flexy::raiseError('HTML_Template_Flexy::failed to create Namespace Handler ' . $namespace . ' in file ' . $GLOBALS['_HTML_TEMPLATE_FLEXY']['filename'], HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_RETURN);
}
}
return $this->tagHandlers[$namespace]->toString($element);
}
开发者ID:altesien,项目名称:FinalProject,代码行数:29,代码来源:Standard.php
示例16: tokenize
/**
* The core tokenizing part - runs the tokenizer on the data,
* and stores the results in $this->tokens[]
*
* @param string Data to tokenize
*
* @return none | PEAR::Error
* @access public|private
* @see see also methods.....
*/
function tokenize($data)
{
require_once 'HTML/Template/Flexy/Tokenizer.php';
$tokenizer =& HTML_Template_Flexy_Tokenizer::construct($data, $this->options);
// initialize state - this trys to make sure that
// you dont do to many elses etc.
//echo "RUNNING TOKENIZER";
// step one just tokenize it.
$i = 1;
while ($t = $tokenizer->yylex()) {
if ($t == HTML_TEMPLATE_FLEXY_TOKEN_ERROR) {
return HTML_Template_Flexy::raiseError(array("HTML_Template_Flexy_Tree::Syntax error in File: %s (Line %s)\n" . "Tokenizer Error: %s\n" . "Context:\n\n%s\n\n >>>>>> %s\n", $this->options['filename'], $tokenizer->yyline, $tokenizer->error, htmlspecialchars(substr($tokenizer->yy_buffer, 0, $tokenizer->yy_buffer_end)), htmlspecialchars(substr($tokenizer->yy_buffer, $tokenizer->yy_buffer_end, 100))), HTML_TEMPLATE_FLEXY_ERROR_SYNTAX, HTML_TEMPLATE_FLEXY_ERROR_DIE);
}
if ($t == HTML_TEMPLATE_FLEXY_TOKEN_NONE) {
continue;
}
if ($t->token == 'Php') {
continue;
}
$i++;
$this->tokens[$i] = $tokenizer->value;
$this->tokens[$i]->id = $i;
//print_r($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]);
}
//echo "BUILT TOKENS";
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:36,代码来源:Tree.php
示例17: assignRef
/**
*
* Assign a token by reference. This allows you change variable
* values within the template and have those changes reflected back
* at the calling logic script. Works as with form 2 of assign().
*
* @access public
*
* @param string $name The template token-name for the reference.
*
* @param mixed &$ref The variable passed by-reference.
*
* @return bool|PEAR_Error Boolean true on success, or a PEAR_Error
* on failure.
*
* @throws SAVANT_ERROR_ASSIGN_REF Unknown reason for error.
*
* @see assign()
* @author Paul M. Jones <[email protected]>
* @see assignObject()
*
*/
function assignRef($name, &$ref)
{
// look for the proper case: name and variable
if (is_string($name) && isset($ref)) {
if (isset($this->variables[$name])) {
unset($this->variables[$name]);
}
//
// assign the token as a reference
$this->references[$name] =& $ref;
// done!
return true;
}
// final error catch
return HTML_Template_Flexy::raiseError("invalid type sent to assignRef, " . print_r($name, true), HTML_TEMPLATE_FLEXY_ASSIGN_ERROR_INVALIDARGS);
}
开发者ID:esclapes,项目名称:revive-adserver,代码行数:38,代码来源:Assign.php
示例18: ic2_display
function ic2_display($path, $params)
{
global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
if (P2_OS_WINDOWS) {
$path = str_replace('\\', '/', $path);
}
if (strncmp($path, '/', 1) == 0) {
$s = empty($_SERVER['HTTPS']) ? '' : 's';
$to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
} else {
$dir = dirname(P2Util::getMyUrl());
if (strncasecmp($path, './', 2) == 0) {
$to = $dir . substr($path, 1);
} elseif (strncasecmp($path, '../', 3) == 0) {
$to = dirname($dir) . substr($path, 2);
} else {
$to = $dir . '/' . $path;
}
}
$name = basename($path);
$ext = strrchr($name, '.');
switch ($redirect) {
case 1:
header("Location: {$to}");
exit;
case 2:
switch ($ext) {
case '.jpg':
header("Content-Type: image/jpeg; name=\"{$name}\"");
break;
case '.png':
header("Content-Type: image/png; name=\"{$name}\"");
break;
case '.gif':
header("Content-Type: image/gif; name=\"{$name}\"");
break;
default:
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
header("Content-Type: application/octetstream; name=\"{$name}\"");
} else {
header("Content-Type: application/octet-stream; name=\"{$name}\"");
}
}
header("Content-Disposition: inline; filename=\"{$name}\"");
header('Content-Length: ' . filesize($path));
readfile($path);
exit;
default:
if (!class_exists('HTML_Template_Flexy', false)) {
require 'HTML/Template/Flexy.php';
}
if (!class_exists('HTML_QuickForm', false)) {
require 'HTML/QuickForm.php';
}
if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
}
if (isset($uri)) {
$img_o = 'uri';
$img_p = $uri;
} elseif (isset($id)) {
$img_o = 'id';
$img_p = $id;
} else {
$img_o = 'file';
$img_p = $file;
}
$img_q = $img_o . '=' . rawurlencode($img_p);
// QuickFormの初期化
$_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
$_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
$_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
$mobile = Net_UserAgent_Mobile::singleton();
$qa = 'size=3 maxlength=3';
if ($mobile->isDoCoMo()) {
$qa .= ' istyle=4';
} elseif ($mobile->isEZweb()) {
$qa .= ' format=*N';
} elseif ($mobile->isSoftBank()) {
$qa .= ' mode=numeric';
}
$_presets = array('' => 'サイズ・品質');
foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
$_presets[$_preset_name] = $_preset_name;
}
$qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
$qf->setConstants($_constants);
$qf->setDefaults($_defaults);
$qf->addElement('hidden', 't');
$qf->addElement('hidden', 'u');
$qf->addElement('hidden', 'v');
$qf->addElement('text', 'x', '高さ', $qa);
$qf->addElement('text', 'y', '横幅', $qa);
$qf->addElement('text', 'q', '品質', $qa);
$qf->addElement('select', 'p', 'プリセット', $_presets);
$qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
$qf->addElement('checkbox', 'w', 'トリム');
$qf->addElement('checkbox', 'z', 'DL');
$qf->addElement('submit', 's');
$qf->addElement('submit', 'o');
//.........这里部分代码省略.........
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:101,代码来源:ic2.php
示例19: display
function display()
{
$output = new HTML_Template_Flexy(array('templateDir' => MAX_PATH . '/lib/max/Admin/Inventory/themes', 'compileDir' => MAX_PATH . '/var/templates_compiled', 'flexyIgnore' => true));
$codes = $this->codes;
$this->codes = array();
if (is_array($codes)) {
foreach ($codes as $v) {
$k = count($this->codes);
$v['id'] = "tag_{$k}";
$v['name'] = "tag[{$k}]";
$v['autotrackname'] = "autotrack[{$k}]";
$v['autotrack'] = isset($v['autotrack']) ? $v['autotrack'] : false;
$v['rank'] = $k + 1;
$v['move_up'] = $k > 0;
$v['move_down'] = $k < count($codes) - 1;
$this->codes[] = $v;
}
}
// Display page content
$output->compile('TrackerAppend.html');
$output->outputObject($this);
}
开发者ID:akirsch,项目名称:revive-adserver,代码行数:22,代码来源:TrackerAppend.php
示例20: getInputWidget
function getInputWidget($key, $value = "", $type = "text")
{
global $sql;
$retval = '';
preg_match('/[a-zA-Z]+/', $type, $matches);
preg_match('/\\[[_\\|\\=a-zA-Z0-9]+\\]/', $type, $options);
if ($options) {
$options = str_replace(array('[', ']'), '', $options[0]);
$tmp = explode("|", $options);
unset($options);
foreach ($tmp as $v) {
$tmp = explode("=", $v);
$options[$tmp[1]] = $tmp[0];
}
}
switch ($matches[0]) {
case 'radio':
foreach ($options as $k => $v) {
if ($k != '_bootstrap') {
$retval .= "<label class='radio inline'>";
if ($k == $value) {
$retval .= "<input type='radio' name='{$key}' value='{$k}' checked='checked'>{$v}";
} else {
$retval .= "<input type='radio' name='{$key}' value='{$k}'>{$v}";
}
$retval .= "</label>";
}
}
break;
case 'dbcombobox':
foreach ($options as $k => $v) {
$ref[$v] = $k;
}
$retval .= "<select name='{$key}' value='{$value}'>";
$query = "SELECT * FROM " . $ref['TABLE'] . ";";
$result = $sql->con->query($query);
while ($row = $result->fetch_assoc()) {
if ($value == $row[$ref['INDEX']]) {
$retval .= "\t<option value='" . $row[$ref['INDEX']] . "' selected>" . $row[$ref['LABEL']] . "</option>";
} else {
$retval .= "\t<option value='" . $row[$ref['INDEX']] . "'>" . $row[$ref['LABEL']] . "</option>";
}
}
$retval .= "</select>";
break;
case 'textarea':
if ($options) {
foreach ($options as $k => $v) {
$configs[$v] = $k;
}
$cols = $configs['cols'];
$rows = $configs['rows'];
$retval .= "<textarea name='{$key}' cols='{$cols}' rows='{$rows}'>";
} else {
$retval .= "<textarea name='{$key}'>";
}
$retval .= "{$value}</textarea>";
break;
case 'tinyMCE':
$retval = "<textarea id='{$key}' name='{$key}'>{$value}</textarea>";
$retval .= "<script src=\"//tinymce.cachefly.net/4.1/tinymce.min.js\"></script>";
$retval .= "<script>tinymce.init({selector:'#{$key}'});</script>";
break;
case 'file':
if (empty($value)) {
$retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/NoDisponible.jpg\" alt=\"Preview\">";
} else {
$retval = "<img class=\"thumbnail\" src=\"/thumbnailer/200/200/crop/{$value}\" alt=\"Preview\">";
}
$retval .= "<input type='{$type}' name='" . $key . "_file' value='{$value}' onchange='previewImage(this)' width='200'>";
$retval .= "<input type='hidden' name='{$key}' value='{$value}'>";
break;
case 'multifile':
include_once "HTML/Template/Flexy.php";
$options = array('templateDir' => "inputWidgets/templates", 'compileDir' => "inputWidgets/templates");
$obj = new stdClass();
$obj->KEY = $key;
$obj->JAVASCRIPT = "<script>var key = '" . $key . "'</script>";
$tmp = unserialize($value);
if (is_array($tmp)) {
foreach ($tmp as $tk => $tv) {
$obj->FILAS[]['nombre'] = $tv;
}
}
$output = new HTML_Template_Flexy($options);
$output->compile('multifile.html');
$retval = $output->bufferedOutputObject($obj);
break;
default:
$retval = "<input type='{$type}' name='{$key}' value='{$value}'>";
break;
}
return $retval;
}
开发者ID:pablogarin,项目名称:equilibrio-restaurant,代码行数:94,代码来源:form.php
注:本文中的HTML_Template_Flexy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论