Exemplo n.º 1
0
 /**
  * Get class instance
  *
  * @return \Caldera_Forms_Tracking
  */
 public static function get_instance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 /**
  * Get any admin alert/notices from remote API
  *
  * @since 1.3.4
  *
  * @return array|mixed|void
  */
 public static function get_admin_alerts()
 {
     $notices = get_option('_cf_admin_alerts', array());
     if (!is_array($notices)) {
         $notices = array();
     }
     $day_ago = time() - DAY_IN_SECONDS;
     $last_check = get_option('_cf_last_alert_check', false);
     if (false === $last_check || $day_ago > $last_check) {
         $url = Caldera_Forms_Tracking::api_url('notices');
         $r_notices = Caldera_Forms_Tracking::send_to_api($url);
         if (!empty($r_notices)) {
             $notices = array_merge($notices, $r_notices);
             update_option('_cf_admin_alerts', $notices);
         }
     }
     update_option('_cf_last_alert_check', time());
     return $notices;
 }