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


PHP USER_ERROR函数代码示例

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


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

示例1: javascript

	/**
	 * Creates the client side validation from form fields
	 * which is generated at the header of each page 
	 */
	function javascript() {
		$code = '';
		$fields = $this->form->Fields();
		foreach($fields as $field){
			//if the field type has some special specific specification for validation of itself
			$valid = $field->jsValidation();
			if($valid){
				$code .= $valid;
			}
		}
		if(is_array($this->required)){

			foreach($this->required as $field) {
				if(is_array($field) && isset($field['js'])){
					$code .= $field['js'] . "\n";
				}else if($fields->dataFieldByName($field)) {
					$code .= "						require('$field');\n";
					//Tabs for output tabbing :-)
				}
			}
		}else{
			USER_ERROR("CustomRequiredFields::requiredfields is not set / not an array",E_USER_WARNING);
		}
		return $code;
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:29,代码来源:CustomRequiredFields.php

示例2: CanEditShareIcons

 function CanEditShareIcons()
 {
     if (class_exists('DataObjectSorterDOD')) {
         $obj = singleton('ShareThisDataObject');
         if ($obj->hasExtension('DataObjectSorterDOD')) {
             return true;
         } else {
             USER_ERROR('You have installed DataObjectSorterDOD, but you have not extended ShareThisDataObject with DataObjectSorterDOD, see sharethis/_config.php for more information.', E_USER_NOTICE);
         }
     } else {
         USER_ERROR('You need to install the DataObjectSorter module (see sharethis/README or sharethis/_config.php for more information)', E_USER_NOTICE);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-sharethis,代码行数:13,代码来源:ShareThisSiteConfigDE.php

示例3: FlashObjectData

 function FlashObjectData()
 {
     if (!class_exists("FlashObject")) {
         USER_ERROR("You have not installed the flash module, please see README for more information", E_USER_WARNING);
     }
     $file = self::get_youtube_embed_url() . $this->YouTubeVideoCode . "?";
     $array = self::get_player_options();
     foreach ($array as $key => $value) {
         $file .= "&" . urlencode($key) . "=" . urlencode($value);
     }
     FlashObject::set_use_dynamic_insert(false);
     $obj = new FlashObject();
     return $obj->CreateFlashObject($Title = $this->Title, $FlashFileDivID = "YouTubeVideo" . $this->URLSegment, $FlashFilename = $file, $AlternativeContent = '', $Width = self::get_player_width(), $Height = self::get_player_height(), $FlashVersion = '9.0.0', $ParamArray = self::get_player_options());
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-youtubegallery,代码行数:14,代码来源:YouTubeGalleryPage.php

示例4: setByCheckboxSetField

 /**
  * Allows you to set groups based on a CheckboxSetField
  *
  * Pass the form element from your post data directly to this method, and
  * it will update the groups and add and remove the member as appropriate.
  *
  * On the form setup:
  *
  * <code>
  * $fields->push(
  *   new CheckboxSetField(
  *     "NewsletterSubscriptions",
  *     "Receive email notification of events in ",
  *     $sourceitems = DataObject::get("NewsletterType")->toDropDownMap("GroupID","Title"),
  *     $selectedgroups = $member->Groups()->Map("ID","ID")
  *   )
  * );
  * </code>
  *
  * On the form handler:
  *
  * <code>
  * $groups = $member->Groups();
  * $checkboxfield = $form->Fields()->fieldByName("NewsletterSubscriptions");
  * $groups->setByCheckboxSetField($checkboxfield);
  * </code>
  *
  * @param CheckboxSetField $checkboxsetfield The CheckboxSetField (with
  *                                           data) from your form.
  */
 function setByCheckboxSetField(CheckboxSetField $checkboxsetfield)
 {
     // Get the values from the formfield.
     $values = $checkboxsetfield->Value();
     $sourceItems = $checkboxsetfield->getSource();
     if ($sourceItems) {
         // If (some) values are present, add and remove as necessary.
         if ($values) {
             // update the groups based on the selections
             foreach ($sourceItems as $k => $item) {
                 if (in_array($k, $values)) {
                     $add[] = $k;
                 } else {
                     $remove[] = $k;
                 }
             }
             // else we should be removing all from the necessary groups.
         } else {
             $remove = array_keys($sourceItems);
         }
         if ($add) {
             $this->addManyByGroupID($add);
         }
         if ($remove) {
             $this->RemoveManyByGroupID($remove);
         }
     } else {
         USER_ERROR("Member::setByCheckboxSetField() - No source items could be found for checkboxsetfield " . $checkboxsetfield->Name(), E_USER_WARNING);
     }
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:60,代码来源:Member.php

示例5: generateResizedImage

 /**
  * Generate a resized copy of this image with the given width & height.
  * Use in templates with $ResizedImage.
  */
 function generateResizedImage($gd, $width, $height)
 {
     if (is_numeric($gd) || !$gd) {
         USER_ERROR("Image::generateFormattedImage - generateResizedImage is being called by legacy code or gd is not set.", E_USER_WARNING);
     } else {
         return $gd->resize($width, $height);
     }
 }
开发者ID:leeyisoft,项目名称:Uploadify,代码行数:12,代码来源:S3Image.php

示例6: FieldSetForRow

	/**
	 * Get all {@link FormField} instances necessary for a single row,
	 * respecting the casting set in {@link $fieldTypes}.
	 * Doesn't populate with any data. Optionally performs a readonly
	 * transformation if {@link $IsReadonly} is set, or the current user
	 * doesn't have edit permissions.
	 * 
	 * @return FieldList
	 */
	function FieldSetForRow() {
		$fieldset = new FieldList();
		if($this->fieldTypes){
			foreach($this->fieldTypes as $key => $fieldType) {
				if(isset($fieldType->class) && is_subclass_of($fieldType, 'FormField')) {
					// using clone, otherwise we would just add stuff to the same field-instance
					$field = clone $fieldType;
				} elseif(strpos($fieldType, '(') === false) {
					$field = new $fieldType($key);
				} else {
					$fieldName = $key;
					$fieldTitle = "";
					$field = eval("return new $fieldType;");
				}
				if($this->IsReadOnly || !$this->Can('edit')) {
					$field = $field->performReadonlyTransformation();
				}
				$fieldset->push($field);
			}
		}else{
			USER_ERROR("TableField::FieldSetForRow() - Fieldtypes were not specified",E_USER_WARNING);
		}

		return $fieldset;
	}
开发者ID:redema,项目名称:sapphire,代码行数:34,代码来源:TableField.php

示例7: paid

 /**
  * confirm payment...
  * @param HTTP_Request (SS_HTTPRequest)
  */
 public function paid($request)
 {
     $timeStamp = $request->param("ID");
     if ($timeStamp) {
         //find payment
         $payment = AuthorizeDotNetPayment::get()->byID(intval($_POST["x_invoice_num"]));
         if ($payment) {
             $payment->ValuesReceived = Convert::raw2sql(serialize($_POST));
             //already completed?
             if ($payment->Status != "Incomplete") {
                 return $payment->redirectToOrder();
             }
             //get amount ...
             if (isset($_REQUEST["x_amount"])) {
                 $amount = $_REQUEST["x_amount"];
             } else {
                 $amount = "0.00";
             }
             //check if it is authorize.net response
             $checkHash = AuthorizeDotNetPayment::create_fingerprint($payment->ID, trim($timeStamp), $amount);
             if ($payment->Hash == $checkHash) {
                 $payment->Hash = "";
                 //now we know it is legit, lets see the response...
                 $responseCode = $_POST["x_response_code"];
                 if ($responseCode == self::$response_approved) {
                     $payment->Status = 'Success';
                 } elseif ($responseCode == self::$response_held) {
                     $payment->Status = 'Pending';
                 } else {
                     $payment->Status = 'Failure';
                 }
             } else {
                 $payment->Status = 'Failure';
             }
             $payment->write();
             return $payment->redirectToOrder();
         } else {
             USER_ERROR("PAYMENT COULD NOT BE FOUND ", E_USER_WARNING);
         }
     } else {
         USER_ERROR("URL IS MISSING TIMESTAMP OF TRANSACTION", E_USER_WARNING);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-payment-authorizedotnet,代码行数:47,代码来源:AuthorizeDotNetPayment.php

示例8: generateTransparentFormattedImage

 /**
  * Generate an image on the specified format. It will save the image
  * at the location specified by cacheFilename(). The image will be generated
  * using the specific 'generate' method for the specified format.
  * @param string $format Name of the format to generate.
  * @param string $arg1 Argument to pass to the generate method.
  * @param string $arg2 A second argument to pass to the generate method.
  */
 public function generateTransparentFormattedImage($format, $arg1 = null, $arg2 = null)
 {
     $cacheFile = $this->owner->cacheTransparentFilename($format, $arg1, $arg2);
     $backend = Injector::inst()->createWithArgs(Image::get_backend(), array(Director::baseFolder() . "/" . $this->owner->Filename));
     if ($backend->hasImageResource()) {
         $generateFunc = "generate{$format}";
         if ($this->owner->hasMethod($generateFunc)) {
             $backend = $this->owner->{$generateFunc}($backend, $arg1, $arg2);
             if ($backend) {
                 $backend->writeTo(Director::baseFolder() . "/" . $cacheFile);
             }
         } else {
             USER_ERROR("Image::generateTransparentFormattedImage - Image {$format} function not found.", E_USER_WARNING);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-extended-image,代码行数:24,代码来源:ExtendedImage.php

示例9: paid

 /**
  * Get the Order object to modify, check security that it's the object you want to modify based
  * off Worldpay confirmation, update the Order object to show complete and Payment object to show
  * that it was received. Finally, send a receipt to the buyer to show these details.
  */
 function paid()
 {
     // Check if callback password is the same, otherwise fail
     if ($_REQUEST['callbackPW'] == WorldpayPayment::$callback_password) {
         $paymentID = $_REQUEST['MC_paymentID'];
         if (is_numeric($paymentID)) {
             if ($payment = DataObject::get_by_id('WorldpayPayment', $paymentID)) {
                 if ($_REQUEST['transStatus'] == "Y") {
                     $payment->Status = 'Success';
                 } else {
                     $payment->Status = 'Failure';
                 }
                 $payment->write();
                 $payment->redirectToOrder();
             } else {
                 USER_ERROR("CheckoutPage::OrderConfirmed - There is no Payment object for this order object (Order ID " . $orderID . ")", E_USER_WARNING);
             }
         } else {
             USER_ERROR('CheckoutPage::OrderConfirmed - Order ID is NOT numeric', E_USER_WARNING);
         }
     } else {
         USER_ERROR("CheckoutPage::OrderConfirmed - Order error - password failed", E_USER_WARNING);
     }
     return;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-payment,代码行数:30,代码来源:WorldpayPayment.php

示例10: dodataobjectsort

 function dodataobjectsort()
 {
     if (!class_exists("DataObjectSorterDOD")) {
         USER_ERROR("you have not installed the dataobjectsorter module - either hide the sort option OR install it: http://sunny.svnrepository.com/svn/sunny-side-up-general/dataobjectsorter");
     } else {
         $this->extend("dodataobjectsort");
     }
 }
开发者ID:riddler7,项目名称:silverstripe-product-variations,代码行数:8,代码来源:ProductAttributeValue.php

示例11: paid

 function paid()
 {
     $this->extend("DpsPxPayPayment_Handler_completion_start");
     $commsObject = new DpsPxPayComs();
     $response = $commsObject->processRequestAndReturnResultsAsObject();
     if ($payment = DpsPxPayPayment::get()->byID($response->getMerchantReference())) {
         if (1 == $response->getSuccess()) {
             $payment->Status = 'Success';
         } else {
             $payment->Status = 'Failure';
         }
         if ($DpsTxnRef = $response->getDpsTxnRef()) {
             $payment->TxnRef = $DpsTxnRef;
         }
         if ($ResponseText = $response->getResponseText()) {
             $payment->Message = $ResponseText;
         }
         $payment->write();
         $payment->redirectToOrder();
     } else {
         USER_ERROR("could not find payment with matching ID", E_USER_WARNING);
     }
     return;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-payment-dps,代码行数:24,代码来源:DpsPxPayPayment.php

示例12: trigger_error

<?php

trigger_error('this is a mistake');
USER_ERROR('this is another mistake', E_USER_NOTICE);
开发者ID:exakat,项目名称:exakat,代码行数:4,代码来源:TriggerErrorUsage.01.php

示例13: paid

 function paid()
 {
     $commsObject = new DpsPxPayComs();
     $response = $commsObject->processRequestAndReturnResultsAsObject();
     if ($payment = DpsPxPayStoredPayment::get()->byID($response->getMerchantReference())) {
         if ($payment->Status != 'Success') {
             if (1 == $response->getSuccess()) {
                 $payment->Status = 'Success';
                 if ($response->DpsBillingId) {
                     $existingCard = DpsPxPayStoredCard::get()->filter(array("BillingID" => $response->DpsBillingId))->First();
                     if ($existingCard == false) {
                         $storedCard = new DpsPxPayStoredCard();
                         $storedCard->BillingID = $response->DpsBillingId;
                         $storedCard->CardName = $response->CardName;
                         $storedCard->CardHolder = $response->CardHolderName;
                         $storedCard->CardNumber = $response->CardNumber;
                         $storedCard->MemberID = $payment->Order()->MemberID;
                         $storedCard->write();
                     }
                 }
             } else {
                 $payment->Status = 'Failure';
             }
             if ($DpsTxnRef = $response->getDpsTxnRef()) {
                 $payment->TxnRef = $DpsTxnRef;
             }
             if ($ResponseText = $response->getResponseText()) {
                 $payment->Message = $ResponseText;
             }
             $payment->write();
         }
         $payment->redirectToOrder();
     } else {
         USER_ERROR("could not find payment with matching ID", E_USER_WARNING);
     }
     return;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-payment-dps,代码行数:37,代码来源:DpsPxPayStoredPayment.php

示例14: createOrderFromRepeatOrder

 /**
  * creates order from repeatorder for a specific day.
  * IF it does not already exists.
  *
  */
 protected function createOrderFromRepeatOrder($orderDateInteger)
 {
     if ($order = DataObject::get_one("Order", "\"OrderDateInteger\" = '" . $orderDateInteger . "' AND \"RepeatOrderID\" = " . $this->ID)) {
         //do nothing
     } else {
         $order = new Order();
         $order->OrderDate = date("Y-m-d", $orderDateInteger);
         $order->OrderDateInteger = $orderDateInteger;
         $order->RepeatOrderID = $this->ID;
         $order->MemberID = $this->MemberID;
         $order->CustomerOrderNote = "Created as part of a repeating order.";
         $order->write();
         if ($this->OrderItems()) {
             foreach ($this->OrderItems() as $repeatOrderOrderItem) {
                 $product = DataObject::get_by_id('Product', $repeatOrderOrderItem->ProductID);
                 if ($product) {
                     //START CHECK AVAILABILITY
                     if (class_exists("ProductStockCalculatedQuantity")) {
                         $numberAvailable = ProductStockCalculatedQuantity::get_quantity_by_product_id($product->ID);
                         if ($numberAvailable < $repeatOrderOrderItem->Quantity) {
                             $alternatives = $repeatOrderOrderItem->AlternativesPerProduct();
                             $product = null;
                             if ($dos) {
                                 foreach ($alternatives as $alternative) {
                                     $stillLookingForAlternative = true;
                                     $numberAvailable = ProductStockCalculatedQuantity::get_quantity_by_product_id($alternative->ID);
                                     if ($numberAvailable > $repeatOrderOrderItem->Quantity && $stillLookingForAlternative) {
                                         $stillLookingForAlternative = false;
                                         $product = $alternative;
                                     }
                                 }
                             }
                         }
                     }
                     //END CHECK AVAILABILITY
                     if ($product) {
                         $newProductOrderItem = new Product_OrderItem();
                         $newProductOrderItem->addBuyableToOrderItem($product, $repeatOrderOrderItem->Quantity);
                         $newProductOrderItem->OrderID = $order->ID;
                         $newProductOrderItem->write();
                     }
                 } else {
                     USER_ERROR("Product does not exist", E_USER_WARNING);
                 }
             }
         } else {
             USER_ERROR("There are no order items", E_USER_WARNING);
         }
         //FINALISE!!!
         $order->write();
         $order->tryToFinaliseOrder();
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-repeatorders,代码行数:58,代码来源:RepeatOrder.php


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