Exemplo n.º 1
0
 public static function get_fields()
 {
     if (empty(self::$fields)) {
         $fields = array('notifications' => array('title' => esc_html__('Notifications', 'stream-notifications'), 'fields' => array(array('name' => 'role_access', 'title' => esc_html__('Role Access', 'stream-notifications'), 'type' => 'multi_checkbox', 'desc' => esc_html__('Users from the selected roles above will have permission to view, create and edit Stream Notifications. However, only site Administrators can access Stream Notifications Settings.', 'stream-notifications'), 'choices' => WP_Stream_Settings::get_roles(), 'default' => array('administrator')), array('name' => 'export_rules', 'title' => esc_html__('Export Rules', 'stream'), 'type' => 'link', 'href' => add_query_arg(array('action' => 'wp_stream_notifications_export', 'stream_notifications_nonce' => wp_create_nonce('stream-notifications-nonce')), admin_url('admin-ajax.php')), 'desc' => esc_html__('Export all rules to a JSON file.', 'stream-notifications'), 'default' => 0), array('name' => 'import_rules', 'title' => esc_html__('Import Rules', 'stream-notifications'), 'type' => 'file', 'href' => add_query_arg(array('action' => 'wp_stream_notifications_import', 'stream_notifications_nonce' => wp_create_nonce('stream-notifications-nonce')), admin_url('admin-ajax.php')), 'desc' => esc_html__('Import rules from a JSON file.', 'stream-notifications'), 'default' => 0))));
         self::$fields = apply_filters('wp_stream_notifications_options_fields', $fields);
     }
     return self::$fields;
 }
Exemplo n.º 2
0
 public static function get_fields()
 {
     if (empty(self::$fields)) {
         $fields = array('reports' => array('title' => __('Reports', 'stream-reports'), 'fields' => array(array('name' => 'role_access', 'title' => __('Role Access', 'stream-reports'), 'type' => 'multi_checkbox', 'desc' => __('Users from the selected roles above will have permission to view and edit Stream Reports. However, only site Administrators can access Stream Reports Settings.', 'stream-reports'), 'choices' => WP_Stream_Settings::get_roles(), 'default' => array('administrator')))));
         self::$fields = apply_filters('wp_stream_reports_options_fields', $fields);
     }
     return self::$fields;
 }
Exemplo n.º 3
0
/**
 * @param $labels array connectors terms labels
 *
 * @action wp_stream_after_connectors_registration
 * @return string $current_version if updated correctly
 */
function wp_stream_update_migrate_old_options_to_exclude_tab($labels)
{
    global $wpdb;
    $db_version = WP_Stream_Install::$db_version;
    $current_version = WP_Stream_Install::$current;
    do_action('wp_stream_before_db_update_' . $db_version, $current_version);
    $old_options = get_option(WP_Stream_Settings::KEY, array());
    // Stream > Settings > General > Log Activity for
    if (isset($old_options['general_log_activity_for'])) {
        WP_Stream_Settings::$options['exclude_authors_and_roles'] = array_diff(array_keys(WP_Stream_Settings::get_roles()), $old_options['general_log_activity_for']);
        unset(WP_Stream_Settings::$options['general_log_activity_for']);
    }
    // Stream > Settings > Connectors > Active Connectors
    if (isset($old_options['connectors_active_connectors'])) {
        WP_Stream_Settings::$options['exclude_connectors'] = array_diff(array_keys($labels), $old_options['connectors_active_connectors']);
        unset(WP_Stream_Settings::$options['connectors_active_connectors']);
    }
    update_option(WP_Stream_Settings::KEY, WP_Stream_Settings::$options);
    do_action('wp_stream_after_db_update_' . $db_version, $current_version, $wpdb->last_error);
    if ($wpdb->last_error) {
        return false;
    }
    return $current_version;
}