updated imce, colorbox, admin_menu_source, honey_pot

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 16:33:10 +01:00
parent 2e0abeed03
commit 7aeabebddf
28 changed files with 455 additions and 123 deletions

View File

@@ -27,4 +27,6 @@
* use the file's name. i.e. __title_or_filename__.
*/
?>
<a href="<?php print $path; ?>" title="__title__" class="colorbox colorbox-insert-image" rel="<?php print $gallery_id; ?>"><img src="<?php print $url; ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="<?php print $class; ?>" /></a>
<a href="<?php print $path; ?>" title="__title__" class="colorbox colorbox-insert-image" data-colorbox-gallery="<?php print $gallery_id; ?>">
<img src="<?php print $url; ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="<?php print $class; ?>" />
</a>

View File

@@ -250,12 +250,19 @@ function colorbox_admin_settings() {
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['colorbox_advanced_settings']['colorbox_unique_token'] = array(
'#type' => 'radios',
'#title' => t('Unique per-request gallery token'),
'#options' => array(1 => t('On'), 0 => t('Off')),
'#default_value' => variable_get('colorbox_unique_token', 1),
'#description' => t('If On (default), Colorbox will add a unique per-request token to the gallery id to avoid images being added manually to galleries. The token was added as a security fix but some see the old behavoiur as an feature and this settings makes it possible to remove the token.'),
);
$form['colorbox_advanced_settings']['colorbox_mobile_detect'] = array(
'#type' => 'radios',
'#title' => t('Mobile detection'),
'#options' => array(1 => t('On'), 0 => t('Off')),
'#default_value' => variable_get('colorbox_mobile_detect', 1),
'#description' => t('If on (default) Colorbox will not be active for devices with a the max width set below.'),
'#description' => t('If On (default), Colorbox will not be active for devices with the max width set below.'),
);
$form['colorbox_advanced_settings']['colorbox_mobile_device_width'] = array(
'#type' => 'textfield',

View File

@@ -10,11 +10,11 @@
*
* Implements hook_colorbox_settings_alter().
*
* @param $settings
* @param array $settings
* An associative array of Colorbox settings. See the
* @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
* for the full list of supported parameters.
* @param $style
* @param string $style
* The name of the active style plugin. If $style is 'none', no Colorbox
* theme will be loaded.
*/
@@ -29,9 +29,9 @@ function hook_colorbox_settings_alter(&$settings, &$style) {
}
/**
* Allows to override activation of Colobox for the current URL.
* Allows to override activation of Colorbox for the current URL.
*
* @param $active
* @param bool $active
* A boolean indicating whether colorbox should be active for the current
* URL or not.
*/

View File

@@ -6,9 +6,9 @@ configure = admin/config/media/colorbox
files[] = views/colorbox_handler_field_colorbox.inc
; Information added by Drupal.org packaging script on 2015-10-01
version = "7.x-2.10"
; Information added by Drupal.org packaging script on 2016-06-06
version = "7.x-2.12"
core = "7.x"
project = "colorbox"
datestamp = "1443691449"
datestamp = "1465255741"

View File

@@ -6,9 +6,9 @@
*/
/**
* The default path to the Colorbox directory.
* The minimum required version of the Colorbox plugin.
*/
define('COLORBOX_MIN_PLUGIN_VERSION', '1.3.21.1');
define('COLORBOX_MIN_PLUGIN_VERSION', '1.6.1');
/**
@@ -56,8 +56,8 @@ function colorbox_theme() {
*/
function colorbox_init() {
// Do not load colorbox during the Drupal installation process, e.g. if part
// of installation profiles.
if (!drupal_installation_attempted()) {
// of installation profiles. Only add the JavaScript and CSS on specified paths.
if (!drupal_installation_attempted() && _colorbox_active()) {
_colorbox_doheader();
}
}
@@ -132,7 +132,7 @@ function colorbox_menu() {
/**
* Check if Colorbox should be active for the current URL.
*
* @return
* @return bool
* TRUE if Colorbox should be active for the current page.
*/
function _colorbox_active() {
@@ -166,9 +166,6 @@ function _colorbox_doheader() {
if ($already_added) {
return; // Don't add the JavaScript and CSS multiple times.
}
if (!_colorbox_active()) {
return; // Don't add the JavaScript and CSS on specified paths.
}
// Insert options and translated strings as javascript settings.
if (variable_get('colorbox_custom_settings_activate', 0)) {
@@ -371,7 +368,7 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $
'#type' => 'fieldset',
'#title' => t('Replacement patterns'),
'#theme' => 'token_tree',
'#token_types' => array($instance['entity_type'], 'file'),
'#token_types' => array_merge(array_keys($field['bundles']),array('file')),
'#recursion_limit' => $recursion_limit,
'#dialog' => TRUE,
'#states' => array(
@@ -495,6 +492,8 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
/**
* Implements hook_insert_styles().
*
* @return array
*/
function colorbox_insert_styles() {
$insert_styles = array();
@@ -517,7 +516,7 @@ function colorbox_insert_content($item, $style, $widget) {
/**
* Machine names normally need to be unique but that does not apply to galleries.
*
* @return
* @return false
* Always FALSE
*/
function colorbox_gallery_exists() {

View File

@@ -8,12 +8,15 @@
/**
* Returns HTML for an Colorbox image field formatter.
*
* @param $variables
* @param array $variables
* An associative array containing:
* - item: An array of image data.
* - image_style: An optional image style.
* - path: An array containing the link 'path' and link 'options'.
*
* @return string
* An HTML string representing the themed output.
*
* @ingroup themeable
*/
function theme_colorbox_image_formatter($variables) {
@@ -125,8 +128,8 @@ function theme_colorbox_image_formatter($variables) {
}
// If gallery id is not empty add unique per-request token to avoid images being added manually to galleries.
if (!empty($gallery_id)) {
// Check if gallery token has alrady been set, we need to reuse the token for the whole request.
if (!empty($gallery_id) && variable_get('colorbox_unique_token', 1)) {
// Check if gallery token has already been set, we need to reuse the token for the whole request.
if (is_null($gallery_token)) {
// We use a short token since randomness is not critical.
$gallery_token = drupal_random_key(8);
@@ -147,13 +150,16 @@ function theme_colorbox_image_formatter($variables) {
/**
* Returns HTML for an image using a specific Colorbox image style.
*
* @param $variables
* @param array $variables
* An associative array containing:
* - image: image item as array.
* - path: The path of the image that should be displayed in the Colorbox.
* - title: The title text that will be used as a caption in the Colorbox.
* - gid: Gallery id for Colorbox image grouping.
*
* @return string
* An HTML string containing a link to the given path.
*
* @ingroup themeable
*/
function theme_colorbox_imagefield($variables) {
@@ -176,9 +182,8 @@ function theme_colorbox_imagefield($variables) {
'attributes' => array(
'title' => $variables['title'],
'class' => $class,
'rel' => $variables['gid'],
'data-colorbox-gallery' => $variables['gid'],
),
'language' => array('language' => NULL),
);
return l($image, $options['path'], $options);
@@ -186,6 +191,8 @@ function theme_colorbox_imagefield($variables) {
/**
* Preprocess variables for the colorbox-insert-image.tpl.php file.
*
* @param array $variables
*/
function template_preprocess_colorbox_insert_image(&$variables) {
$item = $variables['item'];

View File

@@ -23,7 +23,7 @@ define('COLORBOX_DOWNLOAD_PREFIX', 'colorbox-');
*
* See `drush topic docs-commands` for a list of recognized keys.
*
* @return
* @return array
* An associative array describing your command(s).
*/
function colorbox_drush_command() {
@@ -49,10 +49,10 @@ function colorbox_drush_command() {
* This function is called whenever a drush user calls
* 'drush help <name-of-your-command>'
*
* @param
* @param string $section
* A string with the help section (prepend with 'drush:')
*
* @return
* @return string
* A string with the help text for your command.
*/
function colorbox_drush_help($section) {
@@ -63,14 +63,14 @@ function colorbox_drush_help($section) {
}
/**
* Implements drush_MODULE_post_pm_enable().
* Implements drush_MODULE_pre_pm_enable().
*/
// function drush_colorbox_post_pm_enable() {
// $modules = func_get_args();
// if (in_array('colorbox', $modules)) {
// drush_colorbox_plugin();
// }
// }
function drush_colorbox_pre_pm_enable() {
$modules = drush_get_context('PM_ENABLE_MODULES');
if (in_array('colorbox', $modules) && !drush_get_option('skip')) {
drush_colorbox_plugin();
}
}
/**
* Command to download the Colorbox plugin.

View File

@@ -14,6 +14,16 @@ Drupal.behaviors.initColorbox = {
}
}
// Use "data-colorbox-gallery" if set otherwise use "rel".
settings.colorbox.rel = function () {
if ($(this).data('colorbox-gallery')) {
return $(this).data('colorbox-gallery');
}
else {
return $(this).attr('rel');
}
};
$('.colorbox', context)
.once('init-colorbox')
.colorbox(settings.colorbox);

View File

@@ -5,6 +5,15 @@ Drupal.behaviors.initColorboxInline = {
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
return;
}
if (settings.colorbox.mobiledetect && window.matchMedia) {
// Disable Colorbox for small screens.
var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
if (mq.matches) {
return;
}
}
$.urlParam = function(name, url){
if (name == 'fragment') {
var results = new RegExp('(#[^&#]*)').exec(url);

View File

@@ -5,6 +5,15 @@ Drupal.behaviors.initColorboxLoad = {
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
return;
}
if (settings.colorbox.mobiledetect && window.matchMedia) {
// Disable Colorbox for small screens.
var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
if (mq.matches) {
return;
}
}
$.urlParams = function (url) {
var p = {},
e,