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


PHP Tool::classExists方法代码示例

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


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

示例1: createClassMappings

 /**
  * @static
  * @return array
  */
 public static function createClassMappings()
 {
     $modelsDir = PIMCORE_PATH . "/models/";
     $files = rscandir($modelsDir);
     $includePatterns = array("/Webservice\\/Data/");
     foreach ($files as $file) {
         if (is_file($file)) {
             $file = str_replace($modelsDir, "", $file);
             $file = str_replace(".php", "", $file);
             $class = str_replace(DIRECTORY_SEPARATOR, "_", $file);
             if (\Pimcore\Tool::classExists($class)) {
                 $match = false;
                 foreach ($includePatterns as $pattern) {
                     if (preg_match($pattern, $file)) {
                         $match = true;
                         break;
                     }
                 }
                 if (strpos($file, "Webservice" . DIRECTORY_SEPARATOR . "Data") !== false) {
                     $match = true;
                 }
                 if (!$match) {
                     continue;
                 }
                 $classMap[str_replace("\\Pimcore\\Model\\Webservice\\Data\\", "", $class)] = $class;
             }
         }
     }
     return $classMap;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:34,代码来源:Tool.php

示例2: map

 /**
  * @param $object
  * @param $apiclass
  * @param $type
  * @param null $options
  * @return array|string
  * @throws \Exception
  */
 public static function map($object, $apiclass, $type, $options = null)
 {
     if ($object instanceof \Zend_Date) {
         $object = $object->toString();
     } else {
         if (is_object($object)) {
             if (Tool::classExists($apiclass)) {
                 $new = new $apiclass();
                 if (method_exists($new, "map")) {
                     $new->map($object, $options);
                     $object = $new;
                 }
             } else {
                 throw new \Exception("Webservice\\Data\\Mapper: Cannot map [ {$apiclass} ] - class does not exist");
             }
         } else {
             if (is_array($object)) {
                 $tmpArray = array();
                 foreach ($object as $v) {
                     $className = self::findWebserviceClass($v, $type);
                     $tmpArray[] = self::map($v, $className, $type);
                 }
                 $object = $tmpArray;
             }
         }
     }
     return $object;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:36,代码来源:Mapper.php

示例3: getInstance

 /**
  * @param null $adapter
  * @return null|Adapter\GD|Adapter\Imagick
  * @throws \Exception
  */
 public static function getInstance($adapter = null)
 {
     // use the default adapter if set manually (!= null) and no specify adapter is given
     if (!$adapter && self::$defaultAdapter) {
         $adapter = self::$defaultAdapter;
     }
     try {
         if ($adapter) {
             $adapterClass = "\\Pimcore\\Image\\Adapter\\" . $adapter;
             if (Tool::classExists($adapterClass)) {
                 return new $adapterClass();
             } else {
                 if (Tool::classExists($adapter)) {
                     return new $adapter();
                 } else {
                     throw new \Exception("Image-transform adapter `" . $adapter . "´ does not exist.");
                 }
             }
         } else {
             if (extension_loaded("imagick")) {
                 return new Adapter\Imagick();
             } else {
                 return new Adapter\GD();
             }
         }
     } catch (\Exception $e) {
         \Logger::crit("Unable to load image extensions: " . $e->getMessage());
         throw $e;
     }
     return null;
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:36,代码来源:Image.php

示例4: determineResourceClass

 /**
  * determineResourceClass
  *
  * @param $className
  */
 protected function determineResourceClass($className)
 {
     if (Tool::classExists($className)) {
         return $className;
     }
     return parent::determineResourceClass($className);
 }
开发者ID:Cube-Solutions,项目名称:pimcore-migrations,代码行数:12,代码来源:Migration.php

示例5: checkConfig

 /**
  * checks configuration and if specified classes exist
  *
  * @param $config
  * @throws OnlineShop_Framework_Exception_InvalidConfigException
  */
 protected function checkConfig($config)
 {
     $tempCart = null;
     if (empty($config->cart->class)) {
         throw new OnlineShop_Framework_Exception_InvalidConfigException("No Cart class defined.");
     } else {
         if (Tool::classExists($config->cart->class)) {
             $tempCart = new $config->cart->class($config->cart);
             if (!$tempCart instanceof OnlineShop_Framework_ICart) {
                 throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->cart->class . " does not implement OnlineShop_Framework_ICart.");
             }
         } else {
             throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->cart->class . " not found.");
         }
     }
     if (empty($config->pricecalculator->class)) {
         throw new OnlineShop_Framework_Exception_InvalidConfigException("No pricecalculator class defined.");
     } else {
         if (Tool::classExists($config->pricecalculator->class)) {
             $tempCalc = new $config->pricecalculator->class($config->pricecalculator->config, $tempCart);
             if (!$tempCalc instanceof OnlineShop_Framework_ICartPriceCalculator) {
                 throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->pricecalculator->class . " does not implement OnlineShop_Framework_ICartPriceCalculator.");
             }
         } else {
             throw new OnlineShop_Framework_Exception_InvalidConfigException("pricecalculator class " . $config->pricecalculator->class . " not found.");
         }
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:34,代码来源:MultiCartManager.php

示例6: registerModule

 /**
  * @param $module
  * @throws \Exception
  */
 public function registerModule($module)
 {
     if (Tool::classExists($module)) {
         $moduleInstance = new $module();
         $moduleInstance->init();
         $this->_systemModules[] = $moduleInstance;
     } else {
         throw new \Exception("unknown module [ {$module} ].");
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:14,代码来源:Broker.php

示例7: getDataFromEditmode

 public static function getDataFromEditmode($data, $pimcoreTagName)
 {
     $tagClass = '\\Pimcore\\Model\\Object\\ClassDefinition\\Data\\' . ucfirst($pimcoreTagName);
     if (\Pimcore\Tool::classExists($tagClass)) {
         /**
          * @var \Pimcore\Model\Object\ClassDefinition\Data $tag
          */
         $tag = new $tagClass();
         return $tag->getDataFromEditmode($data);
     }
     //purposely return null if there is no valid class, log a warning
     Logger::warning("No valid pimcore tag found for fieldType ({$pimcoreTagName}), check 'fieldType' exists, and 'type' is not being used in config");
     return null;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:14,代码来源:Service.php

示例8: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         if (\Pimcore\Tool::classExists("\\Elements\\Logging\\Log")) {
             $logger = new \Elements\Logging\Log();
             $logger->addWriter(new \Elements\Logging\Writer\LogWriterDb(\Zend_Log::DEBUG));
             $logger->addWriter(new \Zend_Log_Writer_Stream(PIMCORE_WEBSITE_PATH . "/var/log/trustedshop.log"));
             $systemConfig = \Pimcore\Config::getSystemConfig();
             $debugAddresses = explode(',', $systemConfig->email->debug->emailaddresses);
             $logger->addWriter(new \Elements\Logging\Writer\LogWriterMail($debugAddresses, "TrustedShop-Importer", "", \Zend_Log::ERR));
             self::$instance = $logger;
         }
     }
     return self::$instance;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:15,代码来源:Logging.php

示例9: getOfferedServices

 /**
 * @return \Pimcore\Model\Object\Objectbrick
 */
 public function getOfferedServices()
 {
     $data = $this->offeredServices;
     if (!$data) {
         if (\Pimcore\Tool::classExists("\\Pimcore\\Model\\Object\\Subscriptions\\OfferedServices")) {
             $data = new \Pimcore\Model\Object\Subscriptions\OfferedServices($this, "offeredServices");
             $this->offeredServices = $data;
         } else {
             return null;
         }
     }
     $preValue = $this->preGetValue("offeredServices");
     if ($preValue !== null && !\Pimcore::inAdmin()) {
         return $preValue;
     }
     return $data;
 }
开发者ID:cometCube,项目名称:nyt,代码行数:20,代码来源:Subscriptions.php

示例10: getExtraInformation

 /**
 * @return \Pimcore\Model\Object\Objectbrick
 */
 public function getExtraInformation()
 {
     $data = $this->extraInformation;
     if (!$data) {
         if (\Pimcore\Tool::classExists("\\Pimcore\\Model\\Object\\CoreShopCartItem\\ExtraInformation")) {
             $data = new \Pimcore\Model\Object\CoreShopCartItem\ExtraInformation($this, "extraInformation");
             $this->extraInformation = $data;
         } else {
             return null;
         }
     }
     $preValue = $this->preGetValue("extraInformation");
     if ($preValue !== null && !\Pimcore::inAdmin()) {
         return $preValue;
     }
     return $data;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:20,代码来源:CoreShopCartItem.php

示例11: getProvidersAction

 public function getProvidersAction()
 {
     $gateways = \Omnipay\Tool::getSupportedGateways();
     $available = [];
     $activeProviders = Model\Configuration::get("OMNIPAY.ACTIVEPROVIDERS");
     if (!is_array($activeProviders)) {
         $activeProviders = [];
     }
     foreach ($gateways as $gateway) {
         $class = \Omnipay\Common\Helper::getGatewayClassName($gateway);
         if (\Pimcore\Tool::classExists($class)) {
             if (!in_array($gateway, $activeProviders)) {
                 $available[] = ["name" => $gateway];
             }
         }
     }
     $this->_helper->json(array("data" => $available));
 }
开发者ID:coreshop,项目名称:omnipay,代码行数:18,代码来源:AdminController.php

示例12: getDefaultAdapter

 /**
  * @return bool
  */
 public static function getDefaultAdapter()
 {
     $adapters = array("LibreOffice", "Ghostscript");
     foreach ($adapters as $adapter) {
         $adapterClass = "\\Pimcore\\Document\\Adapter\\" . $adapter;
         if (Tool::classExists($adapterClass)) {
             try {
                 $adapter = new $adapterClass();
                 if ($adapter->isAvailable()) {
                     return $adapter;
                 }
             } catch (\Exception $e) {
                 \Logger::warning($e);
             }
         }
     }
     return null;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:21,代码来源:Document.php

示例13: getDefaultAdapter

 /**
  * @return bool
  */
 public static function getDefaultAdapter()
 {
     $adapters = ["Ffmpeg"];
     foreach ($adapters as $adapter) {
         $adapterClass = "\\Pimcore\\Video\\Adapter\\" . $adapter;
         if (Tool::classExists($adapterClass)) {
             try {
                 $adapter = new $adapterClass();
                 if ($adapter->isAvailable()) {
                     return $adapter;
                 }
             } catch (\Exception $e) {
                 Logger::warning($e);
             }
         }
     }
     return null;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:21,代码来源:Video.php

示例14: factory

 /**
  * @param $type
  * @param $name
  * @param $documentId
  * @param null $config
  * @param null $controller
  * @param null $view
  * @param null $editmode
  * @return mixed
  */
 public static function factory($type, $name, $documentId, $config = null, $controller = null, $view = null, $editmode = null)
 {
     $tagClass = "\\Pimcore\\Model\\Document\\Tag\\" . ucfirst($type);
     // this is the fallback for custom document tags using prefixes
     // so we need to check if the class exists first
     if (!\Pimcore\Tool::classExists($tagClass)) {
         $oldStyleClass = "\\Document_Tag_" . ucfirst($type);
         if (\Pimcore\Tool::classExists($oldStyleClass)) {
             $tagClass = $oldStyleClass;
         }
     }
     $tag = new $tagClass();
     $tag->setName($name);
     $tag->setDocumentId($documentId);
     $tag->setController($controller);
     $tag->setView($view);
     $tag->setEditmode($editmode);
     $tag->setOptions($config);
     return $tag;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:30,代码来源:Tag.php

示例15: getElements

 /**
  * Get all elements containing the content (tags) from the database
  *
  * @return void
  */
 public function getElements()
 {
     $elementsRaw = $this->db->fetchAll("SELECT * FROM documents_elements WHERE documentId = ?", $this->model->getId());
     $elements = array();
     foreach ($elementsRaw as $elementRaw) {
         $class = "\\Pimcore\\Model\\Document\\Tag\\" . ucfirst($elementRaw["type"]);
         // this is the fallback for custom document tags using prefixes
         // so we need to check if the class exists first
         if (!\Pimcore\Tool::classExists($class)) {
             $oldStyleClass = "\\Document_Tag_" . ucfirst($elementRaw["type"]);
             if (\Pimcore\Tool::classExists($oldStyleClass)) {
                 $class = $oldStyleClass;
             }
         }
         $element = new $class();
         $element->setName($elementRaw["name"]);
         $element->setDocumentId($this->model->getId());
         $element->setDataFromResource($elementRaw["data"]);
         $elements[$elementRaw["name"]] = $element;
         $this->model->setElement($elementRaw["name"], $element);
     }
     return $elements;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:28,代码来源:Dao.php


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