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


PHP VmConfig::ensureMemoryLimit方法代码示例

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


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

示例1: Img2Thumb

 /**
 *   Constructor - requires following vars:
 *
 *	@param string $filename			image path
 *
 *	These are additional vars:
 *
 *	@param int $newxsize			new maximum image width
 *	@param int $newysize			new maximum image height
 *	@param string $fileout			output image path
 *	@param int $thumbMaxSize		whether thumbnail should have background fill to make it exactly $newxsize x $newysize
 *	@param int $bgred				0-255 - red color variable for background filler
 *	@param int $bggreen				0-255 - green color variable for background filler
 *	@param int $bgblue				0-255 - blue color variable for background filler
 *
 */
 function Img2Thumb($filename, $newxsize = 60, $newysize = 60, $fileout = '', $thumbMaxSize = 0, $bgred = 0, $bggreen = 0, $bgblue = 0)
 {
     //Some big pictures need that
     VmConfig::ensureMemoryLimit(128);
     //	New modification - checks color int to be sure within range
     if ($thumbMaxSize) {
         $this->maxSize = true;
     } else {
         $this->maxSize = false;
     }
     if ($bgred >= 0 || $bgred <= 255) {
         $this->bg_red = $bgred;
     } else {
         $this->bg_red = 0;
     }
     if ($bggreen >= 0 || $bggreen <= 255) {
         $this->bg_green = $bggreen;
     } else {
         $this->bg_green = 0;
     }
     if ($bgblue >= 0 || $bgblue <= 255) {
         $this->bg_blue = $bgblue;
     } else {
         $this->bg_blue = 0;
     }
     $this->NewImgCreate($filename, $newxsize, $newysize, $fileout);
 }
开发者ID:juanmcortez,项目名称:Lectorum,代码行数:43,代码来源:img2thumb.php

