itro_update_option('select_' . $opt_name[$i], NULL); } } else { /* Read in existing option value from database */ $opt_val[$i] = itro_get_option($opt_name[$i]); $px_opt_val[$i] = itro_get_option('px_' . $opt_name[$i]); $perc_opt_val[$i] = itro_get_option('perc_' . $opt_name[$i]); } } /* unsorted option and field */ if (isset($_POST[$submitted_form]) && $_POST[$submitted_form] == 'Y') { //wp token check check_admin_referer('ipp_save_data', 'ipp_sec_nonce_fld'); //WP Editor content if (isset($_POST['custom_html'])) { $field_value = ipp_validate_data('custom_html', $_POST['custom_html']); } else { $field_value = NULL; } /* Save the posted value in the database */ itro_update_field('custom_html', $field_value); if (isset($_POST['selected_page_id'])) { $selected_page_id = json_encode($_POST['selected_page_id']); itro_update_option('selected_page_id', $selected_page_id); } else { itro_update_option('selected_page_id', NULL); } if (!empty($_POST['background_source'])) { itro_update_option('background_source', $_POST['background_source']); } } else {
function itro_get_field($field_name) { global $wpdb; $field_table_name = FIELD_TABLE_NAME; $result = $wpdb->get_results("SELECT * FROM {$field_table_name} WHERE field_name='{$field_name}'"); foreach ($result as $pippo) { $field_value = $pippo->field_value; } if (isset($field_value)) { return ipp_validate_data($field_name, $field_value); } else { return NULL; } }