Projet

Général

Profil

Révision 32700c57

Ajouté par Assos Assos il y a environ 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapQueryFetcher.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * FeedsLdapQueryFetcher
5
 * FeedsLdapQueryFetcher.
6 6
 */
7 7

  
8 8
/**
9
 * FeedsLdapQueryFetcherResult
9
 * FeedsLdapQueryFetcherResult.
10 10
 */
11 11
class FeedsLdapQueryFetcherResult extends FeedsFetcherResult {
12
  public $query_ids = array();
12
  public $query_ids = [];
13 13
  public $ldap_result;
14 14

  
15 15
  /**
16 16
   * Constructor.
17 17
   */
18 18
  public function __construct($source_config) {
19
    $this->query_ids = (isset($source_config['query_ids']) && is_array($source_config['query_ids'])) ? $source_config['query_ids'] : array();
19
    $this->query_ids = (isset($source_config['query_ids']) && is_array($source_config['query_ids'])) ? $source_config['query_ids'] : [];
20 20
    parent::__construct('');
21 21
    $this->ldap_result = $this->getRaw();
22 22
    return $this->ldap_result;
23 23
  }
24 24

  
25 25
  /**
26
   * Overrides parent::getRaw();
26
   * Overrides parent::getRaw();.
27 27
   */
28 28
  public function getRaw() {
29 29

  
30
    $results = array();
30
    $results = [];
31 31
    $count = 0;
32 32
    foreach ($this->query_ids as $i => $query_id) {
33 33
      $ldapQuery = ldap_query_get_queries($query_id, 'enabled', TRUE);
......
42 42
    }
43 43
    return $results;
44 44
  }
45

  
45 46
}
46 47

  
47 48
/**
......
58 59
    return $result;
59 60
  }
60 61

  
61

  
62 62
  /**
63 63
   * Override parent::configDefaults().
64 64
   */
65 65
  public function configDefaults() {
66
    return array(
67
      'query_ids' => array(),
68
    );
66
    return [
67
      'query_ids' => [],
68
    ];
69 69
  }
70 70

  
71
    /**
71
  /**
72 72
   * Override parent::configForm().
73 73
   */
74 74
  public function configForm(&$form_state) {
75 75
    $queries = ldap_query_get_queries(NULL, 'enabled');
76
    $query_options = array(0 => '--- select one or more queries ---');
76
    $query_options = [0 => '--- select one or more queries ---'];
77 77
    foreach ($queries as $qid => $query) {
78 78
      $query_options[$qid] = $query->name;
79 79
    }
80
    $form = array();
81
    $form['query_ids'] = array(
80
    $form = [];
81
    $form['query_ids'] = [
82 82
      '#type' => 'select',
83 83
      '#title' => t('LDAP Query'),
84 84
      '#multiple' => TRUE,
......
86 86
      '#required' => TRUE,
87 87
      '#default_value' => $this->config['query_ids'],
88 88
      '#description' => t('If more than one query is selected, results from all the queries will be returned.') .
89
        ' ' .
90
        t('Queries can be added and edited at !link', array('!link' => l(t('LDAP Query Admin'), LDAP_QUERY_INDEX_BASE_PATH))),
89
      ' ' .
90
      t('Queries can be added and edited at !link', ['!link' => l(t('LDAP Query Admin'), LDAP_QUERY_INDEX_BASE_PATH)]),
91 91
      '#options' => $query_options,
92
    );
92
    ];
93 93

  
94 94
    return $form;
95 95
  }
......
99 99
   */
100 100
  public function sourceForm($source_config) {
101 101

  
102
    $tokens = array(
102
    $tokens = [
103 103
      '!edit_link' => l(t('Edit Feed'), 'admin/structure/feeds/' . $this->id),
104
    );
104
    ];
105 105

  
106
    $form_state = array();
106
    $form_state = [];
107 107
    $form = $this->configForm($form_state);
108
    $form['preamble'] = array(
108
    $form['preamble'] = [
109 109
      '#type' => 'markup',
110 110
      '#markup' => t('This import is configured at !edit_link.', $tokens),
111
    );
111
    ];
112 112

  
113 113
    return $form;
114 114
  }
......
117 117
   * Override parent::sourceFormValidate().
118 118
   */
119 119
  public function sourceFormValidate(&$values) {
120
     // could execute query and see if it returns anything for validation
120
    // Could execute query and see if it returns anything for validation.
121 121
  }
122 122

  
123 123
}

Formats disponibles : Unified diff