/** * @param array $data - array of values for check. If it is empty - will check data from config * @return bool */ public function checkRequiredSettings($data = array()) { if (isset($this->config->settings->item)) { /** * @var $items SimpleXmlElement */ $items = $this->config->settings->item; foreach ($items as $item) { if (!isset($data[(string) $item['id']])) { //if data for check not given - do nothing continue; } $value = $data[(string) $item['id']]; if (!is_multi($value)) { if (is_array($value)) { $value = array_map('trim', $value); } else { $value = trim($value); } } /** @noinspection PhpUndefinedMethodInspection */ $type_attr = $item->type->attributes(); if ((string) $type_attr['required'] == 'true' && !$value) { return false; } } } // at last we need to validate data return true; }
public function showFinderSomeoneElse() { $categories = $this->categories_repo->getCategories(); $giftee_occasions = $categories['occasion_categories']; $giftee_relations = $categories['relation_categories']; $giftee_genders = $categories['gender_categories']; $giftee_ages = $categories['age_categories']; $giftee_interests = $categories['interest_categories']; $add_profile = $this->add_profile_mgr->getUserAddProfile(); $view = View::make('gift-assistant')->with('_page_title', 'Giftertipster - Gift Search')->with('_page_description', 'Search for the perfect gift using our matching engine and purchase on Amazon.')->with('_page_keywords', 'gift,search,occasion,what to buy')->with('gift_assistant_form_type', 'find')->with('giftee_occasions', $giftee_occasions)->with('giftee_relations', $giftee_relations)->with('giftee_genders', $giftee_genders)->with('giftee_ages', $giftee_ages)->with('giftee_interests', $giftee_interests); //if we have a add self profile already, lets pre populate the form if (is_multi($add_profile)) { return $view->with('pre_populate', true)->with('pre_populate_occasion_ids', $add_profile['occasion_ids'])->with('pre_populate_relation_ids', $add_profile['relation_ids'])->with('pre_populate_gender_ids', $add_profile['gender_ids'])->with('pre_populate_age_ids', $add_profile['age_ids'])->with('pre_populate_interest_ids', $add_profile['interest_ids'])->with('pre_populate_sub_interest_ids', $add_profile['sub_interest_ids'])->with('info_message', '<i class="icon icon-thumbs-up-alt"></i> We took the liberty of pre-populating this based on your last search.'); } //otherwise return a fresh form return $view; }
function event_espresso_confirm_and_pay() { global $wpdb; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $events_in_session = isset($_SESSION['espresso_session']['events_in_session']) ? $_SESSION['espresso_session']['events_in_session'] : event_espresso_clear_session(TRUE); foreach ($events_in_session as $k => $v) { foreach ($_POST as $field_name => $field_value) { if (is_array($field_value) && array_key_exists($events_in_session, $field_value)) { if (is_multi($field_value)) { //$multi_key= $field_value[$k]; foreach ($field_value[$k] as $mkey => $mval) { if (is_array($mval)) { array_walk_recursive($mval, 'sanitize_text_field'); } else { $mval = sanitize_text_field($mval); } echo "multi {$k} > {$field_name} >" . $mkey . " > " . $mval . "<br />"; } } else { if (is_array($field_value)) { array_walk_recursive($field_value, 'sanitize_text_field'); } else { $field_value = sanitize_text_field($field_value); } echo "{$k} > {$field_name} >" . $field_value[$k] . "<br />"; } } } echo "<hr />"; } //echo "<pre>" , print_r($_POST) , "</pre>"; die; }
<div class="text-center"> <a href="<?php echo base_url() . 'memoir/form'; ?> " class="btn blue-btn" data-toggle="tooltip" title="Create a new Memoir"> <i class="fa fa-plus"></i> </a> </div> </div> </div> <?php if (isset($memoir)) { $right = true; if (is_multi($memoir)) { foreach ($memoir as $m) { ?> <div class="row"> <div class="col-md-12"> <div class="memoir <?php echo $right ? 'right' : 'left'; ?> " data-id="<?php echo $m['id']; ?> "> <?php echo nl2br($m['message']); ?> </div>
function event_espresso_confirm_and_pay() { global $wpdb; $events_in_session = $_SESSION['espresso_session']['events_in_session']; foreach ($events_in_session as $k => $v) { foreach ($_POST as $field_name => $field_value) { if (is_array($field_value) && array_key_exists($events_in_session, $field_value)) { if (is_multi($field_value)) { //$multi_key= $field_value[$k]; foreach ($field_value[$k] as $mkey => $mval) { echo "multi {$k} > {$field_name} >" . $mkey . " > " . $mval . "<br />"; } } else { echo "{$k} > {$field_name} >" . $field_value[$k] . "<br />"; } } } echo "<hr />"; } //echo "<pre>" , print_r($_POST) , "</pre>"; die; }