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


PHP Phone::GetInstance方法代码示例

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


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

示例1: Notify

		function Notify(AbstractPaymentModule $PaymentModule, $status)
		{		
			global $PaymentModuleFactory;
			
			if ($status == PAYMENT_STATUS::SUCCESS)
			{
				UI::Redirect("payment_success.php?op=".$_SESSION['wizard']['whois']["operation"]);
			}
			else
			{
				$smarty = Core::GetSmartyInstance("SmartyExt");
				
				$PaymentForm = $PaymentModule->GetPaymentForm();
				
				$payment_module = $PaymentModuleFactory->GetModuleObjectByName($_SESSION['wizard']['checkout']["gate"]);
					
				$fields = $PaymentForm->ListFields();
				$smarty_fields = array();
				foreach($fields as $field)
				{
					$smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options);
					if ($_REQUEST[$field->Name])
						$attr[$field->Title] = $_REQUEST[$field->Name];
				}
				
				$display["errors"] = explode("\n", $PaymentModule->GetFailureReason());
				$display["fields"] = $smarty_fields;
				$display["post"] = $attr;
				$display['phone_widget'] = Phone::GetInstance()->GetWidget();
				$template_name = "paymentgate.tpl";
				
				$smarty->assign($GLOBALS["display"]);
				$smarty->assign($display);
				$smarty->display($template_name);
			}
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:36,代码来源:process_payment.php

示例2: ValidateOverXML

		/**
		 * Returns array of error messages. 
		 *
		 * @param array $data
		 * @return array Empty when form passes validation
		 */
		private function ValidateOverXML ($data)
		{
			$err = array();
			foreach ($this->XMLValidator->field as $field)
			{
				settype($field, "array");			
				$field = $field["@attributes"];
				$field_name = $field["name"];
				
				if ($field_name)
				{
					$description = ucfirst($field['description']);
						
					if ($field['iseditable'] == 0)
					{
						if ($field['iseditable'] == 0 && isset($data[$field_name]) && isset($this->Fields[$field_name]->Value))
						{
							$err[$field_name] = sprintf(_("'%s' is uneditable"), $description);
							continue;
						}
					}
					
					
					if ($field['required'] && (!strlen($data[$field_name]) && ($field['iseditable'] || (!$field['iseditable'] && !array_key_exists($field_name, $this->Fields)))))
					{
						$err[$field_name] = sprintf(_("'%s' is required"), $description);
					}
					elseif (strlen($data[$field_name]))
					{
						if ($field["minlength"])
							if (strlen($data[$field_name]) < (int)$field["minlength"])
							{
								$err[$field_name] = sprintf(_("'%s' must contain at least %d chars"), $description, (int)$field["minlength"]);
							}
								
						if ((int)$field["maxlength"])
							if (strlen($data[$field_name]) > (int)$field["maxlength"])
							{
								$err[$field_name] = sprintf(_("'%s' cannot be longer than %d chars"), $description, (int)$field["maxlength"]);
							}
							
						if ($field["pattern"] && !preg_match("{$field['pattern']}msi", $data[$field_name]))
						{
							$err[$field_name] = sprintf(_("'%s' is not valid"), $description);
						}
					}
					
					if ($field['type'] == FORM_FIELD_TYPE::PHONE && $data[$field_name])
					{
						$Phone = Phone::GetInstance();
						if ($Phone->IsE164($data[$field_name]) || $Phone->IsPhone($data[$field_name]))
							continue;
						else
							$err[$field_name] = sprintf(_('%s must be in %s format'), $description, CONFIG::$PHONE_FORMAT); 
					}
				}
			}
			return $err;
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:65,代码来源:class.DataForm.php

示例3: ConvertUsers

 public function ConvertUsers()
 {
     $this->Log('Convert users');
     $skip_fields = array('opt_canMtech', 'opt_canMbill', 'opt_canbulkregister', 'isres', 'tax', 'idnumber', 'mobile');
     $phone_fields = array('phone', 'fax');
     $Phone = Phone::GetInstance();
     $user_data = $this->DbOld->GetAll('SELECT * FROM users');
     foreach ($user_data as &$row) {
         // Process skipped fields
         foreach ($skip_fields as $f) {
             unset($row[$f]);
         }
         // Convert phone and fax
         foreach ($phone_fields as $f) {
             if ($row[$f]) {
                 $chunks = str_split(preg_replace("/[^0-9]+/", "", $row[$f]), 3);
                 $e164 = trim("+" . array_shift($chunks) . "." . implode("", $chunks));
                 $row[$f] = $Phone->E164ToPhone($e164);
             }
         }
     }
     $this->TruncateTable('users', 'client_fields', 'client_info');
     $this->BulkInsert('users', $user_data);
     if ($this->OldTableExists('cliend_fields', 'client_info')) {
         $this->CopyTable('client_fields');
         $this->CopyTable('client_info');
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:28,代码来源:upgrade-to-v31-lu.php

示例4: _

	        
	    if (!$Validator->IsNotEmpty($_POST["zipcode"]))
	        $err[] = _("Postal code required");
	        
	        
	    if ($Validator->IsNotEmpty($_POST['phone']))
	    {
	    	if (!Phone::GetInstance()->IsPhone($_POST["phone"]))
	        	$err[] = _("Phone invalid");
	    }
		else
			$err[] = _('Phone required');	        
	        
		if ($Validator->IsNotEmpty($_POST['fax']))
		{
			if (!Phone::GetInstance()->IsPhone($_POST['fax']))
				$err[] = _('Fax invalid');
		}
	
			
		$DBEmailCheck = $db->GetOne("SELECT COUNT(*) FROM users WHERE email=?", array($post_email));
		if ($DBEmailCheck > 0)
			$err[] = _("E-mail already exists in database");
			
	    $DBLoginCheck = $db->GetOne("SELECT COUNT(*) FROM users WHERE login=?", array($post_login));
	    if ($DBLoginCheck > 0)
			$err[] = _("Login already exists in database");
			
		if (count($err) != 0)
			$step = "newclient";
	}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:30,代码来源:placeorder.php

示例5: array

								}
							}
							else
							{	
								$fields = $PaymentForm->ListFields();
								$smarty_fields = array();
								foreach($fields as $field)
								{
									$smarty_fields[$field->Title] = array("name" => $field->Name, "required" => $field->IsRequired, "type" => $field->FieldType, "values" => $field->Options);
									if ($_REQUEST[$field->Name])
										$attr[$field->Title] = $_REQUEST[$field->Name];
								}
								
								
								$display["post"] = $attr;
								$display['phone_widget'] = Phone::GetInstance()->GetWidget();						
								$display["fields"] = $smarty_fields;
								$template_name = "paymentgate.tpl";
							}
						}
					}
					
				}
				
								
				$display["errors"] = $err;
				if (!$template_name)
				{
					$template_name = "placeorder.tpl";
					include('order/calculate_placeorder.php');
				}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:31,代码来源:index.php

