当前位置: 首页>>代码示例>>PHP>>正文


PHP MagebridgeModelConfig::allEmpty方法代码示例

本文整理汇总了PHP中MagebridgeModelConfig::allEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP MagebridgeModelConfig::allEmpty方法的具体用法?PHP MagebridgeModelConfig::allEmpty怎么用?PHP MagebridgeModelConfig::allEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MagebridgeModelConfig的用法示例。


在下文中一共展示了MagebridgeModelConfig::allEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkConfig

 public function checkConfig()
 {
     // Check if the settings are all empty
     if (MagebridgeModelConfig::allEmpty() == true) {
         JError::raiseWarning(500, JText::sprintf('Check the online %s for more information.', MageBridgeHelper::getHelpText('quickstart')));
         return;
     }
     // Otherwise check all values
     $config = MagebridgeModelConfig::load();
     foreach ($config as $c) {
         if (isset($c['name']) && isset($c['value']) && ($message = MageBridge::getConfig()->check($c['name'], $c['value']))) {
             JError::raiseWarning(500, $message);
         }
     }
     return;
 }
开发者ID:traveladviser,项目名称:magebridge-mirror,代码行数:16,代码来源:view.html.php

示例2: check

 /**
  * Method to check a specific configuratione-element
  * 
  * @param string $element
  * @param string $value
  * @return string|null
  */
 public static function check($element, $value = null)
 {
     // Reset an empty value to its original value
     if (empty($value)) {
         $value = MagebridgeModelConfig::load($element);
     }
     // Check for settings that should not be kept empty
     $nonempty = array('host', 'website', 'api_user', 'api_key');
     if (MagebridgeModelConfig::allEmpty() == false && in_array($element, $nonempty) && empty($value)) {
         return JText::sprintf('Setting "%s" is empty - Please configure it below', JText::_($element));
     }
     // Check host
     if ($element == 'host') {
         if (preg_match('/([^a-zA-Z0-9\\.\\-\\_\\:]+)/', $value) == true) {
             return JText::_('Hostname contains illegal characters. Note that a hostname is not an URL, but only a fully qualified domainname.');
         } else {
             if (gethostbyname($value) == $value && !preg_match('/([0-9\\.]+)/', $value)) {
                 return JText::sprintf('DNS lookup of hostname %s failed', $value);
             } else {
                 if (MagebridgeModelConfig::load('api_widgets') == true) {
                     $bridge = MageBridgeModelBridge::getInstance();
                     $data = $bridge->build();
                     if (empty($data)) {
                         $url = $bridge->getMagentoBridgeUrl();
                         return JText::sprintf('Unable to open a connection to <a href="%s" target="_new">%s</a>', $url, $url);
                     }
                 }
             }
         }
     }
     // Check supportkey
     if ($element == 'supportkey' && empty($value)) {
         return JText::sprintf('Please configure your support-key. Your support-key can be obtained from %s', MageBridgeHelper::getHelpText('subscriptions'));
     }
     // Check API widgets
     if ($element == 'api_widgets' && $value != 1) {
         return JText::_('API widgets are disabled');
     }
     // Check offline
     if ($element == 'offline' && $value == 1) {
         return JText::_('Bridge is disabled through settings');
     }
     // Check website
     if ($element == 'website' && !empty($value)) {
         if (is_numeric($value) == false) {
             return JText::sprintf('Website ID needs to be a numeric value. Current value is "%s"', $value);
         }
     }
     /**
     if ($element == 'storeview' && !empty($value)) {
     	if ( preg_match( '/([a-zA-Z0-9\.\-\_]+)/', $value ) == false ) {
     		return JText::_( 'Store-name contains illegal characters: '.$value );
     	} else {
     		$storeviews = MagebridgeModelConfig::getStoreNames();
     		if (!is_array($storeviews) && $storeviews != 0) {
     			return JText::_($storeviews);
     
     		} else {
     
     			$match = false;
     			if (!empty($storeviews)) {
     				foreach ($storeviews as $storeview) {
     					if ($storeview['value'] == $value) {
     						$match = true;
     						break;
     					}
     				}
     			}
     
     			if ($match == false) {
     				$msg = JText::sprintf( 'Store-names detected, but "%s" is not one of them', $value );
     				return $msg;
     			}
     		}
     	}
     }
     */
     // Check basedir
     if ($element == 'basedir') {
         if (empty($value)) {
             return null;
         }
         if (preg_match('/([a-zA-Z0-9\\.\\-\\_]+)/', $value) == false) {
             return JText::_('Basedir contains illegal characters');
         }
         $root = MageBridgeUrlHelper::getRootItem();
         $joomla_host = JFactory::getURI()->toString(array('host'));
         $magento_host = MagebridgeModelConfig::load('host');
         // Check whether the Magento basedir conflicts with the MageBridge alias
         if (!empty($root) && !empty($root->route) && $root->route == $value && $joomla_host == $magento_host) {
             return JText::_('Magento basedir is same as MageBridge alias, which is not possible');
         }
     }
//.........这里部分代码省略.........
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:101,代码来源:config.php


注:本文中的MagebridgeModelConfig::allEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。