本文整理汇总了PHP中vmJsApi::setPath方法的典型用法代码示例。如果您正苦于以下问题:PHP vmJsApi::setPath方法的具体用法?PHP vmJsApi::setPath怎么用?PHP vmJsApi::setPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmJsApi
的用法示例。
在下文中一共展示了vmJsApi::setPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: css
/**
* Write a <link ></link > element
* @param string path to file
* @param string library name
* @param string library version
* @param boolean library version
* @return nothing
*/
public static function css($namespace, $path = FALSE, $version = '', $minified = NULL)
{
static $loaded = array();
// Only load once
// using of namespace assume same css have same namespace
// loading 2 time css with this method simply return and do not load it the second time
if (!empty($loaded[$namespace])) {
return;
}
$file = vmJsApi::setPath($namespace, $path, $version = '', $minified, 'css');
$document = JFactory::getDocument();
$document->addStyleSheet($file);
$loaded[$namespace] = TRUE;
}
示例2: jDate
static function jDate($date = '', $name = "date", $id = NULL, $resetBt = TRUE, $yearRange = '')
{
if ($yearRange) {
$yearRange = 'yearRange: "' . $yearRange . '",';
}
$test = (int) str_replace(array('-', ' ', ':'), '', $date);
if (empty($test)) {
$date = 0;
}
if (empty($id)) {
$id = str_replace(array('[]', '[', ']'), '.', $name);
$id = str_replace('..', '.', $id);
}
static $jDate;
if (!class_exists('VmHtml')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$id = VmHtml::ensureUniqueId($id);
$dateFormat = vmText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');
//="m/d/y"
$search = array('m', 'd', 'Y');
$replace = array('mm', 'dd', 'yy');
$jsDateFormat = str_replace($search, $replace, $dateFormat);
if ($date) {
$formatedDate = JHtml::_('date', $date, $dateFormat);
} else {
$formatedDate = vmText::_('COM_VIRTUEMART_NEVER');
}
$display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
$display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" />';
if ($resetBt) {
$display .= '<span class="vmicon vmicon-16-logout icon-nofloat js-date-reset"></span>';
}
// If exist exit
if ($jDate) {
return $display;
}
self::addJScript('datepicker', '
jQuery(document).ready( function($) {
jQuery(document).on( "focus",".datepicker", function() {
jQuery( this ).datepicker({
changeMonth: true,
changeYear: true,
' . $yearRange . '
dateFormat:"' . $jsDateFormat . '",
altField: $(this).prev(),
altFormat: "yy-mm-dd"
});
});
jQuery(document).on( "click",".js-date-reset", function() {
jQuery(this).prev("input").val("' . vmText::_('COM_VIRTUEMART_NEVER') . '").prev("input").val("0");
});
});
');
vmJsApi::css('ui/jquery.ui.all');
$lg = JFactory::getLanguage();
$lang = $lg->getTag();
$vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-' . $lang, FALSE, '', $minified = NULL, 'js', true);
if (!file_exists($vlePath) or is_dir($vlePath)) {
$lang = 'en-GB';
}
vmJsApi::addJScript('i18n/jquery.ui.datepicker-' . $lang);
$jDate = TRUE;
return $display;
}
示例3: JvalideForm
static function JvalideForm($name = '#adminForm')
{
static $jvalideForm;
// If exist exit
if ($jvalideForm === $name) {
return;
}
$document = JFactory::getDocument();
$document->addScriptDeclaration("\r\n//<![CDATA[\r\n\t\t\tjQuery(document).ready(function() {\r\n\t\t\t\tjQuery('" . $name . "').validationEngine();\r\n\t\t\t});\r\n//]]>\r\n");
if ($jvalideForm) {
return;
}
vmJsApi::js('jquery.validationEngine');
$lg = JFactory::getLanguage();
$lang = substr($lg->getTag(), 0, 2);
/*$existingLang = array("cz", "da", "de", "en", "es", "fr", "it", "ja", "nl", "pl", "pt", "ro", "ru", "tr");
if (!in_array ($lang, $existingLang)) {
$lang = "en";
}*/
$vlePath = vmJsApi::setPath('languages/jquery.validationEngine-' . $lang, FALSE, '', $minified = NULL, 'js', true);
if (file_exists($vlePath) and !is_dir($vlePath)) {
vmJsApi::js('languages/jquery.validationEngine-' . $lang);
} else {
vmJsApi::js('languages/jquery.validationEngine-en');
}
vmJsApi::css('validationEngine.template');
vmJsApi::css('validationEngine.jquery');
$jvalideForm = $name;
}