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


PHP Shineisp_Commons_Utilities类代码示例

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


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

示例1: init

 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'creationdate', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Date'), 'title' => $translate->_('eg: 01/11/2010'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'expiringdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'title' => $translate->_('eg: 01/11/2011'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment Date'), 'title' => $translate->_('eg: 01/11/2010'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('select', 'category_id', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setMultiOptions(PurchaseCategories::getList());
     $this->addElement('select', 'method_id', array('label' => $translate->_('Payment Method'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('method_id')->setAllowEmpty(false)->setMultiOptions(PaymentsMethods::getList());
     $this->addElement('text', 'number', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Number'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'company', array('filters' => array('StringTrim'), 'label' => $translate->_('Company'), 'required' => true, 'title' => $translate->_('eg: Google inc.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'total_net', array('filters' => array('StringTrim'), 'label' => $translate->_('Total Net'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'total_vat', array('filters' => array('StringTrim'), 'label' => $translate->_('Total VAT'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'total', array('filters' => array('StringTrim'), 'label' => $translate->_('Total'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Note'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $file = $this->createElement('file', 'document', array('label' => $translate->_('Document'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         $file->addValidator('Extension', false, $filetypes)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $file->setValueDisabled(true);
         $file->setRequired(false);
         $this->addElement($file);
     }
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
     $this->addElement('hidden', 'purchase_id');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:33,代码来源:PurchasesForm.php

示例2: saveConfig

 /**
 * Save the setup data
 * @param array $dbconfig
 * @param array $preferences
 * 
 * <?xml version="1.0" encoding="UTF-8"?>
 		<shineisp>
 			<config>
 				<database>
 					<hostname>localhost</hostname>
 					<db>shineisp</db>
 					<username>shineisp</username>
 					<password>shineisp2013</password>
 				</database>
 			</config>
 		</shineisp>
 */
 public static function saveConfig($dbconfig, $version = null)
 {
     try {
         $xml = new SimpleXMLElement('<shineisp></shineisp>');
         if (!empty($version)) {
             $xml->addAttribute('version', $version);
         }
         $xml->addAttribute('setupdate', date('Ymdhis'));
         $config = $xml->addChild('config');
         // Database Configuration
         $database = $config->addChild('database');
         $database->addChild('hostname', $dbconfig->hostname);
         $database->addChild('username', $dbconfig->username);
         $database->addChild('password', $dbconfig->password);
         $database->addChild('database', $dbconfig->database);
         // Get the xml string
         $xmlstring = $xml->asXML();
         // Prettify and save the xml configuration
         $dom = new DOMDocument();
         $dom->loadXML($xmlstring);
         $dom->formatOutput = true;
         $dom->saveXML();
         // Save the config xml file
         if (@$dom->save(APPLICATION_PATH . "/configs/config.xml")) {
             Shineisp_Commons_Utilities::log("Update ShineISP config xml file");
             return true;
         } else {
             throw new Exception("Error on saving the xml file in " . APPLICATION_PATH . "/configs/config.xml <br/>Please check the folder permissions");
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:51,代码来源:Settings.php

示例3: checkFields

 protected function checkFields()
 {
     parent::checkFields();
     if ($this->amount == NULL) {
         throw new IgfsMissingParException("Missing amount");
     }
     if ($this->refTranID == NULL) {
         if ($this->pan == NULL) {
             if ($this->payInstrToken == NULL) {
                 Shineisp_Commons_Utilities::logs("---> Missing refTranID", 'bnl_igfs.log');
             }
         }
     }
     return false;
     if ($this->pan != NULL) {
         // Se è stato impostato il pan verifico...
         if ($this->pan == "") {
             Shineisp_Commons_Utilities::logs("---> Missing pan", 'bnl_igfs.log');
         }
         return false;
     }
     if ($this->payInstrToken != NULL) {
         // Se è stato impostato il payInstrToken verifico...
         if ($this->payInstrToken == "") {
             Shineisp_Commons_Utilities::logs("---> Missing payInstrToken", 'bnl_igfs.log');
         }
         return false;
     }
     if ($this->pan != NULL or $this->payInstrToken != NULL) {
         if ($this->currencyCode == NULL) {
             Shineisp_Commons_Utilities::logs("---> Missing currencyCode", 'bnl_igfs.log');
         }
         return false;
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:35,代码来源:CgCredit.php

示例4: init

 public function init()
 {
     $NS = new Zend_Session_Namespace('Default');
     $translate = Shineisp_Registry::get('Zend_Translate');
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'domain_id', array('decorators' => array('Bootstrap'), 'required' => false, 'label' => $translate->_('Domain'), 'description' => $translate->_('Choose the domain name reference'), 'class' => 'form-control large-input'));
     $this->getElement('domain_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList(true, $NS->customer['customer_id']));
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'title' => $translate->_('Write here a subject of the issue.'), 'label' => $translate->_('Subject'), 'description' => $translate->_('Write here the domain name or a simple description of the problem.'), 'class' => 'form-control large-input'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Body Message'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here all the information.'), 'rows' => '8', 'class' => 'form-control wysiwyg-simple'));
     $this->addElement('select', 'status', array('filters' => array('StringTrim'), 'label' => $translate->_('Set the issue status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'multioptions' => array('' => '', Statuses::id("solved", "tickets") => $translate->_('Solved'), Statuses::id("closed", "tickets") => $translate->_('Closed'))));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'description' => 'Select a category.', 'class' => 'form-control large-input'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList(true));
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('useruploadlimit');
         $Types = Settings::findbyParam('useruploadfiletypes');
         if (empty($MBlimit)) {
             $MBlimit = 1;
         }
         if (empty($Types)) {
             $Types = "zip,jpg";
         }
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit))));
         $file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     } else {
         $this->addElement('hidden', 'attachments');
     }
     $this->addElement('submit', 'submit', array('label' => $translate->_('Send help request'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
     $this->addElement('hidden', 'ticket_id');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:32,代码来源:TicketsForm.php

示例5: callbackAction

 /**
  * callbackAction
  * This method isn't called from the project 
  * but it is called from a bank gateway service 
  * in order to set as payed the order processed
  *	 
  * IMPORTANT:
  * This method was within the /default/orders controller and it has been moved here
  * because the access to the /default/orders is denied without an authentication process
  * /default/common controller is accessible without login process.
  */
 public function callbackAction()
 {
     $request = $this->getRequest();
     $response = $request->getParams();
     if (!empty($response['custom']) && is_numeric(trim($response['custom']))) {
         // Getting the md5 value in order to match with the class name.
         $classrequest = $request->gateway;
         // Orderid back from the bank
         $order_id = trim($response['custom']);
         // Get the bank selected using the MD5 code
         $bank = Banks::findbyMD5($classrequest);
         if (!empty($bank[0]['classname'])) {
             if (!empty($bank[0]['classname']) && class_exists($bank[0]['classname'])) {
                 $class = $bank[0]['classname'];
                 $payment = new $class($response['custom']);
                 // Check if the method "Response" exists in the Payment class and send all the bank information to the payment module
                 if (method_exists($class, "Response")) {
                     Shineisp_Commons_Utilities::logs("Callback called: {$class}\nParameters: " . json_encode($response), "payments.log");
                     $payment->Callback($response);
                 }
             }
         }
     }
     die;
 }
开发者ID:moay,项目名称:shineisp,代码行数:36,代码来源:CommonController.php

示例6: preStmtExecute

 public function preStmtExecute(Doctrine_Event $event)
 {
     // Check if the administrator has enabled the query logging feature
     if (Settings::findbyParam('debug_queries')) {
         $breadcrumps = array();
         $query = $event->getQuery();
         $params = $event->getParams();
         $callers = array_reverse(debug_backtrace(), true);
         $callers = array_slice($callers, 4, count($callers) - 10);
         foreach ($callers as $caller) {
             $class = !empty($caller['class']) ? $caller['class'] : null;
             $breadcrumps[] = $class . "->" . $caller['function'];
         }
         $strBreadcrump = "System: " . implode(" / ", $breadcrumps);
         //the below makes some naive assumptions about the queries being logged
         while (sizeof($params) > 0) {
             $param = array_shift($params);
             if (!is_numeric($param)) {
                 $param = sprintf("'%s'", $param);
             }
             $query = substr_replace($query, $param, strpos($query, '?'), 1);
         }
         Shineisp_Commons_Utilities::log($query, "queries.log");
         Shineisp_Commons_Utilities::log($strBreadcrump, "debug.log", Zend_Log::DEBUG);
         // Increase query counter
         $queryCount = Shineisp_Registry::isRegistered('querycount') ? Shineisp_Registry::get('querycount') : 0;
         $queryCount = $queryCount + 1;
         Shineisp_Registry::set('querycount', $queryCount);
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:30,代码来源:QueriesLogger.php

示例7: eu_check

 private function eu_check()
 {
     $isp = Shineisp_Registry::get('ISP');
     $VIES = new SoapClient($this->vies_soap_url);
     if ($VIES) {
         try {
             $r = $VIES->checkVat(array('countryCode' => $this->countryCode, 'vatNumber' => $this->vat));
             foreach ($r as $chiave => $valore) {
                 $this->viesOutput[$chiave] = $valore;
             }
             return $r->valid;
         } catch (SoapFault $e) {
             $ret = $e->faultstring;
             $regex = '/\\{ \'([A-Z_]*)\' \\}/';
             $n = preg_match($regex, $ret, $matches);
             $ret = !empty($matches[1]) ? $matches[1] : $ret;
             $faults = array('INVALID_INPUT' => 'The provided CountryCode is invalid or the VAT number is empty', 'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later', 'MS_UNAVAILABLE' => 'The Member State service is unavailable, try again later or with another Member State', 'TIMEOUT' => 'The Member State service could not be reached in time, try again later or with another Member State', 'SERVER_BUSY' => 'The service cannot process your request. Try again later.');
             $ret = $faults[$ret];
             // adding a log message
             Shineisp_Commons_Utilities::log("Response from VIES: " . $ret);
             $subject = 'Invalid VAT code';
             $body = "Response from VIES: " . $ret;
             Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
             return false;
         }
     } else {
         $subject = 'Connect to VIES';
         $body = "Impossible to connect with VIES";
         Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
         // adding a log message
         Shineisp_Commons_Utilities::log("Response from VIES: " . $ret);
         return false;
     }
     return true;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:35,代码来源:Vat.php

示例8: showblock

 /**
  * showblock
  * Handle the XML Blocks 
  * @param unknown_type $side
  */
 public function showblock($side)
 {
     $ns = new Zend_Session_Namespace('Admin');
     $languageID = Languages::get_language_id($ns->lang);
     $record = array();
     $blocks = array();
     // Get the main variables
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $customskin = Settings::findbyParam('adminskin');
     $skin = !empty($customskin) ? $customskin : "base";
     // call the placeholder view helper for each side parsed
     echo $this->view->placeholder($side);
     // Get all the xml blocks
     $xmlblocks = Shineisp_Commons_Layout::getBlocks($module, $side, $controller, $skin);
     if (!empty($xmlblocks)) {
         $blocks['reference'] = $xmlblocks;
     }
     if (!empty($blocks['reference'])) {
         $blocks['reference'] = Shineisp_Commons_Utilities::columnSort($blocks['reference'], 'position');
     }
     if (isset($blocks['reference']['block'])) {
         $this->Iterator($blocks['reference'], $side);
     } elseif (isset($blocks['reference'][0])) {
         foreach ($blocks['reference'] as $block) {
             $this->Iterator($block, $side);
         }
     }
     $this->view->module = $module;
     $this->view->controller = $controller;
     $this->view->action = $action;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:38,代码来源:Blocks.php

示例9: errorAction

 public function errorAction()
 {
     $errors = $this->_getParam('error_handler');
     $mex = $this->_getParam('mex');
     // Ajax controll
     if (Shineisp_Commons_Utilities::isAjax()) {
         echo json_encode($errors->exception->getMessage());
         die;
     }
     switch ($errors->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             // 404 error -- controller or action not found
             $this->getResponse()->setHttpResponseCode(404);
             $this->view->message = 'Controller has been not found';
             break;
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setHttpResponseCode(404);
             $this->view->message = 'Action has been not found';
             break;
         default:
             // application error
             $this->getResponse()->setHttpResponseCode(500);
             $this->view->message = $errors->exception->getMessage();
             break;
     }
     if (!empty($mex)) {
         $this->view->message .= "<br/><b>{$mex}</b>";
     }
     // Save the error message in the log file errors.log
     $errormessage = $errors->type . ": " . $errors->exception->getMessage();
     Shineisp_Commons_Utilities::log($errormessage);
     $this->view->exception = $errors->exception;
     $this->view->request = $errors->request;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:35,代码来源:ErrorController.php

示例10: init

 public function init()
 {
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'locale', array('decorators' => array('Bootstrap'), 'label' => 'Language', 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles(PUBLIC_PATH . "/languages")));
     $this->addElement('textarea', 'agreement', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'label' => 'Agreements', 'rows' => '10', 'value' => Shineisp_Commons_Utilities::readfile(PUBLIC_PATH . "/../LICENSE")));
     $this->addElement('select', 'chkagreement', array('decorators' => array('Bootstrap'), 'label' => 'I agree with the legal terms', 'class' => 'form-control', 'multioptions' => array(1 => 'YES, I agree with the legal terms', 0 => 'NO, I disagree with these legal terms')));
     $this->addElement('submit', 'submit', array('label' => 'Continue', 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:8,代码来源:LocalizationForm.php

示例11: checkFields

 protected function checkFields()
 {
     parent::checkFields();
     if ($this->shopID == NULL || "" == $this->shopID) {
         Shineisp_Commons_Utilities::logs("---> Missing shopID", 'bnl_igfs.log');
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:8,代码来源:BaseIgfsCgTran.php

示例12: gravatar

 public function gravatar($email, $width = 60)
 {
     if (!is_numeric($width)) {
         $width = 60;
     }
     if (Shineisp_Commons_Utilities::isEmail($email)) {
         return Shineisp_Commons_Gravatar::get_gravatar($email, $width);
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:10,代码来源:Gravatar.php

示例13: checkFields

 protected function checkFields()
 {
     parent::checkFields();
     if ($this->amount == NULL) {
         Shineisp_Commons_Utilities::logs("---> Missing amount", 'bnl_igfs.log');
     }
     return false;
     if ($this->refTranID == NULL) {
         Shineisp_Commons_Utilities::logs("---> Missing refTranID", 'bnl_igfs.log');
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:12,代码来源:CgVoidAuth.php

示例14: indexAction

 /**
  * Load all the resources
  * @see Zend_Controller_Action::preDispatch()
  */
 public function indexAction()
 {
     $session = new Zend_Session_Namespace('setup');
     $session->permissions = false;
     $dirs = array();
     $errors = array();
     $applicationfolder = true;
     $publicfolder = true;
     $dirs[] = PUBLIC_PATH;
     $dirs[] = PUBLIC_PATH . "/media/";
     $dirs[] = PUBLIC_PATH . "/documents/";
     $dirs[] = PUBLIC_PATH . "/logs/";
     $dirs[] = PUBLIC_PATH . "/imports/";
     $dirs[] = PUBLIC_PATH . "/tmp/";
     $dirs[] = PUBLIC_PATH . "/cache/";
     $dirs[] = APPLICATION_PATH . "/configs/";
     $dirs[] = APPLICATION_PATH . "/configs/data/";
     $dirs[] = APPLICATION_PATH . "/configs/data/sql/";
     // create all the directories
     foreach ($dirs as $dir) {
         if (!is_dir($dir)) {
             if (!@mkdir($dir)) {
                 $errors[] = $dir;
             }
         } else {
             if (!Shineisp_Commons_Utilities::isWritable($dir)) {
                 $errors[] = $dir;
             }
         }
     }
     // check the public directory
     if (Shineisp_Commons_Utilities::isWritable(PUBLIC_PATH)) {
         $this->view->public_folder = true;
     } else {
         $this->view->public_folder = false;
         $publicfolder = false;
     }
     // check the application config data directory
     if (Shineisp_Commons_Utilities::isWritable(APPLICATION_PATH . "/configs/data/")) {
         $this->view->application_folder = true;
     } else {
         $this->view->application_folder = false;
         $applicationfolder = false;
     }
     $this->view->errors = $errors;
     if ($publicfolder & $applicationfolder && count($errors) == 0) {
         $session->permissions = true;
         $this->_helper->redirector('index', 'localization', 'setup');
     } else {
         return $this->_helper->viewRenderer('index');
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:56,代码来源:CheckerController.php

示例15: googleproductsAction

 /**
  * Export the products by the Google Product Atom Export
  * @author Shine Software
  * @return xml 
  */
 public function googleproductsAction()
 {
     // Calling Google Product Extension
     Zend_Feed_Writer::addPrefixPath('Shineisp_Feed_Writer_Extension_', 'Shineisp/Feed/Writer/Extension/');
     Zend_Feed_Writer::registerExtension('Google');
     $isp = Shineisp_Registry::get('ISP');
     $feed = new Zend_Feed_Writer_Feed();
     $feed->setTitle($isp->company);
     $feed->setLink($isp->website);
     $feed->setFeedLink($isp->website . '/atom/products', 'atom');
     $feed->addAuthor(array('name' => $isp->manager, 'email' => $isp->email, 'uri' => $isp->website));
     $feed->setDateModified(time());
     $feed->setGenerator("ShineISP Atom Extension");
     $products = Products::getAllRss();
     // 		print_r($products);
     // 		die;
     foreach ($products as $product) {
         // Get the google categories
         $categories = ProductsCategories::getGoogleCategories($product['categories']);
         $cattype = Products::get_text_categories($product['categories']);
         // Create the product entries
         $entry = $feed->createEntry();
         $entry->setTitle($product['ProductsData'][0]['name']);
         $entry->setProductType(Products::get_text_categories($product['categories']));
         $entry->setBrand($isp->company);
         $entry->setAvailability(true);
         $entry->setLink($isp->website . "/" . $product['uri'] . ".html");
         // Custom Attributes Google Product Extension
         if (!empty($product['ProductsMedia'][0]['path'])) {
             $entry->setImageLink($isp->website . str_replace(" ", "%20", $product['ProductsMedia'][0]['path']));
         }
         if (!empty($product['uri'])) {
             $entry->setProductId($product['uri']);
         }
         if (!empty($categories[0]['googlecategs'])) {
             $entry->setCategory($categories[0]['googlecategs']);
         }
         $price = Products::getPriceSuggested($product['product_id'], true);
         $entry->setPrice($price);
         $entry->setCondition('new');
         $entry->setDateModified(time());
         $entry->setDescription(strip_tags($product['ProductsData'][0]['shortdescription']));
         $feed->addEntry($entry);
     }
     $feed = $feed->export('atom');
     // Feed Fixing for google products
     $feed = $this->googlefixes($feed);
     Shineisp_Commons_Utilities::writefile($feed, "documents", "googleproducts.xml");
     die($feed);
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:55,代码来源:AtomController.php


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