function stylesheet_tag() { $sources = func_get_args(); $sourceOptions = func_num_args() > 1 && is_array($sources[func_num_args() - 1]) ? array_pop($sources) : array(); $html = ''; foreach ($sources as $source) { $source = system_url($source); $options = array_merge(array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen', 'href' => $source), $sourceOptions); $html .= tag('link', $options) . "\n"; } return $html; }
<div> <?php echo label('content', 'Content: '); ?> <?php echo textarea('content'); ?> </div> <div> <?php echo submit_tag(); ?> </div> <?php echo _form(); ?> <hr/> <p><a href="<?php echo system_url('/'); ?> ">Back to Blog</a></p> <p>Elapsed Time: {elapsed_time}</p> </body> </html>
function sendRedirect($location) { $this->_prepareResponse(); header('Location: ' . system_url($location)); exit; }
function _auto_complete_field($field_id, $url, $options = array()) { $javascript = "new Ajax.Autocompleter("; $javascript .= "'{$field_id}', "; if (isset($options['update'])) { $javascript .= "'" . $options['update'] . "', "; } else { $javascript .= "'{$field_id}_auto_complete', "; } $javascript .= "'" . system_url($url) . "'"; $js_options = array(); if (isset($options['tokens'])) { $js_options['tokens'] = _array_or_string_for_javascript($options['tokens']); } if (isset($options['with'])) { $js_options['callback'] = "function(element, value) { return" . $options['with'] . "}"; } if (isset($options['indicator'])) { $js_options['indicator'] = "'" . $options['indicator'] . "'"; } if (isset($options['on_show'])) { $js_options['onShow'] = $options['on_show']; } if (isset($options['on_hide'])) { $js_options['onHide'] = $options['on_hide']; } if (isset($options['min_chars'])) { $js_options['min_chars'] = $options['min_chars']; } $javascript .= ', ' . _options_for_javascript($js_options) . ');'; return javascript_tag($javascript); }
/** * Returns an XHTML compliant <input> tag with type="image". * * The submit_image_tag is very similar to the submit_tag, the only difference being that it uses an image * for the submit button instead of the browser-generated default button. The image is defined by the * <i>$source</i> parameter and must be a valid image, either local or remote (URL). By default, this * helper creates a submit tag with a name of <em>commit</em> to avoid conflicts with other parts of the * framework. It is recommended that you do not use the name "submit" for submit tags unless absolutely necessary. * * <b>Examples:</b> * <code> * // Assuming your image is in the /web/images/ directory * echo submit_image_tag('my_submit_button.gif'); * </code> * * <code> * echo submit_image_tag('http://mydomain.com/my_submit_button.gif'); * </code> * * @param string path to image file * @param array additional HTML compliant <input> tag parameters * @return string XHTML compliant <input> tag with type="image" */ function submit_image_tag($source, $options = array()) { return tag('input', array_merge(array('type' => 'image', 'name' => 'commit', 'src' => system_url($source)), _convert_options($options))); }
function remote_function($options) { $obj =& get_instance(); $obj->response->enqueue_js('prototype'); $javascript_options = _options_for_ajax($options); $update = ''; if (isset($options['update']) && is_array($options['update'])) { $update = array(); if (isset($options['update']['success'])) { $update[] = "success:'" . $options['update']['success'] . "'"; } if (isset($options['update']['failure'])) { $update[] = "failure:'" . $options['update']['failure'] . "'"; } $update = '{' . join(',', $update) . '}'; } else { if (isset($options['update'])) { $update .= "'" . $options['update'] . "'"; } } $function = !$update ? "new Ajax.Request(" : "new Ajax.Updater({$update}, "; $function .= '\'' . system_url($options['url']) . '\''; $function .= ', ' . $javascript_options . ')'; if (isset($options['before'])) { $function = $options['before'] . '; ' . $function; } if (isset($options['after'])) { $function = $function . '; ' . $options['after']; } if (isset($options['condition'])) { $function = 'if (' . $options['condition'] . ') { ' . $function . '; }'; } if (isset($options['confirm'])) { $function = "if (confirm('" . escape_javascript($options['confirm']) . "')) { {$function}; }"; if (isset($options['cancel'])) { $function = $function . ' else { ' . $options['cancel'] . ' }'; } } return $function; }
?> </h3> <p><?php echo $post->content; ?> </p> <p><a href="<?php echo system_url('/editpost/' . $post->id); ?> ">Edit</a> <a href="<?php echo system_url('/deletepost/' . $post->id); ?> ">Delete</a></p> <hr/> <?php } ?> <p><a href="<?php echo system_url('/createpost'); ?> ">Create New Post</a></p> <p>Elapsed Time: {elapsed_time}</p> </body> </html>