class. * * @return string The class selector to use. */ public function getAdminTableClass() { return 'wp-list-table widefat fixed striped'; } /** * Backward compatibility for admin list
| class.
*
* @param string $h_align The additional class to use for horizontal alignment.
* Accepted rules should be: left, center or right.
*
* @return string The class selector to use.
*/
public function getAdminThClass($h_align = 'center')
{
return 'manage-column ' . $h_align;
}
/**
* Backward compatibility for admin list checkAll JS event.
*
* @param integer $count The total count of rows in the table.
*
* @return string The check all checkbox input to use.
*/
public function getAdminToggle($count)
{
return '';
}
/**
* Backward compatibility for admin list isChecked JS event.
*
* @return string The JS function to use.
*/
public function checkboxOnClick()
{
return 'Joomla.isChecked(this.checked);';
}
/**
* Includes a script framework.
*
* @param string $fw The framework name.
*
* @return void
*/
public function loadFramework($fw)
{
JHtml::fetch($fw);
}
/**
* Includes a script URI.
*
* @param string $uri The script URI.
*
* @return void
*/
public function addScript($uri)
{
JHtml::fetch('script', $uri);
}
/**
* Helper method to send e-mails.
*
* @param string $from_address The e-mail address of the sender.
* @param string $from_name The name of the sender.
* @param string $to The e-mail address of the receiver.
* @param string $reply_address The reply to e-mail address.
* @param string $subject The subject of the e-mail.
* @param string $hmess The body of the e-mail (HTML is supported).
* @param array $attachments The list of the attachments to include.
* @param boolean $is_html True to support HTML body, otherwise false for plain text.
* @param string $encoding The encoding to use.
*
* @return boolean True if the e-mail was sent successfully, otherwise false.
*/
public function sendMail($from_address, $from_name, $to, $reply_address, $subject, $hmess, $attachments = null, $is_html = true, $encoding = 'base64')
{
// $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
if ($is_html)
{
$hmess = "\n\n{$hmess}\n";
}
$mailer = JFactory::getMailer();
$sender = array($from_address, $from_name);
$mailer->setSender($sender);
$mailer->addRecipient($to);
$mailer->addReplyTo($reply_address);
$mailer->setSubject($subject);
$mailer->setBody($hmess);
$mailer->isHTML($is_html);
$mailer->Encoding = $encoding;
if ($attachments !== null)
{
if (!is_array($attachments))
{
$attachments = array($attachments);
}
foreach ($attachments as $attach)
{
if (!empty($attach) && file_exists($attach))
{
$mailer->addAttachment($attach);
}
}
}
return $mailer->Send();
}
/**
* Backward compatibility for punycode conversion.
*
* @param string $mail The e-mail to convert in punycode.
*
* @return string The punycode conversion of the e-mail.
*/
public function emailToPunycode($email = '')
{
return $email;
}
/**
* Helper method to build a tiny YES/NO radio button.
*
* @param string $name The name of the input.
* @param object $elem_1 The first input object.
* @param object $elem_2 The second input object.
* @param boolean wrapped True if the input is wrapped in a control class, otherwise false..
*
* @return string The html to display.
*/
public function radioYesNo($name, $elem_1, $elem_2, $wrapped = true, $layout = null)
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for fieldset opening.
*
* @param string $legend The title of the fieldset.
* @param string $class The class attribute for the fieldset.
* @param string $id The ID attribute for the fieldset.
*
* @return string The html to display.
*/
public function openFieldset($legend, $class = '', $id = '')
{
$data = array();
$data['name'] = $legend;
$data['class'] = $class;
$data['id'] = $id;
return JHtml::fetch('layoutfile', 'html.form.fieldset.open')->render($data);
}
/**
* Backward compatibility for fieldset closing.
*
* @return string The html to display.
*/
public function closeFieldset()
{
return JHtml::fetch('layoutfile', 'html.form.fieldset.close')->render();
}
/**
* Backward compatibility for empty fieldset opening.
*
* @param string $class An additional class to use for the fieldset.
* @param string $id The ID attribute for the fieldset.
*
* @return string The html to display.
*/
public function openEmptyFieldset($class = '', $id = '')
{
return $this->openFieldset('', $class, $id);
}
/**
* Backward compatibility for empty fieldset opening.
*
* @return string The html to display.
*/
public function closeEmptyFieldset()
{
return $this->closeFieldset();
}
/**
* Backward compatibility for control opening.
*
* @param string $label The label of the control field.
* @param string $class The class of the control field.
* @param array $attr The additional attributes to add.
*
* @return string The html to display.
*/
public function openControl($label, $class = '', $attr = array())
{
$data = array();
foreach ($attr as $k => $v)
{
$data[$k] = $v;
}
$data['label'] = $label;
$data['class'] = $class;
return JHtml::fetch('layoutfile', 'html.form.control.open')->render($data);
}
/**
* Backward compatibility for control closing.
*
* @return string The html to display.
*/
public function closeControl()
{
return JHtml::fetch('layoutfile', 'html.form.control.close')->render();
}
/**
* Returns the codemirror editor in 3.x, otherwise a simple textarea.
*
* @param string $name The name of the textarea.
* @param string $value The value of the textarea.
*
* @return string The html to display.
*/
public function getCodeMirror($name, $value)
{
return '';
}
/**
* Backward compatibility for Bootstrap tabset opening.
*
* @param string $group The group of the tabset.
* @param string $attr The attributes to use.
*
* @return string The html to display.
*/
public function bootStartTabSet($group, $attr = array())
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for Bootstrap tabset closing.
*
* @return string The html to display.
*/
public function bootEndTabSet()
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for Bootstrap add tab.
*
* @param string $group The tabset parent group.
* @param string $id The id of the tab.
* @param string $label The title of the tab.
*
* @return string The html to display.
*/
public function bootAddTab($group, $id, $label)
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for Bootstrap end tab.
*
* @return string The html to display.
*/
public function bootEndTab()
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for Bootstrap open modal JS event.
*
* @param string $onclose The javascript function to call on close event.
*
* @return string The javascript function.
*/
public function bootOpenModalJS($onclose = '')
{
/**
* @todo
*/
return '';
}
/**
* Backward compatibility for Bootstrap dismiss modal JS event.
*
* @param string $selector The selector to identify the modal box.
*
* @return string The javascript function.
*/
public function bootDismissModalJS($selector)
{
/**
* @todo
*/
return '';
}
/**
* Returns the HTML used to render a Bootstrap modal.
*
* @param string $id The modal ID.
* @param string $title The modal title.
* @param string $body The modal body (if static HTML).
* @param mixed $options An array of attributes or the inline style string.
*
* @return string The modal HTML.
*/
public function getJModalHtml($id, $title, $body = '', $options = null)
{
if (is_array($options))
{
$width = isset($options['width']) ? abs($options['width']) : 90;
$height = isset($options['height']) ? abs($options['height']) : 80;
$left = isset($options['left']) ? abs($options['left']) : $width / 2;
$style = "width:$width%;height:$height%;margin-left:-$left%;";
if (isset($options['top']))
{
if ($options['top'] === true)
{
$top = (100 - $height) / 2;
}
else
{
$top = $options['top'];
}
$style .= "top:$top%;";
}
}
else if (is_string($options))
{
$style = $options;
}
else
{
$style = "width:90%;height:80%;margin-left:-45%";
}
$options = array();
$options['id'] = $id;
$options['title'] = $title;
$options['body'] = $body;
$options['style'] = $style;
$layout = new JLayoutFile('html.plugins.modal', null, array('component' => 'com_vikbooking'));
return $layout->render($options);
}
/**
* Adds javascript support for Bootstrap popovers.
*
* @param string $selector Selector for the popover.
* @param array $options An array of options for the popover.
* Options for the popover can be:
* animation boolean apply a css fade transition to the popover
* html boolean Insert HTML into the popover. If false, jQuery's text method will be used to insert
* content into the dom.
* placement string|function how to position the popover - top | bottom | left | right
* selector string If a selector is provided, popover objects will be delegated to the specified targets.
* trigger string how popover is triggered - hover | focus | manual
* title string|function default title value if `title` tag isn't present
* content string|function default content value if `data-content` attribute isn't present
* delay number|object delay showing and hiding the popover (ms) - does not apply to manual trigger type
* If a number is supplied, delay is applied to both hide/show
* Object structure is: delay: { show: 500, hide: 100 }
* container string|boolean Appends the popover to a specific element: { container: 'body' }
*/
public function attachPopover($selector = '.wpPopover', array $options = array())
{
static $loaded = array();
$sign = serialize(array($selector, $options));
if (!isset($loaded[$sign]))
{
$options['sanitize'] = false;
$data = $options ? json_encode($options) : '{}';
JFactory::getDocument()->addScriptDeclaration(
<< |
|---|