public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $template = $this->getAttribute('template') ? $this->getAttribute('template') : '/mailform/field/text.inc.html'; $include = new Typeframe_Tag_Include('include', array('template' => $template), $this); $include->output($data, $stream); $include->detach(); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { Typeframe::Timestamp('Starting debug output'); $debug = new Pagemill_Data(); $timestamps = Typeframe::GetTimestamps(); $tdata = array(); if ($timestamps) { $begin = $timestamps[0]->time(); foreach ($timestamps as $t) { //$dump .= "{$t->action()}: " . ($t->time() - $begin) . "<br/>"; $tdata[] = array('action' => $t->action(), 'time' => $t->time() - $begin); } } $debug['timestamps'] = $tdata; $debug['memory_used'] = memory_get_usage(); $debug['memory_used_real'] = memory_get_usage(true); $debug['includes'] = get_included_files(); $debug['querycount'] = Dbi_Source::QueryCount(); $debug['templates'] = Pagemill::ProcessedTemplates(); // TODO: Get template files $debug['data'] = $data; $this->_recurseTines($debug); $include = new Typeframe_Tag_Include('include', array('template' => '/pagemill/tag/debug.html')); $include->process($debug, $stream); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $include = null; if (!$this->children()) { if ($this->pluginTemplate) { $include = new Typeframe_Tag_Include('include', array('template' => $this->pluginTemplate), $this); } } $this->processInner($data, $stream); if ($include) { $include->detach(); } }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $id = $data->parseVariables($this->getAttribute('id')); if (!$id) { $id = self::EditorId(); } $name = $data->parseVariables($this->getAttribute('name')); if ($this->getAttribute('config')) { $config = $this->getAttribute('config'); } else { $config = TYPEF_WEB_DIR . '/fckeditor/config.js'; } $data = $data->fork(); $data->set('id', $id); $data->set('name', $name); $data->set('config', $config); $data->set('toolbarset', $data->parseVariables($this->getAttribute('toolbarset'))); $data->set('stylesheets', $data->parseVariables($this->getAttribute('stylesheets'))); $data->set('bodyclass', $data->parseVariables($this->getAttribute('bodyclass'))); $data->set('bodyid', $data->parseVariables($this->getAttribute('bodyid'))); $data->set('editselector', $data->parseVariables($this->getAttribute('editselector'))); $include = new Typeframe_Tag_Include('', array('template' => '/ckeditor/ckeditor.inc.html'), $this, $this->doctype()); $include->process($data, $stream); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { // A list of attributes and settings to send to the template. $attribs = array(); $settings = array(); foreach ($this->attributes() as $k => $v) { switch ($k) { // The 'extra' attributes, these are settings that control something. case 'value': case 'name': case 'dir': case 'imgwidth': case 'imgheight': case 'id': $settings[$k] = $data->parseVariables($v); break; // Any additional attribute, will be passed to the div containing the elemnts. // Any additional attribute, will be passed to the div containing the elemnts. default: $attribs[] = array('name' => $k, 'value' => $data->parseVariables($v)); break; } } if (!isset($settings['name'])) { return ''; } // I need to ensure some exist. if (!(isset($settings['imgwidth']) && $settings['imgwidth'])) { $settings['imgwidth'] = 150; } if (!(isset($settings['imgheight']) && $settings['imgheight'])) { $settings['imgheight'] = 100; } if (!(isset($settings['id']) && $settings['id'])) { $settings['id'] = 'imageuploadtag-' . preg_replace('/[^a-zA-Z0-9]/', '_', $settings['name']) . '-' . rand(0, 9) . rand(0, 9) . rand(0, 9); } $data = $data->fork(); $data->setArray($settings); $data->set('attributes', $attribs); Typeframe_Tag_Include::Generate('/pagemill/tag/imageupload.html', $this)->process($data, $stream); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $data = $data->fork(); // Will contain the variables to do operations against before I send them all to the pagemill. $atts = array(); foreach ($this->attributes() as $k => $v) { //$pm->setVariable($k, $data->parseVariables($v)); $atts[$k] = $data->parseVariables($v); } // ID needs to be set if it's not. if (!isset($atts['id'])) { self::$_calID++; //$pm->setVariable('id', 'cal_' . CalendarTag::$_calID); $atts['id'] = 'cal_' . self::$_calID; } $atts['showtime'] = isset($atts['showtime']) ? 'true' : 'false'; // Is typeframe default configured to display time as a 24-hr or 12-hr clock? $h24 = strpos('g', TYPEF_DEFAULT_DATE_TIME_FORMAT) !== false || strpos('h', TYPEF_DEFAULT_DATE_TIME_FORMAT) !== false; // Allow the option of easily selecting dates in the past. // This is really a shorthand method of setting some variables. if (isset($atts['inpast']) && $atts['inpast'] == 'true') { if (!isset($atts['minDate'])) { $atts['minDate'] = '-60y'; } if (!isset($atts['maxDate'])) { $atts['maxDate'] = '-12y'; } // translate the min/max date to year ranges. $minyear = preg_match('/[\\-\\+]{0,1}[0-9]*y/i', $atts['minDate']) ? preg_replace('/([\\-\\+]{0,1}[0-9]*)y/i', '$1', $atts['minDate']) : 0; $maxyear = preg_match('/[\\-\\+]{0,1}[0-9]*y/i', $atts['maxDate']) ? preg_replace('/([\\-\\+]{0,1}[0-9]*)y/i', '$1', $atts['maxDate']) : 0; if (!isset($atts['defaultDate'])) { $atts['defaultDate'] = ($minyear + $maxyear) / 2 . 'y'; } if (!isset($atts['yearRange'])) { $atts['yearRange'] = $minyear . ':+' . abs($minyear); } $atts['monthNames'] = "['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']"; $atts['changeYear'] = 'true'; } // More defaults if (!isset($atts['monthNames'])) { $atts['monthNames'] = "['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']"; } if (!isset($atts['minDate'])) { $atts['minDate'] = 'null'; } if (!isset($atts['maxDate'])) { $atts['maxDate'] = 'null'; } if (!isset($atts['yearRange'])) { $atts['yearRange'] = 'c-10:c+10'; } if (!isset($atts['changeYear'])) { $atts['changeYear'] = 'false'; } // PHP has some differences with Javascript. $dateformatdiffs = array('n' => 'm', 'j' => 'd', 'Y' => 'yy'); $dateFormat = isset($atts['dateFormat']) ? $atts['dateFormat'] : TYPEF_DEFAULT_DATE_FORMAT; if (!isset($atts['dateFormat'])) { $atts['dateFormat'] = str_replace(array_keys($dateformatdiffs), array_values($dateformatdiffs), TYPEF_DEFAULT_DATE_FORMAT); } else { $atts['dateFormat'] = str_replace(array_keys($dateformatdiffs), array_values($dateformatdiffs), $atts['dateFormat']); } if (!isset($atts['defaultDate'])) { $atts['defaultDate'] = 'null'; } if (!isset($atts['time24h'])) { $atts['time24h'] = $atts['showtime'] == 'true' && $h24 ? 'true' : 'false'; } if (!isset($atts['input24h'])) { $atts['input24h'] = $atts['showtime'] == 'true' && $h24 ? 'true' : 'false'; } // Format the incoming value if it's set. It should be formatted in the same manner. if (isset($atts['value'])) { // Because the timepicker doesn't allow for a formatted time string.... if ($atts['showtime'] == 'true') { $valueformat = $dateFormat . ($h24 ? ' H:i' : ' h:i a'); } else { $valueformat = $dateFormat; } if ($atts['value'] == '0000-00-00' || $atts['value'] == '0000-00-00 00:00:00') { $atts['value'] = ''; } if ($atts['value']) { $atts['formattedvalue'] = Pagemill_ExprFunc::format_date($valueformat, $atts['value']); } } // Pad the appropriate fields so they don't bomb out the javascript. // (These generally can be null, so the JS needs them to be appropriately escaped, ie: null vs. 'some string'). if ($atts['minDate'] != 'null') { $atts['minDate'] = "'" . $atts['minDate'] . "'"; } if ($atts['maxDate'] != 'null') { $atts['maxDate'] = "'" . $atts['maxDate'] . "'"; } if ($atts['defaultDate'] != 'null') { $atts['defaultDate'] = "'" . $atts['defaultDate'] . "'"; } /*$pm->setVariable('ajaxie', requestIsAjax()); $pm->setVariableArray($atts); $tree = $pm->writeText('<pm:include template="/datetimepicker.inc.html"/>'); return $tree;*/ $data->setArray($atts); $include = new Typeframe_Tag_Include('include', array('template' => '/datetimepicker.inc.html'), $this); $include->process($data, $stream); }