/**
  * True if doing WP Cron, otherwise false
  *
  * Note: If native WP Cron has been disabled and you are
  * hitting the cron endpoint with a system cron job, this
  * method will always return false.
  *
  * @return bool
  */
 static function is_doing_wp_cron()
 {
     return wp_stream_is_wp_cron_enabled() && defined('DOING_CRON') && DOING_CRON;
 }
 /**
  * Return settings fields
  *
  * @return array Multidimensional array of fields
  */
 public static function get_fields()
 {
     $fields = array('general' => array('title' => esc_html__('General', 'stream'), 'fields' => array(array('name' => 'role_access', 'title' => esc_html__('Role Access', 'stream'), 'type' => 'multi_checkbox', 'desc' => esc_html__('Users from the selected roles above will have permission to view Stream Records. However, only site Administrators can access Stream Settings.', 'stream'), 'choices' => self::get_roles(), 'default' => array('administrator')), array('name' => 'private_feeds', 'title' => esc_html__('Private Feeds', 'stream'), 'type' => 'checkbox', 'desc' => sprintf(__('Users from the selected roles above will be given a private key found in their %suser profile%s to access feeds of Stream Records securely. Please %sflush rewrite rules%s on your site after changing this setting.', 'stream'), sprintf('<a href="%s" title="%s">', admin_url(sprintf('profile.php#wp-stream-highlight:%s', WP_Stream_Feeds::USER_FEED_OPTION_KEY)), esc_attr__('View Profile', 'stream')), '</a>', sprintf('<a href="%s" title="%s" target="_blank">', esc_url('http://codex.wordpress.org/Rewrite_API/flush_rules#What_it_does'), esc_attr__('View Codex', 'stream')), '</a>'), 'after_field' => esc_html__('Enabled', 'stream'), 'default' => 0))), 'exclude' => array('title' => esc_html__('Exclude', 'stream'), 'fields' => array(array('name' => 'rules', 'title' => esc_html__('Exclude Rules', 'stream'), 'type' => 'rule_list', 'desc' => esc_html__('Create rules for excluding certain kinds of records from appearing in Stream.', 'stream'), 'default' => array(), 'nonce' => 'stream_get_ips'))), 'advanced' => array('title' => esc_html__('Advanced', 'stream'), 'fields' => array(array('name' => 'comment_flood_tracking', 'title' => esc_html__('Comment Flood Tracking', 'stream'), 'type' => 'checkbox', 'desc' => __('WordPress will automatically prevent duplicate comments from flooding the database. By default, Stream does not track these attempts unless you opt-in here. Enabling this is not necessary or recommended for most sites.', 'stream'), 'after_field' => esc_html__('Enabled', 'stream'), 'default' => 0))));
     // If Akismet is active, allow Admins to opt-in to Akismet tracking
     if (class_exists('Akismet')) {
         $akismet_tracking = array('name' => 'akismet_tracking', 'title' => esc_html__('Akismet Tracking', 'stream'), 'type' => 'checkbox', 'desc' => __('Akismet already keeps statistics for comment attempts that it blocks as SPAM. By default, Stream does not track these attempts unless you opt-in here. Enabling this is not necessary or recommended for most sites.', 'stream'), 'after_field' => esc_html__('Enabled', 'stream'), 'default' => 0);
         array_push($fields['advanced']['fields'], $akismet_tracking);
     }
     // If WP Cron is enabled, allow Admins to opt-in to WP Cron tracking
     if (wp_stream_is_wp_cron_enabled()) {
         $wp_cron_tracking = array('name' => 'wp_cron_tracking', 'title' => esc_html__('WP Cron Tracking', 'stream'), 'type' => 'checkbox', 'desc' => __('By default, Stream does not track activity performed by WordPress cron events unless you opt-in here. Enabling this is not necessary or recommended for most sites.', 'stream'), 'after_field' => esc_html__('Enabled', 'stream'), 'default' => 0);
         array_push($fields['advanced']['fields'], $wp_cron_tracking);
     }
     /**
      * Filter allows for modification of options fields
      *
      * @return array  Array of option fields
      */
     self::$fields = apply_filters('wp_stream_settings_option_fields', $fields);
     // Sort option fields in each tab by title ASC
     foreach (self::$fields as $tab => $options) {
         $titles = wp_list_pluck(self::$fields[$tab]['fields'], 'title');
         array_multisort($titles, SORT_ASC, self::$fields[$tab]['fields']);
     }
     return self::$fields;
 }