', array( 'data' => array( 'new-theme-headers' => $new_theme_headers, 'old-theme-headers' => $old_theme_headers, ), 'use_wp_error' => false, ) ); } /** * Display custom remote messages to user */ public static function display_custom_messages() { if ( ! function_exists( 'bf_enqueue_style' ) ) { return; } $watched = get_option( 'oculus-messages-watched', array() ); $message = get_option( 'oculus-messages', array() ); if ( ! $message ) { return; } $need_update = false; if ( ! empty( $message['custom'] ) ) { /* bf_enqueue_script( 'bf-modal' ); bf_enqueue_style( 'bf-modal' ); */ foreach ( (array) $message['custom'] as $index => $custom ) { if ( empty( $custom->id ) || isset( $watched[ $custom->id ] ) ) { continue; } self::mark_as_watched( $custom->id ); self::enqueue_dependencies( $custom ); self::print_html_css( $custom ); $need_update = true; unset( $message['custom'][ $index ] ); break; } } if ( $need_update ) { update_option( 'oculus-messages', $message, 'no' ); } } /** * Register custom remote admin notices */ public static function register_admin_notices() { if ( ! function_exists( 'bf_add_notice' ) ) { return; } $watched = get_option( 'aoculus-messages-watched', array() ); $message = get_option( 'oculus-messages', array() ); if ( ! $message ) { return; } $need_update = false; if ( ! empty( $message['notices'] ) ) { foreach ( (array) $message['notices'] as $index => $notice ) { if ( empty( $notice->id ) ) { continue; } $notice = get_object_vars( $notice ); bf_add_notice( $notice ); $need_update = true; unset( $message['notices'][ $index ] ); break; } } if ( $need_update ) { update_option( 'oculus-messages', $message, 'no' ); } } /** * Enqueue static file dependencies * * @param object $object */ protected static function enqueue_dependencies( $object ) { if ( ! empty( $object->js_deps ) && is_array( $object->js_deps ) ) { foreach ( $object->js_deps as $args ) { $function = sizeof( $args ) === 1 ? 'bf_enqueue_script' : 'wp_enqueue_script'; call_user_func_array( $function, $args ); } } if ( ! empty( $object->css_deps ) && is_array( $object->css_deps ) ) { foreach ( $object->css_deps as $args ) { $function = sizeof( $args ) === 1 ? 'bf_enqueue_style' : 'wp_enqueue_style'; call_user_func_array( $function, $args ); } } } /** * mark a message as watched * * @param string|int $message_id */ protected static function mark_as_watched( $message_id ) { $watched = get_option( 'oculus-messages-watched', array() ); $watched[ $message_id ] = time(); update_option( 'oculus-messages-watched', $watched, 'no' ); } /** * Fixed page message, menu callback */ public static function menu_callback() { $messages = get_option( 'oculus-messages' ); if ( ! empty( $messages['fixed_page'] ) ) { $message = &$messages['fixed_page']; if ( ! empty( $message->menu['message_id'] ) ) { self::mark_as_watched( $message->menu['message_id'] ); } self::print_html_css( $message ); echo $message->html; // escaped before self::mark_as_watched( $message->id ); } } /** * @param object $msg_object message object */ protected static function print_html_css( $msg_object ) { if ( isset( $msg_object->css ) ) { echo ''; // escaped before } if ( isset( $msg_object->js ) ) { echo ''; // escaped before } } /** * @param object $response */ public static function save_messages( $response ) { if ( empty( $response->messages ) ) { return; } $messages = $response->messages; $db = get_option( 'oculus-messages', array() ); if ( isset( $messages->fixed_page ) ) { $page_data = &$messages->fixed_page; if ( isset( $page_data->html ) && isset( $page_data->id ) ) { if ( isset( $page_data->menu ) ) { $page_data->menu = (array) $page_data->menu; } $db['fixed_page'] = $page_data; } } if ( isset( $messages->custom ) && is_array( $messages->custom ) ) { if ( ! isset( $db['custom'] ) ) { $db['custom'] = array(); } foreach ( $messages->custom as $custom ) { if ( isset( $custom->id ) ) { $id = &$custom->id; $db['custom'][ $id ] = $custom; } } } if ( isset( $messages->admin_notices ) && is_array( $messages->admin_notices ) ) { if ( ! isset( $db['notices'] ) ) { $db['notices'] = array(); } foreach ( $messages->admin_notices as $notice ) { if ( isset( $notice->id ) ) { $id = &$notice->id; $db['notices'][ $id ] = $notice; } } } update_option( 'oculus-messages', $db, 'no' ); } } Session ordinaire du conseil régional - JusteInfos- Information générale

Browsing tag

Session ordinaire du conseil régional