示例2: __construct

	public function __construct(){

// 		JTable::addIncludePath(VMPATH_ADMIN . DS . 'tables');

		$this->_app = JFactory::getApplication();
		$this->_db = JFactory::getDBO();
		// 		$this->_oldToNew = new stdClass();
		$this->starttime = microtime(true);

		$max_execution_time = VmConfig::getExecutionTime();
		$jrmax_execution_time= vRequest::getInt('max_execution_time',300);

		if(!empty($jrmax_execution_time)){
			// 			vmdebug('$jrmax_execution_time',$jrmax_execution_time);
			if($max_execution_time!==$jrmax_execution_time) @ini_set( 'max_execution_time', $jrmax_execution_time );
		}

		$this->maxScriptTime = VmConfig::getExecutionTime() * 0.90-1;	//Lets use 10% of the execution time as reserve to store the progress

		VmConfig::ensureMemoryLimit(128);

		$this->maxMemoryLimit = $this->return_bytes(ini_get('memory_limit')) * 0.85;

		$config = JFactory::getConfig();
		$this->_prefix = $config->get('dbprefix');

		$this->reCreaPri = VmConfig::get('reCreaPri',0);
		$this->reCreaKey = VmConfig::get('reCreaKey',1);
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:29,代码来源:tableupdater.php

示例3: __construct

	public function __construct(){

// 		JTable::addIncludePath(VMPATH_ADMIN . DS . 'tables');

		$this->_app = JFactory::getApplication();
		$this->_db = JFactory::getDBO();
		$this->_oldToNew = new stdClass();
		$this->starttime = microtime(true);

		$max_execution_time = VmConfig::getExecutionTime();
		$jrmax_execution_time= vRequest::getInt('max_execution_time');

		if(!empty($jrmax_execution_time)){
			// 			vmdebug('$jrmax_execution_time',$jrmax_execution_time);
			if($max_execution_time!=$jrmax_execution_time) @ini_set( 'max_execution_time', $jrmax_execution_time );
		} else if($max_execution_time<60) {
			@ini_set( 'max_execution_time', 60 );
		}

		$this->maxScriptTime = VmConfig::getExecutionTime()*0.80-1;	//Lets use 30% of the execution time as reserve to store the progress

		$jrmemory_limit= vRequest::getInt('memory_limit');
		if(!empty($jrmemory_limit)){
			@ini_set( 'memory_limit', $jrmemory_limit.'M' );
		} else {
			VmConfig::ensureMemoryLimit(128);
		}

		$this->maxMemoryLimit = $this->return_bytes(ini_get('memory_limit')) - (14 * 1024 * 1024)  ;		//Lets use 11MB for joomla
		// 		vmdebug('$this->maxMemoryLimit',$this->maxMemoryLimit); //134217728
		//$this->maxMemoryLimit = $this -> return_bytes('20M');

		// 		ini_set('memory_limit','35M');
		$q = 'SELECT `id` FROM `#__virtuemart_migration_oldtonew_ids` ';
		$this->_db->setQuery($q);
		$res = $this->_db->loadResult();
		if(empty($res)){
			$q = 'INSERT INTO `#__virtuemart_migration_oldtonew_ids` (`id`) VALUES ("1")';
			$this->_db->setQuery($q);
			$this->_db->execute();
			$this->_app->enqueueMessage('Start with a new migration process and setup log maxScriptTime '.$this->maxScriptTime.' maxMemoryLimit '.$this->maxMemoryLimit/(1024*1024));
		} else {
			$this->_app->enqueueMessage('Found prior migration process, resume migration maxScriptTime '.$this->maxScriptTime.' maxMemoryLimit '.$this->maxMemoryLimit/(1024*1024));
		}

		$this->_keepOldProductIds = VmConfig::get('keepOldProductIds',FALSE);
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:47,代码来源:migrator.php

示例4: display

 /**
  * Override of display to prevent caching
  *
  * @return  JController  A JController object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     $format = JRequest::getWord('format', 'html');
     $layout = JRequest::getWord('layout', 'invoice');
     if ($format != 'pdf') {
         $viewName = 'invoice';
         $view = $this->getView($viewName, $format);
         $view->headFooter = true;
         $view->display();
     } else {
         //PDF needs more RAM than usual
         VmConfig::ensureMemoryLimit(64);
         $viewName = 'invoice';
         $format = "html";
         // Create the invoice PDF file on disk and send that back
         $orderDetails = $this->getOrderDetails();
         $fileLocation = $this->getInvoicePDF($orderDetails, 'invoice', $layout);
         $fileName = basename($fileLocation);
         if (file_exists($fileLocation)) {
             $maxSpeed = 200;
             $range = 0;
             $size = filesize($fileLocation);
             $contentType = 'application/pdf';
             header("Cache-Control: public");
             header("Content-Transfer-Encoding: binary\n");
             header('Content-Type: application/pdf');
             $contentDisposition = 'attachment';
             $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
             if (strpos($agent, 'msie') !== FALSE) {
                 $fileName = preg_replace('/\\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
             }
             header("Content-Disposition: {$contentDisposition}; filename=\"{$fileName}\"");
             header("Accept-Ranges: bytes");
             if (isset($_SERVER['HTTP_RANGE'])) {
                 list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']);
                 str_replace($range, "-", $range);
                 $size2 = $size - 1;
                 $new_length = $size - $range;
                 header("HTTP/1.1 206 Partial Content");
                 header("Content-Length: {$new_length}");
                 header("Content-Range: bytes {$range}{$size2}/{$size}");
             } else {
                 $size2 = $size - 1;
                 header("Content-Range: bytes 0-{$size2}/{$size}");
                 header("Content-Length: " . $size);
             }
             if ($size == 0) {
                 die('Zero byte file! Aborting download');
             }
             //$contents = file_get_contents ($fileName);
             //echo $contents;
             //	set_magic_quotes_runtime(0);
             $fp = fopen("{$fileLocation}", "rb");
             fseek($fp, $range);
             while (!feof($fp) and connection_status() == 0) {
                 set_time_limit(0);
                 print fread($fp, 1024 * $maxSpeed);
                 flush();
                 ob_flush();
                 sleep(1);
             }
             fclose($fp);
             JFactory::getApplication()->close();
         } else {
             // TODO: Error message
             // vmError("File $fileName not found!");
         }
     }
 }
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:74,代码来源:invoice.php

示例5: display

 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $pathway = $mainframe->getPathway();
     $task = JRequest::getWord('task', 'list');
     $layoutName = JRequest::getWord('layout', 'list');
     $this->setLayout($layoutName);
     $_currentUser = JFactory::getUser();
     $document = JFactory::getDocument();
     if (!empty($tpl)) {
         $format = $tpl;
     } else {
         $format = JRequest::getWord('format', 'html');
     }
     $this->assignRef('format', $format);
     if ($format == 'pdf') {
         $document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
         //PDF needs more RAM than usual
         VmConfig::ensureMemoryLimit(96);
     } else {
         if ($layoutName == 'details') {
             $document->setTitle(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
             $pathway->additem(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
         } else {
             $document->setTitle(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
             $pathway->additem(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
         }
     }
     $orderModel = VmModel::getModel('orders');
     if ($layoutName == 'details') {
         $order_list_link = FALSE;
         $order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list', FALSE);
         $this->assignRef('order_list_link', $order_list_link);
         $orderDetails = $orderModel->getMyOrderDetails();
         if (!$orderDetails or empty($orderDetails['details'])) {
             echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
             return;
         }
         $userFieldsModel = VmModel::getModel('userfields');
         $_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type'));
         $orderbt = $orderDetails['details']['BT'];
         $orderst = array_key_exists('ST', $orderDetails['details']) ? $orderDetails['details']['ST'] : $orderbt;
         $userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderbt);
         $_userFields = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type'));
         $shipmentfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderst);
         $shipment_name = '';
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmshipment');
         $dispatcher = JDispatcher::getInstance();
         $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name));
         $payment_name = '';
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmpayment');
         $dispatcher = JDispatcher::getInstance();
         $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id, &$payment_name));
         if ($format == 'pdf') {
             $invoiceNumberDate = array();
             $return = $orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate);
             if (empty($invoiceNumberDate)) {
                 $invoiceNumberDate[0] = 'no invoice number accessible';
                 $invoiceNumberDate[1] = 'no invoice date accessible';
             }
             $this->assignRef('invoiceNumber', $invoiceNumberDate[0]);
             $this->assignRef('invoiceDate', $invoiceNumberDate[1]);
         }
         $this->assignRef('userfields', $userfields);
         $this->assignRef('shipmentfields', $shipmentfields);
         $this->assignRef('shipment_name', $shipment_name);
         $this->assignRef('payment_name', $payment_name);
         $this->assignRef('orderdetails', $orderDetails);
         if ($_currentUser->guest) {
             $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&order_pass=' . JRequest::getString('order_pass', false) . '&order_number=' . JRequest::getString('order_number', false);
         } else {
             $details_url = juri::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&tmpl=component&virtuemart_order_id=' . $this->orderdetails['details']['BT']->virtuemart_order_id;
         }
         $this->assignRef('details_url', $details_url);
         $tmpl = JRequest::getWord('tmpl');
         $print = false;
         if ($tmpl) {
             $print = true;
         }
         $this->prepareVendor();
         $this->assignRef('print', $print);
         $vendorId = 1;
         $emailCurrencyId = $orderDetails['details']['BT']->user_currency_id;
         $exchangeRate = FALSE;
         if (!class_exists('vmPSPlugin')) {
             require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
         }
         JPluginHelper::importPlugin('vmpayment');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('plgVmgetEmailCurrency', array($orderDetails['details']['BT']->virtuemart_paymentmethod_id, $orderDetails['details']['BT']->virtuemart_order_id, &$emailCurrencyId));
         if (!class_exists('CurrencyDisplay')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance($emailCurrencyId, $vendorId);
//.........这里部分代码省略.........
开发者ID:sergy444,项目名称:joomla,代码行数:101,代码来源:view.html.php

示例6: sendVmMail

 /**
  * With this function you can use a view to sent it by email.
  * Just use a task in a controller
  *
  * @param string $view for example user, cart
  * @param string $recipient shopper@whatever.com
  * @param bool $vendor true for notifying vendor of user action (e.g. registration)
  */
 private static function sendVmMail(&$view, $recipient, $noVendorMail = FALSE)
 {
     VmConfig::ensureMemoryLimit(96);
     VmConfig::loadJLang('com_virtuemart', true);
     if ($noVendorMail and !empty($view->orderDetails) and !empty($view->orderDetails['details']['BT']->order_language)) {
         VmConfig::loadJLang('com_virtuemart', true, $view->orderDetails['details']['BT']->order_language);
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE, $view->orderDetails['details']['BT']->order_language);
         VmConfig::loadJLang('com_virtuemart_orders', TRUE, $view->orderDetails['details']['BT']->order_language);
     } else {
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     }
     ob_start();
     $view->renderMailLayout($noVendorMail, $recipient);
     $body = ob_get_contents();
     ob_end_clean();
     $subject = isset($view->subject) ? $view->subject : vmText::_('COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT');
     $mailer = JFactory::getMailer();
     $mailer->addRecipient($recipient);
     $mailer->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mailer->isHTML(VmConfig::get('order_mail_html', TRUE));
     $mailer->setBody($body);
     if (!$noVendorMail) {
         $replyTo[0] = $view->vendorEmail;
         $replyTo[1] = $view->vendor->vendor_name;
         $mailer->addReplyTo($replyTo);
     } else {
         if (isset($view->orderDetails['details']) and isset($view->orderDetails['details']['BT'])) {
             $replyTo[0] = $view->orderDetails['details']['BT']->email;
             $replyTo[1] = $view->orderDetails['details']['BT']->first_name . ' ' . $view->orderDetails['details']['BT']->last_name;
         } else {
             $replyTo[0] = $view->user->email;
             $replyTo[1] = $view->user->name;
         }
         $mailer->addReplyTo($replyTo);
     }
     if (isset($view->mediaToSend)) {
         foreach ((array) $view->mediaToSend as $media) {
             $mailer->addAttachment($media);
         }
     }
     // set proper sender
     $sender = array();
     if (!empty($view->vendorEmail) and VmConfig::get('useVendorEmail', 0)) {
         $sender[0] = $view->vendorEmail;
         $sender[1] = $view->vendor->vendor_name;
     } else {
         // use default joomla's mail sender
         $app = JFactory::getApplication();
         $sender[0] = $app->getCfg('mailfrom');
         $sender[1] = $app->getCfg('fromname');
         if (empty($sender[0])) {
             $config = JFactory::getConfig();
             $sender = array($config->get('mailfrom'), $config->get('fromname'));
         }
     }
     $mailer->setSender($sender);
     return $mailer->Send();
 }
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:67,代码来源:shopfunctionsf.php

示例7: display

 public function display($cachable = false, $urlparams = false)
 {
     $format = JRequest::getWord('format', 'html');
     $layout = JRequest::getWord('layout', 'invoice');
     if ($format != 'pdf') {
         $viewName = 'invoice';
         //PDF needs more RAM than usual
         VmConfig::ensureMemoryLimit(64);
         $view = $this->getView($viewName, $format);
         $view->headFooter = true;
         $view->display();
     } else {
         $viewName = 'invoice';
         $format = "html";
         /* Create the invoice PDF file on disk and send that back */
         $orderModel = VmModel::getModel('orders');
         $orderDetails = $this->getOrderDetails();
         $fileName = $this->getInvoicePDF($orderDetails, $viewName, $layout, $format);
         if (file_exists($fileName)) {
             header("Cache-Control: public");
             header("Content-Transfer-Encoding: binary\n");
             header('Content-Type: application/pdf');
             $contentDisposition = 'attachment';
             header("Content-Disposition: {$contentDisposition}; filename=\"" . basename($fileName) . "\"");
             $contents = file_get_contents($fileName);
             echo $contents;
             JFactory::getApplication()->close();
         } else {
             // TODO: Error message
             // vmError("File $fileName not found!");
         }
     }
 }
开发者ID:Roma48,项目名称:abazherka_old,代码行数:33,代码来源:invoice.php

示例8: sendVmMail

 /**
  * With this function you can use a view to sent it by email.
  * Just use a task in a controller
  *
  * @param string $view for example user, cart
  * @param string $recipient shopper@whatever.com
  * @param bool $vendor true for notifying vendor of user action (e.g. registration)
  */
 private static function sendVmMail(&$view, $recipient, $noVendorMail = FALSE)
 {
     VmConfig::ensureMemoryLimit(96);
     $jlang = JFactory::getLanguage();
     if (VmConfig::get('enableEnglish', 1)) {
         $jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', TRUE);
     }
     $jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), TRUE);
     $jlang->load('com_virtuemart', JPATH_SITE, NULL, TRUE);
     if (!empty($view->orderDetails['details']['BT']->order_language)) {
         $jlang->load('com_virtuemart', JPATH_SITE, $view->orderDetails['details']['BT']->order_language, true);
         $jlang->load('com_virtuemart_shoppers', JPATH_SITE, $view->orderDetails['details']['BT']->order_language, true);
         $jlang->load('com_virtuemart_orders', JPATH_SITE, $view->orderDetails['details']['BT']->order_language, true);
     } else {
         VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
         VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     }
     ob_start();
     $view->renderMailLayout($noVendorMail, $recipient);
     $body = ob_get_contents();
     ob_end_clean();
     $subject = isset($view->subject) ? $view->subject : JText::_('COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT');
     $mailer = JFactory::getMailer();
     $mailer->addRecipient($recipient);
     $mailer->setSubject(html_entity_decode($subject));
     $mailer->isHTML(VmConfig::get('order_mail_html', TRUE));
     $mailer->setBody($body);
     if (!$noVendorMail) {
         $replyto[0] = $view->vendorEmail;
         $replyto[1] = $view->vendor->vendor_name;
         $mailer->addReplyTo($replyto);
     }
     /*	if (isset($view->replyTo)) {
     			 $mailer->addReplyTo($view->replyTo);
     		 }*/
     if (isset($view->mediaToSend)) {
         foreach ((array) $view->mediaToSend as $media) {
             $mailer->addAttachment($media);
         }
     }
     // set proper sender
     $sender = array();
     if (!empty($view->vendorEmail) and VmConfig::get('useVendorEmail', 0)) {
         $sender[0] = $view->vendorEmail;
         $sender[1] = $view->vendor->vendor_name;
     } else {
         // use default joomla's mail sender
         $app = JFactory::getApplication();
         $sender[0] = $app->getCfg('mailfrom');
         $sender[1] = $app->getCfg('fromname');
         if (empty($sender[0])) {
             $config = JFactory::getConfig();
             $sender = array($config->getValue('config.mailfrom'), $config->getValue('config.fromname'));
         }
     }
     $mailer->setSender($sender);
     return $mailer->Send();
 }
开发者ID:sergy444,项目名称:joomla,代码行数:66,代码来源:shopfunctionsf.php


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