示例6: AcceptFieldList

		private function AcceptFieldList ($xml_fields, $data, &$buf, $ErrList, $strict=true)
		{
			foreach ($xml_fields as $f_obj)
			{			
				settype($f_obj, "array");			
				$field = $f_obj["@attributes"];
							
				$field_name = (string)$field["name"];
				
				$err = false;
				
				if ($field_name)
				{
					$description = ucfirst($field['description']);
					
					if ($strict && (int)$field['iseditable'] == 0)
					{
						if ((int)$field['iseditable'] == 0 && isset($data[$field_name]) && isset($this->Fields[$field_name]))
							$err = sprintf(_("'%s' is uneditable"), $description);
						else if (isset($this->Fields[$field_name]))
						{
							$buf[$field_name] = $this->Fields[$field_name];
							continue;
						}
					}
					
					// �������� �� ������������ ����
					if ($strict && (bool)$field['required'] && (strlen($data[$field_name]) == 0 && ($field['iseditable'] || (!$field['iseditable'] && !array_key_exists($field_name, $this->Fields)))))
					{
						$err = sprintf(_("'%s' is required"), $description);
					}
					elseif ($strict && strlen($data[$field_name]))
					{
						if ((int)$field["minlength"])
						{
							if (strlen($data[$field_name]) < (int)$field["minlength"])
								$err = sprintf(_("'%s' must contain at least %d chars"), $description, (int)$field["minlength"]);
						}
							
						if ((int)$field["maxlength"])
						{
							if (strlen($data[$field_name]) > (int)$field["maxlength"])
								$err = sprintf(_("'%s' cannot be longer than %d chars"), $description, (int)$field["maxlength"]);
						}
							
						if ($field["pattern"] && !preg_match("{$field['pattern']}msi", $data[$field_name]))
							$err = sprintf(_("'%s' is not valid"), $description);
					}
					
					
					if ($field['type'] == 'phone' && $data[$field_name])
					{
						$Phone = Phone::GetInstance();
						if ($Phone->IsE164($data[$field_name]))
						{
							// E164 phone
							$buf[$field_name] = $data[$field_name];
							if (isset($data[$field_name . '_display']))  
								$buf[$field_name . '_display'] = $data[$field_name . '_display'];
							else
								$buf[$field_name . '_display'] = $Phone->E164ToPhone($data[$field_name]);
								 
							continue;
						}
						else if ($Phone->IsPhone($data[$field_name]))
						{
							// Display phone 
							$buf[$field_name] = $Phone->PhoneToE164($data[$field_name]);
							$buf[$field_name . '_display'] = $data[$field_name];
							 
							continue;
						}
						else if ($strict)
						{
							$err = sprintf(_('%s must be in %s format'), $description, CONFIG::$PHONE_FORMAT);
						}
					}
	
					if (!$err) 
					{
						$buf[$field_name] = $data[$field_name];
					} 
					else 
					{
						$ErrList->AddMessage($err);
					}
				}
			}
			
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:90,代码来源:class.Contact.php

示例7: _testPhoneField

 function _testPhoneField()
 {
     $e164_phone = '+380.507243484';
     $phone = '+380-50-7243484';
     $Phone = Phone::GetInstance();
     $this->assertTrue($Phone->PhoneToE164($phone) == $e164_phone, 'phone to e164');
     $this->assertTrue($Phone->IsPhone($phone), 'phone is phone.. la lay lalala');
     $this->assertTrue($Phone->IsE164($e164_phone), 'phone is e164');
     $Contact = $this->Registry->NewContactInstance(CONTACT_TYPE::TECH);
     $field_list = $this->ContactFields;
     $field_list['voice'] = $phone;
     $field_list['fax'] = '';
     $Contact->SetFieldList($field_list);
     try {
     } catch (ErrorList $e) {
         var_dump($e->GetAllMessages());
     }
     $this->DBContact->Save($Contact);
     /*
     $this->assertTrue(
     	$Contact->GetField('voice') == $phone_e164 &&
     	$Contact->GetField('voice_display') == $phone,
     	'Set phone'
     );
     */
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:26,代码来源:tests.php

示例8: MakePhoneField

 public function MakePhoneField($attrs = array())
 {
     return Phone::GetInstance()->GetWidget($attrs);
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:4,代码来源:class.RegistryManifest.php


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