/** * @return SplashImageBean with "esc_attr" security on each property. */ public function get($splashImageID) { global $wpdb; if (!isset($this->splashImageBean)) { $splashImageBean = new SplashImageBean(); $wsi_splashimage_results = $wpdb->get_results("SELECT * FROM " . $this->tableName() . " WHERE id = " . $splashImageID); $wsi_splashimage_row = $wsi_splashimage_results[0]; $splashImageBean->setId(esc_attr($wsi_splashimage_row->id)); $splashImageBean->setUrl_splash_image(esc_attr($wsi_splashimage_row->url_splash_image)); $splashImageBean->setSplash_image_width(esc_attr($wsi_splashimage_row->splash_image_width)); $splashImageBean->setSplash_image_height(esc_attr($wsi_splashimage_row->splash_image_height)); $splashImageBean->setWsi_margin_top(esc_attr($wsi_splashimage_row->wsi_margin_top)); $splashImageBean->setSplash_color(esc_attr($wsi_splashimage_row->splash_color)); $splashImageBean->setWsi_display_time(esc_attr($wsi_splashimage_row->wsi_display_time)); $splashImageBean->setWsi_picture_link_url(esc_attr($wsi_splashimage_row->wsi_picture_link_url)); $splashImageBean->setWsi_picture_link_target(esc_attr($wsi_splashimage_row->wsi_picture_link_target)); $splashImageBean->setWsi_type(esc_attr($wsi_splashimage_row->wsi_type)); $splashImageBean->setWsi_opacity(esc_attr($wsi_splashimage_row->wsi_opacity)); $splashImageBean->setWsi_idle_time(esc_attr($wsi_splashimage_row->wsi_idle_time)); // Dates management $splashImageBean->setDatepicker_start(esc_attr($wsi_splashimage_row->datepicker_start)); $splashImageBean->setDatepicker_end(esc_attr($wsi_splashimage_row->datepicker_end)); // Booleans management $splashImageBean->setWsi_close_on_esc_function(esc_attr($wsi_splashimage_row->wsi_close_on_esc_function == '1' ? 'true' : 'false')); $splashImageBean->setWsi_close_on_click_function(esc_attr($wsi_splashimage_row->wsi_close_on_click_function == '1' ? 'true' : 'false')); $splashImageBean->setWsi_hide_cross(esc_attr($wsi_splashimage_row->wsi_hide_cross == '1' ? 'true' : 'false')); $splashImageBean->setWsi_disable_shadow_border(esc_attr($wsi_splashimage_row->wsi_disable_shadow_border == '1' ? 'true' : 'false')); $splashImageBean->setWsi_youtube_autoplay(esc_attr($wsi_splashimage_row->wsi_youtube_autoplay == '1' ? 'true' : 'false')); $splashImageBean->setWsi_youtube_loop(esc_attr($wsi_splashimage_row->wsi_youtube_loop == '1' ? 'true' : 'false')); $splashImageBean->setWsi_fixed_splash(esc_attr($wsi_splashimage_row->wsi_fixed_splash == '1' ? 'true' : 'false')); $splashImageBean->setWsi_display_always(esc_attr($wsi_splashimage_row->wsi_display_always == '1' ? 'true' : 'false')); $splashImageBean->setWsi_hide_on_mobile_devices(esc_attr($wsi_splashimage_row->wsi_hide_on_mobile_devices == '1' ? 'true' : 'false')); // Valeurs des onglets $splashImageBean->setWsi_youtube(esc_attr($wsi_splashimage_row->wsi_youtube)); $splashImageBean->setWsi_yahoo(esc_attr($wsi_splashimage_row->wsi_yahoo)); $splashImageBean->setWsi_dailymotion(esc_attr($wsi_splashimage_row->wsi_dailymotion)); $splashImageBean->setWsi_metacafe(esc_attr($wsi_splashimage_row->wsi_metacafe)); $splashImageBean->setWsi_swf(esc_attr($wsi_splashimage_row->wsi_swf)); $splashImageBean->setWsi_include_url(esc_attr($wsi_splashimage_row->wsi_include_url)); //No escape for HTML values. $splashImageBean->setWsi_html($wsi_splashimage_row->wsi_html); $this->splashImageBean = $splashImageBean; } return $this->splashImageBean; }
<?php // Vérification du token de sécurité. check_admin_referer('update', 'nonce_update_field'); // On met à jour la base de données (table: options) avec la fonction de wp: update $siBean = new SplashImageBean(); $configBean = new ConfigBean(); $siBean->setId($_POST['id']); $siBean->setUrl_splash_image($_POST['url_splash_image']); $siBean->setSplash_image_width($_POST['splash_image_width']); $siBean->setSplash_image_height($_POST['splash_image_height']); $siBean->setWsi_margin_top($_POST['wsi_margin_top']); $siBean->setSplash_color($_POST['splash_color']); $siBean->setWsi_display_time($_POST['wsi_display_time']); $siBean->setWsi_picture_link_url($_POST['wsi_picture_link_url']); $siBean->setWsi_picture_link_target($_POST['wsi_picture_link_target']); $siBean->setWsi_include_url($_POST['wsi_include_url']); $siBean->setWsi_type($_POST['wsi_type']); $siBean->setWsi_opacity($_POST['wsi_opacity']); $siBean->setWsi_idle_time($_POST['wsi_idle_time']); // Dates management $siBean->setDatepicker_start($_POST['datepicker_start']); $siBean->setDatepicker_end($_POST['datepicker_end']); // Booleans management $configBean->setSplash_active(isset($_POST['splash_active'])); $configBean->setWsi_first_load_mode_active(isset($_POST['wsi_first_load_mode_active'])); $siBean->setWsi_close_on_esc_function(isset($_POST['wsi_close_on_esc_function'])); $siBean->setWsi_close_on_click_function(isset($_POST['wsi_close_on_click_function'])); $siBean->setWsi_hide_cross(isset($_POST['wsi_hide_cross'])); $siBean->setWsi_disable_shadow_border(isset($_POST['wsi_disable_shadow_border'])); $siBean->setWsi_youtube_autoplay(isset($_POST['wsi_youtube_autoplay']));