summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoloc2012-10-29 16:23:27 (GMT)
committer Moloc2012-10-29 16:23:27 (GMT)
commit2fcf98ed40478bc6f392683bd2258b1f20e98d49 (patch)
tree9a39c3bf37d076b8a6cc856884a8c522bf1863cf
parent0e9421474581a5372a2ee13820601f4227f8a78e (diff)
Issue #1670738 by Moloc: Fixed Coder coding standards.
-rw-r--r--fields_rsi_prevention.inc19
-rw-r--r--media.pages.inc6
-rw-r--r--media_gallery.admin.inc5
-rw-r--r--media_gallery.fields.inc2
-rw-r--r--media_gallery.install16
-rw-r--r--media_gallery.module26
-rw-r--r--media_gallery.pages.inc11
-rw-r--r--media_gallery.theme.inc5
8 files changed, 54 insertions, 36 deletions
diff --git a/fields_rsi_prevention.inc b/fields_rsi_prevention.inc
index cd79a84..374b358 100644
--- a/fields_rsi_prevention.inc
+++ b/fields_rsi_prevention.inc
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * This file provides easier access on entity properties and methods.
+ */
+
+/**
* Decorates an entity to provide getters/setters.
*
* @example
@@ -15,10 +20,10 @@
*
* // Gets the 2nd value of body in spanish
* $node->getValue('body', 2, 'esp');
- */
+ */
class FieldsRSIPreventor {
private $entity;
-
+
function __construct($entity) {
// Prevent this thing from chaining if people accidentally use it twice.
if ($entity instanceof FieldRSIPreventor) {
@@ -26,27 +31,25 @@ class FieldsRSIPreventor {
}
$this->entity = $entity;
}
-
+
function getValue($field_name, $delta = 0, $language = LANGUAGE_NONE) {
if ($item = $this->getItem($field_name, $delta, $language)) {
return $item['value'];
}
}
-
+
function getItem($field_name, $delta = 0, $language = LANGUAGE_NONE) {
if (!isset($this->entity->{$field_name}[$language]) || !isset($this->entity->{$field_name}[$language][$delta])) {
return FALSE;
}
return $this->entity->{$field_name}[$language][$delta];
}
-
+
function __get($key) {
return $this->entity->{$key};
}
-
+
function __set($key, $value) {
$this->entity->{$key} = $value;
}
}
-
-?> \ No newline at end of file
diff --git a/media.pages.inc b/media.pages.inc
index 7221a61..9407147 100644
--- a/media.pages.inc
+++ b/media.pages.inc
@@ -1,6 +1,12 @@
<?php
/**
+ * @file
+ * This file provieds media specific functions.
+ */
+
+
+/**
* @todo Move this code to the Media module's media.pages.inc file when it is
* ready to be committed to CVS.
*/
diff --git a/media_gallery.admin.inc b/media_gallery.admin.inc
index c06797f..3974059 100644
--- a/media_gallery.admin.inc
+++ b/media_gallery.admin.inc
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * This file contains the admin functions for the Media Gallery module.
+ */
+
+/**
* The Galleries settings page will just return the term edit form for the "all galleries" tid.
*
*/
diff --git a/media_gallery.fields.inc b/media_gallery.fields.inc
index dbaa9ba..029087c 100644
--- a/media_gallery.fields.inc
+++ b/media_gallery.fields.inc
@@ -309,7 +309,7 @@ function _media_gallery_get_expose_block_values() {
/**
* Allowed values callback for field_license list field.
- *
+ *
* @todo: should be moved to media_cc module or something.
*/
function _media_gallery_get_field_license_values() {
diff --git a/media_gallery.install b/media_gallery.install
index a633d63..a786f58 100644
--- a/media_gallery.install
+++ b/media_gallery.install
@@ -118,7 +118,7 @@ function media_gallery_requirements() {
// In addition to the fields we control, we also need the standard field_tags
// that most sites will have gotten from their install profile.
$required_fields['field_tags'] = array('type' => 'taxonomy_term_reference');
-
+
foreach ($required_fields as $field_name => $field_definition) {
$field = field_info_field($field_name);
// If the field doesn't exist, we will create it on install.
@@ -881,7 +881,7 @@ function media_gallery_create_taxonomy_vocab() {
'description' => $t('Groups of rich media galleries'),
'machine_name' => 'gallery_collections',
);
-
+
taxonomy_vocabulary_save($vocabulary);
variable_set('media_gallery_collection_vid', $vocabulary->vid);
return $vocabulary;
@@ -972,7 +972,7 @@ function media_gallery_uninstall() {
* In order to have the expose block checkbox appear above the column and row number dropdowns
* it was necessary to update those field instances with their initial values, essentially
* refreshing them.
- */
+ */
function media_gallery_update_7000() {
$t = get_t();
@@ -1004,7 +1004,7 @@ function media_gallery_update_7000() {
field_delete_field('media_gallery_image_info');
// Ensure that the new field exists
- $extraField = array(
+ $extra_field = array(
'field_name' => 'media_gallery_lightbox_extras',
'cardinality' => 1,
'locked' => TRUE,
@@ -1013,9 +1013,9 @@ function media_gallery_update_7000() {
'allowed_values_function' => '_media_gallery_get_lightbox_extras_values',
),
);
- _media_gallery_ensure_field($extraField);
+ _media_gallery_ensure_field($extra_field);
- $newInstance = array(
+ $new_instance = array(
'field_name' => 'media_gallery_lightbox_extras',
'label' => 'Lightbox title and description',
'description' => $t('Show title and description'),
@@ -1044,7 +1044,7 @@ function media_gallery_update_7000() {
),
),
);
- _media_gallery_ensure_instance($newInstance);
+ _media_gallery_ensure_instance($new_instance);
}
/**
@@ -1052,7 +1052,7 @@ function media_gallery_update_7000() {
*/
function media_gallery_update_7001() {
$result = db_query("SELECT nid FROM {node} WHERE type = 'media_gallery'");
- foreach($result as $record) {
+ foreach ($result as $record) {
$node = node_load($record->nid);
if ($node->media_gallery_format[LANGUAGE_NONE][0]['value'] == 'lightbox_text') {
$node->media_gallery_format[LANGUAGE_NONE][0]['value'] = 'lightbox';
diff --git a/media_gallery.module b/media_gallery.module
index db54747..c017b9e 100644
--- a/media_gallery.module
+++ b/media_gallery.module
@@ -340,7 +340,7 @@ function media_gallery_view($node, $view_mode) {
else {
$media = array();
}
-
+
// Only display the requested number of media items per page.
$columns = $full ? $node->media_gallery_columns[LANGUAGE_NONE][0]['value'] : $node->media_gallery_block_columns[LANGUAGE_NONE][0]['value'];
$rows = $full ? $node->media_gallery_rows[LANGUAGE_NONE][0]['value'] : $node->media_gallery_block_rows[LANGUAGE_NONE][0]['value'];
@@ -379,12 +379,11 @@ function media_gallery_view($node, $view_mode) {
// Field rendering requires sequential deltas, so re-key.
// @todo Open a Drupal core issue about this.
-
if ($media) {
$node->media_gallery_media[LANGUAGE_NONE] = array_values($media);
}
else {
- $node->media_gallery_media[LANGUAGE_NONE] = array();
+ $node->media_gallery_media[LANGUAGE_NONE] = array();
}
// Create a set of dummy links to media items that don't appear on this
@@ -806,7 +805,7 @@ function media_gallery_get_media_type_count($node, $media_field = 'media_gallery
function media_gallery_get_file_ids($node, $media_field = 'media_gallery_media') {
$fids = array();
$media_items = _media_gallery_field_get_items('node', $node, $media_field);
- if( $media_items !== FALSE ) {
+ if ($media_items !== FALSE) {
foreach ($media_items as $item) {
$fids[] = _media_gallery_get_media_fid($item);
}
@@ -956,7 +955,7 @@ function media_gallery_form_media_gallery_node_form_alter(&$form, &$form_state)
);
// Move the items to the fieldset.
- foreach($fieldset as $id => $subgroup) {
+ foreach ($fieldset as $id => $subgroup) {
$form['settings_wrapper'][$subgroup][$id] = $form[$id];
// locale_field_node_form_submit() looks for field language information in
// a hard-coded part of $form.
@@ -983,7 +982,7 @@ function media_gallery_form_media_gallery_node_form_alter(&$form, &$form_state)
);
// Move the items to the fieldset.
- foreach($fieldset as $id => $subgroup) {
+ foreach ($fieldset as $id => $subgroup) {
$form[$subgroup][$id] = $form[$id];
// locale_field_node_form_submit() looks for field language information in
// a hard-coded part of $form.
@@ -1116,7 +1115,7 @@ function media_gallery_multiedit_remove_item($form, &$form_state) {
* @see media_gallery_form_media_edit_alter()
*/
function media_gallery_media_edit_submit($form, &$form_state) {
- $form_state['redirect'] = 'media-gallery/detail/' . $form_state['media_gallery']['gallery']->nid . '/' . $form_state['values']['fid'];
+ $form_state['redirect'] = 'media-gallery/detail/' . $form_state['media_gallery']['gallery']->nid . '/' . $form_state['values']['fid'];
}
/**
@@ -1165,7 +1164,7 @@ function _media_gallery_attach_css_resources(&$element) {
}
/**
- * Helper function to attach JS for media galleries to
+ * Helper function to attach JS for media galleries to
*/
function _media_gallery_attach_edit_resources(&$element) {
$path = drupal_get_path('module', 'media_gallery');
@@ -1277,7 +1276,7 @@ function media_gallery_contextual_links_view_alter(&$element, $items) {
function media_gallery_preprocess_field(&$variables, $hook) {
if ($variables['element']['#field_name'] === 'media_gallery_media') {
$columns = 1;
- switch($variables['element']['#view_mode']) {
+ switch ($variables['element']['#view_mode']) {
case 'media_gallery_block':
$columns = $variables['element']['#object']->media_gallery_block_columns['und'][0]['value'];
break;
@@ -1294,7 +1293,6 @@ function media_gallery_preprocess_field(&$variables, $hook) {
}
foreach ($variables['items'] as $delta => $item) {
$variables['item_attributes_array'][$delta] = array('id' => 'media-gallery-media-' . $delta);
-
}
}
}
@@ -1367,7 +1365,7 @@ function media_gallery_form_taxonomy_form_term_alter(&$form, &$form_state) {
);
// Move the items to the fieldset.
- foreach($fieldset as $id => $subgroup) {
+ foreach ($fieldset as $id => $subgroup) {
$form['settings_wrapper'][$subgroup][$id] = $form[$id];
unset($form[$id]);
}
@@ -1425,7 +1423,7 @@ function media_gallery_module_implements_alter(&$implementations, $hook) {
// control, this can be changed.
//case 'form_taxonomy_form_term_alter':
case 'form_alter':
- if (!isset($implementations['media_gallery'])){
+ if (!isset($implementations['media_gallery'])) {
break;
}
$group = $implementations['media_gallery'];
@@ -1452,7 +1450,7 @@ function media_gallery_get_default_gallery_collection() {
$tid = db_select('taxonomy_term_data', 'ttd')
->fields('ttd', array('tid'))
->condition('vid', $gallery_collection_vid)
- ->range(0,1)
+ ->range(0, 1)
->execute()
->fetchField();
@@ -1492,7 +1490,7 @@ function media_gallery_edit_access($node) {
function media_gallery_multiedit_access($node) {
if (media_gallery_edit_access($node) && media_access('edit')) {
$media_items = field_get_items('node', $node, 'media_gallery_media');
- if( $media_items !== FALSE && count($media_items) > 0 ) {
+ if ($media_items !== FALSE && count($media_items) > 0) {
return TRUE;
}
}
diff --git a/media_gallery.pages.inc b/media_gallery.pages.inc
index 6c7aba9..09b3271 100644
--- a/media_gallery.pages.inc
+++ b/media_gallery.pages.inc
@@ -1,6 +1,11 @@
<?php
/**
+ * @file
+ * Common pages for the Media Gallery module.
+ */
+
+/**
* Page callback to list all galleries.
*
* TODO: When I grow up I want to be a View.
@@ -11,7 +16,7 @@ function media_gallery_list_galleries($term) {
module_load_include('inc', 'taxonomy', 'taxonomy.pages');
return taxonomy_term_page($term);
}
-
+
// Add front-end resources for drag-and-drop sorting.
if (user_access('administer media galleries')) {
drupal_add_library('system', 'ui.sortable');
@@ -60,7 +65,7 @@ function media_gallery_list_galleries($term) {
$build['pager'] = array(
'#theme' => 'pager',
'#weight' => 10,
- );
+ );
$build['#term'] = $term;
$build['#theme'] = 'media_gallery_collection';
}
@@ -229,7 +234,7 @@ function media_gallery_reorder_gallery($gallery, $order) {
$num_per_page = $gallery->media_gallery_columns[LANGUAGE_NONE][0]['value'] * $gallery->media_gallery_rows[LANGUAGE_NONE][0]['value'];
$offset = $num_per_page * $page;
}
-
+
foreach ($order as $new_delta => $old_delta) {
$gallery->media_gallery_media[LANGUAGE_NONE][$new_delta + $offset] = $media_field[$old_delta + $offset];
}
diff --git a/media_gallery.theme.inc b/media_gallery.theme.inc
index 7fd7942..ea64cbc 100644
--- a/media_gallery.theme.inc
+++ b/media_gallery.theme.inc
@@ -241,7 +241,8 @@ function theme_media_gallery_media_item_lightbox($variables) {
drupal_render_children($element) .
'</div>' .
'</div>';
- } else {
+ }
+ else {
$output = $media_gallery_detail;
}
@@ -430,7 +431,7 @@ function theme_media_gallery_item($variables) {
// video thumbnails had no title and alt attributes so the string replace was
// not triggering for them.
$new_image = str_replace(array('title=""', 'alt=""'), array('', ''), $image);
- $image = str_replace('/>', ' title="'.$variables['title'].'" alt="'.$variables['title'].'" />', $new_image);;
+ $image = str_replace('/>', ' title="' . $variables['title'] . '" alt="' . $variables['title'] . '" />', $new_image);;
}
// Add sliding door top div and wrappers