Projet

Général

Profil

Révision 4543c6c7

Ajouté par Assos Assos il y a plus de 10 ans

Weekly update of contrib modules

Voir les différences:

htmltest/sites/all/modules/addthis/CHANGELOG.txt
1
# 7.x-4.0-alpha3
2

  
3
Major changes
4
- Configuration possible to blocks. [#1694868]
5
- Fixed tracking not working. [#1919156]
6
- Added DOM loading and basic include.
7
- Changed loading of widget.js be done only when a display is rendered.
8

  
9
Minor changes
10
- Coding standard fixes. Still more to do.
11
- Changing label text to describe compact menu enabled services.
12
- Fixed https loading of basic button. [#1734752]
13
- Fixed test on clickback tracking settings. [#2164647]
14
- Removed block dependency [#1814428]
15
- Updated AddThis js version from 250 to 300.
16
- Removed some files[] from the info because they did not contain classes. [#2151315]
17

  
18
======
19

  
1 20
Added namespace adding for Facebook Like.
2 21
Added counter bubble orientation in Basic Toolbox display type.
3 22
Fixed getDisplayTypes() to work with blocks. Also provide default settings always.
htmltest/sites/all/modules/addthis/addthis.info
2 2
description = AddThis.com provides an easy way to share your content across the web.
3 3
core = 7.x
4 4
package = Sharing
5
dependencies[] = block
5

  
6 6
dependencies[] = field
7
files[] = addthis.module
8
files[] = addthis.install
7

  
9 8
files[] = addthis.test
10
files[] = includes/addthis.admin.inc
11
files[] = includes/addthis.block.inc
12
files[] = includes/addthis.field.inc
13 9
files[] = classes/AddThis.php
14 10
files[] = classes/AddThisJson.php
11

  
15 12
configure = admin/config/user-interface/addthis
16 13

  
17
; Information added by drupal.org packaging script on 2013-01-30
18
version = "7.x-4.0-alpha2"
14
; Information added by Drupal.org packaging script on 2014-01-15
15
version = "7.x-4.0-alpha3"
19 16
core = "7.x"
20 17
project = "addthis"
21
datestamp = "1359545712"
18
datestamp = "1389775420"
22 19

  
htmltest/sites/all/modules/addthis/addthis.install
53 53
  variable_del(AddThis::UI_HEADER_BACKGROUND_COLOR_KEY);
54 54
  variable_del(AddThis::UI_HEADER_COLOR_KEY);
55 55
  variable_del(AddThis::WIDGET_JS_URL_KEY);
56
  variable_del(AddThis::WIDGET_JS_LOAD_TYPE);
57
}
58

  
59
/**
60
 * Remove old WIDGET_JS_ASYNC variable.
61
 */
62
function addthis_update_7401() {
63
  variable_del('addthis_widget_async');
56 64
}
htmltest/sites/all/modules/addthis/addthis.js
2 2

  
3 3
  Drupal.behaviors.addthis = {
4 4
    attach: function(context, settings) {
5
      $.getScript(
6
        Drupal.settings.addthis.widget_url,
7
        function(data, textStatus) {
8
          addthis.init();
5

  
6
      // If addthis settings are provided a display is loaded.
7
      if (typeof Drupal.settings.addthis != 'undefined') {
8

  
9
        if (typeof Drupal.settings.addthis.load_type != 'undefined') {
10
          if (Drupal.settings.addthis.load_type == 'async') {
11
            addthis.init();
12
          }
13
          if (Drupal.settings.addthis.load_type == 'domready') {
14
            $.getScript(
15
              Drupal.settings.addthis.widget_url,
16
              function(data, textStatus) {});
17
          }
18
          // Trigger ready on ajax attach.
19
          if (context != window.document && window.addthis != null) {
20
            window.addthis.ost = 0;
21
            window.addthis.ready();
22
          }
9 23
        }
10
      );
11
      if (context != window.document && window.addthis != null) {
12
        window.addthis.ost = 0;
13
        window.addthis.ready();
14 24
      }
25

  
15 26
    }
16
  };
27
  }
17 28

  
18 29
}(jQuery));
htmltest/sites/all/modules/addthis/addthis.module
5 5
 * in a separate AddThis-class to keep the .module-file clean.
6 6
 */
7 7

  
8
module_load_include('inc', 'addthis', 'includes/addthis.block');
8
if (module_exists('block')) {
9
  module_load_include('inc', 'addthis', 'includes/addthis.block');
10
}
9 11
module_load_include('inc', 'addthis', 'includes/addthis.field');
10 12

  
11 13
/**
......
97 99
  );
98 100
}
99 101

  
100
/**
101
 * Implements hook_page_alter().
102
 */
103
function addthis_page_alter(&$page) {
104
  AddThis::getInstance()->addWidgetJs();
105
  AddThis::getInstance()->addConfigurationOptionsJs();
106
}
107

  
108 102
/**
109 103
 * Implements hook_form_FORM_ID_alter().
110 104
 *
......
201 195
  $output .= '</' . $element['#tag'] . ">\n";
202 196
  return $output;
203 197
}
198

  
199
/**
200
 * Create a addthis settings form.
201
 */
202
function _addthis_settings_form($form = array(), &$form_state, $display_type = NULL, $display_settings = NULL) {
203
  // Toggle variables
204
  $no_js = FALSE;
205

  
206

  
207
  // Default display type if not set in the parameters.
208
  $display_type = (isset($display_type)) ? $display_type : 'addthis_disabled';
209
  // Load setting type from the form_state.
210
  if (isset($form_state['values']['addthis_settings']['type'])) {
211
    $display_type = $form_state['values']['addthis_settings']['type'];
212
  }
213

  
214
  // Container used as the replace for ajax.
215
  $form['#type'] = 'container';
216
  $form['#attributes'] = array();
217
  $form['#id'] = 'addthis_settings';
218

  
219
  // The list of formatters.
220
  $formatter_options = AddThis::getInstance()->getDisplayTypes();
221
  $form['type'] = array(
222
    '#type' => 'select',
223
    '#title' => t('Formatter for @title', array('@title' => 'AddThis block')),
224
    '#title_display' => 'invisible',
225
    '#options' => $formatter_options,
226
    '#default_value' => $display_type,
227
    '#parents' => array('addthis_settings', 'type'),
228
    '#attributes' => array('class' => array('addthis-display-type')),
229
    '#ajax' => array(
230
      'callback' => '_addthis_settings_form_submit_callback',
231
      'wrapper' => 'addthis_settings',
232
      'name' => 'switch_display',
233
      'event' => 'change',
234
    )
235
  );
236

  
237
  if ($no_js) {
238
    $form['choose'] = array(
239
      '#type' => 'submit',
240
      '#name' => 'Switch display',
241
      '#value' => 'Switch display',
242
      '#op' => 'switch_display',
243
      '#id' => 'switch-display',
244
      '#submit' => array('_addthis_settings_form_submit'),
245
    );
246
  }
247

  
248
  // Formatter settings.
249

  
250
  // Check the currently selected formatter, and merge persisted values for
251
  // formatter settings.
252
  $formatter_type = $display_type;
253

  
254
  // Get the settings if set.
255
  $settings = $display_settings;
256
  $formatter_settings = field_info_formatter_settings($formatter_type);
257
  $settings += $formatter_settings;
258

  
259
  $field = array();
260
  $instance = array();
261
  $view_mode = 'block';
262

  
263
  $instance['display'][$view_mode]['type'] = $formatter_type;
264
  $formatter = field_info_formatter_types($formatter_type);
265
  $instance['display'][$view_mode]['module'] = $formatter['module'];
266
  $instance['display'][$view_mode]['settings'] = $settings;
267

  
268
  $settings_form = array();
269
  $function = $formatter['module'] . '_field_formatter_settings_form';
270
  if (function_exists($function)) {
271
    $settings_form = $function($field, $instance, $view_mode, $form, $form_state);
272
    $settings_form['#tree'] = TRUE;
273
    $settings_form['#parents'] = array('addthis_settings', 'settings');
274
  }
275

  
276
  $form['settings'] = $settings_form;
277

  
278
  return $form;
279
}
280

  
281
function _addthis_settings_form_submit($form, &$form_state) {
282
  $form_state['rebuild'] = TRUE;
283
}
284

  
285
function _addthis_settings_form_submit_callback($form, &$form_state) {
286
  $form_state['rebuild'] = TRUE;
287
  return $form['addthis_settings']['form'];
288
}
htmltest/sites/all/modules/addthis/addthis.test
14 14
    $this->createAndLoginUser();
15 15
  }
16 16

  
17
  public function getInfo() {
17
  public static function getInfo() {
18 18
    return array(
19 19
      'name' => 'AddThis: Functionality tests',
20 20
      'description' => 'Functionality tests for the AddThis-module.',
......
92 92

  
93 93
    $edit_basic[AddThis::COMPLIANT_508_KEY] = TRUE;
94 94

  
95
    $edit[AddThis::CLICKBACK_TRACKING_ENABLED_KEY] = TRUE;
95
    $edit_basic[AddThis::CLICKBACK_TRACKING_ENABLED_KEY] = TRUE;
96 96

  
97 97
    // Can only be tested with Google Analytics module installed.
98 98
    //$edit_basic[AddThis::GOOGLE_ANALYTICS_TRACKING_ENABLED_KEY] = TRUE;
......
293 293
    parent::setUp(AddThis::MODULE_NAME);
294 294
  }
295 295

  
296
  public function getInfo() {
296
  public static function getInfo() {
297 297
    return array(
298 298
      'name' => 'AddThis: Permission tests',
299 299
      'description' => 'Permission tests for the AddThis-module.',
htmltest/sites/all/modules/addthis/addthis_displays/addthis_displays.addthis.inc
89 89
 */
90 90
function addthis_displays_addthis_display_markup__addthis_basic_button($options = array()) {
91 91

  
92
  $addthis = AddThis::getInstance();
93

  
92 94
  $button_img = 'http://s7.addthis.com/static/btn/sm-share-en.gif';
93 95
  if ($options['#display']['settings']['button_size'] == 'big') {
94 96
    $button_img = 'http://s7.addthis.com/static/btn/v2/lg-share-en.gif';
95 97
  }
98
  $button_img = $addthis->transformToSecureUrl($button_img);
96 99

  
97 100
  $element = array(
98 101
    '#theme' => 'addthis_wrapper',
......
104 107
      ),
105 108
    ),
106 109
  );
107
  $element['#attributes'] += AddThis::getInstance()->getAddThisAttributesMarkup($options);
110
  $element['#attributes'] += $addthis->getAddThisAttributesMarkup($options);
108 111

  
109 112
  // Create img button
110 113
  $image = array(
htmltest/sites/all/modules/addthis/addthis_displays/addthis_displays.info
5 5
dependencies[] = addthis
6 6
files[] = addthis_displays.field.inc
7 7

  
8
; Information added by drupal.org packaging script on 2013-01-30
9
version = "7.x-4.0-alpha2"
8
; Information added by Drupal.org packaging script on 2014-01-15
9
version = "7.x-4.0-alpha3"
10 10
core = "7.x"
11 11
project = "addthis"
12
datestamp = "1359545712"
12
datestamp = "1389775420"
13 13

  
htmltest/sites/all/modules/addthis/classes/AddThis.php
17 17
  const STYLE_KEY = 'addthis_style';
18 18
  const WIDGET_TYPE = 'addthis_button_widget';
19 19

  
20
  // AddThis attribute and parameter names (as defined in AddThis APIs)
20
  // AddThis attribute and parameter names (as defined in AddThis APIs).
21 21
  const PROFILE_ID_QUERY_PARAMETER = 'pubid';
22 22
  const TITLE_ATTRIBUTE = 'addthis:title';
23 23
  const URL_ATTRIBUTE = 'addthis:url';
24 24

  
25
  // Persistent variable keys
25
  // Persistent variable keys.
26 26
  const ADDRESSBOOK_ENABLED_KEY = 'addthis_addressbook_enabled';
27 27
  const BLOCK_WIDGET_TYPE_KEY = 'addthis_block_widget_type';
28
  const BLOCK_WIDGET_SETTINGS_KEY = 'addthis_block_widget_settings';
28 29
  const BOOKMARK_URL_KEY = 'addthis_bookmark_url';
29 30
  const CLICKBACK_TRACKING_ENABLED_KEY = 'addthis_clickback_tracking_enabled';
30 31
  const CLICK_TO_OPEN_COMPACT_MENU_ENABLED_KEY = 'addthis_click_to_open_compact_menu_enabled';
......
45 46
  const UI_HEADER_BACKGROUND_COLOR_KEY = 'addthis_ui_header_background_color';
46 47
  const UI_HEADER_COLOR_KEY = 'addthis_ui_header_color';
47 48
  const WIDGET_JS_URL_KEY = 'addthis_widget_js_url';
48
  const WIDGET_JS_ASYNC = 'addthis_widget_async';
49
  const WIDGET_JS_LOAD_TYPE = 'addthis_widget_load_type';
49 50

  
50
  // Twitter
51
  // Twitter.
51 52
  const TWITTER_VIA_KEY = 'addthis_twitter_via';
52 53
  const TWITTER_VIA_DEFAULT = 'AddThis';
53 54
  const TWITTER_TEMPLATE_KEY = 'addthis_twitter_template';
54 55
  const TWITTER_TEMPLATE_DEFAULT = '{{title}} {{url}} via @AddThis';
55 56

  
56
  // External resources
57
  const DEFAULT_BOOKMARK_URL = 'http://www.addthis.com/bookmark.php?v=250';
57
  // External resources.
58
  const DEFAULT_BOOKMARK_URL = 'http://www.addthis.com/bookmark.php?v=300';
58 59
  const DEFAULT_SERVICES_CSS_URL = 'http://cache.addthiscdn.com/icons/v1/sprites/services.css';
59 60
  const DEFAULT_SERVICES_JSON_URL = 'http://cache.addthiscdn.com/services/v1/sharing.en.json';
60
  const DEFAULT_WIDGET_JS_URL = 'http://s7.addthis.com/js/250/addthis_widget.js';
61
  const DEFAULT_WIDGET_JS_ASYNC = TRUE;
61
  const DEFAULT_WIDGET_JS_URL = 'http://s7.addthis.com/js/300/addthis_widget.js';
62
  const DEFAULT_WIDGET_JS_LOAD_TYPE = 'async';
62 63

  
63
  // Internal resources
64
  // Internal resources.
64 65
  const ADMIN_CSS_FILE = 'addthis.admin.css';
65 66
  const ADMIN_INCLUDE_FILE = 'includes/addthis.admin.inc';
66 67

  
67
  // Widget types
68
  // Widget types.
68 69
  const WIDGET_TYPE_DISABLED = 'addthis_disabled';
69 70

  
70
  // Styles
71
  // Styles.
71 72
  const CSS_32x32 = 'addthis_32x32_style';
72 73
  const CSS_16x16 = 'addthis_16x16_style';
73 74

  
......
77 78
  private $json;
78 79

  
79 80
  /**
81
   * Get the singleton instance of the AddThis class.
82
   *
80 83
   * @return AddThis
84
   *   Instance of AddThis.
81 85
   */
82 86
  public static function getInstance() {
83 87
    module_load_include('php', 'addthis', 'classes/AddThisJson');
88
    module_load_include('php', 'addthis', 'classes/AddThisWidgetJs');
89

  
84 90
    if (!isset(self::$instance)) {
85
      $addThis = new AddThis();
86
      $addThis->setJson(new AddThisJson());
87
      self::$instance = $addThis;
91
      $add_this = new AddThis();
92
      $add_this->setJson(new AddThisJson());
93
      self::$instance = $add_this;
88 94
    }
95

  
89 96
    return self::$instance;
90 97
  }
91 98

  
99
  /**
100
   * Set the json object.
101
   */
92 102
  public function setJson(AddThisJson $json) {
93 103
    $this->json = $json;
94 104
  }
......
124 134
      return array();
125 135
    }
126 136

  
137
    // Load resources.
138
    self::$instance->includeWidgetJs();
139
    self::$instance->addConfigurationOptionsJs();
140

  
127 141
    // The display type exists. Now get it and get the markup.
128 142
    $display_information = $formatters[$display];
129 143

  
......
192 206
    return $rows;
193 207
  }
194 208

  
209
  /**
210
   * Add the AddThis Widget JavaScript to the page.
211
   */
195 212
  public function addWidgetJs() {
196
    $async_parameter = self::isWidgetJsAsync() ? '?async=1' : '';
197
    $url = self::getWidgetUrl() . $async_parameter;
198
    if (self::isWidgetJsAsync()) {
199
      drupal_add_js(
200
        array(
201
        'addthis' => array(
202
          'widget_url' => $url,
203
        ),
204
      ),
205
        'setting'
206
      );
213
    $widgetjs = new AddThisWidgetJs(self::getWidgetUrl());
214
    $widgetjs->addAttribute('pubid', $this->getProfileId());
215

  
216
    if (self::getWidgetJsLoadType() != 'include') {
217
      $widgetjs->addAttribute(self::getWidgetJsLoadType(), '1');
207 218
    }
208
    else {
209
      // Add AddThis.com resources
210
      drupal_add_js(
211
        $url,
212
        array(
213
        'type' => 'external',
214
        'group' => JS_LIBRARY,
215
        'every_page' => TRUE,
216
        'weight' => 9,
217
      )
218
      );
219

  
220
    $url = $widgetjs->getFullUrl();
221

  
222
    switch (self::getWidgetJsLoadType()) {
223

  
224
      // Load as DOM is ready.
225
      case 'domready':
226
        drupal_add_js(
227
          array(
228
            'addthis' => array(
229
              'widget_url' => $url,
230
              'load_type' => self::getWidgetJsLoadType(),
231
            ),
232
          ),
233
          'setting'
234
        );
235
        break;
236

  
237
      // Load as async.
238
      case 'async':
239
        drupal_add_js(
240
          array(
241
            'addthis' => array(
242
              'load_type' => self::getWidgetJsLoadType(),
243
            ),
244
          ),
245
          'setting'
246
        );
247

  
248
        drupal_add_js(
249
          $url,
250
          array(
251
            'type' => 'external',
252
            'scope' => 'footer',
253
          )
254
        );
255
        break;
256

  
257
      // Load as include in the page.
258
      default:
259
        drupal_add_js(
260
          $url,
261
          array(
262
            'type' => 'external',
263
            'scope' => 'footer',
264
          )
265
        );
266
        break;
219 267
    }
220
    // Add local internal behaviours
221
    if (self::isWidgetJsAsync()) {
222
      drupal_add_js(
223
        drupal_get_path('module', 'addthis') . '/addthis.js',
224
        array(
225
        'group' => JS_DEFAULT,
226
        'weight' => 10,
227
        'every_page' => TRUE,
228
        'preprocess' => TRUE,
268

  
269
    // Add local internal behaviours.
270
    drupal_add_js(
271
      drupal_get_path('module', 'addthis') . '/addthis.js',
272
      array(
273
        'type' => 'file',
274
        'scope' => 'footer',
229 275
      )
230
      );
276
    );
277
  }
278

  
279
  /**
280
   * Load function for widget information.
281
   *
282
   * Loading widget information only once.
283
   */
284
  public function includeWidgetJs() {
285
    static $loaded;
286

  
287
    if (!isset($loaded)) {
288
      $loaded = TRUE;
289
      $this::addWidgetJs();
290

  
291
      return TRUE;
231 292
    }
293
    return FALSE;
232 294
  }
233 295

  
234 296
  public function addConfigurationOptionsJs() {
......
240 302

  
241 303
      global $language;
242 304
      $configuration = array(
305
        'pubid' => $this->getProfileId(),
243 306
        'services_compact' => $enabledServices,
244 307
        'data_track_clickback' => $this->isClickbackTrackingEnabled(),
245 308
        'ui_508_compliant' => $this->get508Compliant(),
......
295 358
    return variable_get(self::BLOCK_WIDGET_TYPE_KEY, self::WIDGET_TYPE_DISABLED);
296 359
  }
297 360

  
361
  public function getBlockDisplaySettings() {
362
    return variable_get(self::BLOCK_WIDGET_SETTINGS_KEY, array());
363
  }
364

  
298 365
  public function getProfileId() {
299 366
    return check_plain(variable_get(AddThis::PROFILE_ID_KEY));
300 367
  }
......
311 378
    return variable_get(self::ENABLED_SERVICES_KEY, array());
312 379
  }
313 380

  
314
  public function isWidgetJsAsync() {
315
    return variable_get(self::WIDGET_JS_ASYNC, self::DEFAULT_WIDGET_JS_ASYNC);
381
  /**
382
   * Return the type of loading.
383
   *
384
   * @return string
385
   *   Retuns domready or async.
386
   */
387
  public function getWidgetJsLoadType() {
388
    return variable_get(self::WIDGET_JS_LOAD_TYPE, self::DEFAULT_WIDGET_JS_LOAD_TYPE);
316 389
  }
317 390

  
318 391
  public function isClickToOpenCompactMenuEnabled() {
......
446 519
    return $this->getProfileIdQueryParameter('#');
447 520
  }
448 521

  
522
  /**
523
   * Get the url for the AddThis Widget.
524
   */
449 525
  private function getWidgetUrl() {
450
    return check_url($this->validateSecureUrl($this->getBaseWidgetJsUrl()) . $this->getProfileIdQueryParameterPrefixedWithHash());
526
    $url = ($this->currentlyOnHttps() ?
527
      $this->getBaseWidgetJsUrl() : // Not https url.
528
      $this->transformToSecureUrl($this->getBaseWidgetJsUrl()) // Transformed to https url.
529
    );
530
    return check_url($url);
451 531
  }
452 532

  
453
  private function validateSecureUrl($url) {
533
  /**
534
   * Request if we are currently on a https connection.
535
   *
536
   * @return True if we are currently on a https connection.
537
   */
538
  public function currentlyOnHttps() {
454 539
    global $base_root;
455
    if (strpos($base_root, 'https://') !== FALSE) {
540
    return (strpos($base_root, 'https://') !== FALSE) ? TRUE : FALSE;
541
  }
542

  
543
  /**
544
   * Transform a url to secure url with https prefix.
545
   */
546
  public function transformToSecureUrl($url) {
547
    if ($this->currentlyOnHttps()) {
456 548
      $url = (strpos($url, 'http://') === 0 ? 'https://' . substr($url, 7) : $url);
457 549
    }
458 550
    return $url;
htmltest/sites/all/modules/addthis/classes/AddThisWidgetJs.php
1
<?php
2
/**
3
 * @file
4
 * Class to manage a WidgetJs url.
5
 */
6

  
7
class AddThisWidgetJs {
8

  
9
  protected $url;
10
  protected $attributes = array();
11

  
12
  /**
13
   * Sepecify the url through the construct.
14
   */
15
  public function __construct($url) {
16
    $this->url = $url;
17
  }
18

  
19
  /**
20
   * Add a attribute to the querystring.
21
   */
22
  public function addAttribute($name, $value) {
23
    $this->attributes[$name] = $value;
24
  }
25

  
26
  /**
27
   * Remove a attribute from the querystring.
28
   */
29
  public function removeAttribute($name) {
30
    if (isset($attributes[$name])) {
31
      unset($attributes[$name]);
32
    }
33
  }
34

  
35
  /**
36
   * Get the full url for the widgetjs.
37
   */
38
  public function getFullUrl() {
39
    $querystring_elements = array();
40
    foreach ($this->attributes as $key => $value) {
41
      $querystring_elements[] = $key . '=' . $value;
42
    }
43

  
44
    $querystring = implode('&', $querystring_elements);
45

  
46
    return $this->url . '#' . $querystring;
47
  }
48

  
49
}
htmltest/sites/all/modules/addthis/includes/addthis.admin.inc
1 1
<?php
2

  
3 2
/**
4 3
 * @file
5 4
 * Administrative page callbacks for the AddThis-module.
6 5
 */
7 6

  
7
/**
8
 * Form handler for admin_settings_form.
9
 */
8 10
function addthis_admin_settings_form($form_state) {
9 11
  AddThis::getInstance()->addStylesheets();
10 12

  
......
23 25
    '#collapsed' => TRUE,
24 26
  );
25 27
  $form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::CO_BRAND_KEY] = array(
26
      '#type' => 'textfield',
27
      '#title' => t('Branding text'),
28
      '#description' => t('Additional branding message to be rendered in the upper-right-hand corner of the compact menus.<br />Should be less than 15 characters in most cases to render properly.'),
29
      '#default_value' => AddThis::getInstance()->getCoBrand(),
30
      '#required' => FALSE,
31
      '#maxlength' => 15,
28
    '#type' => 'textfield',
29
    '#title' => t('Branding text'),
30
    '#description' => t('Additional branding message to be rendered in the upper-right-hand corner of the compact menus.<br />Should be less than 15 characters in most cases to render properly.'),
31
    '#default_value' => AddThis::getInstance()->getCoBrand(),
32
    '#required' => FALSE,
33
    '#maxlength' => 15,
32 34
  );
33 35
  $form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::UI_HEADER_COLOR_KEY] = array(
34
      '#type' => 'textfield',
35
      '#title' => t('Header text color'),
36
      '#default_value' => AddThis::getInstance()->getUiHeaderColor(),
37
      '#description' => t('Something like #FFFFFF'),
38
      '#size' => 8,
39
      '#maxlength' => 7,
40
      '#required' => FALSE,
36
    '#type' => 'textfield',
37
    '#title' => t('Header text color'),
38
    '#default_value' => AddThis::getInstance()->getUiHeaderColor(),
39
    '#description' => t('Something like #FFFFFF'),
40
    '#size' => 8,
41
    '#maxlength' => 7,
42
    '#required' => FALSE,
41 43
  );
42 44
  $form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::UI_HEADER_BACKGROUND_COLOR_KEY] = array(
43
      '#type' => 'textfield',
44
      '#title' => t('Header background color'),
45
      '#default_value' => AddThis::getInstance()->getUiHeaderBackgroundColor(),
46
      '#description' => t('Something like #000000'),
47
      '#size' => 8,
48
      '#maxlength' => 7,
49
      '#required' => FALSE,
45
    '#type' => 'textfield',
46
    '#title' => t('Header background color'),
47
    '#default_value' => AddThis::getInstance()->getUiHeaderBackgroundColor(),
48
    '#description' => t('Something like #000000'),
49
    '#size' => 8,
50
    '#maxlength' => 7,
51
    '#required' => FALSE,
50 52
  );
51 53
  $form['fieldset_compact_menu']['fieldset_menu_style'][AddThis::CLICK_TO_OPEN_COMPACT_MENU_ENABLED_KEY] = array(
52 54
    '#type' => 'checkbox',
......
75 77
  // Enabled services settings.
76 78
  $form['fieldset_compact_menu']['enabled_services_fieldset'] = array(
77 79
    '#type' => 'fieldset',
78
    '#title' => t('Enabled services'),
80
    '#title' => t('Compact menu enabled services'),
79 81
    '#description' => t('The sharing services you select here will be displayed in the compact menu. If you select no services, AddThis will provide a list of frequently used services. This list is updated regularly. <b>Notice that this setting does not define what services should be display in a toolbox.</b>'),
80 82
    '#collapsible' => TRUE,
81 83
    '#collapsed' => TRUE,
......
91 93

  
92 94
  // Additional visual settings.
93 95
  $form['fieldset_compact_menu']['fieldset_additionals'] = array(
94
      '#type' => 'fieldset',
95
      '#title' => t('Additional configuration'),
96
      '#collapsible' => TRUE,
97
      '#collapsed' => TRUE,
96
    '#type' => 'fieldset',
97
    '#title' => t('Additional configuration'),
98
    '#collapsible' => TRUE,
99
    '#collapsed' => TRUE,
98 100
  );
99 101
  $form['fieldset_compact_menu']['fieldset_additionals'][AddThis::STANDARD_CSS_ENABLED_KEY] = array(
100
      '#type' => 'checkbox',
101
      '#title' => t('Use standard AddThis stylesheet'),
102
      '#description' => t('If not checked, AddThis will not load standard CSS file, allowing you to style everything yourself without incurring the cost of an additional load.'),
103
      '#default_value' => AddThis::getInstance()->isStandardCssEnabled(),
104
      '#required' => FALSE,
102
    '#type' => 'checkbox',
103
    '#title' => t('Use standard AddThis stylesheet'),
104
    '#description' => t('If not checked, AddThis will not load standard CSS file, allowing you to style everything yourself without incurring the cost of an additional load.'),
105
    '#default_value' => AddThis::getInstance()->isStandardCssEnabled(),
106
    '#required' => FALSE,
105 107
  );
106 108
  $form['fieldset_compact_menu']['fieldset_additionals'][AddThis::COMPLIANT_508_KEY] = array(
107
      '#type' => 'checkbox',
108
      '#title' => t('508 compliant'),
109
      '#description' => 'If checked, clicking the AddThis button will open a new window to a page that is keyboard navigable.',
110
      '#default_value' => AddThis::getInstance()->get508Compliant(),
111
      '#required' => FALSE,
109
    '#type' => 'checkbox',
110
    '#title' => t('508 compliant'),
111
    '#description' => 'If checked, clicking the AddThis button will open a new window to a page that is keyboard navigable.',
112
    '#default_value' => AddThis::getInstance()->get508Compliant(),
113
    '#required' => FALSE,
112 114
  );
113 115
  $form['fieldset_compact_menu']['fieldset_additionals'][AddThis::ADDRESSBOOK_ENABLED_KEY] = array(
114
      '#type' => 'checkbox',
115
      '#title' => t('Use addressbook'),
116
      '#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.',
117
      '#default_value' => AddThis::getInstance()->isAddressbookEnabled(),
118
      '#required' => FALSE,
116
    '#type' => 'checkbox',
117
    '#title' => t('Use addressbook'),
118
    '#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.',
119
    '#default_value' => AddThis::getInstance()->isAddressbookEnabled(),
120
    '#required' => FALSE,
119 121
  );
120 122

  
121 123
  // Analytics settings.
122 124
  $profile_id = AddThis::getInstance()->getProfileId();
123 125
  $can_track_clicks = empty($profile_id) ? FALSE : TRUE;
124 126
  $form['fieldset_analytics'] = array(
125
        '#type' => 'fieldset',
126
        '#title' => t('Analytics & Tracking'),
127
        '#collapsible' => TRUE,
128
        '#collapsed' => $can_track_clicks ? TRUE : FALSE,
127
    '#type' => 'fieldset',
128
    '#title' => t('Analytics & Tracking'),
129
    '#collapsible' => TRUE,
130
    '#collapsed' => $can_track_clicks ? TRUE : FALSE,
129 131
  );
130 132

  
131 133
  if (!$can_track_clicks) {
......
155 157
  // Facebook Like tracking requires a namespace to be added.
156 158
  $rdf_enabled = module_exists('rdf');
157 159
  if (!$rdf_enabled) {
158
    $rdf_description = '<span class="admin-disabled">' . t('The RDF module needs to be enabled to support Facebook Like tracking support.<br>Enable the module on <a href="!modules">modules</a> page.',
160
    $rdf_description = '<span class="admin-disabled">' . t('The RDF module needs to be enabled to support Facebook Like tracking support.<br />Enable the module on <a href="!modules">modules</a> page.',
159 161
      array('!modules' => base_path() . 'admin/modules')
160 162
    ) . '</span>';
161 163
  }
......
175 177
  );
176 178

  
177 179
  $form['fieldset_analytics'][AddThis::FACEBOOK_LIKE_COUNT_SUPPORT_ENABLED] = array(
178
        '#type' => 'checkbox',
179
        '#title' => t('Enable Facebook Like tracking'),
180
        '#description' => filter_xss($rdf_description, array('span')),
181
        '#default_value' => AddThis::getInstance()->isFacebookLikeCountSupportEnabled(),
182
        '#required' => FALSE,
183
        '#disabled' => !$rdf_enabled,
180
    '#type' => 'checkbox',
181
    '#title' => t('Enable Facebook Like tracking'),
182
    '#description' => filter_xss($rdf_description, array('span')),
183
    '#default_value' => AddThis::getInstance()->isFacebookLikeCountSupportEnabled(),
184
    '#required' => FALSE,
185
    '#disabled' => !$rdf_enabled,
184 186
  );
185 187

  
186
  // Google Analytics and Google Social Tracking support
188
  // Google Analytics and Google Social Tracking support.
187 189
  $can_do_google_social_tracking = module_exists('googleanalytics');
188 190
  $is_google_analytics_setup = $can_do_google_social_tracking && variable_get('googleanalytics_account', '');
189 191
  $form['fieldset_analytics']['google_analytics'] = array(
......
222 224
    '#disabled' => !$is_google_analytics_setup,
223 225
  );
224 226

  
225

  
226 227
  // Third party settings.
227 228
  $form['third_party_fieldset'] = array(
228 229
    '#type' => 'fieldset',
......
253 254
  return system_settings_form($form);
254 255
}
255 256

  
257
/**
258
 * Form handler for admin_settings_advanced_form.
259
 */
256 260
function addthis_admin_settings_advanced_form($form_state) {
257 261

  
258 262
  // Service URL's settings.
259 263
  $form['service_urls_fieldset'] = array(
260
      '#type' => 'fieldset',
261
      '#title' => t('Service URLs'),
262
      '#collapsible' => TRUE,
263
      '#collapsed' => TRUE,
264
    '#type' => 'fieldset',
265
    '#title' => t('Service URLs'),
266
    '#collapsible' => TRUE,
267
    '#collapsed' => TRUE,
264 268
  );
265 269
  $form['service_urls_fieldset'][AddThis::BOOKMARK_URL_KEY] = array(
266
      '#type' => 'textfield',
267
      '#title' => t('AddThis bookmark URL'),
268
      '#default_value' => AddThis::getInstance()->getBaseBookmarkUrl(),
269
      '#required' => TRUE,
270
    '#type' => 'textfield',
271
    '#title' => t('AddThis bookmark URL'),
272
    '#default_value' => AddThis::getInstance()->getBaseBookmarkUrl(),
273
    '#required' => TRUE,
270 274
  );
271 275
  $form['service_urls_fieldset'][AddThis::SERVICES_CSS_URL_KEY] = array(
272
      '#type' => 'textfield',
273
      '#title' => t('AddThis services stylesheet URL'),
274
      '#default_value' => AddThis::getInstance()->getServicesCssUrl(),
275
      '#required' => TRUE,
276
    '#type' => 'textfield',
277
    '#title' => t('AddThis services stylesheet URL'),
278
    '#default_value' => AddThis::getInstance()->getServicesCssUrl(),
279
    '#required' => TRUE,
276 280
  );
277 281
  $form['service_urls_fieldset'][AddThis::SERVICES_JSON_URL_KEY] = array(
278
      '#type' => 'textfield',
279
      '#title' => t('AddThis services json URL'),
280
      '#default_value' => AddThis::getInstance()->getServicesJsonUrl(),
281
      '#required' => TRUE,
282
    '#type' => 'textfield',
283
    '#title' => t('AddThis services json URL'),
284
    '#default_value' => AddThis::getInstance()->getServicesJsonUrl(),
285
    '#required' => TRUE,
282 286
  );
283 287
  $form['service_urls_fieldset'][AddThis::WIDGET_JS_URL_KEY] = array(
284
      '#type' => 'textfield',
285
      '#title' => t('AddThis javascript widget URL'),
286
      '#default_value' => AddThis::getInstance()->getBaseWidgetJsUrl(),
287
      '#required' => TRUE,
288
    '#type' => 'textfield',
289
    '#title' => t('AddThis javascript widget URL'),
290
    '#default_value' => AddThis::getInstance()->getBaseWidgetJsUrl(),
291
    '#required' => TRUE,
288 292
  );
289 293

  
290 294
  // Advanced settings.
......
309 313
    '#required' => FALSE,
310 314
    '#description' => t('AddThis custom configuration code. See format at <a href="http://addthis.com/" target="_blank">AddThis.com</a>'),
311 315
  );
316
  $form['advanced_settings_fieldset'][AddThis::WIDGET_JS_LOAD_TYPE] = array(
317
    '#type' => 'select',
318
    '#title' => t('When to load the widget js.'),
319
    '#options' => array(
320
      'async' => t('When the page loads, but load assets asynchronously. (default)'),
321
      'include' => t('When the page loads.'),
322
      'domready' => t('When the DOM is ready at the script dynamicly.'),
323
    ),
324
    '#default_value' => AddThis::getInstance()->getWidgetJsLoadType(),
325
    '#required' => FALSE,
326
  );
312 327
  return system_settings_form($form);
313 328
}
htmltest/sites/all/modules/addthis/includes/addthis.block.inc
24 24
 * want to change this specific display.
25 25
 */
26 26
function addthis_block_view($block_name = '') {
27

  
27 28
  if ($block_name == AddThis::BLOCK_NAME) {
29

  
28 30
    $widget_type = AddThis::getInstance()->getBlockDisplayType();
29
    $markup = AddThis::getInstance()->getDisplayMarkup($widget_type, array('#block' => AddThis::BLOCK_NAME));
31
    $widget_settings = AddThis::getInstance()->getBlockDisplaySettings();
32

  
33
    $block_options = array(
34
      '#block' => AddThis::BLOCK_NAME,
35
      '#display' => array(
36
        'settings' => $widget_settings,
37
      )
38
    );
39

  
40
    $markup = AddThis::getInstance()->getDisplayMarkup($widget_type, $block_options);
30 41
    return array(
31 42
      'subject' => '',
32 43
      'content' => $markup,
......
38 49
 * Implements hook_block_configure().
39 50
 */
40 51
function addthis_block_configure($delta = '') {
41
  $form[AddThis::BLOCK_WIDGET_TYPE_KEY] = array(
42
    '#type' => 'select',
43
    '#title' => t('AddThis display type'),
44
    '#options' => AddThis::getInstance()->getDisplayTypes(),
45
    '#default_value' => AddThis::getInstance()->getBlockDisplayType(),
46
  );
47
  return $form;
52
  AddThis::getInstance()->includeWidgetJs();
53

  
54
  return array();
48 55
}
49 56

  
50 57
/**
51 58
 * Implements hook_block_save().
52 59
 */
53 60
function addthis_block_save($delta = '', $edit = array()) {
54
  variable_set(AddThis::BLOCK_WIDGET_TYPE_KEY, $edit[AddThis::BLOCK_WIDGET_TYPE_KEY]);
61
  variable_set(AddThis::BLOCK_WIDGET_TYPE_KEY, $edit['addthis_settings']['type']);
62
  variable_set(AddThis::BLOCK_WIDGET_SETTINGS_KEY, $edit['addthis_settings']['settings']);
63
}
64

  
65
/**
66
 * Callback submit.
67
 */
68
function _addthis_settings_form_block_submit($form, &$form_state) {
69
  $form_state['rebuild'] = TRUE;
70
}
71

  
72
/**
73
 * Callback to return ajax replace part.
74
 */
75
function _addthis_settings_form_block_submit_callback($form, &$form_state) {
76
  return $form['settings']['addthis_settings']['form'];
77
}
78

  
79
/**
80
 * Implements hook_form_FORM_ID_alter().
81
 */
82
function addthis_form_block_admin_configure_alter(&$form, &$form_state) {
83

  
84
  if ($form['module']['#value'] == 'addthis' && $form['delta']['#value'] == 'addthis_block') {
85
    form_load_include($form_state, 'inc', 'addthis', 'addthis.block');
86
    $form['#cache'] = TRUE;
87

  
88
    $form['settings']['addthis_settings'] = array(
89
      '#type' => 'fieldset',
90
      '#title' => 'Display settings',
91
    );
92

  
93
    // Retrieve settings.
94
    $addthis_settings['type'] = AddThis::getInstance()->getBlockDisplayType();
95
    $addthis_settings['settings'] = AddThis::getInstance()->getBlockDisplaySettings();
96

  
97
    // Create a addthis settings form based on the available configuration.
98
    $element = _addthis_settings_form(
99
      isset($form['addthis_settings']['form']) ? $form['addthis_settings']['form'] : array(),
100
      $form_state,
101
      isset($addthis_settings['type']) ? $addthis_settings['type'] : NULL,
102
      isset($addthis_settings['settings']) ? $addthis_settings['settings'] : NULL
103
    );
104

  
105
    // Change the submit and callback because our handling is different and the
106
    // form structure is different form the default implementation.
107
    $element['type']['#submit'] = array('_addthis_settings_form_block_submit');
108
    $element['type']['#ajax']['callback'] = '_addthis_settings_form_block_submit_callback';
109
    $form['settings']['addthis_settings']['form'] = $element;
110

  
111
    array_unshift($form['#submit'], '_addthis_settings_form_block_submit');
112
  }
113

  
114
  return $form;
55 115
}
htmltest/sites/all/modules/nodeaccess/CHANGELOG.txt
1 1
Nodeaccess 7.x-1.x
2 2
===================
3 3

  
4
Nodeaccess 7.x-1.1
5
===================
6
Issue #2146209: Show localized role names in Grant tab.
7
Issue #306541: Strange behavior about anonymous content management.
8
Issues #2033711 and #2075033: Anonymous access for existing nodes
9
(fix by k4v and Blackice2999).
10
Issues #2040967 and #2037225: Unpublished access ignore set. User
11
reference access fix.
12

  
4 13
Nodeaccess 7.x-1.0
5 14
===================
6 15
A number of bug fixes, including:
7
Issue [#1414256] by rv0: enable 'Keep?' for new users (fix by rv0).
8
Issue [#1444040] by natuk: Access to unpublished nodes.
16
Issue #1414256 by rv0: enable 'Keep?' for new users (fix by rv0).
17
Issue #1444040 by natuk: Access to unpublished nodes.
9 18
Code cleanup. Remove nodeaccess_node_insert(), it's handled by node_access now.
10
Issue [#306541] by gianfrasoft: Strange behavior anonymous content management.
11
Issue [#1496280] by rv0: Don't enforce default "View" access setting.
19
Issue #306541 by gianfrasoft: Strange behavior anonymous content management.
20
Issue #1496280 by rv0: Don't enforce default "View" access setting.
12 21
------------------------------------------------------------------------------
13
Issue [#1088920] by Peasoup: Undefined offset fix (fix by rv0).
14
Issue [#1200556] by xjm: D7 IA standards, use admin/config/people path.
15
Issue [#1846786] by jcmc: Correct the admin path in info file.
16
Issue [#1285150] by jmart: Undefined index: keys in nodeaccess_grants_form().
17
Issue [#1082262] by aquaseal: Undefined $rows in nodeaccess_grants_form().
18
Issue [#1155706] by tristanmatthews: Undefined index in nodeaccess_access().
22
Issue #1088920 by Peasoup: Undefined offset fix (fix by rv0).
23
Issue #1200556 by xjm: D7 IA standards, use admin/config/people path.
24
Issue #1846786 by jcmc: Correct the admin path in info file.
25
Issue #1285150 by jmart: Undefined index: keys in nodeaccess_grants_form().
26
Issue #1082262 by aquaseal: Undefined $rows in nodeaccess_grants_form().
27
Issue #1155706 by tristanmatthews: Undefined index in nodeaccess_access().
htmltest/sites/all/modules/nodeaccess/nodeaccess.info
5 5
configure = admin/config/people/nodeaccess
6 6
version = 7.0-1.x
7 7

  
8
; Information added by drupal.org packaging script on 2013-10-01
9
version = "7.x-1.0+2-dev"
8
; Information added by Drupal.org packaging script on 2014-01-14
9
version = "7.x-1.2"
10 10
core = "7.x"
11 11
project = "nodeaccess"
12
datestamp = "1380593284"
12
datestamp = "1389723809"
13 13

  
htmltest/sites/all/modules/nodeaccess/nodeaccess.module
877 877
  $form = $variables['form'];
878 878
  $allowed_roles = variable_get('nodeaccess-roles', array());
879 879
  $allowed_grants = variable_get('nodeaccess-grants', array());
880

  
880
  // Retrieve role names for columns.
881
  $role_names = user_roles();
881 882
  // Roles table.
882 883
  $roles = element_children($form['rid']);
883 884

  
......
896 897
    foreach ($roles as $key) {
897 898
      if (isset($allowed_roles[$key]) && $allowed_roles[$key]) {
898 899
        $row = array();
899
        $row[] = $form['rid'][$key]['name']['#value'] . drupal_render($form['rid'][$key]['name']);
900
        $row[] = $role_names[$key] . drupal_render($form['rid'][$key]['name']);
900 901
        if ($allowed_grants['view']) {
901 902
          $row[] = drupal_render($form['rid'][$key]['grant_view']);
902 903
        }

Formats disponibles : Unified diff