summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.txt75
-rw-r--r--g2image.js8
-rwxr-xr-xgallery.css8
-rw-r--r--gallery.install7
-rw-r--r--gallery.module71
-rw-r--r--gallery_base.inc75
-rw-r--r--gallery_block.inc71
-rw-r--r--gallery_filter.inc8
-rw-r--r--gallery_g2image.inc28
-rw-r--r--gallery_groups.inc22
-rw-r--r--gallery_help.inc17
-rw-r--r--gallery_install.inc27
-rw-r--r--gallery_menu/gallery_menu.module42
-rw-r--r--gallery_report.inc14
-rw-r--r--gallery_search.inc25
-rw-r--r--gallery_settings.inc212
-rw-r--r--gallery_user.inc60
-rw-r--r--gallery_user_admin.inc35
18 files changed, 535 insertions, 270 deletions
diff --git a/README.txt b/README.txt
index 12bb0d8..6d8af8c 100644
--- a/README.txt
+++ b/README.txt
@@ -1,6 +1,73 @@
// $Id$
-This version of the Gallery module (Drupal-5--2 branch) is for development
-purposes only (new features, major improvements, rewrite of existing code,
-etc.) and highly subject to change. Dont expect any code to be stable and
-ready for daily use.
+Overview
+---------
+This module embeds Gallery2 (http://gallery.menalto.com) inside your Drupal
+installation to support photos, videos and other content. There is support for
+2 types of image blocks and a navigation menu, inserting of images into nodes
+via an input filter, TinyMCE support, syncing of users between the two
+applications, ...
+
+Note that you will need to download and install Gallery2
+(http://gallery.menalto.com/downloads) prior to installing this module.
+
+Requirements
+------------
+* Gallery 2.2
+* Drupal 5.x
+
+Installation
+------------
+
+1. Install Gallery 2 and Drupal (see their respective installation documents).
+Gallery2 should be *inside* your Drupal installation so that it's accessible
+by the same website. If you installed Gallery somewhere else, you can create
+a symlink to it from inside your Drupal site or you can move Gallery2.
+
+Warning - Do not name your G2 directory 'gallery', call it something else
+(e.g. 'gallery2'). Calling it 'gallery' will cause a conflict with the Drupal
+gallery.module as Drupal assumes that http://www.example.com/gallery refers
+to the Drupal module.
+
+2. Ensure that 'Image Block' and 'Image Frame' plugins are installed and
+activated in Gallery2. Check them in the non-embedded Gallery.
+
+3. Log out of Gallery 2 (non-embedded) - people have reported errors relating
+to sessions if this is not done.
+
+4. Copy gallery.module to your Drupal modules/ directory.
+
+5. Enable the gallery module in Administer -> Site building -> Modules in
+your Drupal installation (admin/build/modules).
+
+6. Go to Administer -> Site configuration -> Gallery (admin/settings/gallery)
+and configure the path to your Gallery2 installation using the install wizard
+provided there.
+
+7. Enable the 'Gallery Block' in Administer -> Site building -> Blocks
+(admin/build/block).
+
+- Optional -
+8. The Gallery user administration is now available in Administer -> User
+management -> Gallery users (admin/user/gallery). You should at least check
+the 'User settings' (admin/user/gallery/settings).
+
+9. G2Image:
+If you install G2Image (http://g2image.steffensenfamily.com) as either a
+standalone or TinyMCE plugin you will have an excellent image chooser for
+Drupal/Gallery2. The configuration is automatic when you hit the 'Save
+configuration' button on the G2Image settings page
+(admin/settings/gallery/g2image).
+
+Support
+-------
+Please post bug reports and feature requests in the Issues tracker
+(http://drupal.org/project/issues/gallery), support requests should generally
+go to the Gallery 2 Integrations Forums (http://gallery.menalto.com/forum/78)
+first.
+
+Authors
+-------
+James Walker <walkah@walkah.net>
+Kieran Parsons <kiz_0987@yahoo.com>
+Thilo Wawrzik <drupal@profix898.de>
diff --git a/g2image.js b/g2image.js
index 75927ff..671f736 100644
--- a/g2image.js
+++ b/g2image.js
@@ -2,18 +2,22 @@
function g2ic_open(field) {
// Find the form id by going back through the hierarchy.
- // Kludge until can get the form id directly from drupal.
+ // Kludge until can get the form id directly from Drupal.
var element = document.getElementById(field).parentNode;
while (element.tagName != 'FORM') {
element = element.parentNode;
}
+
+ // Set some properties
var form = element.id;
- var url = G2IMAGE_URI + 'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
+ var url = G2IMAGE_URI+'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
var name = 'g2image';
var w = 600;
var h = 600;
var valLeft = (screen.width) ? (screen.width-w)/2 : 0;
var valTop = (screen.height) ? (screen.height-h)/2 : 0;
var features = 'width='+w+',height='+h+',left='+valLeft+',top='+valTop+',resizable=1,scrollbars=1';
+
+ // Open the G2Image window
window.open(url, name, features);
}
diff --git a/gallery.css b/gallery.css
index f9da35c..3241879 100755
--- a/gallery.css
+++ b/gallery.css
@@ -147,15 +147,15 @@ img.g2image_centered, div.g2image_centered {
/* Embed success, warning, error messages */
.g2_embed_success {
- color: #008800;
+ color: #008800;
}
.g2_embed_warning {
- color: #f63;
+ color: #f63;
}
.g2_embed_error {
- color: #880000;
- font-weight: bold;
+ color: #880000;
+ font-weight: bold;
}
/* Gallery Grid Block */
diff --git a/gallery.install b/gallery.install
index f99a1d5..42a536d 100644
--- a/gallery.install
+++ b/gallery.install
@@ -7,12 +7,13 @@
*/
/**
- * Implementation of hook_install
+ * Implementation of hook_install().
*/
function gallery_install() {
}
/**
+ * Implementation of hook_update_N().
* Migrate settings from the 5.x-1.x to 5.x-2.x series
*/
function gallery_update_1() {
@@ -98,7 +99,7 @@ function gallery_update_1() {
}
/**
- * Implementation of hook_uninstall
+ * Implementation of hook_uninstall().
*/
function gallery_uninstall() {
// Remove all gallery related variables and blocks
@@ -106,5 +107,3 @@ function gallery_uninstall() {
db_query("DELETE FROM {blocks} WHERE module = 'gallery'");
cache_clear_all('variables', 'cache');
}
-
-?>
diff --git a/gallery.module b/gallery.module
index d193b3a..06a76ac 100644
--- a/gallery.module
+++ b/gallery.module
@@ -14,14 +14,14 @@ define(GALLERY_FILTER_MAXSIZE_DEFAULT, 150);
define(GALLERY_FILTER_EXACTSIZE_DEFAULT, '');
/**
- * Implementation of hook_perm()
+ * Implementation of hook_perm().
*/
function gallery_perm() {
return array('administer gallery settings', 'access gallery', 'access standalone g2image');
}
/**
- * Implementation of hook_menu()
+ * Implementation of hook_menu().
*/
function gallery_menu($may_cache) {
global $custom_theme;
@@ -156,7 +156,7 @@ function gallery_menu($may_cache) {
}
/**
- * Implementation of hook_help()
+ * Implementation of hook_help().
*/
function gallery_help($section) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_help.inc');
@@ -164,7 +164,7 @@ function gallery_help($section) {
}
/**
- * Implementation of gallery_settings
+ * Function gallery_settings().
*/
function gallery_settings($form = '_gallery_settings_general') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_settings.inc');
@@ -172,7 +172,7 @@ function gallery_settings($form = '_gallery_settings_general') {
}
/**
- * Implementation of gallery_report
+ * Function gallery_report().
*/
function gallery_report($download = NULL) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_report.inc');
@@ -180,7 +180,7 @@ function gallery_report($download = NULL) {
}
/**
- * Implementation of hook_info()
+ * Implementation of hook_info().
*/
function gallery_info($field = NULL) {
$info['name'] = 'Gallery2';
@@ -190,7 +190,7 @@ function gallery_info($field = NULL) {
}
/**
- * Implementation of hook_auth()
+ * Implementation of hook_auth().
*/
function gallery_auth($username, $password, $server) {
if (_gallery_init()) {
@@ -216,7 +216,7 @@ function gallery_auth($username, $password, $server) {
}
/**
- * Implementation of hook_user()
+ * Implementation of hook_user().
*/
function gallery_user($op, &$edit, &$user, $category = NULL) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
@@ -240,25 +240,32 @@ function gallery_user($op, &$edit, &$user, $category = NULL) {
}
/**
- * Gallery User Administration
+ * Function gallery_users().
+ * (gallery user administration)
*/
function gallery_users($args = NULL) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user_admin.inc');
return _gallery_user_users($args);
}
+/**
+ * Function gallery_user_admin().
+ */
function gallery_user_admin($form) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user_admin.inc');
return drupal_get_form($form);
}
+/**
+ * Function gallery_user_admin_advanced_progress().
+ */
function gallery_user_admin_advanced_progress() {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user_admin.inc');
return _gallery_user_advanced_progress();
}
/**
- * Implementation of hook_search
+ * Implementation of hook_search().
*/
function gallery_search($op = 'search', $keys = NULL) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_search.inc');
@@ -266,7 +273,8 @@ function gallery_search($op = 'search', $keys = NULL) {
}
/**
- * Implementation of hook_search_item to override how to display the item
+ * Implementation of hook_search_item().
+ * (override how to display the item)
*/
function gallery_search_page($results) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_search.inc');
@@ -274,7 +282,7 @@ function gallery_search_page($results) {
}
/**
- * Implementation of hook_form_alter()
+ * Implementation of hook_form_alter().
*/
function gallery_form_alter($form_id, &$form) {
if (($form_id == 'user_admin_role') || ($form_id == 'user_admin_new_role')) {
@@ -288,7 +296,7 @@ function gallery_form_alter($form_id, &$form) {
}
/**
- * Implementation of hook_filter()
+ * Implementation of hook_filter().
*/
function gallery_filter($op, $delta = 0, $format = -1, $text = '') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_filter.inc');
@@ -307,7 +315,7 @@ function gallery_filter($op, $delta = 0, $format = -1, $text = '') {
}
/**
- * Implementation of hook_filter_tips
+ * Implementation of hook_filter_tips().
*/
function gallery_filter_tips($delta = 0, $format = -1, $long = FALSE) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_help.inc');
@@ -320,15 +328,16 @@ function gallery_filter_tips($delta = 0, $format = -1, $long = FALSE) {
}
/**
- * Implementation of hook_elements() - from img_assist
+ * Implementation of hook_elements().
*/
function gallery_elements() {
$type['textarea'] = array('#process' => array('gallery_g2image_textarea' => array()));
return $type;
}
-/*
- * Add image link underneath textareas
+/**
+ * Function gallery_g2image_textarea().
+ * (add image link underneath textareas)
*/
function gallery_g2image_textarea($element) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_g2image.inc');
@@ -344,8 +353,7 @@ function gallery_g2image_textarea($element) {
}
/**
- * Implementation of hook_block()
- *
+ * Implementation of hook_block().
*/
function gallery_block($op = 'list', $delta = 0, $edit = array()) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_block.inc');
@@ -355,34 +363,35 @@ function gallery_block($op = 'list', $delta = 0, $edit = array()) {
}
/**
- * Main gallery display page
+ * Function gallery_page().
+ * (main gallery display page)
*/
function gallery_page($internal = FALSE) {
if (!_gallery_init()) {
return $internal ? array() : '';
}
- // turn off sidebar
+ // Turn off sidebar
if (variable_get('gallery_move_sidebar_to_block', 1)) {
GalleryCapabilities::set('showSidebarBlocks', FALSE);
}
$result = gallery_handle_request();
if ($result && !$result['isDone']) {
gallery_set_head($result['headHtml'], TRUE);
- // add pathbar. See http://gallery.menalto.com/node/33447
+ // Add pathbar (see http://gallery.menalto.com/node/33447)
if (isset($result['themeData'])) {
$breadcrumb = array(l(t('Home'), ''));
- // some themes (eg hybrid) do not set $result['themeData']['parents']
+ // Some themes (eg hybrid) do not set $result['themeData']['parents']
if ($result['themeData']['parents']) {
foreach ($result['themeData']['parents'] as $parent) {
$parent_title = $parent['title'];
- // simple strip of bbcode (italic, bold)
+ // Simple strip of bbcode (italic, bold)
$parent_title = str_replace(
array('[i]', '[/i]', '[b]', '[/b]'),
array('<i>', '</i>', '<strong>', '</strong>'),
$parent_title
);
$parent_title = str_replace('[/i]', '</i>', $parent_title);
- // still does not generate a clean url for /gallery (uses index.php?q=gallery)
+ // Still does not generate a clean url for /gallery (uses index.php?q=gallery)
$link = gallery_generate_url(array('view' => 'core.ShowItem', 'itemId' => $parent['id']), FALSE);
$breadcrumb[] = l($parent_title, $link);
}
@@ -392,9 +401,9 @@ function gallery_page($internal = FALSE) {
// Hack to get the admin sidebar
if (variable_get('gallery_move_admin_sidebar_to_block', 0)) {
if (preg_match("/^(.*<td id=\"gsSidebarCol\">)(.*?)(<\/td>.*?)$/s", $result['bodyHtml'], $match)) {
- // new body
+ // New body
$result['bodyHtml'] = $match[1] . $match[3];
- // insert admin sidebar in $result['sidebarBlocksHtml']
+ // Insert admin sidebar in $result['sidebarBlocksHtml']
if (empty($result['sidebarBlocksHtml'][1])) {
$result['sidebarBlocksHtml'][1] = $match[2];
}
@@ -403,7 +412,7 @@ function gallery_page($internal = FALSE) {
}
}
}
- // store the sidebar info in a global variable for use in the gallery navigation block
+ // Store the sidebar info in a global variable for use in the gallery navigation block
$GLOBALS['_gallery_sidebar_'] = $result['sidebarBlocksHtml'];
return $internal ? $result : $result['bodyHtml'];
@@ -413,7 +422,8 @@ function gallery_page($internal = FALSE) {
}
/**
- * Define additional links to add to the site map.
+ * Function gallery_gsitemap().
+ * (define additional links to add to the site map)
*
* This hook allows modules to add additional links to the site map. Links
* may be associated with nodes, terms, or users, as shown in the example.
@@ -429,7 +439,6 @@ function gallery_gsitemap($type = NULL, $excludes = array()) {
if (($type != 'xml') || !variable_get('gallery_enable_sitemap', 1)) {
return;
}
-
// Need to do a full init
if (!_gallery_init(TRUE)) {
return;
@@ -455,5 +464,3 @@ function gallery_gsitemap($type = NULL, $excludes = array()) {
return $g2_sitemap;
}
-
-?>
diff --git a/gallery_base.inc b/gallery_base.inc
index a9d75c0..2a9a774 100644
--- a/gallery_base.inc
+++ b/gallery_base.inc
@@ -26,14 +26,16 @@ define(GALLERY_PLUGIN_MISSING, -4);
define(GALLERY_DEBUGTRACE, TRUE);
/**
- * Login user into embedded gallery
+ * Function gallery_login().
+ * (login user into embedded gallery)
*/
function gallery_login() {
_gallery_init();
}
/**
- * End user session
+ * Function gallery_logout().
+ * (end user session)
*/
function gallery_logout() {
if (variable_get('gallery_valid', FALSE)) {
@@ -43,7 +45,8 @@ function gallery_logout() {
}
/**
- * Initialize embedded gallery
+ * Function _gallery_init().
+ * (initialize embedded gallery)
*/
function _gallery_init($full = FALSE, $vars = NULL, $report_error = TRUE) {
global $user;
@@ -119,7 +122,8 @@ function _gallery_init($full = FALSE, $vars = NULL, $report_error = TRUE) {
}
/**
- * handleRequest extension with error handling
+ * Function gallery_handle_request().
+ * (handleRequest extension with error handling)
*/
function gallery_handle_request() {
ob_start();
@@ -146,7 +150,8 @@ function gallery_handle_request() {
}
/**
- * Get the language for $user
+ * Function gallery_get_language().
+ * (get the language for $user)
*/
function gallery_get_language($user) {
$language = $user->language;
@@ -165,7 +170,8 @@ function gallery_get_language($user) {
}
/**
- * Retrieve all image frames from Gallery2
+ * Function gallery_get_image_frames().
+ * (retrieve all image frames from Gallery2)
*/
function gallery_get_image_frames() {
_gallery_init();
@@ -183,13 +189,13 @@ function gallery_get_image_frames() {
}
/**
- * Implementation of gallery_generate_url
+ * Function gallery_generate_url().
*/
function gallery_generate_url($params, $html = TRUE, $full = TRUE) {
$options = array();
$options['forceFullUrl'] = $full;
$options['htmlEntities'] = $html;
-
+
$url_generator =& $GLOBALS['gallery']->getUrlGenerator();
if (!$url_generator) {
gallery_error(t('Error: UrlGenerator not available'));
@@ -200,7 +206,7 @@ function gallery_generate_url($params, $html = TRUE, $full = TRUE) {
}
/**
- * Implementation of gallery_item_details
+ * Function gallery_item_details().
*/
function gallery_item_details($id, $verbose = FALSE) {
$details = array();
@@ -227,13 +233,13 @@ function gallery_item_details($id, $verbose = FALSE) {
}
/**
- * Implementation of gallery_flush_entity_cache
+ * Function gallery_flush_entity_cache().
*/
function gallery_flush_entity_cache() {
- $platform =& $GLOBALS['gallery']->getPlatform();
+ $platform =& $GLOBALS['gallery']->getPlatform();
$cache_basedir = $GLOBALS['gallery']->getConfig('data.gallery.cache');
-
$cache_dir = $cache_basedir .'entity';
+
if ($platform->file_exists($cache_dir)) {
if (!$platform->recursiveRmDir($cache_dir)) {
return FALSE;
@@ -244,7 +250,7 @@ function gallery_flush_entity_cache() {
}
/**
- * Implementation of gallery_set_head
+ * Function gallery_set_head().
*/
function gallery_set_head($html, $settitle = FALSE) {
if (!empty($html)) {
@@ -258,7 +264,7 @@ function gallery_set_head($html, $settitle = FALSE) {
}
/**
- * Implementation of gallery_set_css
+ * Function gallery_set_css().
*/
function gallery_set_css($css) {
global $base_url;
@@ -278,7 +284,7 @@ function gallery_set_css($css) {
}
elseif (substr($include, 0, 4) == 'http' || variable_get('gallery_outside', 0)) {
// drupal_add_css() does not support external paths
- drupal_set_html_head('<style type="text/css" media="all">@import "'. $include .'";</style>' ."\n");
+ drupal_set_html_head('<style type="text/css" media="all">@import "'. $include .'";</style>'."\n");
}
else {
// Gallery's css must always be added first to allow overriding from the module(s)
@@ -290,7 +296,7 @@ function gallery_set_css($css) {
}
/**
- * Implementation of gallery_set_javascript
+ * Function gallery_set_javascript().
* (druapl_add_js() ensures proper cascading of included G2 javascript)
*/
function gallery_set_javascript($javascript) {
@@ -311,7 +317,7 @@ function gallery_set_javascript($javascript) {
$js_memory[] = $md5;
if (substr($include, 0, 4) == 'http' || variable_get('gallery_outside', 0)) {
// drupal_add_js() does not support external paths
- drupal_set_html_head('<script type="text/javascript" src="'. $include .'"></script>' ."\n");
+ drupal_set_html_head('<script type="text/javascript" src="'. $include .'"></script>'."\n");
}
else {
drupal_add_js($include);
@@ -322,13 +328,12 @@ function gallery_set_javascript($javascript) {
}
/**
- * Split an image block result into individual images
+ * Function _gallery_split_imageblock().
+ * (split an image block result into individual images)
*/
function _gallery_split_imageblock($html) {
- /**
- * From http://uk.php.net/manual/en/function.preg-split.php
- * Split the html from image block into <...> parts
- */
+ // From http://uk.php.net/manual/en/function.preg-split.php
+ // Split the html from image block into <...> parts
$pattern = '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/';
$html_array = preg_split($pattern, trim($html), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
@@ -369,6 +374,9 @@ function _gallery_split_imageblock($html) {
* --------------------------------------------------------------------------
*/
+/**
+ * Function gallery_error().
+ */
function gallery_error($msg, $ret = NULL, $serious = FALSE) {
$error_mode = variable_get('gallery_error_mode', array(GALLERY_ERROR_WATCHDOG));
$admin = user_access('administer site configuration');
@@ -413,6 +421,9 @@ function gallery_error($msg, $ret = NULL, $serious = FALSE) {
}
}
+/**
+ * Function _gallery_report_error().
+ */
function _gallery_report_error($report = array()) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_help.inc');
require_once(drupal_get_path('module', 'gallery') .'/gallery_report.inc');
@@ -421,12 +432,18 @@ function _gallery_report_error($report = array()) {
_gallery_report(FALSE, $report, TRUE);
}
+/**
+ * Function gallery_debug().
+ */
function gallery_debug($array, $label = 'Gallery Debug') {
if (variable_get('gallery_debug', 0) && user_access('administer site configuration')) {
drupal_set_message('<strong>'. $label .':</strong><br />'. nl2br(htmlspecialchars(print_r($array, TRUE))), 'error');
}
}
+/**
+ * Function gallery_plugin_status().
+ */
function gallery_plugin_status($plugin_names) {
static $all_plugins_status = array();
@@ -475,11 +492,17 @@ function gallery_plugin_status($plugin_names) {
return $plugins_status;
}
+/**
+ * Function gallery_single_plugin_status().
+ */
function gallery_single_plugin_status($plugin_name) {
$status = gallery_plugin_status(array($plugin_name));
return $status[$plugin_name];
}
+/**
+ * Function gallery_set_status().
+ */
function gallery_set_status($status = array(), $reset = FALSE) {
$status_array = $status;
if (!$reset) {
@@ -497,10 +520,16 @@ function gallery_set_status($status = array(), $reset = FALSE) {
variable_set('gallery_status', serialize($status_array));
}
+/**
+ * Function gallery_get_status().
+ */
function gallery_get_status() {
return unserialize(variable_get('gallery_status', serialize(array())));
}
+/**
+ * Function gallery_version().
+ */
function gallery_version() {
if (!_gallery_init(FALSE)) {
return array();
@@ -522,5 +551,3 @@ function gallery_version() {
return $version;
}
-
-?>
diff --git a/gallery_block.inc b/gallery_block.inc
index 1d30b39..9f0aff9 100644
--- a/gallery_block.inc
+++ b/gallery_block.inc
@@ -7,7 +7,7 @@
*/
/**
- * Implementation of hook_block
+ * Implementation of hook_block().
*
* 0 - gallery imageblock (random, most viewed, etc)
* 1 - gallery navigation block (recommended)
@@ -23,14 +23,14 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
$blocks['navigation']['info'] = t('Gallery Navigation');
$imageblock_num = variable_get('gallery_block_image_num', 1);
for ($i=0; $i<$imageblock_num; $i++) {
- $id = variable_get('gallery_block_image_'.$i.'_blockid', '');
- $blocks['image-'.$i]['info'] = t('Gallery Image Block @id',
+ $id = variable_get('gallery_block_image_'. $i .'_blockid', '');
+ $blocks['image-'. $i]['info'] = t('Gallery Image Block @id',
array('@id' => ($imageblock_num > 1) ? ('['. ($id ? $id : $i+1) .']') : ''));
}
$gridblock_num = variable_get('gallery_block_grid_num', 1);
for ($i=0; $i<$gridblock_num; $i++) {
- $id = variable_get('gallery_block_grid_'.$i.'_blockid', '');
- $blocks['grid-'.$i]['info'] = t('Gallery Grid Block @id',
+ $id = variable_get('gallery_block_grid_'. $i .'_blockid', '');
+ $blocks['grid-'. $i]['info'] = t('Gallery Grid Block @id',
array('@id' => ($gridblock_num > 1) ? ('['. ($id ? $id : $i+1) .']') : ''));
}
return $blocks;
@@ -70,6 +70,9 @@ function _gallery_block($op = 'list', $delta = 0, $edit = array()) {
}
}
+/**
+ * Function _gallery_block_options().
+ */
function _gallery_block_options(&$type_map, &$param_map) {
$type_map = array(
'randomImage' => t('Random image'),
@@ -94,10 +97,13 @@ function _gallery_block_options(&$type_map, &$param_map) {
);
}
+/**
+ * Function _gallery_block_image_block().
+ */
function _gallery_block_image_block($delta, $type_map) {
- $param_blocks_array = variable_get('gallery_block_image_'.$delta.'_block_block', array('randomImage'));
+ $param_blocks_array = variable_get('gallery_block_image_'. $delta .'_block_block', array('randomImage'));
$params['blocks'] = is_array($param_blocks_array) ? implode('|', $param_blocks_array) : '';
- $param_itemid = variable_get('gallery_block_image_'.$delta.'_item_id', '');
+ $param_itemid = variable_get('gallery_block_image_'. $delta .'_item_id', '');
if (trim($param_itemid) == '%user') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$param_itemid = gallery_user_useralbum(NULL, FALSE);
@@ -105,18 +111,18 @@ function _gallery_block_image_block($delta, $type_map) {
if (!empty($param_itemid)) {
$params['itemId'] = $param_itemid;
}
- $param_show_array = variable_get('gallery_block_image_'.$delta.'_block_show', array());
+ $param_show_array = variable_get('gallery_block_image_'. $delta .'_block_show', array());
$params['show'] = is_array($param_show_array) ? implode('|', $param_show_array) : '';
- if (variable_get('gallery_block_image_'.$delta.'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT) == 'maxsize') {
- $params['maxSize'] = variable_get('gallery_block_image_'.$delta.'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT);
+ if (variable_get('gallery_block_image_'. $delta .'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT) == 'maxsize') {
+ $params['maxSize'] = variable_get('gallery_block_image_'. $delta .'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT);
}
else {
- $params['exactSize'] = variable_get('gallery_block_image_'.$delta.'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT);
+ $params['exactSize'] = variable_get('gallery_block_image_'. $delta .'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT);
}
- $params['albumFrame'] = variable_get('gallery_block_image_'.$delta.'_album_frame', 'none');
- $params['itemFrame'] = variable_get('gallery_block_image_'.$delta.'_item_frame', 'none');
- $params['linkTarget'] = variable_get('gallery_block_image_'.$delta.'_link_target', '');
- $params['link'] = variable_get('gallery_block_image_'.$delta.'_link', '');
+ $params['albumFrame'] = variable_get('gallery_block_image_'. $delta .'_album_frame', 'none');
+ $params['itemFrame'] = variable_get('gallery_block_image_'. $delta .'_item_frame', 'none');
+ $params['linkTarget'] = variable_get('gallery_block_image_'. $delta .'_link_target', '');
+ $params['link'] = variable_get('gallery_block_image_'. $delta .'_link', '');
$block = array();
list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
@@ -141,18 +147,24 @@ function _gallery_block_image_block($delta, $type_map) {
return $block;
}
+/**
+ * Theme function : theme_gallery_block_image_block().
+ */
function theme_gallery_block_image_block($content) {
return '<div class="g2image_centered">'. $content .'</div>';
}
+/**
+ * Function _gallery_block_grid_block().
+ */
function _gallery_block_grid_block($delta, $type_map) {
- $num_cols = variable_get('gallery_block_grid_'.$delta.'_num_cols', 2);
- $num_rows = variable_get('gallery_block_grid_'.$delta.'_num_rows', 2);
+ $num_cols = variable_get('gallery_block_grid_'. $delta .'_num_cols', 2);
+ $num_rows = variable_get('gallery_block_grid_'. $delta .'_num_rows', 2);
$num_images = $num_cols * $num_rows;
- $param_blocks_array = array_fill(0, $num_images, variable_get('gallery_block_grid_'.$delta.'_block_block', 'randomImage'));
+ $param_blocks_array = array_fill(0, $num_images, variable_get('gallery_block_grid_'. $delta .'_block_block', 'randomImage'));
$params['blocks'] = is_array($param_blocks_array) ? implode('|', $param_blocks_array) : '';
- $param_itemid = variable_get('gallery_block_grid_'.$delta.'_item_id', '');
+ $param_itemid = variable_get('gallery_block_grid_'. $delta .'_item_id', '');
if (trim($param_itemid) == '%user') {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$param_itemid = gallery_user_useralbum(NULL, FALSE);
@@ -160,18 +172,18 @@ function _gallery_block_grid_block($delta, $type_map) {
if (!empty($param_itemid)) {
$params['itemId'] = $param_itemid;
}
- $param_show_array = variable_get('gallery_block_grid_'.$delta.'_block_show', array());
+ $param_show_array = variable_get('gallery_block_grid_'. $delta .'_block_show', array());
$params['show'] = is_array($param_show_array) ? implode('|', $param_show_array) : '';
- if (variable_get('gallery_block_grid_'.$delta.'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT) == 'maxsize') {
- $params['maxSize'] = variable_get('gallery_block_grid_'.$delta.'_size', GALLERY_GRID_SIZE_DEFAULT);
+ if (variable_get('gallery_block_grid_'. $delta .'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT) == 'maxsize') {
+ $params['maxSize'] = variable_get('gallery_block_grid_'. $delta .'_size', GALLERY_GRID_SIZE_DEFAULT);
}
else {
- $params['exactSize'] = variable_get('gallery_block_grid_'.$delta.'_size', GALLERY_GRID_SIZE_DEFAULT);
+ $params['exactSize'] = variable_get('gallery_block_grid_'. $delta .'_size', GALLERY_GRID_SIZE_DEFAULT);
}
- $params['albumFrame'] = variable_get('gallery_block_grid_'.$delta.'_album_frame', 'none');
- $params['itemFrame'] = variable_get('gallery_block_grid_'.$delta.'_item_frame', 'none');
- $params['linkTarget'] = variable_get('gallery_block_grid_'.$delta.'_link_target', '');
- $params['link'] = variable_get('gallery_block_grid_'.$delta.'_link', '');
+ $params['albumFrame'] = variable_get('gallery_block_grid_'. $delta .'_album_frame', 'none');
+ $params['itemFrame'] = variable_get('gallery_block_grid_'. $delta .'_item_frame', 'none');
+ $params['linkTarget'] = variable_get('gallery_block_grid_'. $delta .'_link_target', '');
+ $params['link'] = variable_get('gallery_block_grid_'. $delta .'_link', '');
$block = array();
list($ret, $content, $head) = GalleryEmbed::getImageBlock($params);
@@ -192,6 +204,9 @@ function _gallery_block_grid_block($delta, $type_map) {
return $block;
}
+/**
+ * Theme function : theme_gallery_block_grid_block().
+ */
function theme_gallery_block_grid_block($images) {
$rows = array();
foreach ($images as $image_row) {
@@ -208,5 +223,3 @@ function theme_gallery_block_grid_block($images) {
return $html;
}
-
-?>
diff --git a/gallery_filter.inc b/gallery_filter.inc
index ee4c5c5..a9e13dd 100644
--- a/gallery_filter.inc
+++ b/gallery_filter.inc
@@ -7,7 +7,8 @@
*/
/**
- * Implementation of the main filter routine
+ * Function gallery_filter_process().
+ * (implementation of the main filter routine)
*/
function gallery_filter_process($text) {
$prefix = trim(variable_get('gallery_filter_prefix', 'G2'));
@@ -123,7 +124,8 @@ function gallery_filter_process($text) {
}
/**
- * Sanitize filter parameters
+ * Function _gallery_filter_sanitize().
+ * (sanitize filter parameters)
*/
function _gallery_filter_sanitize($key, $value) {
switch (strtolower($key)) {
@@ -148,5 +150,3 @@ function _gallery_filter_sanitize($key, $value) {
return $value;
}
-
-?>
diff --git a/gallery_g2image.inc b/gallery_g2image.inc
index 6169f9e..b1489d9 100644
--- a/gallery_g2image.inc
+++ b/gallery_g2image.inc
@@ -5,28 +5,27 @@
* gallery.module : gallery_g2image.inc
* Support functions for g2image by capt_kirk (from http://g2image.steffensenfamily.com)
*/
-
- /**
- * Add js to page
+
+/**
+ * Function gallery_g2image_add_js().
*/
- function gallery_g2image_add_js() {
+function gallery_g2image_add_js() {
// Ensure only sent once
static $sent = FALSE;
if (!$sent) {
$path = drupal_get_path('module', 'gallery');
$g2image_uri = base_path() . $path .'/g2image/';
- $output = ' var G2IMAGE_URI = "'. $g2image_uri .'";';
-
- drupal_add_js($output, 'inline');
+ drupal_add_js('var G2IMAGE_URI = "'. $g2image_uri .'";', 'inline');
drupal_add_js($path .'/g2image.js');
$sent = TRUE;
}
}
-
- /**
- * Theme for adding an image link underneath textareas
+
+/**
+ * Theme function : theme_gallery_g2image_textarea_link().
+ * (for adding an image link underneath textareas)
*/
function theme_gallery_g2image_textarea_link($element, $link) {
$output = '<div class="g2image-button"><a class="g2image-link" id="g2image-link-'. $element['#id']
@@ -39,8 +38,8 @@ function theme_gallery_g2image_textarea_link($element, $link) {
}
/**
- * Determine if g2image button should be attached to the page/textarea.
- * (from img_assist and tinymce code)
+ * Function _gallery_g2image_page_match().
+ * (determine if g2image button should be attached to the page/textarea)
*
* @return
* TRUE if can render, FALSE if not allowed.
@@ -48,8 +47,7 @@ function theme_gallery_g2image_textarea_link($element, $link) {
function _gallery_g2image_page_match() {
$page_match = FALSE;
$only_listed_pages = variable_get('gallery_g2image_only_listed_pages', 1);
- $pages = variable_get('gallery_g2image_std_pages', gallery_help('admin/settings/gallery_g2image#pages'));
- if ($pages) {
+ if ($pages = variable_get('gallery_g2image_std_pages', gallery_help('admin/settings/gallery_g2image#pages'))) {
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. variable_get('site_frontpage', 'node') .'\2'), preg_quote($pages, '/')) .')$/';
$page_match = !($only_listed_pages xor preg_match($regexp, $path));
@@ -57,5 +55,3 @@ function _gallery_g2image_page_match() {
return $page_match;
}
-
- ?>
diff --git a/gallery_groups.inc b/gallery_groups.inc
index 53d34a2..dd6bfb9 100644
--- a/gallery_groups.inc
+++ b/gallery_groups.inc
@@ -7,7 +7,8 @@
*/
/**
- * Sync Drupal roles and Gallery groups for a specific user
+ * Function _gallery_groups_user().
+ * (sync Drupal roles and Gallery groups for a specific user)
*/
function _gallery_groups_user($user, $groups = FALSE) {
// Sync the Drupal roles and Gallery groups
@@ -71,7 +72,8 @@ function _gallery_groups_user($user, $groups = FALSE) {
}
/**
- * Sync Drupal roles and Gallery groups
+ * Function _gallery_groups_sync().
+ * (sync Drupal roles and Gallery groups)
*/
function _gallery_groups_sync() {
static $sync_groups = TRUE;
@@ -189,10 +191,11 @@ function _gallery_groups_sync() {
}
/**
- * Fetch 'GalleryGroup' entries from G2 'ExternalIdMap'
- * g2Id => externalId (default)
+ * Function _gallery_groups_map().
+ * (fetch 'GalleryGroup' entries from G2 'ExternalIdMap')
*/
function _gallery_groups_map($ids = array(), $inverse = FALSE) {
+ // g2Id => externalId (default)
$match = array('entityType' => 'GalleryGroup');
if (count($ids) > 0) {
if ($inverse) {
@@ -218,7 +221,8 @@ function _gallery_groups_map($ids = array(), $inverse = FALSE) {
}
/**
- * Get info about groups map status
+ * Function gallery_groups_map_info().
+ * (get info about groups map status)
*/
function gallery_groups_map_info($g2_user, $user) {
// Get the groups for this G2 user
@@ -245,7 +249,8 @@ function gallery_groups_map_info($g2_user, $user) {
}
/**
- * Import Gallery groups into Drupal
+ * Function _gallery_groups_import().
+ * (import Gallery groups into Drupal)
*/
function _gallery_groups_import() {
// Fetch G2 album names
@@ -288,7 +293,8 @@ function _gallery_groups_import() {
}
/**
- * Sync Drupal role <> G2 group when Drupal role has changed
+ * Function _gallery_groups_submit().
+ * (sync Drupal role <> G2 group when Drupal role has changed)
*/
function _gallery_groups_submit($form_id, &$form_values) {
if (!_gallery_init(TRUE)) {
@@ -299,5 +305,3 @@ function _gallery_groups_submit($form_id, &$form_values) {
GalleryEmbed::done();
}
-
-?>
diff --git a/gallery_help.inc b/gallery_help.inc
index d3e5376..1105d7b 100644
--- a/gallery_help.inc
+++ b/gallery_help.inc
@@ -7,10 +7,9 @@
*/
/**
- * Implementation of hook_help
+ * Implementation of hook_help().
*/
function _gallery_help($section) {
-
switch ($section) {
case 'filter#short-tip' :
return gallery_filter_short_tip_translated();
@@ -81,10 +80,16 @@ function _gallery_help($section) {
}
}
+/**
+ * Function gallery_filter_short_tip_translated().
+ */
function gallery_filter_short_tip_translated() {
return t('You may link to Gallery2 items on this site <a href="@explanation-url">using a special syntax</a>.', array('@explanation-url' => url('filter/tips', NULL, 'filter-gallery-0')));
}
+/**
+ * Function gallery_filter_long_tip_translated().
+ */
function gallery_filter_long_tip_translated() {
$prefix = variable_get("gallery_filter_prefix", "G2");
@@ -118,6 +123,9 @@ from a larger image and so image quality is maintained. This only works for Gall
<li>frame/album_frame/item_frame: You can use just "frame" to assign a frame to the thumbnail regardless of whether it\'s for an album or a single item. Using aframe will only affect albums and iframe will only affect single items. Frames included with the default Gallery 2 install are: bamboo, book, brand , dots, flicking, gold, gold2, polaroid, polaroids, shadow, shells, slide, solid, notebook, wood.</li></ul>');
}
+/**
+ * Function _gallery_g2image_help().
+ */
function _gallery_g2image_help() {
return t('
<h3>Gallery Image Assist (g2image)</h3>
@@ -125,9 +133,10 @@ function _gallery_g2image_help() {
<p>Caution: By default, Drupal uses the \'Filtered HTML\' input format for adding content to the site and the default settings cause the &lt;img&gt; tags added by g2image to be removed. Check the TinyMCE documentation for instructions on how to avoid this.</p>');
}
+/**
+ * Function _gallery_report_help().
+ */
function _gallery_report_help() {
return t('<p><strong>A serious error has occured. This can happen due to an incorrect configuration or a bug in the gallery module. If you plan to submit a bug report to the issue queue at <a href="@gallery-issues">drupal.org</a> consider to include the <a href="@report">pre-generated report file</a>.</strong></p>',
array('@gallery-issues' => 'http://drupal.org/project/issues/gallery', '@report' => url('admin/settings/gallery/report/download')));
}
-
-?>
diff --git a/gallery_install.inc b/gallery_install.inc
index 0905f15..f1186b3 100644
--- a/gallery_install.inc
+++ b/gallery_install.inc
@@ -12,6 +12,9 @@ define(GALLERY_INSTALL_STEP_PLUGINS, 3);
define(GALLERY_INSTALL_STEP_URLREWRITE, 4);
define(GALLERY_INSTALL_STEP_USERSYNC, 5);
+/**
+ * Function _gallery_install().
+ */
function _gallery_install($form_values = NULL) {
$form['#multistep'] = TRUE;
$form['#redirect'] = FALSE;
@@ -147,6 +150,7 @@ function _gallery_install($form_values = NULL) {
}
/**
+ * Function _gallery_install_step_php_memory().
* Step 1: Check PHP Memory
*/
function _gallery_install_step_php_memory(&$form, &$form_values, &$install_status) {
@@ -176,6 +180,7 @@ function _gallery_install_step_php_memory(&$form, &$form_values, &$install_statu
}
/**
+ * Function _gallery_install_step_locations().
* Step 2: Gallery2 Locations
*/
function _gallery_install_step_locations(&$form, &$form_values, &$install_status) {
@@ -338,6 +343,7 @@ function _gallery_install_step_locations(&$form, &$form_values, &$install_status
}
/**
+ * Function _gallery_install_step_plugins().
* Step 3: Drupal Modules / Gallery2 Plugins
*/
function _gallery_install_step_plugins(&$form, &$form_values, &$install_status) {
@@ -462,6 +468,7 @@ function _gallery_install_step_plugins(&$form, &$form_values, &$install_status)
}
/**
+ * Function _gallery_install_step_urlrewrite().
* Step 4: Clean URL configuration
*/
function _gallery_install_step_urlrewrite(&$form, &$form_values, &$install_status) {
@@ -579,6 +586,7 @@ function _gallery_install_step_urlrewrite(&$form, &$form_values, &$install_statu
}
/**
+ * Function _gallery_install_step_usersync().
* Step 5: User Synchronization
*/
function _gallery_install_step_usersync(&$form, &$form_values, &$install_status) {
@@ -615,6 +623,9 @@ function _gallery_install_step_usersync(&$form, &$form_values, &$install_status)
}
}
+/**
+ * Function _gallery_install_submit().
+ */
function _gallery_install_submit($form_id, $form_values) {
switch ($form_values['op']) {
case t('Sync users/groups'):
@@ -691,6 +702,9 @@ function _gallery_install_submit($form_id, $form_values) {
variable_set('gallery_wizard_data', serialize($form_values));
}
+/**
+ * Function _gallery_install_locations().
+ */
function _gallery_install_locations(&$form, &$form_values, &$install_status) {
include_once(drupal_get_path('module', 'gallery') .'/G2EmbedDiscoveryUtilities.class');
@@ -735,6 +749,9 @@ function _gallery_install_locations(&$form, &$form_values, &$install_status) {
Remember that the auto-config will not work for all hosts.');
}
+/**
+ * Function _gallery_install_locations_check().
+ */
function _gallery_install_locations_check($orig, $autodetect) {
// Set up the result status array. The rest gets filled in later.
$result = array(
@@ -767,7 +784,7 @@ function _gallery_install_locations_check($orig, $autodetect) {
i18n_get_lang_prefix($embed_uri, TRUE);
}
if (substr($embed_uri, -8) == '/gallery') {
- $embed_uri = substr($embed_uri, 0, -7) . 'index.php?q=gallery';
+ $embed_uri = substr($embed_uri, 0, -7) .'index.php?q=gallery';
}
}
@@ -871,6 +888,9 @@ function _gallery_install_locations_check($orig, $autodetect) {
return array($vars['gallery_valid'], $vars, $result);
}
+/**
+ * Function _gallery_install_in_drupal_folder().
+ */
function _gallery_install_in_drupal_folder($embed_path) {
static $warn = TRUE;
@@ -898,6 +918,9 @@ function _gallery_install_in_drupal_folder($embed_path) {
}
}
+/**
+ * Function _gallery_install_urlrewrite().
+ */
function _gallery_install_urlrewrite(&$public_path, &$htaccess_path, $load_config = FALSE) {
list($ret, $rewrite_api) = GalleryCoreApi::newFactoryInstance('RewriteApi');
if ($ret || !$rewrite_api) {
@@ -955,5 +978,3 @@ function _gallery_install_urlrewrite(&$public_path, &$htaccess_path, $load_confi
return TRUE;
}
-
-?>
diff --git a/gallery_menu/gallery_menu.module b/gallery_menu/gallery_menu.module
index b6bd7a6..cb6b401 100644
--- a/gallery_menu/gallery_menu.module
+++ b/gallery_menu/gallery_menu.module
@@ -6,7 +6,7 @@
*/
/**
- * Implementation of hook_menu
+ * Implementation of hook_menu().
*/
function gallery_menu_menu($may_cache) {
$items = array();
@@ -32,7 +32,7 @@ function gallery_menu_menu($may_cache) {
}
/**
- * Implementation of gallery_menu_settings
+ * Function gallery_menu_settings().
*/
function gallery_menu_settings() {
$form['menu'] = array(
@@ -61,21 +61,21 @@ function gallery_menu_settings() {
}
/**
- * Implementation of hook_enable
+ * Implementation of hook_enable().
*/
function gallery_menu_enable() {
variable_set('gallery_page_callback', 'gallery_menu_page');
}
/**
- * Implementation of hook_disable
+ * Implementation of hook_disable().
*/
function gallery_menu_disable() {
variable_del('gallery_page_callback');
}
/**
- * Implementation of gallery_menu_page
+ * Function gallery_menu_page().
*/
function gallery_menu_page() {
$result = gallery_page(TRUE);
@@ -85,13 +85,13 @@ function gallery_menu_page() {
if ($item['type'] != 'GalleryAlbumItem') {
$id = $item['parent'];
}
- list ($ret, $parents) = GalleryCoreApi::fetchParentSequence($id);
+ list($ret, $parents) = GalleryCoreApi::fetchParentSequence($id);
if ($ret) {
gallery_error(t('Error fetching item parents'), $ret);
}
else {
array_shift($parents);
- $path = 'gallery/' . (count($parents) ? implode('/', $parents) . '/' : '') . $id;
+ $path = 'gallery/'. (count($parents) ? implode('/', $parents) .'/' : '') . $id;
menu_set_active_item($path);
}
}
@@ -100,7 +100,7 @@ function gallery_menu_page() {
}
/**
- * Implementation of gallery_menu_album
+ * Function gallery_menu_album().
*/
function gallery_menu_album($id = NULL, $path) {
// Redirect to true album url (from the virtual menu path)
@@ -109,7 +109,7 @@ function gallery_menu_album($id = NULL, $path) {
}
/**
- * Implementation of gallery_menu_build_menu
+ * Function gallery_menu_build_menu().
*/
function gallery_menu_build_menu() {
$items = array();
@@ -126,10 +126,10 @@ function gallery_menu_build_menu() {
}
/**
- * Implementation of _gallery_menu_album_tree
+ * Function _gallery_menu_album_tree().
*/
function _gallery_menu_album_tree($root = NULL, $depth = NULL, $user = NULL) {
- list ($ret, $tree) = GalleryCoreApi::fetchAlbumTree($root, $depth, $user);
+ list($ret, $tree) = GalleryCoreApi::fetchAlbumTree($root, $depth, $user);
if ($ret) {
gallery_error(t('Error fetching album tree'), $ret);
return FALSE;
@@ -139,15 +139,15 @@ function _gallery_menu_album_tree($root = NULL, $depth = NULL, $user = NULL) {
}
/**
- * Implementation of _gallery_menu_album_traverse
+ * Function _gallery_menu_album_traverse().
*/
function _gallery_menu_traverse(&$tree, &$items) {
static $parents = array();
foreach (array_keys($tree) as $id) {
$album = gallery_item_details($id);
- if (variable_get('gallery_menu_show_' . $id, 1)) {
- $path = 'gallery/' . (count($parents) ? implode('/', $parents) . '/' : '') . $id;
+ if (variable_get('gallery_menu_show_'. $id, 1)) {
+ $path = 'gallery/'. (count($parents) ? implode('/', $parents) .'/' : '') . $id;
$items[] = array(
'path' => $path,
'title' => $album['title'],
@@ -167,7 +167,7 @@ function _gallery_menu_traverse(&$tree, &$items) {
}
/**
- * Implementation of _gallery_menu_settings_table
+ * Function _gallery_menu_settings_table().
*/
function _gallery_menu_settings_table() {
if (!_gallery_init(TRUE)) {
@@ -185,15 +185,15 @@ function _gallery_menu_settings_table() {
}
/**
- * Implementation of _gallery_menu_album_traverse
+ * Function _gallery_menu_album_traverse().
*/
function _gallery_menu_settings_traverse(&$tree) {
static $parents = array();
foreach (array_keys($tree) as $id) {
$album = gallery_item_details($id);
- $enabled = variable_get('gallery_menu_show_' . $id, 1);
- $form[$id]['title'] = array('#value' => implode('', $parents) . ' ' . $album['title']);
- $form[$id]['checkbox']['gallery_menu_show_' . $id] = array(
+ $enabled = variable_get('gallery_menu_show_'. $id, 1);
+ $form[$id]['title'] = array('#value' => implode('', $parents) .' '. $album['title']);
+ $form[$id]['checkbox']['gallery_menu_show_'. $id] = array(
'#type' => 'checkbox',
'#title' => '',
'#default_value' => $enabled
@@ -210,7 +210,7 @@ function _gallery_menu_settings_traverse(&$tree) {
}
/**
- * Theme function : theme_gallery_menu_settings_table
+ * Theme function : theme_gallery_menu_settings_table().
*/
function theme_gallery_menu_settings_table($form, $rows = array()) {
static $depth = 0;
@@ -230,5 +230,3 @@ function theme_gallery_menu_settings_table($form, $rows = array()) {
$depth--;
return ($depth < 0) ? theme('table', array(t('Album'), t('Show')), $rows) : $rows;
}
-
-?>
diff --git a/gallery_report.inc b/gallery_report.inc
index 688f58f..675bc49 100644
--- a/gallery_report.inc
+++ b/gallery_report.inc
@@ -6,6 +6,9 @@
* Bug report assistance (system info)
*/
+/**
+ * Function _gallery_report().
+ */
function _gallery_report($download = FALSE, $report = array(), $cache = FALSE) {
// provide download of the cached report
if ($download && ($content = cache_get('gallery_report_'. session_id()))) {
@@ -96,6 +99,9 @@ function _gallery_report($download = FALSE, $report = array(), $cache = FALSE) {
return $content;
}
+/**
+ * Function _gallery_report_download().
+ */
function _gallery_report_download($content) {
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=gallery_report.html");
@@ -107,10 +113,16 @@ function _gallery_report_download($content) {
exit();
}
+/**
+ * Theme function : theme_gallery_report().
+ */
function theme_gallery_report($report) {
return ' <div><table border=1 style=\'empty-cells:hide;\'>'. _gallery_report_walk($report) ."\n".' </table></div>';
}
+/**
+ * Function _gallery_report_walk().
+ */
function _gallery_report_walk($element, $level = 1, $sub = FALSE) {
$html = '';
$element = is_object($element) ? get_object_vars($element) : $element;
@@ -133,5 +145,3 @@ function _gallery_report_walk($element, $level = 1, $sub = FALSE) {
return $html;
}
-
-?>
diff --git a/gallery_search.inc b/gallery_search.inc
index e18459a..ff04204 100644
--- a/gallery_search.inc
+++ b/gallery_search.inc
@@ -6,7 +6,7 @@
*/
/**
- * Implementation of hook_search
+ * Implementation of hook_search().
*/
function _gallery_search($op = 'search', $keys = NULL) {
switch ($op) {
@@ -75,6 +75,9 @@ function _gallery_search($op = 'search', $keys = NULL) {
}
}
+/**
+ * Function _gallery_search_pager_search().
+ */
function _gallery_search_pager_search(&$keys, $limit = 10, $element = 0) {
// adapted version of the pager_query() function (from /includes/pager.inc)
// for use with the Gallery2 search() function
@@ -94,6 +97,9 @@ function _gallery_search_pager_search(&$keys, $limit = 10, $element = 0) {
return _gallery_search_perform($keys, $pager_page_array[$element] * $limit, $limit);
}
+/**
+ * Function _gallery_search_perform().
+ */
function _gallery_search_perform(&$keys, $offset = 0, $limit = -1) {
list($search_interface, $options) = _gallery_search_init();
if (!$search_interface) {
@@ -117,6 +123,9 @@ function _gallery_search_perform(&$keys, $offset = 0, $limit = -1) {
return $matches;
}
+/**
+ * Function _gallery_search_form().
+ */
function _gallery_search_form(&$form) {
list($search_interface, $options) = _gallery_search_init();
if (!count($options)) {
@@ -149,6 +158,9 @@ function _gallery_search_form(&$form) {
$form['#validate']['_gallery_search_validate'] = array();
}
+/**
+ * Function _gallery_search_validate().
+ */
function _gallery_search_validate($form_id, $form_values, $form) {
$keys = $form_values['processed_keys'];
// append field options to query
@@ -161,6 +173,9 @@ function _gallery_search_validate($form_id, $form_values, $form) {
}
}
+/**
+ * Function _gallery_search_init().
+ */
function _gallery_search_init() {
// init gallery
if (!_gallery_init(TRUE)) {
@@ -188,6 +203,9 @@ function _gallery_search_init() {
return array($search_interface, $options);
}
+/**
+ * Function _gallery_search_page().
+ */
function _gallery_search_page($results) {
$items_per_row = variable_get('gallery_search_num_per_row', 3);
$rows_per_pager = variable_get('gallery_search_rows_per_pager', 4);
@@ -212,6 +230,9 @@ function _gallery_search_page($results) {
return $output;
}
+/**
+ * Theme function : theme_gallery_search_item().
+ */
function theme_gallery_search_item($item) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$output .= '<div class="g2image_centered">'. $item['thumbnail'] .'</div>';
@@ -219,5 +240,3 @@ function theme_gallery_search_item($item) {
return $output;
}
-
-?>
diff --git a/gallery_settings.inc b/gallery_settings.inc
index 9a21efd..862e0a6 100644
--- a/gallery_settings.inc
+++ b/gallery_settings.inc
@@ -5,12 +5,18 @@
* gallery.module : gallery_settings.inc
* Settings functions
*/
-
+
+/**
+ * Function _gallery_settings_install().
+ */
function _gallery_settings_install($form_values = NULL) {
require_once(drupal_get_path('module', 'gallery') .'/gallery_install.inc');
return _gallery_install($form_values);
}
-
+
+/**
+ * Function _gallery_settings_general().
+ */
function _gallery_settings_general() {
// Short Status
gallery_version();
@@ -215,6 +221,9 @@ function _gallery_settings_general() {
return system_settings_form($form);
}
+/**
+ * Function _gallery_settings_general_validate().
+ */
function _gallery_settings_general_validate($form_id, $form_values) {
if (!is_numeric($form_values['gallery_block_image_num']) || $form_values['gallery_block_image_num'] < 1) {
form_set_error('gallery_block_image_num', t('Number of image blocks must be a positiv integer greater zero.'));
@@ -224,12 +233,18 @@ function _gallery_settings_general_validate($form_id, $form_values) {
}
}
+/**
+ * Function _gallery_settings_general_submit().
+ */
function _gallery_settings_general_submit($form_id, $form_values) {
if ($form_values['gallery_enable_sitemap'] != variable_get('gallery_enable_sitemap', 0)) {
drupal_set_message('The Google (XML) sitemap setting has been updated, but the new sitemap may not be generated immediately (controlled by gsitemap).');
}
}
+/**
+ * Function _gallery_settings_block_image().
+ */
function _gallery_settings_block_image($delta) {
$plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
@@ -256,17 +271,17 @@ function _gallery_settings_block_image($delta) {
$form['#description'] = $imageblock_desc;
$imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
- t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
+ t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
$image_frames = gallery_get_image_frames();
_gallery_block_options($type_map, $param_map);
if (variable_get('gallery_block_image_num', 1) > 1) {
- $form['gallery_block_image_'.$delta.'_blockid'] = array(
+ $form['gallery_block_image_'. $delta .'_blockid'] = array(
'#type' => 'textfield',
'#title' => t('Block Identifier [Block @id]', array('@id' => $delta+1)),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_blockid', ''),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_blockid', ''),
'#size' => 25,
'#maxlength' => 30,
'#description' => t('A short identifier to distinguish blocks of the same type. (Blocks are numbered by default)'),
@@ -274,9 +289,9 @@ function _gallery_settings_block_image($delta) {
}
if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
- $numimages = variable_get('gallery_block_image_'.$delta.'_num_images', 3);
+ $numimages = variable_get('gallery_block_image_'. $delta .'_num_images', 3);
- $form['gallery_block_image_'.$delta.'_num_images'] = array(
+ $form['gallery_block_image_'. $delta .'_num_images'] = array(
'#type' => 'select',
'#title' => t('Number of images in block'),
'#default_value' => $numimages,
@@ -284,9 +299,9 @@ function _gallery_settings_block_image($delta) {
'#description' => t('Choose the number of images to appear. You will need to submit the form if you have increased the number in order to choose the image types.'),
);
- $gallery_block_block = variable_get('gallery_block_image_'.$delta.'_block_block', array('randomImage'));
+ $gallery_block_block = variable_get('gallery_block_image_'. $delta .'_block_block', array('randomImage'));
- $form['gallery_block_image_'.$delta.'_block_block'] = array(
+ $form['gallery_block_image_'. $delta .'_block_block'] = array(
'#type' => 'fieldset',
'#title' => t('Image types'),
'#collapsible' => FALSE,
@@ -295,7 +310,7 @@ function _gallery_settings_block_image($delta) {
'#description' => t('Pick the type of images you would like to see. You can select the same type more than once.'),
);
for ($i=0; $i<$numimages; $i++) {
- $form['gallery_block_image_'.$delta.'_block_block'][$i] = array(
+ $form['gallery_block_image_'. $delta .'_block_block'][$i] = array(
'#type' => 'select',
'#title' => '',
'#default_value' => $gallery_block_block[$i],
@@ -303,10 +318,10 @@ function _gallery_settings_block_image($delta) {
);
}
- $form['gallery_block_image_'.$delta.'_item_id'] = array(
+ $form['gallery_block_image_'. $delta .'_item_id'] = array(
'#type' => 'textfield',
'#title' => t('Album or Item ID'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_item_id', ''),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_item_id', ''),
'#size' => 20,
'#maxlength' => 20,
'#description' => t('Enter the Gallery image or album ID (or blank). If an album or item ID is specified, random
@@ -314,18 +329,18 @@ function _gallery_settings_block_image($delta) {
items will be taken from the visitor\'s useralbum (if possible).')
);
- $form['gallery_block_image_'.$delta.'_block_show'] = array(
+ $form['gallery_block_image_'. $delta .'_block_show'] = array(
'#type' => 'checkboxes',
'#title' => t('Image data'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_block_show', array('title', 'heading')),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_block_show', array('title', 'heading')),
'#options' => $param_map,
'#description' => t('Choose the item metadata you would like to display.'),
);
- $form['gallery_block_image_'.$delta.'_size_method'] = array(
+ $form['gallery_block_image_'. $delta .'_size_method'] = array(
'#type' => 'select',
'#title' => t('Image size method'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_size_method', GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT),
'#options' => array(
'maxsize' => t('Max Size'),
'exactsize' => t('Exact Size'),
@@ -336,44 +351,44 @@ function _gallery_settings_block_image($delta) {
will be guaranteed to be the size defined below. Only supported for G2.2+.'),
);
- $form['gallery_block_image_'.$delta.'_size'] = array(
+ $form['gallery_block_image_'. $delta .'_size'] = array(
'#type' => 'textfield',
'#title' => t('Image size'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_size', GALLERY_IMAGEBLOCK_SIZE_DEFAULT),
'#size' => 10,
'#maxlength' => 10,
'#description' => t('Sets the size (in pixels) of the longest side of the image according to the method defined above.'),
);
- $form['gallery_block_image_'.$delta.'_album_frame'] = array(
+ $form['gallery_block_image_'. $delta .'_album_frame'] = array(
'#type' => 'select',
'#title' => t('Album frame'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_album_frame', 'none'),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_album_frame', 'none'),
'#options' => $image_frames,
'#description' => $imageframe_desc,
);
- $form['gallery_block_image_'.$delta.'_item_frame'] = array(
+ $form['gallery_block_image_'. $delta .'_item_frame'] = array(
'#type' => 'select',
'#title' => t('Item frame'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_item_frame', 'none'),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_item_frame', 'none'),
'#options' => $image_frames,
'#description' => $imageframe_desc,
);
- $form['gallery_block_image_'.$delta.'_link_target'] = array(
+ $form['gallery_block_image_'. $delta .'_link_target'] = array(
'#type' => 'textfield',
'#title' => t('Link target'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_link_target', ''),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_link_target', ''),
'#size' => 20,
'#maxlength' => 20,
'#description' => t('Enter a link target (e.g. \'_blank\' to open in a new window).'),
);
- $form['gallery_block_image_'.$delta.'_link'] = array(
+ $form['gallery_block_image_'. $delta .'_link'] = array(
'#type' => 'textfield',
'#title' => t('Image Link'),
- '#default_value' => variable_get('gallery_block_image_'.$delta.'_link', ''),
+ '#default_value' => variable_get('gallery_block_image_'. $delta .'_link', ''),
'#size' => 60,
'#maxlength' => 255,
'#description' => t('By default the image has a link to the item in the Gallery. This
@@ -385,6 +400,9 @@ function _gallery_settings_block_image($delta) {
return $form;
}
+/**
+ * Function _gallery_settings_block_grid().
+ */
function _gallery_settings_block_grid($delta) {
$plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
@@ -417,10 +435,10 @@ function _gallery_settings_block_grid($delta) {
_gallery_block_options($type_map, $param_map);
if (variable_get('gallery_block_grid_num', 1) > 1) {
- $form['gallery_block_grid_'.$delta.'_blockid'] = array(
+ $form['gallery_block_grid_'. $delta .'_blockid'] = array(
'#type' => 'textfield',
'#title' => t('Block Identifier [Block @id]', array('@id' => $delta+1)),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_blockid', ''),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_blockid', ''),
'#size' => 25,
'#maxlength' => 30,
'#description' => t('A short identifier to distinguish blocks of the same type. (Blocks are numbered by default)'),
@@ -428,34 +446,34 @@ function _gallery_settings_block_grid($delta) {
}
if ($plugin_status['imageblock'] == GALLERY_PLUGIN_ENABLED) {
- $form['gallery_block_grid_'.$delta.'_num_cols'] = array(
+ $form['gallery_block_grid_'. $delta .'_num_cols'] = array(
'#type' => 'select',
'#title' => t('Number of columns'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_num_cols', 2),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_num_cols', 2),
'#options' => _gallery_range_array(1, 5),
'#description' => t('Enter the number of columns in the grid.'),
);
- $form['gallery_block_grid_'.$delta.'_num_rows'] = array(
+ $form['gallery_block_grid_'. $delta .'_num_rows'] = array(
'#type' => 'select',
'#title' => t('Number of rows'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_num_rows', 2),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_num_rows', 2),
'#options' => _gallery_range_array(1, 5),
'#description' => t('Enter the number of rows in the grid.'),
);
- $form['gallery_block_grid_'.$delta.'_block_block'] = array(
+ $form['gallery_block_grid_'. $delta .'_block_block'] = array(
'#type' => 'select',
'#title' => 'Image types',
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_block_block', 'randomImage'),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_block_block', 'randomImage'),
'#options' => $type_map,
'#description' => 'Pick the type of images you would like to see in the grid.',
);
- $form['gallery_block_grid_'.$delta.'_item_id'] = array(
+ $form['gallery_block_grid_'. $delta .'_item_id'] = array(
'#type' => 'textfield',
'#title' => t('Album or Item ID'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_item_id', ''),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_item_id', ''),
'#size' => 20,
'#maxlength' => 20,
'#description' => t('Enter the Gallery image or album ID (or blank). If an album or item ID is specified, random
@@ -463,18 +481,18 @@ function _gallery_settings_block_grid($delta) {
items will be taken from the visitor\'s useralbum (if possible).')
);
- $form['gallery_block_grid_'.$delta.'_block_show'] = array(
+ $form['gallery_block_grid_'. $delta .'_block_show'] = array(
'#type' => 'checkboxes',
'#title' => t('Image data'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_block_show', array()),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_block_show', array()),
'#options' => $param_map,
'#description' => t('Choose the item metadata you would like to display.'),
);
- $form['gallery_block_grid_'.$delta.'_size_method'] = array(
+ $form['gallery_block_grid_'. $delta .'_size_method'] = array(
'#type' => 'select',
'#title' => t('Image size method'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_size_method', GALLERY_GRID_SIZE_METHOD_DEFAULT),
'#options' => array(
'maxsize' => t('Max Size'),
'exactsize' => t('Exact Size'),
@@ -485,45 +503,45 @@ function _gallery_settings_block_grid($delta) {
will be guaranteed to be the size defined below. Only supported for G2.2+.'),
);
- $form['gallery_block_grid_'.$delta.'_size'] = array(
+ $form['gallery_block_grid_'. $delta .'_size'] = array(
'#type' => 'textfield',
'#title' => t('Image size'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_size', GALLERY_GRID_SIZE_DEFAULT),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_size', GALLERY_GRID_SIZE_DEFAULT),
'#size' => 10,
'#maxlength' => 10,
'#description' => t('Sets the size (in pixels) of the longest side of the image according
to the method defined above.'),
);
- $form['gallery_block_grid_'.$delta.'_album_frame'] = array(
+ $form['gallery_block_grid_'. $delta .'_album_frame'] = array(
'#type' => 'select',
'#title' => t('Album frame'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_album_frame', 'none'),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_album_frame', 'none'),
'#options' => $image_frames,
'#description' => $imageframe_desc,
);
- $form['gallery_block_grid_'.$delta.'_item_frame'] = array(
+ $form['gallery_block_grid_'. $delta .'_item_frame'] = array(
'#type' => 'select',
'#title' => t('Item frame'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_item_frame', 'none'),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_item_frame', 'none'),
'#options' => $image_frames,
'#description' => $imageframe_desc,
);
- $form['gallery_block_grid_'.$delta.'_link_target'] = array(
+ $form['gallery_block_grid_'. $delta .'_link_target'] = array(
'#type' => 'textfield',
'#title' => t('Link target'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_link_target', ''),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_link_target', ''),
'#size' => 20,
'#maxlength' => 20,
'#description' => t('Enter a link target (e.g. \'_blank\' to open in a new window).'),
);
- $form['gallery_block_grid_'.$delta.'_link'] = array(
+ $form['gallery_block_grid_'. $delta .'_link'] = array(
'#type' => 'textfield',
'#title' => t('Image Link'),
- '#default_value' => variable_get('gallery_block_grid_'.$delta.'_link', ''),
+ '#default_value' => variable_get('gallery_block_grid_'. $delta .'_link', ''),
'#size' => 60,
'#maxlength' => 255,
'#description' => t('By default the image has a link to the item in the Gallery. This
@@ -535,17 +553,20 @@ function _gallery_settings_block_grid($delta) {
return $form;
}
+/**
+ * Function _gallery_settings_block_save().
+ */
function _gallery_settings_block_save($delta, $form_values) {
// Validate variable values
- if (isset($form_values['gallery_block_image_'.$delta.'_size'])) {
- if (!is_numeric($form_values['gallery_block_image_'.$delta.'_size']) || $form_values['gallery_block_image_'.$delta.'_size'] < 10) {
- $form_values['gallery_block_image_'.$delta.'_size'] = 10;
+ if (isset($form_values['gallery_block_image_'. $delta .'_size'])) {
+ if (!is_numeric($form_values['gallery_block_image_'. $delta .'_size']) || $form_values['gallery_block_image_'. $delta .'_size'] < 10) {
+ $form_values['gallery_block_image_'. $delta .'_size'] = 10;
drupal_set_message(t('Image size must be a number greater than ten pixels. (The value has been updated to \'10\' for your convenience.)'), 'error');
}
}
- if (isset($form_values['gallery_block_grid_'.$delta.'_size'])) {
- if (!is_numeric($form_values['gallery_block_grid_'.$delta.'_size']) || $form_values['gallery_block_grid_'.$delta.'_size'] < 10) {
- $form_values['gallery_block_grid_'.$delta.'_size'] = 10;
+ if (isset($form_values['gallery_block_grid_'. $delta .'_size'])) {
+ if (!is_numeric($form_values['gallery_block_grid_'. $delta .'_size']) || $form_values['gallery_block_grid_'. $delta .'_size'] < 10) {
+ $form_values['gallery_block_grid_'. $delta .'_size'] = 10;
drupal_set_message(t('Image size must be a number greater than ten pixels. (The value has been updated to \'10\' for your convenience.)'), 'error');
}
}
@@ -560,6 +581,9 @@ function _gallery_settings_block_save($delta, $form_values) {
}
}
+/**
+ * Function _gallery_settings_filter().
+ */
function _gallery_settings_filter() {
require_once(drupal_get_path('module', 'gallery') .'/gallery_block.inc');
$plugin_status = gallery_plugin_status(array('imageblock', 'imageframe'));
@@ -585,7 +609,7 @@ function _gallery_settings_filter() {
}
$imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
- t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
+ t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
$form['filter'] = array(
@@ -741,6 +765,9 @@ function _gallery_settings_filter() {
return system_settings_form($form);
}
+/**
+ * Function _gallery_settings_filter_validate().
+ */
function _gallery_settings_filter_validate($form_id, $form_values) {
// Only validate if a setting was returned
if (isset($form_values['gallery_filter_default_maxsize'])) {
@@ -775,6 +802,9 @@ function _gallery_settings_filter_validate($form_id, $form_values) {
}
}
+/**
+ * Function _gallery_settings_filter_submit().
+ */
function _gallery_settings_filter_submit($form_id, $form_values) {
// The default values have changed, so the pages containing the gallery filter need
// to be updated (or else it would only occur on an edit), so empty the filter cache.
@@ -788,6 +818,9 @@ function _gallery_settings_filter_submit($form_id, $form_values) {
drupal_set_message('The gallery filter cache has been cleared so that the new defaults apply.');
}
+/**
+ * Function _gallery_settings_g2image().
+ */
function _gallery_settings_g2image() {
$plugin_status = gallery_plugin_status(array('imageblock'));
@@ -968,6 +1001,9 @@ function _gallery_settings_g2image() {
return system_settings_form($form);
}
+/**
+ * Function _gallery_settings_search().
+ */
function _gallery_settings_search() {
require_once(drupal_get_path('module', 'gallery') .'/gallery_block.inc');
$plugin_status = gallery_plugin_status(array('imageblock', 'imageframe', 'search'));
@@ -1009,7 +1045,7 @@ function _gallery_settings_search() {
}
$imageframe_desc = ($plugin_status['imageframe'] != GALLERY_PLUGIN_ENABLED) ?
- t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
+ t('Requires the Gallery2 Image Frame plugin (!imageframe_status).',
array('!imageframe_status' => theme('gallery_plugin_status_message', $plugin_status['imageframe']))) : '';
$form['search'] = array(
@@ -1136,6 +1172,9 @@ function _gallery_settings_search() {
return system_settings_form($form);
}
+/**
+ * Function _gallery_settings_search_validate().
+ */
function _gallery_settings_search_validate($form_id, $form_values) {
if (isset($form_values['gallery_search_size']) &&
(!is_numeric($form_values['gallery_search_size']) || $form_values['gallery_search_size'] < 1)) {
@@ -1145,7 +1184,8 @@ function _gallery_settings_search_validate($form_id, $form_values) {
}
/**
- * Saves the G2Image config file
+ * Function _gallery_g2image_settings_validate().
+ * (saves the G2Image config file)
*/
function _gallery_g2image_settings_validate($form_id, $form_values) {
switch ($form_values['gallery_g2image_mode']) {
@@ -1162,6 +1202,7 @@ function _gallery_g2image_settings_validate($form_id, $form_values) {
default:
return;
}
+
// Note that file_check_directory uses &$path and will strip the trailing '/'
$filename = $path .'/config.php';
if (is_writable($filename) == FALSE && !file_check_directory($path)) {
@@ -1237,7 +1278,7 @@ function _gallery_g2image_settings_validate($form_id, $form_values) {
$content .= $cr;
$content .= '?>'. $cr;
- $filename = $path . '/config.php';
+ $filename = $path .'/config.php';
if (is_writable($filename) == FALSE) {
form_set_error('', t('Could not write to G2Image config file. Please check the permissions for @filename.',
array('@filename' => $filename)));
@@ -1256,8 +1297,9 @@ function _gallery_g2image_settings_validate($form_id, $form_values) {
}
/**
- * Create an associative range array
- * like array($min=>$min, ..., $max=>$max)
+ * Function _gallery_range_array().
+ * (create an associative range array
+ * like array($min=>$min, ..., $max=>$max))
*/
function _gallery_range_array($min, $max) {
$range_array = array();
@@ -1269,7 +1311,8 @@ function _gallery_range_array($min, $max) {
}
/**
- * Check the amount of PHP Memory
+ * Function _gallery_php_mem_check().
+ * (check the amount of PHP memory)
*/
function _gallery_php_mem_check($min_memory = 24) {
$mem_limit = trim(ini_get('memory_limit'));
@@ -1291,7 +1334,7 @@ function _gallery_php_mem_check($min_memory = 24) {
'@mem_limit' => $mem_limit,
'@min_mem_limit' => $min_memory,
)
- ),
+ )
);
}
else {
@@ -1302,11 +1345,14 @@ function _gallery_php_mem_check($min_memory = 24) {
array(
'@mem_limit' => $mem_limit,
)
- ),
- );
+ )
+ );
}
}
+/**
+ * Function gallery_wanted_plugin_info().
+ */
function gallery_wanted_plugin_info() {
return array(
'imageblock' => array(
@@ -1314,28 +1360,31 @@ function gallery_wanted_plugin_info() {
'info' => t('Allows images to be included in the Drupal sidebar or in nodes.'),
'severity' => GALLERY_SEVERITY_ERROR,
'status' => gallery_single_plugin_status('imageblock'),
- ),
+ ),
'imageframe' => array(
'title' => 'ImageFrame',
'info' => t('Provides a variety of frames around the images.'),
'severity' => GALLERY_SEVERITY_WARNING,
'status' => gallery_single_plugin_status('imageframe'),
- ),
+ ),
'search' => array(
'title' => 'Search',
'info' => t('Allow the Drupal search to also search the Gallery.'),
'severity' => GALLERY_SEVERITY_WARNING,
'status' => gallery_single_plugin_status('search'),
- ),
+ ),
'rewrite' => array(
'title' => 'URL Rewrite',
'info' => t('Allow short URLs (clean URLs).'),
'severity' => GALLERY_SEVERITY_ADVISE,
'status' => gallery_single_plugin_status('rewrite'),
- ),
+ ),
);
}
+/**
+ * Function gallery_unwanted_plugin_info().
+ */
function gallery_unwanted_plugin_info() {
return array(
'register' => array(
@@ -1349,6 +1398,9 @@ function gallery_unwanted_plugin_info() {
);
}
+/**
+ * Function gallery_wanted_module_info().
+ */
function gallery_wanted_module_info() {
return array(
'gsitemap' => array(
@@ -1367,6 +1419,9 @@ function gallery_wanted_module_info() {
);
}
+/**
+ * Function gallery_plugin_set_status().
+ */
function gallery_plugin_set_status($plugin_names) {
$plugins_status = gallery_plugin_status($plugin_names);
$plugin_info = gallery_wanted_plugin_info();
@@ -1386,6 +1441,9 @@ function gallery_plugin_set_status($plugin_names) {
gallery_set_status($status);
}
+/**
+ * Function gallery_format_status().
+ */
function gallery_format_status($status = array(), $title = 'Gallery message(s):') {
$message = $title .'<ul>';
if (count($status)) {
@@ -1405,6 +1463,9 @@ function gallery_format_status($status = array(), $title = 'Gallery message(s):'
return $message;
}
+/**
+ * Theme function : theme_gallery_module_status_message().
+ */
function theme_gallery_module_status_message($status) {
if ($status) {
return '<span class="admin-enabled">'. t('enabled') .'</span>';
@@ -1414,6 +1475,9 @@ function theme_gallery_module_status_message($status) {
}
}
+/**
+ * Theme function : theme_gallery_severity_message().
+ */
function theme_gallery_severity_message($severity = NULL) {
switch ($severity) {
case GALLERY_SEVERITY_SUCCESS:
@@ -1430,6 +1494,9 @@ function theme_gallery_severity_message($severity = NULL) {
}
}
+/**
+ * Theme function : theme_gallery_plugin_status_message().
+ */
function theme_gallery_plugin_status_message($status, $invert = FALSE) {
if ($invert) {
$enabled_class = 'admin-disabled';
@@ -1458,6 +1525,9 @@ function theme_gallery_plugin_status_message($status, $invert = FALSE) {
}
}
+/**
+ * Theme function : theme_gallery_severity_status_message().
+ */
function theme_gallery_severity_status_message($severity, $status, $full_msg = FALSE, $invert = FALSE) {
// In some cases (e.g. unwanted plugins) it makes sense to return the full 2 part message
// even on a success, but in most cases a simple "OK" is sufficient.
@@ -1471,5 +1541,3 @@ function theme_gallery_severity_status_message($severity, $status, $full_msg = F
return theme('gallery_severity_message', $severity) .' ('. theme('gallery_plugin_status_message', $module['status'], $invert) .')';
}
}
-
-?>
diff --git a/gallery_user.inc b/gallery_user.inc
index 6755439..d57ec11 100644
--- a/gallery_user.inc
+++ b/gallery_user.inc
@@ -1,6 +1,8 @@
<?php
// $Id$
+require_once(drupal_get_path('module', 'gallery') .'/gallery_groups.inc');
+
/**
* gallery.module : gallery_user.inc
* User Functions (insert, update, delete, view, details, ...)
@@ -25,11 +27,10 @@ define(G2USERINFO_ERROR_GROUPS, 10);
define(G2IMPORT_CONFLICT_DUPLICATE, 1);
define(G2IMPORT_CONFLICT_INVALID, 2);
-
-require_once(drupal_get_path('module', 'gallery') .'/gallery_groups.inc');
/**
- * Insert new user
+ * Function gallery_user_insert().
+ * (insert new user)
*/
function gallery_user_insert(&$edit, $user) {
$user->roles = isset($edit['roles']) ? $edit['roles'] : $user->roles;
@@ -39,7 +40,8 @@ function gallery_user_insert(&$edit, $user) {
}
/**
- * Update a user with new information
+ * Function gallery_user_update().
+ * (update a user with new information)
*/
function gallery_user_update(&$edit, $user) {
$user->language = isset($edit['language']) ? $edit['language'] : gallery_get_language($user);
@@ -73,14 +75,16 @@ function gallery_user_update(&$edit, $user) {
}
/**
- * Delete the user from the Gallery
+ * Function gallery_user_delete().
+ * (delete the user from the Gallery)
*/
function gallery_user_delete($user) {
gallery_user_modify($user, 'delete');
}
/**
- * Modify (create/update/delete) a user
+ * Function gallery_user_modify().
+ * (modify (create/update/delete) a user)
*/
function gallery_user_modify($user, $action = 'create', $groups = FALSE, $vars = NULL) {
if (!_gallery_init(TRUE, $vars)) {
@@ -226,7 +230,8 @@ function gallery_user_modify($user, $action = 'create', $groups = FALSE, $vars =
}
/**
- * Sync user info for $uid
+ * Function _gallery_user_sync().
+ * (sync user info for $uid)
*/
function _gallery_user_sync($uid) {
$user = user_load(array('uid' => $uid));
@@ -234,7 +239,8 @@ function _gallery_user_sync($uid) {
}
/**
- * View Gallery user details for a specific user
+ * Function gallery_user_view().
+ * (view Gallery user details for a specific user)
*/
function gallery_user_view($user) {
if (variable_get('gallery_user_hide_profile', 0) || !_gallery_init(TRUE)) {
@@ -267,7 +273,8 @@ function gallery_user_view($user) {
}
/**
- * Create link to user album
+ * Function gallery_user_useralbum().
+ * (create link to user album)
*/
function gallery_user_useralbum($uid = NULL, $link = TRUE) {
if (!_gallery_init(TRUE)) {
@@ -300,7 +307,8 @@ function gallery_user_useralbum($uid = NULL, $link = TRUE) {
}
/**
- * Get info about user map status
+ * Function gallery_user_map_info().
+ * (get info about user map status)
*/
function gallery_user_map_info($user, $noerror_status = TRUE) {
$g2_userinfo = array('g2_id' => -1, 'status' => array());
@@ -358,7 +366,8 @@ function gallery_user_map_info($user, $noerror_status = TRUE) {
}
/**
- * Get string representation of the use map status
+ * Function gallery_user_map_info_status().
+ * (get string representation of the use map status)
*/
function gallery_user_map_info_status($info = array(), $format = TRUE) {
$info_map = array(
@@ -389,7 +398,8 @@ function gallery_user_map_info_status($info = array(), $format = TRUE) {
}
/**
- * Get state of user mapping
+ * Function gallery_user_map_state().
+ * (get state of user mapping)
*/
function gallery_user_map_state($user) {
// See if user already exists in G2
@@ -434,7 +444,8 @@ function gallery_user_map_state($user) {
}
/**
- * Import Gallery users into Drupal
+ * Function _gallery_user_import().
+ * (import Gallery users into Drupal)
*/
function _gallery_user_import($g2_users = array()) {
$messages = array();
@@ -475,7 +486,7 @@ function _gallery_user_import($g2_users = array()) {
$values['mail'] = $g2_user->email;
if ($error = user_validate_mail($values['mail'])) {
if ($resolve_conflict[G2IMPORT_CONFLICT_INVALID]) {
- _gallery_user_name2mail($values['mail'], $values['name'], $messages);
+ _gallery_user_resolve_mail($values['mail'], $values['name'], $messages);
$error = user_validate_mail($values['mail']) ? $error : FALSE;
}
if ($error) {
@@ -487,7 +498,7 @@ function _gallery_user_import($g2_users = array()) {
else if ($new_user && db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != 0 AND LOWER(mail) = LOWER('%s')", $values['mail'])) > 0) {
$error = TRUE;
if ($resolve_conflict[G2IMPORT_CONFLICT_DUPLICATE]) {
- _gallery_user_name2mail($values['mail'], $values['name'], $messages);
+ _gallery_user_resolve_mail($values['mail'], $values['name'], $messages);
$error = FALSE;
}
if ($error) {
@@ -565,8 +576,9 @@ function _gallery_user_import($g2_users = array()) {
$_SESSION['gallery_user_progress_messages'] += $messages;
}
else {
- drupal_set_message(theme('item_list', $messages, t('The following messages occured:')), 'error');
- drupal_set_message(t('Invalid user items were skipped.'), 'error');
+ drupal_set_message(theme('item_list', $messages, t('The following messages occured:')), 'notice');
+ drupal_set_message(t('Invalid user items were skipped.'), 'notice');
+ watchdog('gallery', theme('item_list', $messages, t('The following messages occured:')), WATCHDOG_NOTICE);
}
}
@@ -574,9 +586,9 @@ function _gallery_user_import($g2_users = array()) {
}
/**
- * Function _gallery_user_name2mail()
+ * Function _gallery_user_resolve_mail()
*/
-function _gallery_user_name2mail(&$mail, $username, &$messages) {
+function _gallery_user_resolve_mail(&$mail, $username, &$messages) {
// Replace all invalid chars in the username
$invalid_search = array(' ', '!', '#', '$', '%', '&', '*', '+', '/', '=', '?', '`', '|', '{', '}', '~', '\'');
$invalid_replace = array_fill(0, count($invalid_search), '_');
@@ -597,10 +609,11 @@ function _gallery_user_name2mail(&$mail, $username, &$messages) {
}
/**
- * Fetch 'GalleryUser' entries from G2 'ExternalIdMap'
- * g2Id => externalId (default)
+ * Function _gallery_user_map().
+ * (fetch 'GalleryUser' entries from G2 'ExternalIdMap')
*/
function _gallery_user_map($ids = array(), $inverse = FALSE) {
+ // g2Id => externalId (default)
$ids = is_array($ids) ? $ids : array($ids);
$match = array('entityType' => 'GalleryUser');
if (count($ids) > 0) {
@@ -627,7 +640,8 @@ function _gallery_user_map($ids = array(), $inverse = FALSE) {
}
/**
- * Fetch all existing Drupal users (uid => username)
+ * Function _gallery_user_drupal_users().
+ * (fetch all existing Drupal users (uid => username))
*/
function _gallery_user_drupal_users() {
$users = array();
@@ -638,5 +652,3 @@ function _gallery_user_drupal_users() {
return $users;
}
-
-?>
diff --git a/gallery_user_admin.inc b/gallery_user_admin.inc
index 4070b0c..123d358 100644
--- a/gallery_user_admin.inc
+++ b/gallery_user_admin.inc
@@ -1,6 +1,8 @@
<?php
// $Id$
+require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
+
/**
* gallery.module : gallery_user_admin.inc
* Gallery User Administration
@@ -8,10 +10,9 @@
define(G2BATCH_INTERVAL, 50);
-require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
-
/**
- * Gallery Users Page - view list of users
+ * Function _gallery_user_users().
+ * (gallery users page - view list of users)
*/
function _gallery_user_users($args) {
// Sync the selected user
@@ -101,7 +102,8 @@ function _gallery_user_users($args) {
}
/**
- * Filter form for user status
+ * Function _gallery_user_filter_form().
+ * (filter form for user status)
*/
function _gallery_user_filter_form($filter) {
$form['filter'] = array(
@@ -128,7 +130,8 @@ function _gallery_user_filter_form($filter) {
}
/**
- * Submit handler of the filter form
+ * Function _gallery_user_filter_submit().
+ * (submit handler of the filter form)
*/
function _gallery_user_filter_submit($form_id, $form_values) {
unset($_SESSION['gallery_user_filter']);
@@ -138,7 +141,8 @@ function _gallery_user_filter_submit($form_id, $form_values) {
}
/**
- * Advanced User Administration
+ * Function _gallery_user_advanced().
+ * (advanced user administration)
*/
function _gallery_user_advanced() {
$form['advanced'] = array(
@@ -322,9 +326,9 @@ function _gallery_user_advanced_progress() {
unset($_SESSION['gallery_user_progress_offline']);
}
if (count($_SESSION['gallery_user_progress_messages'])) {
- drupal_set_message(theme('item_list', $_SESSION['gallery_user_progress_messages'], t('The following messages occured:')), 'error');
+ drupal_set_message(theme('item_list', $_SESSION['gallery_user_progress_messages'], t('The following messages occured:')), 'notice');
drupal_set_message(t('Invalid user items were skipped.'), 'error');
- $percent = 0;
+ watchdog('gallery', theme('item_list', $_SESSION['gallery_user_progress_messages'], t('The following messages occured:')), WATCHDOG_NOTICE);
}
unset($_SESSION['gallery_user_progress_mode']);
unset($_SESSION['gallery_user_progress_position']);
@@ -333,7 +337,7 @@ function _gallery_user_advanced_progress() {
drupal_set_message(t('User synchronization successfully completed.'));
}
else {
- drupal_set_message(t('User synchronization failed or generated messages.'), 'error');
+ drupal_set_message(t('User synchronization (partially) failed.'), 'error');
}
if ($redirect) {
unset($_SESSION['gallery_user_progress_redirect']);
@@ -350,6 +354,9 @@ function _gallery_user_advanced_progress() {
exit();
}
+/**
+ * Theme function : theme_gallery_user_progress_page().
+ */
function theme_gallery_user_progress_page($content, $messages = TRUE, $partial = FALSE) {
drupal_set_header('Content-Type: text/html; charset=utf-8');
drupal_set_html_head('<link rel="shortcut icon" href="'. base_path() .'misc/favicon.ico" type="image/x-icon" />');
@@ -376,6 +383,9 @@ function theme_gallery_user_progress_page($content, $messages = TRUE, $partial =
return $output;
}
+/**
+ * Function _gallery_user_settings().
+ */
function _gallery_user_settings() {
$form['user'] = array(
'#type' => 'fieldset',
@@ -384,7 +394,7 @@ function _gallery_user_settings() {
'#collapsed' => FALSE
);
- // Generaal (not sync related) settings
+ // General (not sync related) settings
$form['user']['gallery_user_hide_profile'] = array(
'#type' => 'checkbox',
'#title' => t('Hide Gallery2 section in profiles'),
@@ -531,6 +541,9 @@ function _gallery_user_settings() {
return system_settings_form($form);
}
+/**
+ * Function _gallery_user_settings_submit().
+ */
function _gallery_user_settings_submit($form_id, $form_values) {
if ($form_values['op'] == t('Reset to defaults')) {
$fullname_changed = variable_get('gallery_use_fullname', 0);
@@ -544,5 +557,3 @@ function _gallery_user_settings_submit($form_id, $form_values) {
array('@user-admin' => url('admin/user/gallery'))));
}
}
-
-?>