本文整理匯總了PHP中type::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getValue方法的具體用法?PHP type::getValue怎麽用?PHP type::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getValue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doAddFavoriteSphone
/**
* Add product to authenticated user's favorites. (for Smart phone)
*
* @param type $objCustomer
* @return void
*/
function doAddFavoriteSphone($objCustomer)
{
// ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
$this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
if (count($this->arrErr) == 0) {
if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
$objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
$objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this));
print 'true';
SC_Response_Ex::actionExit();
}
}
print 'error';
SC_Response_Ex::actionExit();
}
}
示例2: sanitizePhone
/**
*
* @param type $phone
* @return type
*/
public static function sanitizePhone($phone)
{
$num = preg_replace("/[^0-9]/", "", $phone->getValue());
return intval(substr($num, strlen($num) - 9, 9));
}
示例3: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例4: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$rules = $field->getValidationData();
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
$rule = apply_filters('wptoolset_validation_rule_php', $rule);
$args['args'] = apply_filters('wptoolset_validation_args_php', $args['args'], $rule);
// Set value in args - search string '$value' or replace first element
$replace = array_search('$value', $args['args']);
if ($replace !== false) {
$args['args'][$replace] = $value;
} else {
$args['args'][0] = $value;
}
if (!$this->validate($rule, $args['args'])) {
$errors[] = $args['message'];
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例5: simpleMatchSetTagLabel
/**
* add the simpleAssociableChoiceTag.
*
*
* @param type $label
* @param type $numberLabel
* @param type $elementLabel
*/
protected function simpleMatchSetTagLabel($label, $numberLabel, $elementLabel)
{
if ($this->cardinality == 'multiple') {
$w = 0;
foreach ($this->interactionmatching->getProposals() as $pr) {
++$w;
}
$maxAssociation = $w;
} else {
$maxAssociation = 1;
}
if ($label->getPositionForce() == 1) {
$positionForced = 'true';
} else {
$positionForced = 'false';
}
$simpleLabel = $this->document->CreateElement('simpleAssociableChoice');
$simpleLabel->setAttribute('identifier', 'right' . $numberLabel);
$simpleLabel->setAttribute('fixed', $positionForced);
$simpleLabel->setAttribute('matchMax', $maxAssociation);
$this->matchInteraction->appendChild($simpleLabel);
$this->getDomEl($simpleLabel, $label->getValue());
$elementLabel->appendChild($simpleLabel);
if ($label->getFeedback() != null && $label->getFeedback() != '') {
$feedbackInline = $this->document->CreateElement('feedbackInline');
$feedbackInline->setAttribute('outcomeIdentifier', 'FEEDBACK');
$feedbackInline->setAttribute('identifier', 'Choice' . $numberLabel);
$feedbackInline->setAttribute('showHide', 'show');
$this->getDomEl($feedbackInline, $label->getFeedback());
$simpleLabel->appendChild($feedbackInline);
}
}
示例6: validateField
/**
* Bulk PHP validation.
*
* @param type $field Field class instance
* @param type $value
* @return \WP_Error|boolean
* @throws Exception
*/
public function validateField($field)
{
$value = apply_filters('wptoolset_validation_value_' . $field->getType(), $field->getValue());
$rules = $this->_parseRules($field->getValidationData(), $value);
// If not required but empty - skip
if (!isset($rules['required']) && (is_null($value) || $value === false || $value === '')) {
return true;
}
try {
$errors = array();
foreach ($rules as $rule => $args) {
if (!$this->validate($rule, $args['args'])) {
/**
* Allow turn off field name.
*
* Allow turn off field name from error message.
*
* @since x.x.x
*
* @param boolean $var show field title in message, * default true.
*/
if (apply_filters('toolset_common_validation_add_field_name_to_error', true)) {
$errors[] = $field->getTitle() . ' ' . $args['message'];
} else {
$errors[] = $args['message'];
}
}
}
if (!empty($errors)) {
throw new Exception();
}
} catch (Exception $e) {
return new WP_Error(__CLASS__ . '::' . __METHOD__, 'Field not validated', $errors);
}
return true;
}
示例7: simpleMatchSetTagLabel
/**
* add the simpleAssociableChoiceTag
*
* @access protected
*
* @param type $label
* @param type $numberLabel
* @param type $elementLabel
*/
protected function simpleMatchSetTagLabel($label, $numberLabel, $elementLabel)
{
if ($this->cardinality == "multiple") {
$w = 0;
foreach ($this->interactionmatching->getProposals() as $pr) {
$w++;
}
$maxAssociation = $w;
} else {
$maxAssociation = 1;
}
if ($label->getPositionForce() == 1) {
$positionForced = 'true';
} else {
$positionForced = 'false';
}
$simpleLabel = $this->document->CreateElement('simpleAssociableChoice');
$simpleLabel->setAttribute("identifier", "right" . $numberLabel);
$simpleLabel->setAttribute("fixed", $positionForced);
$simpleLabel->setAttribute("matchMax", $maxAssociation);
$this->matchInteraction->appendChild($simpleLabel);
$simpleLabeltxt = $this->document->CreateTextNode($label->getValue());
$simpleLabel->appendChild($simpleLabeltxt);
$elementLabel->appendChild($simpleLabel);
if ($label->getFeedback() != Null && $label->getFeedback() != "") {
$feedbackInline = $this->document->CreateElement('feedbackInline');
$feedbackInline->setAttribute("outcomeIdentifier", "FEEDBACK");
$feedbackInline->setAttribute("identifier", "Choice" . $numberLabel);
$feedbackInline->setAttribute("showHide", "show");
$feedbackInlinetxt = $this->document->CreateTextNode($label->getFeedback());
$feedbackInline->appendChild($feedbackInlinetxt);
$simpleLabel->appendChild($feedbackInline);
}
}