本文整理汇总了PHP中Swift::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift::getInstance方法的具体用法?PHP Swift::getInstance怎么用?PHP Swift::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift
的用法示例。
在下文中一共展示了Swift::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJQuery
/**
* Returns a HTML script tag which includes the jquery.js engine into the web page.
* to ensure HTML5 compatability for MSIE.
* @return string An HTML script tag.
*/
public function getJQuery()
{
$s = Swift::getInstance();
return $this->createJavaScriptTag($s->config('app_url') . "/Swift/includes/js/jquery/jquery-1.10.2.min.js");
}
示例2: renderForm
/**
* Outputs the SwiftForm HTML to the page.
* @param string $style The style type for displaying the SwiftForm (plain, list, table). Default: plain. (Optional)
* @return string The HTML source code for the SwiftForm.
*/
public function renderForm($style = 'plain')
{
if ($this->m_form_container_id) {
$form_out .= "<div id=\"" . $this->m_form_container_id . "\">";
}
if ($this->m_form_ajax) {
$swift = Swift::getInstance();
$swift_jq = $swift->createJQuery();
$form_out .= $swift_jq->createAjaxCallback('ajax_callback_' . $this->m_form_id, $this->m_form_container_id, 'html');
$form_out .= $swift_jq->createAjaxFunction('ajax_' . $this->m_form_id, $this->m_form_action, $this->m_form_method, $this->m_field_ids, 'ajax_callback_' . $this->m_form_id);
}
$form_out .= "<form";
if ($this->m_form_name) {
$form_out .= " name=\"" . $this->m_form_name . "\"";
}
if ($this->m_form_id) {
$form_out .= " id=\"" . $this->m_form_id . "\"";
}
if ($this->m_form_action && !$this->m_form_ajax) {
$form_out .= " action=\"" . $this->m_form_action . "\"";
}
if ($this->m_form_method && !$this->m_form_ajax) {
$form_out .= " method=\"" . $this->m_form_method . "\"";
}
if ($this->m_form_enctype) {
$form_out .= " enctype=\"" . $this->m_form_enctype . "\"";
}
$form_out .= ">\n";
if ($style == 'table') {
$form_out .= "<table>";
} else {
if ($style == 'list') {
$form_out .= "<ul>";
}
}
for ($i = 0; $i < count($this->m_fields); $i++) {
if ($style == 'table') {
$form_out .= "<tr>";
$form_out .= "<td>" . $this->m_labels[$i] . "</td>";
$form_out .= "<td>" . $this->m_fields[$i] . "</td>";
$form_out .= "</tr>";
} else {
if ($style == 'plain') {
$form_out .= $this->m_labels[$i];
$form_out .= $this->m_fields[$i];
$form_out .= "</br>";
} else {
if ($style == 'list') {
$form_out .= "<li>" . $this->m_labels[$i] . " " . $this->m_fields[$i] . "</li>";
}
}
}
}
if ($style == 'table') {
$form_out .= "</table>";
} else {
if ($style == 'list') {
$form_out .= "</ul>";
}
}
$form_out .= "</form>\n";
if ($this->m_form_container_id) {
$form_out .= "</div>";
}
echo $form_out;
}
示例3: render
/**
* Loads the provided $view file from inside the directory provided by the app_view_dir setting
* and loads all variables inside the $data array.
* @param string $view The filename of a view to render/load.
* @param Array $data Array of variables to load in the public scope for the $view. (Default: null)
* @param boolean $minify Minimize and compress all HTML and JavaScript output from the $view. (Default: false)
*/
public function render($view, $data = null, $minify = false)
{
$path = $this->m_config->get('app_view_dir') . '/' . $view;
if (isset($data)) {
$result = array_merge($this->m_view_data->getAll(), $data);
$this->m_view_data->setAll($result);
}
$all_data = $this->getAllViewData();
extract($all_data);
if ($minify) {
ob_start();
require $path;
$buffer = ob_get_clean();
$swift = Swift::getInstance();
$sm = $swift->createMinify();
echo $sm->minifyString($buffer);
} else {
require $path;
}
}
示例4: getJQuery
/**
* Returns a HTML script tag which includes the jquery.js engine into the web page.
* to ensure HTML5 compatability for MSIE.
* @return string An HTML script tag.
*/
public function getJQuery()
{
$s = Swift::getInstance();
$sh = $s->createHtml();
return $sh->getJQuery();
}