本文整理汇总了PHP中Media::addJsDef方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::addJsDef方法的具体用法?PHP Media::addJsDef怎么用?PHP Media::addJsDef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::addJsDef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hookAdvancedPaymentOptions
public function hookAdvancedPaymentOptions($param)
{
$legacyOptions = Hook::exec('displayPaymentEU', array(), null, true);
$newOptions = array();
Media::addJsDef(array('aeuc_tos_err_str' => Tools::htmlentitiesUTF8($this->l('You must agree to our Terms of Service before going any further!', 'ps_legalcompliance'))));
Media::addJsDef(array('aeuc_submit_err_str' => Tools::htmlentitiesUTF8($this->l('Something went wrong. If the problem persists, please contact us.', 'ps_legalcompliance'))));
Media::addJsDef(array('aeuc_no_pay_err_str' => Tools::htmlentitiesUTF8($this->l('Select a payment option first.', 'ps_legalcompliance'))));
Media::addJsDef(array('aeuc_virt_prod_err_str' => Tools::htmlentitiesUTF8($this->l('Please check the "Revocation of virtual products" box first!', 'ps_legalcompliance'))));
if ($legacyOptions) {
foreach ($legacyOptions as $module_name => $legacyOption) {
if (!$legacyOption) {
continue;
}
foreach (PaymentOption::convertLegacyOption($legacyOption) as $option) {
$option->setModuleName($module_name);
$to_be_cleaned = $option->getForm();
if ($to_be_cleaned) {
$cleaned = str_replace('@hiddenSubmit', '', $to_be_cleaned);
$option->setForm($cleaned);
}
$newOptions[] = $option;
}
}
}
return $newOptions;
}
示例2: hookDisplayHeader
public function hookDisplayHeader()
{
if ($this->algolia->isConfigurationValid() === false) {
return false;
}
require_once dirname(__FILE__) . '/classes/AlgoliaSearch.php';
require_once dirname(__FILE__) . '/classes/AlgoliaSync.php';
/* Generate Algolia front controller link for search form */
$search_url = Context::getContext()->link->getModuleLink('algolia', 'search');
$this->context->smarty->assign('algolia_search_url', $search_url);
/* Add JS values for Algolia scripts */
$algolia_search = new AlgoliaSearch();
$algolia_sync = new AlgoliaSync();
$language = Context::getContext()->language;
$algolia_sync_settings = $algolia_sync->getSettings($language->id);
Media::addJsDef(array('algolia_application_id' => $algolia_search->getApplicationID(), 'algolia_index_name' => $algolia_search->getIndexName(), 'algolia_search_iso_code' => $language->iso_code, 'algolia_search_only_api_key' => $algolia_search->getSearchOnlyAPIKey(), 'algolia_search_url' => $search_url, 'algolia_attributes_to_index' => $algolia_sync_settings['attributesToIndex'], 'algolia_attributes_for_faceting' => $algolia_sync_settings['attributesForFaceting']));
/* Add CSS & JS files required for Algolia search */
$this->context->controller->addJS($this->_path . '/js/typeahead.bundle.js');
$this->context->controller->addJS($this->_path . '/js/hogan-3.0.1.js');
$this->context->controller->addJS($this->_path . '/js/algoliasearch.min.js');
$this->context->controller->addCSS($this->_path . '/css/algolia.css');
/**
* Load the appropriate JS search script
* Depending on the search method
*/
if (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Facet_Search) {
$this->context->controller->addJS($this->_path . '/js/algolia_facet_search.js');
} elseif (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Simple_Search) {
$this->context->controller->addJS($this->_path . '/js/algolia_simple_search.js');
}
}
示例3: setMedia
public function setMedia()
{
parent::setMedia();
Media::addJsDef(array('admin_fronteditor_ajax_url' => $this->context->link->getAdminLink('IqitFronteditor')));
$this->addCSS(array(_MODULE_DIR_ . 'iqitcontentcreator/css/bfronteditor.css'));
$this->addJS(array(_MODULE_DIR_ . 'iqitcontentcreator/js/bfronteditor.js'));
}
示例4: initContent
public function initContent()
{
parent::initContent();
if (Configuration::get('PS_EU_PAYMENT_API')) {
$instance = new EU_Legal();
Media::addJsDef(array('deliveryNowValue' => $this->product->delivery_now, 'deliveryLaterValue' => $this->product->delivery_later, 'deliveryNoStockValue' => $instance->l('This product is no longer in stock')));
}
}
示例5: hookHeader
public function hookHeader($params)
{
if (!$this->_appid || !$this->_appkey) {
return;
}
Media::addJsDef(array('facebook_appid' => $this->_appid, 'facebook_scope' => $this->_appscope));
$this->context->controller->addJs($this->_path . 'views/js/login.js', 'all');
$this->context->controller->addCss($this->_path . 'views/css/login.css', 'all');
}
示例6: hookHeader
public function hookHeader($params)
{
if (!$this->_client_id || !$this->_client_secret) {
return;
}
Media::addJsDef(array('google_appid' => $this->_client_id, 'google_scope' => $this->_client_scope));
$this->context->controller->addJs($this->_path . 'views/js/login.js', 'all');
$this->context->controller->addCss($this->_path . 'views/css/login.css', 'all');
}
示例7: hookTop
public function hookTop($params)
{
$key = $this->getCacheId('blocksearch-top' . (!isset($params['hook_mobile']) || !$params['hook_mobile'] ? '' : '-hook_mobile'));
if (Tools::getValue('search_query') || !$this->isCached('blocksearch-top.tpl', $key)) {
$this->calculHookCommon($params);
$this->smarty->assign(array('blocksearch_type' => 'top', 'search_query' => (string) Tools::getValue('search_query')));
}
Media::addJsDef(array('blocksearch_type' => 'top'));
return $this->display(__FILE__, 'blocksearch-top.tpl', Tools::getValue('search_query') ? null : $key);
}
示例8: hookDisplayHeader
public function hookDisplayHeader($params)
{
if (Configuration::get('PS_CATALOG_MODE')) {
return;
}
$this->context->controller->addCss($this->_path . 'css/iqitcountdown.css', 'all');
$this->context->controller->addJS($this->_path . 'js/count.js');
$this->context->controller->addJS($this->_path . 'js/iqitcountdown.js');
Media::addJsDef(array('countdownEnabled' => true));
}
示例9: hookDisplayHome
public function hookDisplayHome($params)
{
if (!$this->isCached('lasttweets.tpl', $this->getCacheId())) {
global $smarty;
$smarty->assign('username', Configuration::get('PS_TWITTER_USERNAME'));
$smarty->assign('this_path', $this->_path);
}
Media::addJsDef(array('twitter_widgetid' => Configuration::get('PS_TWITTER_ID')));
Media::addJsDef(array('twitter_numberoftweets' => Configuration::get('PS_TWITTER_NB')));
return $this->display(__FILE__, 'lasttweets.tpl', $this->getCacheId());
}
示例10: setMedia
public function setMedia()
{
$this->addJquery();
$this->addjqueryPlugin('validate');
$this->addJS(_PS_JS_DIR_ . 'jquery/plugins/validate/localization/messages_' . $this->context->language->iso_code . '.js');
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/admin-theme.css', 'all', 0);
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX);
$this->addJS(_PS_JS_DIR_ . 'vendor/spin.js');
$this->addJS(_PS_JS_DIR_ . 'vendor/ladda.js');
Media::addJsDef(array('img_dir' => _PS_IMG_));
Media::addJsDefL('one_error', $this->l('There is one error.', null, true, false));
Media::addJsDefL('more_errors', $this->l('There are several errors.', null, true, false));
Hook::exec('actionAdminLoginControllerSetMedia');
}
示例11: setMedia
public function setMedia()
{
parent::setMedia();
$this->context->controller->addJS($this->module->getLocalPath() . 'js/back.js');
$this->context->controller->addCSS($this->module->getLocalPath() . 'css/back.css');
$this->context->controller->addJS($this->module->getLocalPath() . 'js/fontawesome-iconpicker.min.js');
$this->context->controller->addCSS($this->module->getLocalPath() . 'css/fontawesome-iconpicker.min.css');
$this->context->controller->addJS($this->module->getLocalPath() . 'js/spectrum.js');
$this->context->controller->addCSS($this->module->getLocalPath() . 'css/spectrum.css');
$this->context->controller->addCSS($this->module->getLocalPath() . 'css/fronteditor.css');
$this->context->controller->addJS($this->module->getLocalPath() . 'js/fronteditor.js');
Media::addJsDef(array('iqit_frontcreator' => true));
$this->context->controller->addJqueryUI('ui.sortable');
$this->context->controller->addJqueryPlugin('autocomplete');
}
示例12: getOptionFields
protected function getOptionFields()
{
$forms = array();
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$carriers = Carrier::getCarriers($this->context->language->id, true);
$modules = Module::getModulesOnDisk(true);
$forms = array('payment' => array('title' => $this->l('Average bank fees per payment method'), 'id' => 'payment'), 'carriers' => array('title' => $this->l('Average shipping fees per shipping method'), 'id' => 'carriers'), 'other' => array('title' => $this->l('Other settings'), 'id' => 'other'));
foreach ($forms as &$form) {
$form['icon'] = 'tab-preferences';
$form['fields'] = array();
$form['submit'] = array('title' => $this->l('Save'));
}
foreach ($modules as $module) {
if (isset($module->tab) && $module->tab == 'payments_gateways' && $module->id) {
$moduleClass = Module::getInstanceByName($module->name);
if (!$moduleClass->isEnabledForShopContext()) {
continue;
}
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed in %1$s with %2$s.'), $currency->iso_code, $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed in %1$s with %2$s. It will be applied on the total paid with taxes.'), $currency->iso_code, $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
if (Currency::isMultiCurrencyActivated()) {
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_FIXED_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a fixed fee for each order placed with a foreign currency with %s.'), $module->displayName), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
$forms['payment']['fields']['CONF_' . strtoupper($module->name) . '_VAR_FOREIGN'] = array('title' => $module->displayName, 'desc' => sprintf($this->l('Choose a variable fee for each order placed with a foreign currency with %s. It will be applied on the total paid with taxes.'), $module->displayName), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
}
}
foreach ($carriers as $carrier) {
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the domestic delivery costs in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['carriers']['fields']['CONF_' . strtoupper($carrier['id_reference']) . '_SHIP_OVERSEAS'] = array('title' => $carrier['name'], 'desc' => sprintf($this->l('For the carrier named %s, indicate the overseas delivery costs in percentage of the price charged to customers.'), $carrier['name']), 'validation' => 'isPercentage', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
}
$forms['carriers']['description'] = $this->l('Method: Indicate the percentage of your carrier margin. For example, if you charge $10 of shipping fees to your customer for each shipment, but you really pay $4 to this carrier, then you should indicate "40" in the percentage field.');
$forms['other']['fields']['CONF_AVERAGE_PRODUCT_MARGIN'] = array('title' => $this->l('Average gross margin percentage'), 'desc' => $this->l('You should calculate this percentage as follows: ((total sales revenue) - (cost of goods sold)) / (total sales revenue) * 100. This value is only used to calculate the Dashboard approximate gross margin, if you do not specify the wholesale price for each product.'), 'validation' => 'isPercentage', 'cast' => 'intval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => '%');
$forms['other']['fields']['CONF_ORDER_FIXED'] = array('title' => $this->l('Other fees per order'), 'desc' => $this->l('You should calculate this value by making the sum of all of your additional costs per order.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'text', 'defaultValue' => '0', 'suffix' => $currency->iso_code);
Media::addJsDef(array('dashboard_ajax_url' => $this->context->link->getAdminLink('AdminDashboard'), 'read_more' => ''));
return $forms;
}
示例13: hookDisplayHeader
public function hookDisplayHeader($params)
{
if (Configuration::get('PH_BLOG_LOAD_BXSLIDER')) {
$this->context->controller->addCSS($this->_path . 'css/jquery.bxslider.css');
}
if (Configuration::get('PH_BLOG_LOAD_FONT_AWESOME')) {
$this->context->controller->addCSS($this->_path . 'css/font-awesome.css');
}
$this->context->controller->addCSS($this->_path . 'css/ph_simpleblog.css');
$this->context->controller->addCSS($this->_path . 'css/custom.css');
if ($this->is_16 === false) {
$this->context->controller->addCSS($this->_path . 'css/ph_simpleblog-15.css');
}
if (Configuration::get('PH_BLOG_LOAD_FITVIDS')) {
$this->context->controller->addJS($this->_path . 'js/jquery.fitvids.js');
}
if (Configuration::get('PH_BLOG_LOAD_BXSLIDER')) {
$this->context->controller->addJS($this->_path . 'js/jquery.bxslider.min.js');
}
$this->context->controller->addJS($this->_path . 'js/ph_simpleblog.js');
$this->context->controller->addJqueryPlugin(array('bxslider', 'fancybox'));
if (Configuration::get('PH_BLOG_MASONRY_LAYOUT') && Configuration::get('PH_BLOG_LOAD_MASONRY')) {
$this->context->controller->addJS($this->_path . 'js/isotope.pkgd.min.js');
$this->context->controller->addJS($this->_path . 'js/ph_simpleblog_masonry.js');
}
if (Tools::getValue('module') && Tools::getValue('module') == 'ph_simpleblog' && Tools::getValue('controller') == 'single') {
$controller = Context::getContext()->controller;
$this->context->smarty->assign(array('post_title' => $controller->simpleblog_post_name, 'post_description' => $controller->simpleblog_post_description, 'post_image' => $controller->simpleblog_post_thumbnail));
Media::addJsDef(array('ph_sharing_name' => addcslashes($controller->simpleblog_post_name, "'"), 'ph_sharing_url' => addcslashes($controller->simpleblog_post_url, "'"), 'ph_sharing_img' => addcslashes($controller->simpleblog_post_thumbnail, "'")));
return $this->display(__FILE__, 'header.tpl');
}
}
示例14: hookHeader
public function hookHeader()
{
$this->context->controller->addJQueryUI('ui.slider');
$this->context->controller->addJqueryPlugin('cooki-plugin');
$this->context->controller->addJS($this->_path . '/views/js/convermax.js');
$this->context->controller->addCSS($this->_path . '/views/css/convermax.css');
if (get_class($this->context->controller) == 'ConvermaxSearchModuleFrontController') {
$this->context->controller->addJS($this->_path . '/views/js/convermax-search.js');
}
$cm_search_url = $this->context->link->getModuleLink('convermax', 'search');
$this->context->smarty->assign('cm_search_url', $cm_search_url);
Media::addJsDef(array('cm_url' => Configuration::get('CONVERMAX_URL')));
Media::addJsDef(array('cm_search_url' => $cm_search_url));
$home_category = Configuration::get('PS_HOME_CATEGORY');
$id_category = (int) Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
if ($id_category != $home_category) {
Media::addJsDef(array('cm_category' => true));
$this->context->controller->addJS($this->_path . '/views/js/convermax-search.js');
}
}
示例15: setMedia
public function setMedia()
{
//Bootstrap
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/' . $this->bo_css, 'all', 0);
$this->addJquery();
$this->addjQueryPlugin(array('scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox'));
$this->addjQueryPlugin('growl', null, false);
$this->addJqueryUI(array('ui.slider', 'ui.datepicker'));
Media::addJsDef(array('host_mode' => defined('_PS_HOST_MODE_') && _PS_HOST_MODE_));
$this->addJS(array(_PS_JS_DIR_ . 'admin.js?v=' . _PS_VERSION_, _PS_JS_DIR_ . 'tools.js?v=' . _PS_VERSION_, _PS_JS_DIR_ . 'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'));
//loads specific javascripts for the admin theme
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/bootstrap.min.js');
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/modernizr.min.js');
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/modernizr-loads.js');
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/moment-with-langs.min.js');
if (!$this->lite_display) {
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/help.js');
}
if (!Tools::getValue('submitFormAjax')) {
$this->addJS(_PS_JS_DIR_ . 'admin/notifications.js');
}
if (defined('_PS_HOST_MODE_') && _PS_HOST_MODE_) {
$this->addJS('https://cdn.statuspage.io/se-v2.js');
Media::addJsDefL('status_operational', $this->l('Operational', null, true, false));
Media::addJsDefL('status_degraded_performance', $this->l('Degraded Performance', null, true, false));
Media::addJsDefL('status_partial_outage', $this->l('Partial Outage', null, true, false));
Media::addJsDefL('status_major_outage', $this->l('Major Outage', null, true, false));
Media::addJsDef(array('host_cluster' => defined('_PS_HOST_CLUSTER_') ? _PS_HOST_CLUSTER_ : 'fr1'));
}
// Execute Hook AdminController SetMedia
Hook::exec('actionAdminControllerSetMedia');
// Specific Admin Theme
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX);
}