Пример #1
0
 static function _enqueue_data()
 {
     //'Most recent booking for this property was 15 minute ago .Most recent booking for this property was 15 minute ago'
     if (!self::$is_working) {
         return;
     }
     $data = array();
     if (is_singular()) {
         $post_type = get_post_type();
         $book_able = array('st_hotel', 'st_cars', 'st_tours', 'st_activity', 'st_rental', 'cruise');
         if (!in_array($post_type, $book_able)) {
             return;
         }
         $label = get_post_type_object($post_type);
         $demo_mode = st()->get_option('edv_enable_demo_mode', 'off');
         if (st()->get_option('enable_user_online_noti', 'on') == 'on') {
             if ($demo_mode == 'on') {
                 $data['noty'][] = array('icon' => 'home', 'message' => sprintf(st_get_language('now_s_users_seeing_this_s'), rand(300, 5000), $label->labels->singular_name), 'type' => 'success');
             } else {
                 $data['noty'][] = array('icon' => 'home', 'message' => sprintf(st_get_language('now_s_users_seeing_this_s'), self::get_user_online(get_the_ID()), $label->labels->singular_name), 'type' => 'success');
             }
         }
         if (st()->get_option('enable_last_booking_noti', 'on') == 'on') {
             if ($demo_mode == 'on') {
                 $data['noty'][] = array('icon' => 'clock-o', 'message' => sprintf(st_get_language('most_revent_booking_for_this_s_was_s'), $label->labels->singular_name, sprintf(__('%s minutes ago', ST_TEXTDOMAIN), rand(2, 50))), 'type' => 'warning');
             } else {
                 $data['noty'][] = array('icon' => 'clock-o', 'message' => sprintf(st_get_language('most_revent_booking_for_this_s_was_s'), $label->labels->singular_name, TravelerObject::get_last_booking_string(get_the_ID())), 'type' => 'warning');
             }
         }
         $data['noti_position'] = st()->get_option('noti_position', 'topRight');
     }
     wp_localize_script('jquery', 'stanalytics', $data);
 }