本文整理匯總了PHP中J2Store::isPro方法的典型用法代碼示例。如果您正苦於以下問題:PHP J2Store::isPro方法的具體用法?PHP J2Store::isPro怎麽用?PHP J2Store::isPro使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類J2Store
的用法示例。
在下文中一共展示了J2Store::isPro方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInfo
public function getInfo()
{
$info = array();
$version = new JVersion();
$platform = new JPlatform();
$db = JFactory::getDbo();
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$sf = $_SERVER['SERVER_SOFTWARE'];
} else {
$sf = getenv('SERVER_SOFTWARE');
}
$info['php'] = php_uname();
$info['dbversion'] = $db->getVersion();
$info['dbcollation'] = $db->getCollation();
$info['phpversion'] = phpversion();
$info['server'] = $sf;
$info['sapi_name'] = php_sapi_name();
$info['version'] = $version->getLongVersion();
$info['platform'] = $platform->getLongVersion();
$info['useragent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
$info['j2store_version'] = $this->getJ2storeVerion();
$info['is_pro'] = J2Store::isPro();
$info['curl'] = $this->_isCurl();
$info['json'] = $this->_isJson();
$config = JFactory::getConfig();
$info['error_reporting'] = $config->get('error_reporting');
$caching = $config->get('caching');
$info['caching'] = $caching ? JText::_('J2STORE_ENABLED') : JText::_('J2STORE_DISABLED');
$cache_plugin = JPluginHelper::isEnabled('system', 'cache');
$info['plg_cache_enabled'] = $cache_plugin;
$info['memory_limit'] = ini_get('memory_limit');
return $info;
}
示例2: loadEmailTemplate
protected function loadEmailTemplate($order)
{
// Initialise
$templateText = '';
$subject = '';
$loadLanguage = null;
$isHTML = false;
// Look for desired languages
$jLang = JFactory::getLanguage();
$userLang = $order->customer_language;
$languages = array($userLang, $jLang->getTag(), $jLang->getDefault(), 'en-GB', '*');
//load all templates
$allTemplates = $this->getEmailTemplates($order);
if (count($allTemplates) && J2Store::isPro() == 1) {
// Pass 1 - Give match scores to each template
$preferredIndex = null;
$preferredScore = 0;
foreach ($allTemplates as $idx => $template) {
// Get the language and level of this template
$myLang = $template->language;
// Make sure the language matches one of our desired languages, otherwise skip it
$langPos = array_search($myLang, $languages);
if ($langPos === false) {
continue;
}
$langScore = 5 - $langPos;
// Calculate the score
$score = $langScore;
if ($score > $preferredScore) {
$loadLanguage = $myLang;
$subject = $template->subject;
if (isset($template->body_source) && $template->body_source == 'file') {
$templateText = $this->getTemplateFromFile($template, $order);
$this->is_template_file = true;
} else {
$templateText = $template->body;
}
$preferredScore = $score;
$isHTML = true;
}
}
} else {
$isHTML = true;
$templateText = JText::_('J2STORE_ORDER_EMAIL_TEMPLATE_STANDARD_BODY');
$subject = JText::_('J2STORE_ORDER_EMAIL_TEMPLATE_STANDARD_SUBJECT');
}
return array($isHTML, $subject, $templateText, $loadLanguage);
}
示例3: array
<div class="control-group">
<?php
echo J2Html::label(JText::_('J2STORE_PRODUCT_MANUFACTURER'), 'manufacturer', array('class' => 'control-label'));
?>
<?php
echo $this->manufacturers;
?>
</div>
<div class="control-group">
<?php
echo J2Html::label(JText::_('J2STORE_PRODUCT_VENDOR'), 'vendor', array('class' => 'control-label'));
?>
<?php
if (J2Store::isPro()) {
?>
<?php
echo $this->vendors;
?>
<?php
} else {
?>
<?php
echo J2Html::pro();
?>
<?php
}
?>
</div>
示例4: foreach
foreach ($fields as $key => $field) {
$pro = $field->getAttribute('pro');
?>
<div class="control-group <?php
echo $layout;
?>
" <?php
echo $style;
?>
>
<div class="control-label"><?php
echo $field->label;
?>
</div>
<?php
if (J2Store::isPro() != 1 && $pro == 1) {
?>
<?php
echo J2Html::pro();
?>
<?php
} else {
?>
<div class="controls"><?php
echo $field->input;
?>
<br />
<small class="muted"><?php
echo JText::_($field->description);
?>
</small>
示例5: migrate_coupons
public function migrate_coupons()
{
$db = JFactory::getDbo();
if (!J2Store::isPro()) {
return true;
}
$total = 0;
$query = $db->getQuery(true)->select('COUNT(*)')->from('#__j2store_coupons')->where('(value_type =' . $db->q('P') . ' OR value_type =' . $db->q('F') . ')')->where('enabled = 1');
$db->setQuery($query);
try {
$total = $db->loadResult();
} catch (Exception $e) {
// do nothing
}
if ($total) {
// disable fixed product type coupons
$query = $db->getQuery(true)->update('#__j2store_coupons')->set('enabled = 0')->where('value_type = ' . $db->q('F'));
$db->setQuery($query);
try {
$db->execute();
} catch (Exception $e) {
// do nothing.
}
// if product category and products not empty, then coupon type is percentage product
$query = $db->getQuery(true)->update('#__j2store_coupons')->set('value_type = ' . $db->q('percentage_product'))->where('value_type = ' . $db->q('P'))->where('product_category <> ""')->where('products <> ""');
$db->setQuery($query);
try {
$db->execute();
} catch (Exception $e) {
// do nothing.
}
// if product category and products is empty, then coupon type is percentage cart
$query = $db->getQuery(true)->update('#__j2store_coupons')->set('value_type = ' . $db->q('percentage_cart'))->where('value_type = ' . $db->q('P'))->where('(product_category = "" OR product_category = NULL)')->where('(products = "" OR products = NULL)');
$db->setQuery($query);
try {
$db->execute();
} catch (Exception $e) {
// do nothing.
}
}
}
示例6: validate_order_stock
/**
* Method to validate stock in an order. Called only before placing the order.
* @return boolean True if successful | False if a condition does not match
*/
public function validate_order_stock()
{
$product_helper = J2Store::product();
$utilities = J2Store::utilities();
$items = $this->getItems();
if (count($items) < 1) {
return true;
}
$quantity_in_cart = $this->get_orderitem_stock($items);
foreach ($items as $item) {
// check quantity restrictions
if ($item->cartitem->quantity_restriction && J2Store::isPro()) {
// get quantity restriction
$product_helper->getQuantityRestriction($item->cartitem);
$quantity = $quantity_in_cart[$item->variant_id];
$min = $item->cartitem->min_sale_qty;
$max = $item->cartitem->max_sale_qty;
if ($max && $max > 0) {
if ($quantity > $max) {
JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_MAXIMUM_QUANTITY_REACHED", $item->orderitem_name, $utilities->stock_qty($max), $utilities->stock_qty($quantity)));
return false;
}
}
if ($min && $min > 0) {
if ($quantity < $min) {
JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_MINIMUM_QUANTITY_REQUIRED", $item->orderitem_name, $utilities->stock_qty($min), $utilities->stock_qty($quantity)));
return false;
}
}
}
if ($product_helper->managing_stock($item->cartitem) && $product_helper->backorders_allowed($item->cartitem) == false) {
$productQuantity = F0FTable::getInstance('ProductQuantity', 'J2StoreTable')->getClone();
$productQuantity->load(array('variant_id' => $item->variant_id));
// no stock, right now?
if ($productQuantity->quantity < 1) {
JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_STOCK_NOT_AVAILABLE", $item->orderitem_name));
return false;
}
// not enough stock ?
if ($productQuantity->quantity > 0 && $quantity_in_cart[$item->variant_id] > $productQuantity->quantity) {
JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_STOCK_NOT_ENOUGH_STOCK", $item->orderitem_name, $utilities->stock_qty($productQuantity->quantity)));
return false;
}
}
}
return true;
}
示例7: defined
<?php
/**
* @package J2Store
* @copyright Copyright (c)2014-17 Ramesh Elamathi / J2Store.org
* @license GNU GPL v3 or later
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<?php
if (J2Store::isPro() != 1) {
?>
<h3><?php
echo JText::_('J2STORE_POSTCONFIG_LBL_MANDATORYINFO');
?>
</h3>
<label for="acceptlicense" class="postsetup-main" id="acceptlicense"> <input
type="checkbox" name="acceptlicense"
<?php
if ($this->params->get('acceptlicense')) {
?>
checked="checked" <?php
}
?>
/>
<?php
echo JText::_('J2STORE_POSTCONFIG_LBL_ACCEPTLICENSE');
?>
</label> </br>
示例8: save
public function save()
{
//first CSRF check
JSession::checkToken() or die('Invalid Token');
$app = JFactory::getApplication();
$json = array();
$values = $app->input->getArray($_POST);
//NOT a PRO version ? check if the mandatory terms are accepted.
if (J2Store::isPro() != 1) {
if (!isset($values['acceptlicense'])) {
$json['error']['acceptlicense'] = JText::_('J2STORE_POSTCONFIG_ERR_ACCEPTLICENSE');
}
if (!isset($values['acceptsupport'])) {
$json['error']['acceptsupport'] = JText::_('J2STORE_POSTCONFIG_ERR_ACCEPTSUPPORT');
}
}
//now we need a store name
if (!$this->validate_field('store_name', $values)) {
$json['error']['store_name'] = JText::_('J2STORE_FIELD_REQUIRED');
}
if (!$this->validate_field('store_zip', $values)) {
$json['error']['store_zip'] = JText::_('J2STORE_FIELD_REQUIRED');
}
if (!$this->validate_field('country_id', $values)) {
$json['error']['country_id'] = JText::_('J2STORE_FIELD_REQUIRED');
}
if (!$this->validate_field('config_currency', $values)) {
$json['error']['config_currency'] = JText::_('J2STORE_FIELD_REQUIRED');
}
if (JString::strlen($values['config_currency']) != 3) {
$json['error']['config_currency'] = JText::_('J2STORE_CURRENCY_CODE_ERROR');
}
$currency_code = $values['config_currency'];
$currency_symbol = isset($values['config_currency_symbol']) ? $values['config_currency_symbol'] : $currency_code;
unset($values['config_currency_symbol']);
if (!$json) {
$db = JFactory::getDbo();
$query = 'REPLACE INTO #__j2store_configurations (config_meta_key,config_meta_value) VALUES ';
jimport('joomla.filter.filterinput');
$filter = JFilterInput::getInstance(null, null, 1, 1);
$conditions = array();
foreach ($values as $metakey => $value) {
//now clean up the value
if ($metakey == 'tax_rate') {
if (!empty($value)) {
$rate = floatval($value);
if ($rate > 0) {
try {
$this->set_default_taxrate($rate, $values);
} catch (Exception $e) {
//do nothing. User can always set tax later
}
}
}
continue;
}
$clean_value = $filter->clean($value, 'string');
$conditions[] = '(' . $db->q(strip_tags($metakey)) . ',' . $db->q($clean_value) . ')';
}
//add the admin email
$conditions[] = '(' . $db->q('admin_email') . ',' . $db->q(JFactory::getUser()->email) . ')';
//set installation complete
$conditions[] = '(' . $db->q('installation_complete') . ',' . $db->q('1') . ')';
$query .= implode(',', $conditions);
try {
$db->setQuery($query);
$db->execute();
F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->create_currency_by_code($currency_code, $currency_symbol);
$msg = JText::_('J2STORE_CHANGES_SAVED');
$json['redirect'] = 'index.php?option=com_j2store&view=cpanel';
} catch (Exception $e) {
$msg = $e->getMessage();
$msgType = 'Warning';
}
}
echo json_encode($json);
$app->close();
}
示例9: validateQuantityRestriction
public function validateQuantityRestriction($variant, $cart_total_qty, $addto_qty = 0)
{
$error = '';
if ($variant->quantity_restriction && J2Store::isPro()) {
$quantity_total = $cart_total_qty + $addto_qty;
$min = $variant->min_sale_qty;
$max = $variant->max_sale_qty;
if ($max && $max > 0) {
if ($quantity_total > $max) {
$error = JText::sprintf('J2STORE_MAX_QUANTITY_FOR_PRODUCT', floatval($max), J2Store::utilities()->stock_qty($cart_total_qty));
}
}
if ($min && $min > 0) {
if ($quantity_total < $min) {
$error = JText::sprintf('J2STORE_MIN_QUANTITY_FOR_PRODUCT', floatval($min));
}
}
}
return $error;
}
示例10: array
<?php
echo J2Html::text($prefix . '[weight]', $this->variant->weight, array('class' => 'input-small'));
?>
<?php
echo J2Html::label(JText::_('J2STORE_PRODUCT_WEIGHT_CLASS'), 'weight_class');
?>
<?php
$default_weight = empty($this->variant->weight_class_id) ? J2Store::config()->get('config_weight_class_id') : $this->variant->weight_class_id;
echo J2Html::select()->clearState()->type('genericlist')->name($prefix . '[weight_class_id]')->value($default_weight)->attribs(array('id' => 'weight_class_' . $this->variant->j2store_variant_id, 'class' => 'input-small'))->setPlaceHolders($this->weights)->getHtml();
?>
</div>
</div>
<div class="span4">
<?php
if (J2Store::isPro() == 1) {
?>
<div class="j2store-product-general">
<div class="control-group form-inline">
<?php
echo J2Html::label(JText::_('J2STORE_PRODUCT_MANAGE_STOCK'), 'manage_stock', array('class' => 'control-label'));
?>
<?php
// echo J2Html::radioBooleanList($prefix.'[manage_stock]',$this->variant->manage_stock,array('hide_label'=>true ,'id' => 'manage_stock_'.$this->variant->j2store_variant_id));
?>
<?php
//pricing options
echo J2Html::select()->clearState()->type('genericlist')->name($prefix . '[manage_stock]')->value($this->variant->manage_stock)->attribs(array('id' => 'manage_stock_' . $this->variant->j2store_variant_id, 'class' => 'input-small'))->setPlaceHolders(array(0 => JText::_('J2STORE_NO'), 1 => JText::_('J2STORE_YES')))->getHtml();
?>
示例11: onCouponsHistory
public function onCouponsHistory()
{
if (J2Store::isPro()) {
$this->noToolbar();
$app = JFactory::getApplication();
$bar = JToolBar::getInstance('toolbar');
// Add "Export to CSV"
$link = JURI::getInstance();
$query = $link->getQuery(true);
$query = array('option' => 'com_j2store', 'view' => 'coupon', 'task' => 'edit', 'id' => $app->input->getInt('coupon_id', 0));
$link->setQuery($query);
JToolBarHelper::divider();
$icon = 'arrow-left';
$bar->appendButton('Link', $icon, JText::_('J2STORE_BACK'), $link->toString());
} else {
$this->noToolbar();
}
}
示例12: onInvoicetemplatesBrowse
public function onInvoicetemplatesBrowse()
{
if (J2Store::isPro()) {
parent::onBrowse();
} else {
$this->noToolbar();
}
}
示例13: getOptionTypes
public static function getOptionTypes()
{
$types = array();
$choose = array();
$choose[] = 'select';
$choose[] = 'radio';
if (J2Store::isPro()) {
$choose[] = 'checkbox';
}
$types['choose'] = $choose;
if (J2Store::isPro()) {
$types['input'] = array('text', 'textarea', 'file');
$types['date'] = array('date', 'time', 'datetime');
}
J2Store::plugin()->event('GetOptionTypes', array(&$types));
return $types;
}