Browse Source

updated i18n i10n_update workflwo imachecache_actions

Bachir Soussi Chiadmi 3 years ago
parent
commit
092758ecb0
100 changed files with 1949 additions and 1011 deletions
  1. 28 35
      sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php
  2. 29 4
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php
  3. 7 4
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php
  4. 5 11
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php
  5. 1 1
      sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php
  6. 6 5
      sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php
  7. 7 6
      sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php
  8. 4 6
      sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc
  9. 7 7
      sites/all/modules/contrib/admin/workflow/workflow.entity.inc
  10. 18 4
      sites/all/modules/contrib/admin/workflow/workflow.features.inc
  11. 4 5
      sites/all/modules/contrib/admin/workflow/workflow.info
  12. 9 2
      sites/all/modules/contrib/admin/workflow/workflow.install
  13. 12 5
      sites/all/modules/contrib/admin/workflow/workflow.module
  14. 2 2
      sites/all/modules/contrib/admin/workflow/workflow.pages.inc
  15. 2 2
      sites/all/modules/contrib/admin/workflow/workflow.tokens.inc
  16. 7 5
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info
  17. 43 39
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module
  18. 15 13
      sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc
  19. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info
  20. 25 10
      sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module
  21. 9 7
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php
  22. 5 3
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php
  23. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info
  24. 10 9
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module
  25. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc
  26. 3 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc
  27. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc
  28. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc
  29. 4 3
      sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc
  30. 8 7
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info
  31. 5 2
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module
  32. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc
  33. 29 0
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.field.inc
  34. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info
  35. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module
  36. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info
  37. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc
  38. 0 236
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc
  39. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info
  40. 118 67
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module
  41. 230 0
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc
  42. 8 6
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info
  43. 14 13
      sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module
  44. 7 7
      sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info
  45. 2 2
      sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc
  46. 5 6
      sites/all/modules/contrib/admin/workflow/workflow_rules/workflow_rules.info
  47. 8 8
      sites/all/modules/contrib/admin/workflow/workflow_search_api/workflow_search_api.info
  48. 5 7
      sites/all/modules/contrib/admin/workflow/workflow_vbo/workflow_vbo.info
  49. 1 1
      sites/all/modules/contrib/admin/workflow/workflow_views/handlers/workflow_views_handler_field_state.inc
  50. 3 4
      sites/all/modules/contrib/admin/workflow/workflow_views/workflow_views.info
  51. 39 0
      sites/all/modules/contrib/files/imagecache_actions/CHANGELOG.txt
  52. 3 4
      sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.info
  53. 33 3
      sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.module
  54. 81 24
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/canvasactions.inc
  55. 3 4
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.info
  56. 16 0
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.module
  57. 2 2
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/rounded_corners.inc
  58. 1 1
      sites/all/modules/contrib/files/imagecache_actions/canvasactions/tests/cheap_dropshadow.imagecache_preset.inc
  59. 3 4
      sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.info
  60. 238 8
      sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.module
  61. 53 2
      sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt
  62. 3 4
      sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info
  63. 7 1
      sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module
  64. 15 2
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt
  65. 141 75
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc
  66. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info
  67. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info
  68. 5 12
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt
  69. 35 38
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc
  70. 3 4
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info
  71. 8 0
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install
  72. 27 2
      sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.module
  73. 3 4
      sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info
  74. 3 4
      sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info
  75. 2 2
      sites/all/modules/contrib/files/imagecache_actions/utility-form.inc
  76. 86 25
      sites/all/modules/contrib/files/imagecache_actions/utility.inc
  77. 1 1
      sites/all/modules/contrib/localisation/i18n/README.txt
  78. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n.info
  79. 2 1
      sites/all/modules/contrib/localisation/i18n/i18n.module
  80. 33 15
      sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt
  81. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info
  82. 13 2
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module
  83. 3 2
      sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test
  84. 25 16
      sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt
  85. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info
  86. 28 15
      sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt
  87. 1 1
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc
  88. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info
  89. 62 4
      sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module
  90. 26 20
      sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt
  91. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info
  92. 43 21
      sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt
  93. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info
  94. 5 6
      sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module
  95. 45 20
      sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt
  96. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info
  97. 31 9
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module
  98. 18 1
      sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc
  99. 3 4
      sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info
  100. 31 17
      sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt

+ 28 - 35
sites/all/modules/contrib/admin/workflow/includes/Entity/Workflow.php

@@ -89,7 +89,7 @@ class Workflow extends Entity implements WorkflowInterface {
   protected function preRebuild() {
   protected function preRebuild() {
     // Remap roles. They can come from another system with shifted role IDs.
     // Remap roles. They can come from another system with shifted role IDs.
     // See also https://drupal.org/node/1702626 .
     // See also https://drupal.org/node/1702626 .
-    $this->rebuildRoles($this->tab_roles);
+    $this->tab_roles = $this->rebuildRoles($this->tab_roles);
 
 
     // After update.php or import feature, label might be empty. @todo: remove in D8.
     // After update.php or import feature, label might be empty. @todo: remove in D8.
     if (empty($this->label)) {
     if (empty($this->label)) {
@@ -160,30 +160,32 @@ class Workflow extends Entity implements WorkflowInterface {
       $data = (array)$data;
       $data = (array)$data;
 
 
       if (is_numeric($name)) {
       if (is_numeric($name)) {
-        $start_state = $saved_states[$saved_state_names[$data['sid']]];
-        $end_state = $saved_states[$saved_state_names[$data['target_sid']]];
-        $name = WorkflowConfigTransition::machineName($start_state->getName(),
-          $end_state->getName());
+        if (isset($saved_states[$data['sid']]) && isset($saved_states[$data['target_sid']])) {
+          $start_state = $saved_states[$data['sid']];      // #2876303
+          $end_state = $saved_states[$data['target_sid']]; // #2876303
+        }
+        else {
+          $start_state = $this->getState($data['sid']);
+          $end_state = $this->getState($data['target_sid']);
+        }
       }
       }
       else {
       else {
         $start_state = $saved_states[$data['start_state']];
         $start_state = $saved_states[$data['start_state']];
         $end_state = $saved_states[$data['end_state']];
         $end_state = $saved_states[$data['end_state']];
       }
       }
-
+      $name = WorkflowConfigTransition::machineName($start_state->getName(), $end_state->getName());
       if (isset($db_transitions[$name])) {
       if (isset($db_transitions[$name])) {
         $transition = $db_transitions[$name];
         $transition = $db_transitions[$name];
       }
       }
       else {
       else {
-        $transition = $this->createTransition($start_state->sid,
-          $end_state->sid);
+        $transition = $this->createTransition($start_state->sid, $end_state->sid);
       }
       }
 
 
       $transition->wid = $this->wid;
       $transition->wid = $this->wid;
       $transition->sid = $start_state->sid;
       $transition->sid = $start_state->sid;
       $transition->target_sid = $end_state->sid;
       $transition->target_sid = $end_state->sid;
       $transition->label = $data['label'];
       $transition->label = $data['label'];
-      $transition->roles = $data['roles'];
-      $this->rebuildRoles($transition->roles);
+      $transition->roles = $this->rebuildRoles($data['roles']);
       $transition->save();
       $transition->save();
 
 
       unset($db_transitions[$name]);
       unset($db_transitions[$name]);
@@ -251,12 +253,14 @@ class Workflow extends Entity implements WorkflowInterface {
   public function isValid() {
   public function isValid() {
     $is_valid = TRUE;
     $is_valid = TRUE;
 
 
+    $workflow_name = $this->getName();
+    $wid = $this->getWorkflowId();
     // Don't allow workflows with no states. There should always be a creation state.
     // Don't allow workflows with no states. There should always be a creation state.
     $states = $this->getStates($all = FALSE);
     $states = $this->getStates($all = FALSE);
     if (count($states) < 1) {
     if (count($states) < 1) {
       // That's all, so let's remind them to create some states.
       // That's all, so let's remind them to create some states.
       $message = t('Workflow %workflow has no states defined, so it cannot be assigned to content yet.',
       $message = t('Workflow %workflow has no states defined, so it cannot be assigned to content yet.',
-        array('%workflow' => $this->getName()));
+        array('%workflow' => $workflow_name));
       drupal_set_message($message, 'warning');
       drupal_set_message($message, 'warning');
 
 
       // Skip allowing this workflow.
       // Skip allowing this workflow.
@@ -268,7 +272,7 @@ class Workflow extends Entity implements WorkflowInterface {
     if (count($transitions) < 1) {
     if (count($transitions) < 1) {
       // That's all, so let's remind them to create some transitions.
       // That's all, so let's remind them to create some transitions.
       $message = t('Workflow %workflow has no transitions defined, so it cannot be assigned to content yet.',
       $message = t('Workflow %workflow has no transitions defined, so it cannot be assigned to content yet.',
-        array('%workflow' => $this->getName()));
+        array('%workflow' => $workflow_name));
       drupal_set_message($message, 'warning');
       drupal_set_message($message, 'warning');
 
 
       // Skip allowing this workflow.
       // Skip allowing this workflow.
@@ -281,7 +285,7 @@ class Workflow extends Entity implements WorkflowInterface {
       $message = t('Please maintain Workflow %workflow on its <a href="@url">settings</a> page.',
       $message = t('Please maintain Workflow %workflow on its <a href="@url">settings</a> page.',
         array(
         array(
           '%workflow' => $this->getName(),
           '%workflow' => $this->getName(),
-          '@url' => url('admin/config/workflow/workflow/manage/' . $this->wid),
+          '@url' => url(WORKFLOW_ADMIN_UI_PATH . "/manage/$wid"),
         )
         )
       );
       );
       drupal_set_message($message, 'warning');
       drupal_set_message($message, 'warning');
@@ -539,19 +543,7 @@ class Workflow extends Entity implements WorkflowInterface {
   }
   }
 
 
   /**
   /**
-   * Loads all allowed ConfigTransitions for this workflow.
-   *
-   * @param mixed $tids
-   *   Array of Transitions IDs. If FALSE, show all transitions.
-   * @param array $conditions
-   *   $conditions['sid'] : if provided, a 'from' State ID.
-   *   $conditions['target_sid'] : if provided, a 'to' state ID.
-   *   $conditions['roles'] : if provided, an array of roles, or 'ALL'.
-   * @param bool $reset
-   *   Indicator to reset the cache.
-   *
-   * @return array
-   *   An array of keyed transitions.
+   * @inheritdoc
    */
    */
   public function getTransitions($tids = FALSE, array $conditions = array(), $reset = FALSE) {
   public function getTransitions($tids = FALSE, array $conditions = array(), $reset = FALSE) {
     $config_transitions = array();
     $config_transitions = array();
@@ -690,21 +682,22 @@ class Workflow extends Entity implements WorkflowInterface {
   }
   }
 
 
   protected function defaultLabel() {
   protected function defaultLabel() {
-    return isset($this->label) ? $this->label : '';
+    return isset($this->label) ? t('@label', array('@label' => $this->label)) : '';
   }
   }
 
 
   protected function defaultUri() {
   protected function defaultUri() {
-    return array('path' => 'admin/config/workflow/workflow/manage/' . $this->wid);
+    $wid = $this->wid;
+    return array('path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid");
   }
   }
 
 
-  protected function rebuildRoles(array &$roles) {
-    $role_map = isset($this->system_roles) ? $this->system_roles : array();
-    if (!$role_map) {
-      return;
-    }
+  protected function rebuildRoles(array $roles) {
+    $new_roles = array();
+
+    // @todo: importing Roles is incomplete when user language is not English.
+    // function user_roles() translates DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID
+    $role_map = workflow_get_roles(NULL);
 
 
     // See also https://drupal.org/node/1702626 .
     // See also https://drupal.org/node/1702626 .
-    $new_roles = array();
     foreach ($roles as $key => $rid) {
     foreach ($roles as $key => $rid) {
       if ($rid == WORKFLOW_ROLE_AUTHOR_RID) {
       if ($rid == WORKFLOW_ROLE_AUTHOR_RID) {
         $new_roles[$rid] = $rid;
         $new_roles[$rid] = $rid;
@@ -715,7 +708,7 @@ class Workflow extends Entity implements WorkflowInterface {
         }
         }
       }
       }
     }
     }
-    $roles = $new_roles;
+    return $new_roles;
   }
   }
 
 
 }
 }

+ 29 - 4
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowConfigTransition.php

@@ -51,11 +51,12 @@ class WorkflowConfigTransition extends Entity {
   }
   }
 
 
   protected function defaultLabel() {
   protected function defaultLabel() {
-    return $this->label;
+    return isset($this->label) ? t('@label', array('@label' => $this->label)) : '';
   }
   }
 
 
   protected function defaultUri() {
   protected function defaultUri() {
-    return array('path' => 'admin/config/workflow/workflow/manage/' . $this->wid . '/transitions/');
+    $wid = $this->wid;
+    return array('path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid/transitions/");
   }
   }
 
 
   /**
   /**
@@ -96,11 +97,16 @@ class WorkflowConfigTransition extends Entity {
    * - In permissions;
    * - In permissions;
    * - By permission hooks, implemented by other modules.
    * - By permission hooks, implemented by other modules.
    *
    *
+   * @param string|array $user_roles
+   *   The string 'ALL' to force allowing the transition, or an array of role
+   *   IDs to compare against the roles allowed for the transition.
+   *
    * @return bool
    * @return bool
-   *   TRUE if OK, else FALSE.
+   *   If the transition is allowed, this function returns TRUE. Otherwise, it
+   *   returns FALSE.
    */
    */
   public function isAllowed($user_roles) {
   public function isAllowed($user_roles) {
-    if ($user_roles == 'ALL') {
+    if ($user_roles === 'ALL') {
       // Superuser.
       // Superuser.
       return TRUE;
       return TRUE;
     }
     }
@@ -132,6 +138,25 @@ class WorkflowConfigTransition extends Entity {
       $workflow->save();
       $workflow->save();
     }
     }
   }
   }
+
+  /**
+   * Helper debugging function to easily show the contents of a transition.
+   */
+  public function dpm($function = 'not_specified') {
+    $transition = $this;
+    $time = NULL;
+
+    // Do this extensive $user_name lines, for some troubles with Action.
+    $t_string = get_class($this) . ' ' . $this->identifier() . " in function '$function'";
+    //$output[] = 'Entity  = ' . ((!$entity) ? 'NULL' : ($entity_type . '/' . $entity_bundle . '/' . $entity_id));
+    //$output[] = 'Field   = ' . $transition->getFieldName();
+    $output[] = 'From/To = ' . $transition->sid . ' > ' . $transition->target_sid . ' @ ' . $time;
+    //$output[] = 'Comment = ' . $user_name . ' says: ' . $transition->getComment();
+    //$output[] = 'Forced  = ' . ($transition->isForced() ? 'yes' : 'no');
+    if (function_exists('dpm')) { dpm($output, $t_string); }
+  }
+
+
 }
 }
 
 
 /**
 /**

+ 7 - 4
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowInterface.php

@@ -154,11 +154,14 @@ interface WorkflowInterface {
   /**
   /**
    * Loads all allowed ConfigTransitions for this workflow.
    * Loads all allowed ConfigTransitions for this workflow.
    *
    *
-   * @param array|NULL $ids
-   *   Array of Transitions IDs. If NULL, show all transitions.
+   * @param array|bool $tids
+   *   Array of Transitions IDs. If FALSE, show all transitions.
    * @param array $conditions
    * @param array $conditions
-   *   $conditions['from_sid'] : if provided, a 'from' State ID.
-   *   $conditions['to_sid'] : if provided, a 'to' state ID.
+   *   $conditions['sid'] : if provided, a 'from' State ID.
+   *   $conditions['target_sid'] : if provided, a 'to' state ID.
+   *   $conditions['roles'] : if provided, an array of roles, or 'ALL'.
+   * @param bool $reset
+   *   Indicator to reset the cache.
    *
    *
    * @return \Drupal\workflow\Entity\WorkflowConfigTransition[]
    * @return \Drupal\workflow\Entity\WorkflowConfigTransition[]
    */
    */

+ 5 - 11
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowState.php

@@ -153,7 +153,7 @@ class WorkflowState extends Entity {
   public static function loadByName($name, $wid = 0) {
   public static function loadByName($name, $wid = 0) {
     /* @var $state WorkflowState */
     /* @var $state WorkflowState */
     foreach ($states = self::getStates($wid) as $state) {
     foreach ($states = self::getStates($wid) as $state) {
-      if ($name == $state->getName()) {
+      if ($name == $state->name) {
         return $state;
         return $state;
       }
       }
     }
     }
@@ -458,7 +458,7 @@ class WorkflowState extends Entity {
       // We cannot use getTransitions, since there are no ConfigTransitions
       // We cannot use getTransitions, since there are no ConfigTransitions
       // from State with ID 0, and we do not want to repeat States.
       // from State with ID 0, and we do not want to repeat States.
       foreach ($workflow->getStates() as $state) {
       foreach ($workflow->getStates() as $state) {
-        $options[$state->value()] = $state->label(); // Translation is done later.
+        $options[$state->value()] = $state->label(); // Translation is done as part of defaultLabel().
       }
       }
     }
     }
     else {
     else {
@@ -473,7 +473,7 @@ class WorkflowState extends Entity {
           $label = $target_state ? $target_state->label() : '';
           $label = $target_state ? $target_state->label() : '';
         }
         }
         $new_sid = $transition->target_sid;
         $new_sid = $transition->target_sid;
-        $options[$new_sid] = $label; // Translation is done later.
+        $options[$new_sid] = $label; // Translation is done as part of defaultLabel().
       }
       }
 
 
       // Include current state for same-state transitions, except when $sid = 0.
       // Include current state for same-state transitions, except when $sid = 0.
@@ -481,16 +481,10 @@ class WorkflowState extends Entity {
       // but only if the transitions have been saved at least one time.
       // but only if the transitions have been saved at least one time.
       if ($current_sid && ($current_sid != $workflow->getCreationSid())) {
       if ($current_sid && ($current_sid != $workflow->getCreationSid())) {
         if (!isset($options[$current_sid])) {
         if (!isset($options[$current_sid])) {
-          $options[$current_sid] = $this->label(); // Translation is done later.
+          $options[$current_sid] = $this->label(); // Translation is done as part of defaultLabel().
         }
         }
       }
       }
 
 
-      // Properly fix the labels.
-      // Translate, convert '&', make secure.
-      foreach($options as $key => $label) {
-        $options[$key] = html_entity_decode(check_plain(t($label)));
-      }
-
       // Save to entity-specific cache.
       // Save to entity-specific cache.
       $cache[$entity_type][$entity_index][$force][$current_sid] = $options;
       $cache[$entity_type][$entity_index][$force][$current_sid] = $options;
     }
     }
@@ -538,7 +532,7 @@ class WorkflowState extends Entity {
    * Mimics Entity API functions.
    * Mimics Entity API functions.
    */
    */
   protected function defaultLabel() {
   protected function defaultLabel() {
-    return $this->state;
+    return isset($this->state) ? t('@state', array('@state' => $this->state)) : '';
   }
   }
 
 
   public function getName() {
   public function getName() {

+ 1 - 1
sites/all/modules/contrib/admin/workflow/includes/Entity/WorkflowTransition.php

@@ -446,7 +446,7 @@ class WorkflowTransition extends Entity {
           $args = array(
           $args = array(
             '@type' => $entity_type_info['label'],
             '@type' => $entity_type_info['label'],
             '%label' => entity_label($entity_type, $entity),
             '%label' => entity_label($entity_type, $entity),
-            '%state_name' => check_plain(t($new_state->label())),
+            '%state_name' => $new_state->label(),
           );
           );
           $uri = entity_uri($entity_type, $entity);
           $uri = entity_uri($entity_type, $entity);
           watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path']));
           watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path']));

+ 6 - 5
sites/all/modules/contrib/admin/workflow/includes/Field/WorkflowItem.php

@@ -111,7 +111,7 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
       '#default_value' => $wid,
       '#default_value' => $wid,
       '#required' => TRUE,
       '#required' => TRUE,
       '#disabled' => $has_data,
       '#disabled' => $has_data,
-      '#description' => t('Choose the Workflow type. Maintain workflows !url.', array('!url' => l(t('here'), 'admin/config/workflow/workflow'))),
+      '#description' => t('Choose the Workflow type. Maintain workflows !url.', array('!url' => l(t('here'), WORKFLOW_ADMIN_UI_PATH))),
     );
     );
 
 
     // Inform the user of possible states.
     // Inform the user of possible states.
@@ -297,7 +297,7 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
           $previous_wid = $state->wid;
           $previous_wid = $state->wid;
           $lines[] = $state->name . "'s states: ";
           $lines[] = $state->name . "'s states: ";
         }
         }
-        $label = check_plain(t($state->label()));
+        $label = $state->label();
         $states[$state->sid] = $label;
         $states[$state->sid] = $label;
         $lines[] = $state->sid . ' | ' . $label;
         $lines[] = $state->sid . ' | ' . $label;
       }
       }
@@ -317,12 +317,13 @@ class WorkflowItem extends WorkflowD7Base {// D8: extends ConfigFieldItemBase im
    * @return array
    * @return array
    *   The array of allowed values. Keys of the array are the raw stored values
    *   The array of allowed values. Keys of the array are the raw stored values
    *   (number or text), values of the array are the display labels.
    *   (number or text), values of the array are the display labels.
-   *   It contains all possible values, beause the result is cached,
-   *   and used for all nodes on a page.
+   *   It contains all possible values for the field, because the result is
+   *   cached on a field basis, and used for all nodes on a page.
    */
    */
   public function getAllowedValues() {
   public function getAllowedValues() {
     // Get all state names, including inactive states.
     // Get all state names, including inactive states.
-    $options = workflow_get_workflow_state_names(0, $grouped = FALSE, $all = TRUE);
+    $wid = isset($this->field['settings']['wid']) ? $this->field['settings']['wid'] : 0;
+    $options = workflow_get_workflow_state_names($wid, $grouped = FALSE, $all = TRUE);
     return $options;
     return $options;
   }
   }
 
 

+ 7 - 6
sites/all/modules/contrib/admin/workflow/includes/Form/WorkflowTransitionForm.php

@@ -190,7 +190,7 @@ class WorkflowTransitionForm { // extends FormBase {
       }
       }
     }
     }
 
 
-    $workflow_label = $workflow ? check_plain(t($workflow->label())) : '';
+    $workflow_label = $workflow ? $workflow->label() : '';
 
 
     // Change settings locally.
     // Change settings locally.
     if (!$field_name) {
     if (!$field_name) {
@@ -300,7 +300,7 @@ class WorkflowTransitionForm { // extends FormBase {
       else {
       else {
         $element['workflow'] += array(
         $element['workflow'] += array(
           '#type' => 'fieldset',
           '#type' => 'fieldset',
-          '#title' => t($workflow_label),
+          '#title' => $workflow_label,
           '#collapsible' => TRUE,
           '#collapsible' => TRUE,
           '#collapsed' => ($settings_fieldset == 1) ? FALSE : TRUE,
           '#collapsed' => ($settings_fieldset == 1) ? FALSE : TRUE,
         );
         );
@@ -312,13 +312,13 @@ class WorkflowTransitionForm { // extends FormBase {
       $help_text = isset($instance['description']) ? $instance['description'] : '';
       $help_text = isset($instance['description']) ? $instance['description'] : '';
       $element['workflow']['workflow_sid'] = array(
       $element['workflow']['workflow_sid'] = array(
         '#type' => $settings_options_type,
         '#type' => $settings_options_type,
-        '#title' => $settings_title_as_name ? t('Change !name state', array('!name' => $workflow_label)) : t('Target state'),
+        '#title' => $settings_title_as_name ? t('Change @name state', array('@name' => $workflow_label)) : t('Target state'),
         '#access' => TRUE,
         '#access' => TRUE,
         '#options' => $options,
         '#options' => $options,
         // '#name' => $workflow_label,
         // '#name' => $workflow_label,
         // '#parents' => array('workflow'),
         // '#parents' => array('workflow'),
         '#default_value' => $default_value,
         '#default_value' => $default_value,
-        '#description' => $help_text,
+        '#description' => t('@help', array('@help' => $help_text)),
       );
       );
     }
     }
 
 
@@ -605,7 +605,7 @@ class WorkflowTransitionForm { // extends FormBase {
       // content is not associated to a workflow, old_sid is now 0. This may
       // content is not associated to a workflow, old_sid is now 0. This may
       // happen in workflow_vbo, if you assign a state to non-relevant nodes.
       // happen in workflow_vbo, if you assign a state to non-relevant nodes.
       $entity_id = entity_id($entity_type, $entity);
       $entity_id = entity_id($entity_type, $entity);
-      drupal_set_message(t('Error: content !id has no workflow attached. The data is not saved.', array('!id' => $entity_id)), 'error');
+      drupal_set_message(t('Error: content @id has no workflow attached. The data is not saved.', array('@id' => $entity_id)), 'error');
       // The new state is still the previous state.
       // The new state is still the previous state.
       $new_sid = $old_sid;
       $new_sid = $old_sid;
       return $new_sid;
       return $new_sid;
@@ -617,7 +617,8 @@ class WorkflowTransitionForm { // extends FormBase {
     // Try to execute the transition. Return $old_sid when error.
     // Try to execute the transition. Return $old_sid when error.
     if (!$transition) {
     if (!$transition) {
       // This should only happen when testing/developing.
       // This should only happen when testing/developing.
-      drupal_set_message(t('Error: the transition from %old_sid to %new_sid could not be generated.'), 'error');
+      drupal_set_message(t('Error: the transition from @old_sid to @new_sid could not be generated.',
+        array('@old_sid' => $old_sid, '@new_sid' => $new_sid)), 'error');
       // The current value is still the previous state.
       // The current value is still the previous state.
       $new_sid = $old_sid;
       $new_sid = $old_sid;
     }
     }

+ 4 - 6
sites/all/modules/contrib/admin/workflow/workflow.deprecated.inc

@@ -46,16 +46,14 @@ function workflow_get_workflows_by_name($name) {
  * @deprecated: workflow_get_wid_label --> workflow_label
  * @deprecated: workflow_get_wid_label --> workflow_label
  */
  */
 function workflow_get_wid_label($wid) {
 function workflow_get_wid_label($wid) {
+  $label = t('Unknown workflow');
   if (empty($wid)) {
   if (empty($wid)) {
-    $output = t('No workflow');
+    $label = t('No workflow');
   }
   }
   elseif ($workflow = workflow_load_single($wid)) {
   elseif ($workflow = workflow_load_single($wid)) {
-    $output = $workflow->label();
+    $label = $workflow->label();
   }
   }
-  else {
-    $output = t('Unknown workflow');
-  }
-  return $output;
+  return $label;
 }
 }
 
 
 /**
 /**

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow.entity.inc

@@ -36,7 +36,7 @@ function workflow_entity_info() {
     /*
     /*
     // 'access callback' => 'workflow_access',
     // 'access callback' => 'workflow_access',
     // 'admin ui' => array(
     // 'admin ui' => array(
-    //   'path' => 'admin/config/workflow/workflow',
+    //   'path' => WORKFLOW_ADMIN_UI_PATH,
     //   'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
     //   'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
     //   'controller class' => 'EntityWorkflowUIController',
     //   'controller class' => 'EntityWorkflowUIController',
     //   'menu wildcard' => '%workflow',
     //   'menu wildcard' => '%workflow',
@@ -110,7 +110,7 @@ function workflow_entity_info() {
     ),
     ),
 
 
 //    'admin ui' => array(
 //    'admin ui' => array(
-//      'path' => 'admin/config/workflow/workflow/manage/%workflow_transition/fields2',
+//      'path' => WORKFLOW_ADMIN_UI_PATH . '/manage/%workflow_transition/fields2',
 //      'menu wildcard' => '%workflow_transition',
 //      'menu wildcard' => '%workflow_transition',
 //      'controller class' => 'EntityDefaultUIController',
 //      'controller class' => 'EntityDefaultUIController',
 //    ),
 //    ),
@@ -147,12 +147,12 @@ function workflow_entity_info() {
   }
   }
 
 
   // Build an array of bundles.
   // Build an array of bundles.
-  foreach ($types as $type => $info) {
-    $entities['WorkflowTransition']['bundles'][$type] = array(
+  foreach ($types as $wid => $info) {
+    $entities['WorkflowTransition']['bundles'][$wid] = array(
       'label' => $info->label,
       'label' => $info->label,
       'admin' => array(
       'admin' => array(
-        'path' => 'admin/config/workflow/workflow/manage/%workflow',
-        'real path' => 'admin/config/workflow/workflow/manage/' . $type,
+        'path' => WORKFLOW_ADMIN_UI_PATH . '/manage/%workflow',
+        'real path' => WORKFLOW_ADMIN_UI_PATH . "/manage/$wid",
         'bundle argument' => 5,
         'bundle argument' => 5,
 //        'access callback' => 'workflow_access',
 //        'access callback' => 'workflow_access',
       ),
       ),
@@ -510,7 +510,7 @@ function workflow_label($workflow) {
     $output = t('No workflow');
     $output = t('No workflow');
   }
   }
   elseif ($workflow) {
   elseif ($workflow) {
-    $output = check_plain(t($workflow->label()));
+    $output = $workflow->label();
   }
   }
   else {
   else {
     // E.g., NULL.
     // E.g., NULL.

+ 18 - 4
sites/all/modules/contrib/admin/workflow/workflow.features.inc

@@ -31,8 +31,6 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
         if (count($workflow->getTypeMap())) {
         if (count($workflow->getTypeMap())) {
           $export['dependencies']['workflownode'] = 'workflownode';
           $export['dependencies']['workflownode'] = 'workflownode';
         }
         }
-        // Add dependency on workflow_field.
-        $export['features']['Workflow'][$workflow_name] = $workflow_name;
       }
       }
     }
     }
 
 
@@ -109,7 +107,21 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
     // Add roles to translate role IDs on target system.
     // Add roles to translate role IDs on target system.
     $permission = NULL;
     $permission = NULL;
 
 
+    // Get system roles.
     $workflow->system_roles = workflow_get_roles($permission);
     $workflow->system_roles = workflow_get_roles($permission);
+    // Only export system roles for roles used by this workflow.
+    $roles = array();
+    foreach ($workflow->transitions as $id => $transition) {
+      foreach ($transition->roles as $rid) {
+        $roles[] = $rid;
+      }
+    }
+    $roles = array_unique($roles);
+    foreach ($workflow->system_roles as $id => $system_role) {
+      if (!in_array($id, $roles)) {
+        unset($workflow->system_roles[$id]);
+      }
+    }
 
 
     $sid_to_name_map = $this->pack_states($workflow);
     $sid_to_name_map = $this->pack_states($workflow);
     $this->pack_transitions($workflow, $sid_to_name_map);
     $this->pack_transitions($workflow, $sid_to_name_map);
@@ -198,8 +210,10 @@ class WorkflowFeaturesController extends EntityDefaultFeaturesController {
     // Loads defaults from feature code.
     // Loads defaults from feature code.
     $defaults = workflow_get_defaults($module);
     $defaults = workflow_get_defaults($module);
 
 
-    foreach ($defaults as $machine_name => $entity) {
-      workflow_revert($defaults, $machine_name);
+    if (!empty($defaults)) {
+      foreach ($defaults as $machine_name => $entity) {
+        workflow_revert($defaults, $machine_name);
+      }
     }
     }
   }
   }
 }
 }

+ 4 - 5
sites/all/modules/contrib/admin/workflow/workflow.info

@@ -3,7 +3,7 @@ description = Workflow API. (Enable Workflow Node or Workflow Field to add arbit
 package = Workflow
 package = Workflow
 core = 7.x
 core = 7.x
 
 
-dependencies[] = entity (>7.x-1.5)
+dependencies[] = entity (>7.x-1.6)
 dependencies[] = list
 dependencies[] = list
 
 
 files[] = includes/Entity/Workflow.php
 files[] = includes/Entity/Workflow.php
@@ -18,9 +18,8 @@ files[] = includes/Field/WorkflowDefaultWidget.php
 files[] = includes/Form/WorkflowTransitionForm.php
 files[] = includes/Form/WorkflowTransitionForm.php
 files[] = workflow.features.inc
 files[] = workflow.features.inc
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 9 - 2
sites/all/modules/contrib/admin/workflow/workflow.install

@@ -790,7 +790,7 @@ function workflow_update_7016() {
 }
 }
 
 
 /**
 /**
- * Add a primary key to {workflow_scheduled_transition}.
+ * Add/correct a primary key to {workflow_scheduled_transition}.
  */
  */
 function workflow_update_7017() {
 function workflow_update_7017() {
   // Drop existing primary key.
   // Drop existing primary key.
@@ -799,11 +799,18 @@ function workflow_update_7017() {
   // Add new primary key.
   // Add new primary key.
   $spec = array(
   $spec = array(
     'type' => 'serial',
     'type' => 'serial',
+    'not null' => TRUE,
   );
   );
   $keys_new =  array(
   $keys_new =  array(
     'primary key' => array('tid'),
     'primary key' => array('tid'),
   );
   );
-  db_add_field('workflow_scheduled_transition', 'tid', $spec, $keys_new);
+
+  if (!db_field_exists('workflow_scheduled_transition', 'tid') ) {
+    db_add_field('workflow_scheduled_transition', 'tid', $spec, $keys_new);
+  }
+  else {
+    db_change_field('workflow_scheduled_transition', 'tid', 'tid', $spec, $keys_new);
+  }
 
 
   return t('Added tid primary key to {workflow_scheduled_transition}');
   return t('Added tid primary key to {workflow_scheduled_transition}');
 }
 }

+ 12 - 5
sites/all/modules/contrib/admin/workflow/workflow.module

@@ -13,6 +13,8 @@ define('WORKFLOW_CREATION_STATE_NAME', '(' . t('creation') . ')');
 // #2657072 brackets are added later to indicate a special role, and distinguish from frequently used 'author' role.
 // #2657072 brackets are added later to indicate a special role, and distinguish from frequently used 'author' role.
 define('WORKFLOW_ROLE_AUTHOR_NAME', 'author');
 define('WORKFLOW_ROLE_AUTHOR_NAME', 'author');
 define('WORKFLOW_ROLE_AUTHOR_RID', '-1');
 define('WORKFLOW_ROLE_AUTHOR_RID', '-1');
+// The definition of the Admin UI pages.
+define('WORKFLOW_ADMIN_UI_PATH', 'admin/config/workflow/workflow');
 
 
 // The definition of the Field_info property type. Shared between 'workflow_field' and 'workflow_rules'.
 // The definition of the Field_info property type. Shared between 'workflow_field' and 'workflow_rules'.
 define('WORKFLOWFIELD_PROPERTY_TYPE', 'text'); // @todo: 'list', 'text' or 'workflow'?
 define('WORKFLOWFIELD_PROPERTY_TYPE', 'text'); // @todo: 'list', 'text' or 'workflow'?
@@ -133,9 +135,10 @@ function workflow_menu_alter(&$items) {
 
 
         // Add the workflow tab in the Entity Admin UI.
         // Add the workflow tab in the Entity Admin UI.
         if (!empty($entity_info['admin ui']['path'])) {
         if (!empty($entity_info['admin ui']['path'])) {
-          $entity_position = substr_count($entity_info['admin ui']['path'], '/') + 2;
+          $admin_path = $entity_info['admin ui']['path'];
+          $entity_position = substr_count($admin_path, '/') + 2;
           $wildcard = (isset($entity_info['admin ui']['menu wildcard']) ? $entity_info['admin ui']['menu wildcard'] : '%entity_object');
           $wildcard = (isset($entity_info['admin ui']['menu wildcard']) ? $entity_info['admin ui']['menu wildcard'] : '%entity_object');
-          $items[$entity_info['admin ui']['path'] . '/manage/' . $wildcard . '/workflow'] = $menu_item + array(
+          $items["$admin_path/manage/$wildcard/workflow"] = $menu_item + array(
               'page arguments' => array($type, $entity_position),
               'page arguments' => array($type, $entity_position),
               'access arguments' => array($type, $entity_position),
               'access arguments' => array($type, $entity_position),
               'load arguments' => array($type),
               'load arguments' => array($type),
@@ -609,7 +612,11 @@ function workflow_get_workflow_state_names($wid = 0, $grouped = FALSE, $all = FA
   // Since this function is only used in UI, it is save to use the global $user.
   // Since this function is only used in UI, it is save to use the global $user.
   global $user;
   global $user;
 
 
-  foreach (workflow_load_multiple($wid ? array($wid) : FALSE) as $workflow) {
+  /* @var $workflows Workflow[] */
+  $workflows = workflow_load_multiple($wid ? array($wid) : FALSE);
+  // Do not group if only 1 Workflow is configured or selected.
+  $grouped = count($workflows) == 1 ? FALSE : $grouped;
+  foreach ($workflows as $workflow) {
     $state = new WorkflowState(array('wid' => $workflow->wid));
     $state = new WorkflowState(array('wid' => $workflow->wid));
     $workflow_options = $state->getOptions('', NULL, '', $user, FALSE);
     $workflow_options = $state->getOptions('', NULL, '', $user, FALSE);
 
 
@@ -636,7 +643,7 @@ function workflow_get_workflow_state_names($wid = 0, $grouped = FALSE, $all = FA
 function workflow_get_workflow_names() {
 function workflow_get_workflow_names() {
   $options = array();
   $options = array();
   foreach (workflow_load_multiple() as $workflow) {
   foreach (workflow_load_multiple() as $workflow) {
-    $options[$workflow->wid] = html_entity_decode(t($workflow->label()));
+    $options[$workflow->wid] = $workflow->label();
   }
   }
 
 
   return $options;
   return $options;
@@ -655,7 +662,7 @@ function workflow_get_sid_label($sid) {
   else {
   else {
     $label = 'Unknown state';
     $label = 'Unknown state';
   }
   }
-  return html_entity_decode(t($label));
+  return $label;
 }
 }
 
 
 /**
 /**

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow.pages.inc

@@ -61,7 +61,7 @@ function workflow_tab_page($entity_type, $entity = NULL) {
     $new_state = $history->getNewState();
     $new_state = $history->getNewState();
     if ($new_state) {
     if ($new_state) {
       $name = $new_state->getName();
       $name = $new_state->getName();
-      $label = check_plain(t($new_state->label()));
+      $label = $new_state->label();
     }
     }
 
 
     if (!$new_state) {
     if (!$new_state) {
@@ -98,7 +98,7 @@ function workflow_tab_page($entity_type, $entity = NULL) {
     $old_state = $history->getOldState();
     $old_state = $history->getOldState();
     if ($old_state) {
     if ($old_state) {
       $name = $old_state->getName();
       $name = $old_state->getName();
-      $label = check_plain(t($old_state->label()));
+      $label = $old_state->label();
     }
     }
 
 
     if (!$old_state) {
     if (!$old_state) {

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow.tokens.inc

@@ -184,7 +184,7 @@ function workflow_tokens($type, $tokens, array $data = array(), array $options =
         switch (end($name_parts)) {
         switch (end($name_parts)) {
           case 'comment':
           case 'comment':
             if (isset($entity->workflow_transitions) && isset($entity->workflow_transitions[$name_parts[0]])) {
             if (isset($entity->workflow_transitions) && isset($entity->workflow_transitions[$name_parts[0]])) {
-              $replacements[$original] = $entity->workflow_transitions[$name_parts[0]]->$name_parts[1];
+              $replacements[$original] = $entity->workflow_transitions[$name_parts[0]]->{$name_parts[1]};
             }
             }
             break;
             break;
         }
         }
@@ -317,7 +317,7 @@ function _workflow_token_get_token($wrapper, $options) {
   // If there is a label for a property, e.g., defined by an options list or an
   // If there is a label for a property, e.g., defined by an options list or an
   // entity label, make use of it.
   // entity label, make use of it.
   if ($label = $wrapper->label()) {
   if ($label = $wrapper->label()) {
-    return empty($options['sanitize']) ? $label : check_plain(t($label, array(), array('langcode' => $langcode)));
+    return $label;
   }
   }
 
 
   switch ($wrapper->type()) {
   switch ($wrapper->type()) {

+ 7 - 5
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.info

@@ -1,12 +1,14 @@
 name = Workflow access
 name = Workflow access
 description = Content access control based on workflows and roles. Depends on the node_access system, so only works for entities of type 'node'.
 description = Content access control based on workflows and roles. Depends on the node_access system, so only works for entities of type 'node'.
-dependencies[] = workflow
 package = Workflow
 package = Workflow
 core = 7.x
 core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 43 - 39
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.module

@@ -7,16 +7,14 @@
 
 
 /**
 /**
  * Implements hook_menu().
  * Implements hook_menu().
- *
- * Uses pattern of EntityWorkflowUIController::hook_menu().
  */
  */
 function workflow_access_menu() {
 function workflow_access_menu() {
   $items = array();
   $items = array();
 
 
-  $path = 'admin/config/workflow/workflow';
-  $id_count = count(explode('/', $path));
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+  $id_count = count(explode('/', $admin_path));
 
 
-  $items[$path . '/access'] = array(
+  $items["$admin_path/access"] = array(
     'title' => 'Access settings',
     'title' => 'Access settings',
     'file' => 'workflow_access.pages.inc',
     'file' => 'workflow_access.pages.inc',
     'access arguments' => array('administer workflow'),
     'access arguments' => array('administer workflow'),
@@ -24,34 +22,64 @@ function workflow_access_menu() {
     'page arguments' => array('workflow_access_priority_form'),
     'page arguments' => array('workflow_access_priority_form'),
     'type' => MENU_LOCAL_ACTION,
     'type' => MENU_LOCAL_ACTION,
   );
   );
-  $items[$path . '/manage/%workflow/access'] = array(
+  $items["$admin_path/manage/%workflow/access"] = array(
     'title' => 'Access',
     'title' => 'Access',
     'file' => 'workflow_access.pages.inc',
     'file' => 'workflow_access.pages.inc',
     'access arguments' => array('administer workflow'),
     'access arguments' => array('administer workflow'),
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array(
-      'workflow_access_form',
-      $id_count + 1,
-      $id_count + 2,
-    ),
-    // 'type' => MENU_CALLBACK,
-    // 'type' => MENU_LOCAL_TASK,
+    'page arguments' => array('workflow_access_form', $id_count + 1),
+    'type' => MENU_CALLBACK,
   );
   );
 
 
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_workflow_operations().
+ */
+function workflow_access_workflow_operations($op, $workflow = NULL, $state = NULL) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $alt = t('Control content access for @wf', array('@wf' => $workflow->getName()));
+        $actions += array(
+          'workflow_access_form' => array(
+            'title' => t('Access'),
+            'href' => "$admin_path/manage/$wid/access",
+            'attributes' => array('alt' => $alt, 'title' => $alt),
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_access_form' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
+  }
+}
+
 /**
 /**
  * Implements hook_help().
  * Implements hook_help().
  */
  */
 function workflow_access_help($path, $arg) {
 function workflow_access_help($path, $arg) {
   $help = '';
   $help = '';
+
   switch ($path) {
   switch ($path) {
-    case 'admin/config/workflow/workflow/manage/%/access':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/access':
       $help = t("WARNING: Use of the 'Edit any', 'Edit own', and even 'View
       $help = t("WARNING: Use of the 'Edit any', 'Edit own', and even 'View
         published content' permissions for the content type may override these
         published content' permissions for the content type may override these
         access settings. You may need to <a href='!url'>alter the priority of
         access settings. You may need to <a href='!url'>alter the priority of
-        the Workflow access module</a>.", array('!url' => url('admin/config/workflow/workflow/access'))
+        the Workflow access module</a>.", array('!url' => url(WORKFLOW_ADMIN_UI_PATH . '/access'))
       );
       );
 
 
       if (module_exists('og')) {
       if (module_exists('og')) {
@@ -89,30 +117,6 @@ function workflow_access_features_api() {
   );
   );
 }
 }
 
 
-/**
- * Implements hook_workflow_operations().
- *
- * Create action link for access form on EntityWorkflowUIController::overviewForm.
- */
-function workflow_access_workflow_operations($op, $workflow = NULL, $state = NULL) {
-  switch ($op) {
-    case 'workflow':
-      $actions = array();
-      $wid = $workflow->wid;
-
-      $alt = t('Control content access for @wf', array('@wf' => $workflow->getName()));
-      $actions += array(
-        'workflow_access_form' => array(
-          'title' => t('Access'),
-          'href' => "admin/config/workflow/workflow/manage/$wid/access",
-          'attributes' => array('alt' => $alt, 'title' => $alt),
-        ),
-      );
-
-      return $actions;
-  }
-}
-
 /**
 /**
  * Implements hook_node_grants().
  * Implements hook_node_grants().
  *
  *

+ 15 - 13
sites/all/modules/contrib/admin/workflow/workflow_access/workflow_access.pages.inc

@@ -36,7 +36,7 @@ function workflow_access_priority_form($form, $form_state) {
  */
  */
 function workflow_access_priority_form_submit($form, &$form_state) {
 function workflow_access_priority_form_submit($form, &$form_state) {
   variable_set('workflow_access_priority', $form_state['values']['workflow_access']['workflow_access_priority']);
   variable_set('workflow_access_priority', $form_state['values']['workflow_access']['workflow_access_priority']);
-  $form_state['redirect'] = 'admin/config/workflow/workflow';
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 }
 
 
 
 
@@ -46,18 +46,18 @@ function workflow_access_priority_form_submit($form, &$form_state) {
  * Add a "three dimensional" (state, role, permission type) configuration
  * Add a "three dimensional" (state, role, permission type) configuration
  * interface to the workflow edit form.
  * interface to the workflow edit form.
  */
  */
-function workflow_access_form($form, $form_state, $workflow, $op) {
-  if (!$workflow) {
-    // Leave this page immediately.
-    drupal_set_message(t('Unknown workflow'));
-    drupal_goto('admin/config/workflow/workflow');
+function workflow_access_form($form, $form_state, Workflow $workflow) {
+  // If we don't have a workflow that goes with this, return to the admin pg.
+  if (!is_object($workflow)) {
+    drupal_set_message(t('Improper worklow ID provided.'), 'error');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
   }
 
 
-  drupal_set_title(t('@name Access', array('@name' => $workflow->label()))); // No t() for Settings page.
+  // @todo: Let's get a better page title.
+  drupal_set_title(t('@name Access', array('@name' => $workflow->label())));
 
 
-  $form = array('#tree' => TRUE);
-
-  $form['#wid'] = $workflow->wid;
+  $form['#tree'] = TRUE;
+  $form['#wid'] = $wid = $workflow->getWorkflowId();
 
 
   // A list of role names keyed by role ID, including the 'author' role.
   // A list of role names keyed by role ID, including the 'author' role.
   $roles = workflow_get_roles('participate in workflow');
   $roles = workflow_get_roles('participate in workflow');
@@ -90,7 +90,7 @@ function workflow_access_form($form, $form_state, $workflow, $op) {
     // @todo: better tables using a #theme function instead of direct #prefixing.
     // @todo: better tables using a #theme function instead of direct #prefixing.
     $form[$state->sid] = array(
     $form[$state->sid] = array(
       '#type' => 'fieldset',
       '#type' => 'fieldset',
-      '#title' => check_plain($state->label()),
+      '#title' => $state->label(),
       '#collapsible' => TRUE,
       '#collapsible' => TRUE,
       '#collapsed' => FALSE,
       '#collapsed' => FALSE,
       '#tree' => TRUE,
       '#tree' => TRUE,
@@ -131,6 +131,8 @@ function workflow_access_form($form, $form_state, $workflow, $op) {
  * Stores permission settings for workflow states.
  * Stores permission settings for workflow states.
  */
  */
 function workflow_access_form_submit($form, &$form_state) {
 function workflow_access_form_submit($form, &$form_state) {
+  $wid = $form['#wid'];
+
   foreach ($form_state['values'] as $sid => $access) {
   foreach ($form_state['values'] as $sid => $access) {
     // Ignore irrelevant keys.
     // Ignore irrelevant keys.
     if (!is_numeric($sid)) {
     if (!is_numeric($sid)) {
@@ -148,10 +150,10 @@ function workflow_access_form_submit($form, &$form_state) {
     }
     }
 
 
     // Update all nodes having same workflow state to reflect new settings.
     // Update all nodes having same workflow state to reflect new settings.
-    // just set a flag, which is working for both Workflow Field ánd Workflow Node.
+    // just set a flag, which is working for both Workflow Field ánd Workflow Node.
     node_access_needs_rebuild(TRUE);
     node_access_needs_rebuild(TRUE);
   }
   }
 
 
   drupal_set_message(t('Workflow access permissions updated.'));
   drupal_set_message(t('Workflow access permissions updated.'));
-  $form_state['redirect'] = 'admin/config/workflow/workflow/' . $form['#wid'];
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 }

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.info

@@ -1,15 +1,15 @@
 name = Workflow Trigger
 name = Workflow Trigger
 description = Enables actions to be fired upon a Workflow State change.
 description = Enables actions to be fired upon a Workflow State change.
+package = Workflow
+core = 7.x
 
 
-dependencies[] = workflow
 dependencies[] = trigger
 dependencies[] = trigger
+dependencies[] = workflow
 
 
-package = Workflow
-core = 7.x
+configure = admin/structure/trigger/workflow
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 25 - 10
sites/all/modules/contrib/admin/workflow/workflow_actions/workflow_actions.module

@@ -1,4 +1,5 @@
 <?php
 <?php
+
 /**
 /**
  * @file
  * @file
  * Enables actions to be fired upon a Workflow State change.
  * Enables actions to be fired upon a Workflow State change.
@@ -13,17 +14,31 @@
 
 
 /**
 /**
  * Implements hook_workflow_operations().
  * Implements hook_workflow_operations().
- *
- * Menu callback, called in workflow.admin.inc to add actions for states.
  */
  */
-function workflow_actions_workflow_operations($level, $workflow = NULL, $state = NULL) {
-  if ($workflow) {
-    return array(
-      'workflow_overview_actions' => array(
-        'title' => t('Actions'),
-        'href' => 'admin/structure/trigger/workflow/' . $workflow->wid,
-      ),
-    );
+function workflow_actions_workflow_operations($op, $workflow = NULL, $state = NULL) {
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $actions = array(
+          'workflow_overview_actions' => array(
+            'title' => t('Actions'),
+            'href' => "admin/structure/trigger/workflow/$wid",
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_overview_actions' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
   }
   }
 }
 }
 
 

+ 9 - 7
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/includes/Entity/EntityWorkflowUIController.php

@@ -13,7 +13,8 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
     $items = parent::hook_menu();
     $items = parent::hook_menu();
 
 
     // Set this on the object so classes that extend hook_menu() can use it.
     // Set this on the object so classes that extend hook_menu() can use it.
-    $id_count = count(explode('/', $this->path));
+    $admin_path = $this->path;
+    $id_count = count(explode('/', $admin_path));
     $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
     $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
     $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's';
     $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's';
     $entityType = $this->entityInfo['entity class'];
     $entityType = $this->entityInfo['entity class'];
@@ -27,7 +28,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'type' => MENU_LOCAL_TASK,
       'type' => MENU_LOCAL_TASK,
     );
     );
 
 
-    $items[$this->path . '/manage/' . $wildcard . '/states'] = $item + array(
+    $items["$admin_path/manage/$wildcard/states"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.states.inc',
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.states.inc',
       'title' => 'States',
       'title' => 'States',
       'weight' => '11',
       'weight' => '11',
@@ -35,7 +36,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_states_form', $id_count + 1, $id_count + 2),
       'page arguments' => array('workflow_admin_ui_states_form', $id_count + 1, $id_count + 2),
     );
     );
 
 
-    $items[$this->path . '/manage/' . $wildcard . '/transitions'] = $item + array(
+    $items["$admin_path/manage/$wildcard/transitions"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.transitions.inc',
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.transitions.inc',
       'title' => 'Transitions',
       'title' => 'Transitions',
       'weight' => '12',
       'weight' => '12',
@@ -43,7 +44,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_transitions_form', $id_count + 1, $id_count + 2),
       'page arguments' => array('workflow_admin_ui_transitions_form', $id_count + 1, $id_count + 2),
     );
     );
 
 
-    $items[$this->path . '/manage/' . $wildcard . '/labels'] = $item + array(
+    $items["$admin_path/manage/$wildcard/labels"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.labels.inc',
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.labels.inc',
       'title' => 'Labels',
       'title' => 'Labels',
       'weight' => '13',
       'weight' => '13',
@@ -51,7 +52,7 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
       'page arguments' => array('workflow_admin_ui_labels_form', $id_count + 1, $id_count + 2),
       'page arguments' => array('workflow_admin_ui_labels_form', $id_count + 1, $id_count + 2),
     );
     );
 
 
-    $items[$this->path . '/manage/' . $wildcard . '/permissions'] = $item + array(
+    $items["$admin_path/manage/$wildcard/permissions"] = $item + array(
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.permissions.inc',
       'file' => 'workflow_admin_ui/workflow_admin_ui.page.permissions.inc',
       'title' => 'Permission summary',
       'title' => 'Permission summary',
       'weight' => '14',
       'weight' => '14',
@@ -146,10 +147,11 @@ class EntityWorkflowUIController extends EntityDefaultUIController {
    * @see https://www.drupal.org/node/1043634
    * @see https://www.drupal.org/node/1043634
    */
    */
   public function applyOperation($op, $entity) {
   public function applyOperation($op, $entity) {
+    $admin_path = $this->path;
     $label = entity_label($this->entityType, $entity);
     $label = entity_label($this->entityType, $entity);
     $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label);
     $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label);
-    $id = entity_id($this->entityType, $entity);
-    $edit_link = l(t('edit'), $this->path . '/manage/' . $id . '/edit');
+    $wid = entity_id($this->entityType, $entity);
+    $edit_link = l(t('edit'), "$admin_path/manage/$wid/edit");
 
 
     switch ($op) {
     switch ($op) {
       case 'revert':
       case 'revert':

+ 5 - 3
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.api.php

@@ -7,18 +7,20 @@
 /**
 /**
  * Implements hook_workflow_operations().
  * Implements hook_workflow_operations().
  *
  *
+ * Menu callback; adds links on EntityWorkflowUIController::overviewForm.
+ *
  * @param string $op
  * @param string $op
  *   'top_actions': Allow modules to insert their own front page action links.
  *   'top_actions': Allow modules to insert their own front page action links.
  *   'operations': Allow modules to insert their own workflow operations.
  *   'operations': Allow modules to insert their own workflow operations.
  *   'state':  Allow modules to insert state operations.
  *   'state':  Allow modules to insert state operations.
- * @param object $workflow
+ * @param Workflow $workflow
  *   The current workflow object.
  *   The current workflow object.
- * @param object $state
+ * @param WorkflowState $state
  *   The current state object.
  *   The current state object.
  *
  *
  * @return array
  * @return array
  */
  */
-function hook_workflow_operations($op, object $workflow, object $state) {
+function hook_workflow_operations($op, Workflow $workflow, WorkflowState $state) {
   switch ($op) {
   switch ($op) {
     case 'top_actions':
     case 'top_actions':
       $actions = array();
       $actions = array();

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.info

@@ -1,17 +1,17 @@
 name = Workflow UI
 name = Workflow UI
-description = "Provides administrative UI for workflow."
+description = Provides an administrative UI for workflows.
 package = Workflow
 package = Workflow
 core = 7.x
 core = 7.x
 
 
-configure = admin/config/workflow/workflow
-
 dependencies[] = workflow
 dependencies[] = workflow
+
 files[] = includes/Entity/EntityWorkflowUIController.php
 files[] = includes/Entity/EntityWorkflowUIController.php
 stylesheets[all][] = workflow_admin_ui.css
 stylesheets[all][] = workflow_admin_ui.css
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 10 - 9
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.module

@@ -19,10 +19,12 @@ define('WORKFLOW_ADMIN_UI_ARROW', '&#8594;');
  * Adds Admin UI to entities, using EntityWorkflowUIController.
  * Adds Admin UI to entities, using EntityWorkflowUIController.
  */
  */
 function workflow_admin_ui_entity_info_alter(&$entity_info) {
 function workflow_admin_ui_entity_info_alter(&$entity_info) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
   $entity_info['Workflow'] += array(
   $entity_info['Workflow'] += array(
     'access callback' => 'workflow_access',
     'access callback' => 'workflow_access',
     'admin ui' => array(
     'admin ui' => array(
-      'path' => 'admin/config/workflow/workflow',
+      'path' => $admin_path,
       // Do not add 'file', since each page has its own file.
       // Do not add 'file', since each page has its own file.
       // 'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
       // 'file' => 'workflow_admin_ui/workflow_admin_ui.pages.inc',
       'controller class' => 'EntityWorkflowUIController',
       'controller class' => 'EntityWorkflowUIController',
@@ -38,8 +40,7 @@ function workflow_admin_ui_help($path, $arg) {
   switch ($path) {
   switch ($path) {
 
 
     case 'admin/modules':
     case 'admin/modules':
-    case 'admin/config/workflow/workflow':
-    // case 'admin/config/workflow/workflow/manage/%/states': // Already has its own text.
+    case WORKFLOW_ADMIN_UI_PATH:
       if (module_exists('workflownode') && module_exists('workflowfield')) {
       if (module_exists('workflownode') && module_exists('workflowfield')) {
         $m = t('Do not enable Workfow Node and Workflow Field submodules at the
         $m = t('Do not enable Workfow Node and Workflow Field submodules at the
           same time (unless you are in a migration phase). Visit the <a href=
           same time (unless you are in a migration phase). Visit the <a href=
@@ -49,12 +50,12 @@ function workflow_admin_ui_help($path, $arg) {
       }
       }
       return;
       return;
 
 
-    case 'admin/config/workflow/workflow/add':
+    case WORKFLOW_ADMIN_UI_PATH . '/add':
       return t('To get started, provide a name for your workflow. This name
       return t('To get started, provide a name for your workflow. This name
         will be used as a label when the workflow status is shown during node
         will be used as a label when the workflow status is shown during node
         editing.');
         editing.');
 
 
-    case 'admin/config/workflow/workflow/manage/%/states':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/states':
       return t("To create a new state, enter its name in the last row of the
       return t("To create a new state, enter its name in the last row of the
         'State' column. Check the 'Active' box to make it effective. You may
         'State' column. Check the 'Active' box to make it effective. You may
         also drag it to the appropriate position.") . '<br />'
         also drag it to the appropriate position.") . '<br />'
@@ -64,7 +65,7 @@ function workflow_admin_ui_help($path, $arg) {
         not zero), then you need to select a state to which to reassign that
         not zero), then you need to select a state to which to reassign that
         content.");
         content.");
 
 
-    case 'admin/config/workflow/workflow/manage/%/transitions':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/transitions':
       return t('You are currently viewing the possible transitions to and from
       return t('You are currently viewing the possible transitions to and from
         workflow states. The state is shown in the left column; the state to be
         workflow states. The state is shown in the left column; the state to be
         moved to is to the right. For each transition, check the box next to
         moved to is to the right. For each transition, check the box next to
@@ -79,7 +80,7 @@ function workflow_admin_ui_help($path, $arg) {
         array('!url' => url('admin/people/permissions', array(
         array('!url' => url('admin/people/permissions', array(
           'fragment' => 'module-workflow'))));
           'fragment' => 'module-workflow'))));
 
 
-    case 'admin/config/workflow/workflow/manage/%/labels':
+    case WORKFLOW_ADMIN_UI_PATH . '/manage/%/labels':
       return t('You can add labels to transitions if you don\'t like the
       return t('You can add labels to transitions if you don\'t like the
         standard state labels. They will modify the Workflow form options, so
         standard state labels. They will modify the Workflow form options, so
         specific workflow transitions can have their own labels, relative to
         specific workflow transitions can have their own labels, relative to
@@ -161,9 +162,9 @@ function workflow_admin_ui_breadcrumbs($workflow, $extra = NULL) {
   $bc = array(l(t('Home'), '<front>'));
   $bc = array(l(t('Home'), '<front>'));
   $bc[] = l(t('Configuration'), 'admin/config');
   $bc[] = l(t('Configuration'), 'admin/config');
   $bc[] = l(t('Workflow'), 'admin/config/workflow');
   $bc[] = l(t('Workflow'), 'admin/config/workflow');
-  $bc[] = l(t('Workflow'), 'admin/config/workflow/workflow');
+  $bc[] = l(t('Workflow'), WORKFLOW_ADMIN_UI_PATH);
   if ($workflow) {
   if ($workflow) {
-    $bc[] = l($workflow->label(), "admin/config/workflow/workflow/$workflow->wid");
+    $bc[] = l($workflow->label(), WORKFLOW_ADMIN_UI_PATH . "/$workflow->wid");
   }
   }
   if ($extra) {
   if ($extra) {
     $bc[] = $extra;
     $bc[] = $extra;

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.labels.inc

@@ -30,11 +30,11 @@
  * @return array
  * @return array
  *   Array of form items for editing labels on transitions.
  *   Array of form items for editing labels on transitions.
  */
  */
-function workflow_admin_ui_labels_form($form, $form_state, $workflow, $op) {
+function workflow_admin_ui_labels_form($form, &$form_state, $workflow, $op) {
   if (!is_object($workflow)) {
   if (!is_object($workflow)) {
     drupal_set_message(t('Improper worklow ID provided.'), 'error');
     drupal_set_message(t('Improper worklow ID provided.'), 'error');
     watchdog('workflow_named_transitions', 'Improper worklow ID provided.');
     watchdog('workflow_named_transitions', 'Improper worklow ID provided.');
-    drupal_goto('admin/config/workflow/workflow');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
   }
 
 
   $headers = array(
   $headers = array(

+ 3 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.permissions.inc

@@ -17,9 +17,10 @@
 function workflow_admin_ui_view_permissions_form($workflow, $op) {
 function workflow_admin_ui_view_permissions_form($workflow, $op) {
   // If we don't have a workflow at this point, go back to admin page.
   // If we don't have a workflow at this point, go back to admin page.
   if (!$workflow) {
   if (!$workflow) {
-    drupal_goto('admin/config/workflow/workflow');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
   }
   }
 
 
+
   $all = array();
   $all = array();
   $roles = workflow_get_roles();
   $roles = workflow_get_roles();
   foreach ($roles as $rid => $value) {
   foreach ($roles as $rid => $value) {
@@ -31,7 +32,7 @@ function workflow_admin_ui_view_permissions_form($workflow, $op) {
     foreach ($transition->roles as $rid) {
     foreach ($transition->roles as $rid) {
       $old_state = $transition->getOldState();
       $old_state = $transition->getOldState();
       $new_state = $transition->getNewState();
       $new_state = $transition->getNewState();
-      $all[$rid]['transitions'][] = array(check_plain(t($old_state->label())), WORKFLOW_ADMIN_UI_ARROW, check_plain(t($new_state->label())));
+      $all[$rid]['transitions'][] = array($old_state->label(), WORKFLOW_ADMIN_UI_ARROW, $new_state->label());
     }
     }
   }
   }
 
 

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.states.inc

@@ -59,7 +59,7 @@ function workflow_admin_ui_states_form($form, &$form_state, $workflow, $op) {
         '#type' => 'textfield',
         '#type' => 'textfield',
         '#size' => 30,
         '#size' => 30,
         '#maxlength' => 255,
         '#maxlength' => 255,
-        '#default_value' => check_plain($label),
+        '#default_value' => $label,
       ),
       ),
 
 
       'name' => array(
       'name' => array(
@@ -305,7 +305,7 @@ function workflow_admin_ui_states_form_submit($form, &$form_state) {
   }
   }
 
 
   drupal_set_message(t('The workflow was updated.'));
   drupal_set_message(t('The workflow was updated.'));
-  // $form_state['redirect'] = 'admin/config/workflow/workflow';
+  // $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 }
 
 
 /**
 /**

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.transitions.inc

@@ -114,7 +114,7 @@ function theme_workflow_admin_ui_transitions_form($variables) {
       $header = array(array('data' => t('From / To') . ' &nbsp;' . WORKFLOW_ADMIN_UI_ARROW));
       $header = array(array('data' => t('From / To') . ' &nbsp;' . WORKFLOW_ADMIN_UI_ARROW));
       $rows = array();
       $rows = array();
       foreach ($states as $state) {
       foreach ($states as $state) {
-        $label = check_plain($state->label());
+        $label = $state->label();
         // Don't allow transition TO (creation).
         // Don't allow transition TO (creation).
         if (!$state->isCreationState()) {
         if (!$state->isCreationState()) {
           $header[] = array('data' => $label);
           $header[] = array('data' => $label);
@@ -218,5 +218,5 @@ function workflow_admin_ui_transitions_form_submit($form, &$form_state) {
   }
   }
 
 
   drupal_set_message(t('The workflow was updated.'));
   drupal_set_message(t('The workflow was updated.'));
-  // $form_state['redirect'] = 'admin/config/workflow/workflow';
+  // $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
 }
 }

+ 4 - 3
sites/all/modules/contrib/admin/workflow/workflow_admin_ui/workflow_admin_ui.page.workflow.inc

@@ -221,7 +221,7 @@ function workflow_admin_ui_edit_form_validate($form, &$form_state) {
 
 
   // Make sure workflow name is not a duplicate.
   // Make sure workflow name is not a duplicate.
   foreach (workflow_load_multiple() as $stored_workflow) {
   foreach (workflow_load_multiple() as $stored_workflow) {
-    if ($name == check_plain($stored_workflow->getName()) && $workflow->wid != $stored_workflow->wid) {
+    if ($name == $stored_workflow->name && $workflow->wid != $stored_workflow->wid) {
       form_set_error('name', t('A workflow with the name %name already exists. Please enter another name for this workflow.',
       form_set_error('name', t('A workflow with the name %name already exists. Please enter another name for this workflow.',
         array('%name' => $name)));
         array('%name' => $name)));
       break;
       break;
@@ -248,6 +248,7 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
     $workflow->tab_roles = array_filter($form_state['values']['tab_roles']);
     $workflow->tab_roles = array_filter($form_state['values']['tab_roles']);
     $workflow->options = array(
     $workflow->options = array(
       'name_as_title' => $form_state['values']['name_as_title'],
       'name_as_title' => $form_state['values']['name_as_title'],
+      'fieldset' => $form_state['values']['fieldset'],
       'options' => $form_state['values']['options'],
       'options' => $form_state['values']['options'],
       'schedule' => $form_state['values']['schedule'],
       'schedule' => $form_state['values']['schedule'],
       'schedule_timezone' => $form_state['values']['schedule_timezone'],
       'schedule_timezone' => $form_state['values']['schedule_timezone'],
@@ -262,7 +263,7 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
   if ($insert) {
   if ($insert) {
     $args = array(
     $args = array(
       '%name' => $workflow->getName(),
       '%name' => $workflow->getName(),
-      '@url' => url('admin/config/workflow/workflow/edit/' . $workflow->wid),
+      '@url' => url(WORKFLOW_ADMIN_UI_PATH . "/edit/$workflow->wid"),
     );
     );
     watchdog('workflow', 'Created workflow %name', $args);
     watchdog('workflow', 'Created workflow %name', $args);
     drupal_set_message(t('The workflow %name was created. Please maintain the states and transitions.', $args), 'status');
     drupal_set_message(t('The workflow %name was created. Please maintain the states and transitions.', $args), 'status');
@@ -272,5 +273,5 @@ function workflow_admin_ui_edit_form_submit($form, &$form_state) {
   }
   }
   // This redirect is needed, when changing the workflow name, with name in URL.
   // This redirect is needed, when changing the workflow name, with name in URL.
   // Also for cloning a workflow.
   // Also for cloning a workflow.
-  $form_state['redirect'] = 'admin/config/workflow/workflow/manage/' . $workflow->wid;
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH . "/manage/$workflow->wid";
 }
 }

+ 8 - 7
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.info

@@ -1,13 +1,14 @@
 name = Workflow Clean Up
 name = Workflow Clean Up
-description = "Cleans up Workflow cruft."
-dependencies[] = workflow
-core = 7.x
+description = Cleans up Workflow cruft.
 package = Workflow
 package = Workflow
+core = 7.x
+
+dependencies[] = workflow
 
 
 configure = admin/config/workflow/workflow/cleanup
 configure = admin/config/workflow/workflow/cleanup
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 5 - 2
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.module

@@ -1,4 +1,5 @@
 <?php
 <?php
+
 /**
 /**
  * @file
  * @file
  * Cleans up Workflow cruft that may build up over time.
  * Cleans up Workflow cruft that may build up over time.
@@ -10,7 +11,9 @@
 function workflow_cleanup_menu() {
 function workflow_cleanup_menu() {
   $items = array();
   $items = array();
 
 
-  $items['admin/config/workflow/workflow/cleanup'] = array(
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  $items["$admin_path/cleanup"] = array(
     'title' => 'Clean up workflow',
     'title' => 'Clean up workflow',
     'file' => 'workflow_cleanup.pages.inc',
     'file' => 'workflow_cleanup.pages.inc',
     'access arguments' => array('administer workflow'),
     'access arguments' => array('administer workflow'),
@@ -27,7 +30,7 @@ function workflow_cleanup_menu() {
  */
  */
 function workflow_cleanup_help($path, $arg) {
 function workflow_cleanup_help($path, $arg) {
   switch ($path) {
   switch ($path) {
-    case 'admin/config/workflow/workflow/cleanup':
+    case WORKFLOW_ADMIN_UI_PATH . '/cleanup':
       return t('This page allows you to delete orphaned and inactive states.
       return t('This page allows you to delete orphaned and inactive states.
         States can be deleted freely in a development environment, but be
         States can be deleted freely in a development environment, but be
         careful if you have used a State in a production environment. The
         careful if you have used a State in a production environment. The

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_cleanup/workflow_cleanup.pages.inc

@@ -1,13 +1,13 @@
 <?php
 <?php
 /**
 /**
  * @file
  * @file
- * Contains admin/config/workflow/workflow/cleanup page.
+ * Contains an Admin page to delete obsolete states and transitions.
  */
  */
 
 
 /**
 /**
  * The main cleanup page.
  * The main cleanup page.
  */
  */
-function workflow_cleanup_form($form, $form_state) {
+function workflow_cleanup_form($form, &$form_state) {
   $form = array();
   $form = array();
 
 
   // Get all of the states, indexed by sid.
   // Get all of the states, indexed by sid.

+ 29 - 0
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.field.inc

@@ -143,6 +143,9 @@ function _workflowfield_metadata_property_set($entity, $name, $value, $langcode,
  */
  */
 function workflowfield_field_formatter_info_alter(&$info) {
 function workflowfield_field_formatter_info_alter(&$info) {
   $info['list_default']['field types'][] = 'workflow';
   $info['list_default']['field types'][] = 'workflow';
+  if (isset($info['i18n_list_default'])) {
+    $info['i18n_list_default']['field types'][] = 'workflow';
+  }
 }
 }
 
 
 /**
 /**
@@ -312,3 +315,29 @@ function workflowfield_options_list($field, $instance, $entity_type, $entity) {
   }
   }
   return $options;
   return $options;
 }
 }
+
+/**
+ * Implements hook_i18n_field_info().
+ */
+function workflowfield_i18n_field_info() {
+  $info['workflow'] = array(
+    'translate_options' => 'workflowfield_i18n_field_translate_allowed_values',
+  );
+  return $info;
+}
+
+/**
+ * Returns the array of translated allowed values for a workflow (list) field.
+ *
+ * @param $field
+ *   The field definition.
+ *
+ * @return
+ *   The array of allowed values. Keys of the array are the raw stored values
+ *   (number or text), values are the translated, sanitized labels.
+ */
+function workflowfield_i18n_field_translate_allowed_values($field) {
+  // State labels are already translated and sanitized.
+  $workflow_states = workflow_get_workflow_state_names($field['settings']['wid'], $grouped = FALSE, $all = TRUE);
+  return $workflow_states;
+}

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.info

@@ -8,9 +8,8 @@ dependencies[] = field
 dependencies[] = options
 dependencies[] = options
 dependencies[] = workflow
 dependencies[] = workflow
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_field/workflowfield.module

@@ -16,7 +16,7 @@ require_once dirname(__FILE__) . '/workflowfield.formatter.inc';
  */
  */
 function workflowfield_help($path, $arg) {
 function workflowfield_help($path, $arg) {
   switch ($path) {
   switch ($path) {
-    case 'admin/config/workflow/workflow':
+    case WORKFLOW_ADMIN_UI_PATH:
       return t('This page allows you to maintain Workflows. Once a workflow is
       return t('This page allows you to maintain Workflows. Once a workflow is
         created, you can maintain your entity type and add a Field of type
         created, you can maintain your entity type and add a Field of type
         \'Workflow\'.');
         \'Workflow\'.');

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.info

@@ -5,9 +5,8 @@ core = 7.x
 
 
 dependencies[] = workflow
 dependencies[] = workflow
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_node/workflownode.tokens.inc

@@ -177,7 +177,7 @@ function workflownode_tokens($type, $tokens, array $data = array(), array $optio
       foreach ($tokens as $name => $original) {
       foreach ($tokens as $name => $original) {
         switch ($name) {
         switch ($name) {
           case 'workflow-name':
           case 'workflow-name':
-            $replacements[$original] = $sanitize ? check_plain($workflow->label()) : $workflow->label();
+            $replacements[$original] = $workflow->label(); // Already sanitized.
             break;
             break;
 
 
           case 'workflow-current-state-name':
           case 'workflow-current-state-name':

+ 0 - 236
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.admin.inc

@@ -1,236 +0,0 @@
-<?php
-/**
- * @file
- * Admin UI to Notify roles for Workflow state transitions.
- */
-
-/**
- * Settings form.
- */
-function workflow_notify_settings_form($form, $form_state, $workflow) {
-  // If we don't have a workflow that goes with this, return to the admin pg.
-  if ($workflow) {
-    // Let's get a better page title.
-    drupal_set_title(t('@name Notifications', array('@name' => ucwords($workflow->name))));
-
-    // Let's add some breadcrumbs.
-    workflow_admin_ui_breadcrumbs($workflow);
-
-    $noyes = array(t('No'), t('Yes'));
-
-    $form['wid'] = array('#type' => 'value', '#value' => $workflow->wid);
-    $form['#workflow'] = $workflow;
-
-    // Get all the states for this workflow, except the (creation) state.
-//    $states = workflow_get_workflow_states_by_wid($workflow->wid,
-//      array('status' => 1, 'sysid' => 0));
-    $states = array();
-    foreach ($workflow->states as $sid => $state) {
-      if (!$state->sysid) {
-        $states[$sid] = $state;
-      }
-    }
-    if (!$states) {
-      $form['error'] = array(
-        '#type' => 'markup',
-        '#value' => t('There are no states defined for this workflow.'),
-      );
-      return $form;
-    }
-
-    $form['#states'] = $states;
-
-    // Get all roles, except anonymous.
-    $roles = user_roles(TRUE);
-    $roles = array('-1' => t('Author')) + user_roles(TRUE);
-
-    // The module_invoke_all function does not allow passing by reference.
-    $args = array('roles' => $roles);
-    foreach (module_implements('workflow_notify') as $module) {
-      $function = $module . '_workflow_notify';
-      // Call the $op='roles' hooks so the list may be modified.
-      $function('roles', $args);
-    }
-    // Get the modified list.
-    $roles = $args['roles'];
-
-    // Setting for "from" address.
-    $form['from_address'] = array(
-      '#title' => t('Set "From" address to'),
-      '#type' => 'radios',
-      '#options' => array(
-        'site' => t('Site email address'),
-        'changer' => t('Current user'),
-        ),
-      '#default_value' => variable_get('workflow_notify_from_address_' . $workflow->wid, 'site'),
-      '#attributes' => array('class' => array('container-inline')),
-      '#description' => t('Determines whether to use the site address or the address of the person
-        causing the state change.'),
-      );
-
-    // Get the list of input formats.
-    $formats = array();
-    foreach (filter_formats() as $fid => $filter) {
-      $formats[$fid] = $filter->name;
-    }
-
-    $form['filter'] = array(
-      '#title' => t('Filter format to use on message'),
-      '#type' => 'radios',
-      '#options' => $formats,
-      '#default_value' => variable_get('workflow_notify_filter_format_' . $workflow->wid, 'filtered_html'),
-      '#attributes' => array('class' => array('container-inline')),
-      '#description' => t('The message body will be processed using this filter format
-        in order to ensure security.'),
-      );
-
-    $form['tokens'] = array(
-      '#theme' => 'token_tree_link',
-      '#token_types' => array('node', 'workflow'),
-      );
-
-    // Column names for theme function.
-    $columns = array(
-      'state' => t('State'),
-      'roles' => t('Roles to notify'),
-      );
-
-    $args = array('columns' => $columns);
-    // The module_invoke_all function does not allow passing by reference.
-    foreach (module_implements('workflow_notify') as $module) {
-      $function = $module . '_workflow_notify';
-      $function('columns', $args);
-    }
-    $form['#columns'] = $args['columns'];
-
-    // We always want subject and body last.
-    $form['#columns']['subject'] = t('Subject');
-    $form['#columns']['body'] = t('Body');
-
-    $notify = variable_get('workflow_notify_roles', array());
-
-    foreach ($states as $sid => $state) {
-      // Allow modules to insert state operations.
-      $state_links = module_invoke_all('workflow_operations', 'state', $workflow, $state);
-
-      $form['states'][$sid] = array(
-        'state' => array(
-          '#type' => 'markup',
-          '#markup' => filter_xss($state->state),
-          ),
-
-        'roles' => array(
-          '#type' => 'checkboxes',
-          '#options' => $roles,
-          '#default_value' => (isset($notify[$sid]) ? $notify[$sid] : array()),
-          '#attributes' => array('class' => array('state-roles')),
-          ),
-
-        'subject' => array(
-          '#type' => 'textarea',
-          '#rows' => 5,
-          '#default_value' => variable_get('workflow_notify_subject_' . $sid,
-            '[node:title] is now "[node:field_workflow_state:new-state:label]"'),
-          '#attributes' => array('class' => array('subject')),
-          ),
-
-        'body' => array(
-          '#type' => 'textarea',
-          '#rows' => 5,
-          '#default_value' => variable_get('workflow_notify_body_' . $sid,
-            '<a href="[node:url:absolute]">[node:title]</a> is now "[node:field_workflow_state:new-state:label]".'),
-          '#attributes' => array('class' => array('body')),
-          ),
-        );
-    }
-
-    $form['#tree'] = TRUE;
-    $form['submit'] = array('#type' => 'submit', '#value' => 'Save notifications settings');
-
-    return $form;
-  }
-  else {
-    drupal_goto('admin/config/workflow/workflow');
-  }
-}
-
-/**
- * Theme the settings form.
- */
-function theme_workflow_notify_settings_form($variables) {
-  $form = $variables['form'];
-  $output = '';
-  $table_id = 'workflow-notify-settings';
-
-  $output .= drupal_render($form['from_address']);
-  $output .= drupal_render($form['filter']);
-  $output .= drupal_render($form['tokens']);
-
-  $table = array(
-    'rows' => array(),
-    'header' => array(),    // To be filled in.
-    'attributes' => array('id' => $table_id, 'style' => 'width: 100%; margin-top: 1em;'),
-    );
-
-  $columns = $form['#columns'];
-  $colspan = count($columns);
-
-  foreach ($columns as $field => $title) {
-    $table['header'][] = $title;
-  }
-
-  // Iterate over each element in our $form['states'] array
-  foreach (element_children($form['states']) as $id) {
-    // We are now ready to add each element of our $form data to the rows
-    // array, so that they end up as individual table cells when rendered
-    // in the final table.
-    $row = array();
-
-    foreach ($columns as $field => $title) {
-      $row[] = array(
-        'data' => drupal_render($form['states'][$id][$field]),
-        'class' => array(drupal_html_class($field)),
-        );
-    }
-
-    // Put the data row into the table.
-    $table['rows'][] = array('data' => $row);
-  }
-
-  $output .= theme('table', $table);
-
-  $output .= drupal_render($form['explain']);
-
-  // And then render any remaining form elements (such as our submit button)
-  $output .= drupal_render_children($form);
-
-  return $output;
-}
-
-function workflow_notify_settings_form_submit($form, $form_state) {
-  $roles = variable_get('workflow_notify_roles', array());
-
-  $workflow = $form['#workflow'];
-
-  variable_set('workflow_notify_from_address_' . $workflow->wid , $form_state['values']['from_address']);
-  variable_set('workflow_notify_filter_format_' . $workflow->wid , $form_state['values']['filter']);
-
-  foreach ($form_state['values']['states'] as $sid => $values) {
-    $selected = array_filter($values['roles']);
-    // Are there any roles selected?
-    if ($selected) {
-      $roles[$sid] = $selected;
-    }
-    else {
-      // No, so make sure this state is gone.
-      unset($roles[$sid]);
-    }
-
-    variable_set("workflow_notify_subject_$sid", $values['subject']);
-    variable_set("workflow_notify_body_$sid", $values['body']);
-  }
-
-  variable_set('workflow_notify_roles', $roles);
-
-  drupal_set_message(t('The notification settings have been saved.'));
-}

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.info

@@ -1,15 +1,15 @@
 name = Workflow Notify
 name = Workflow Notify
 description = Notify roles of Workflow transitions.
 description = Notify roles of Workflow transitions.
-dependencies[] = workflow
-configure = admin/config/workflow/workflow
-core = 7.x
 package = Workflow
 package = Workflow
+core = 7.x
 
 
 dependencies[] = token
 dependencies[] = token
+dependencies[] = workflow
+
+configure = admin/config/workflow/workflow
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 118 - 67
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.module

@@ -1,9 +1,65 @@
 <?php
 <?php
+
 /**
 /**
  * @file
  * @file
  * Notify roles for Workflow state transitions.
  * Notify roles for Workflow state transitions.
  */
  */
 
 
+/**
+ * Implements hook_menu().
+ */
+function workflow_notify_menu() {
+  $items = array();
+
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+  $id_count = count(explode('/', $admin_path));
+
+  $items["$admin_path/manage/%workflow/notify"] = array(
+    'title' => 'Notifications',
+    'file' => 'workflow_notify.pages.inc',
+    'access arguments' => array('administer workflow'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('workflow_notify_settings_form', $id_count + 1),
+    'type' => MENU_CALLBACK,
+  );
+
+  return $items;
+}
+
+/**
+ * Implements hook_workflow_operations().
+ */
+function workflow_notify_workflow_operations($op, Workflow $workflow = NULL) {
+  $admin_path = WORKFLOW_ADMIN_UI_PATH;
+
+  switch ($op) {
+    case 'workflow':
+      $actions = array();
+      if ($workflow && $workflow->getStates()) {
+        $wid = $workflow->getWorkflowId();
+        $alt = t('Notify users about state changes.');
+        $actions = array(
+          'workflow_notify_settings' => array(
+            'title' => t('Notifications'),
+            'href' => "$admin_path/manage/$wid/notify",
+            'attributes' => array('alt' => $alt, 'title' => $alt),
+          ),
+        );
+      }
+      else {
+        // Generate a dummy, if no states exist.
+        $actions = array(
+          'workflow_notify_settings' => array(
+            'title' => '',
+            'href' => '',
+          ),
+        );
+      }
+
+      return $actions;
+  }
+}
+
 /**
 /**
  * Implements hook_permission().
  * Implements hook_permission().
  */
  */
@@ -21,29 +77,11 @@ function workflow_notify_permission() {
  */
  */
 function workflow_notify_help($path, $arg) {
 function workflow_notify_help($path, $arg) {
   switch ($path) {
   switch ($path) {
-    case 'admin/config/workflow/workflow/notify/%':
+    case WORKFLOW_ADMIN_UI_PATH . '/notify/%':
       return '<p>' . t('The selected roles will be notified of each state change selected.') . '</p>';
       return '<p>' . t('The selected roles will be notified of each state change selected.') . '</p>';
   }
   }
 }
 }
 
 
-/**
- * Implements hook_menu().
- */
-function workflow_notify_menu() {
-  $items = array();
-
-  $items['admin/config/workflow/workflow/notify/%workflow'] = array(
-    'title' => 'Notifications',
-    'access arguments' => array('administer workflow'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('workflow_notify_settings_form', 5),
-    'type' => MENU_CALLBACK,
-    'file' => 'workflow_notify.admin.inc',
-  );
-
-  return $items;
-}
-
 /**
 /**
  * Implements hook_theme().
  * Implements hook_theme().
  */
  */
@@ -51,7 +89,7 @@ function workflow_notify_theme() {
   return array(
   return array(
     'workflow_notify_settings_form' => array(
     'workflow_notify_settings_form' => array(
       'render element' => 'form',
       'render element' => 'form',
-      'file' => 'workflow_notify.admin.inc',
+      'file' => 'workflow_notify.pages.inc',
     ),
     ),
   );
   );
 }
 }
@@ -66,30 +104,6 @@ function workflow_notify_hook_info() {
   return $hooks;
   return $hooks;
 }
 }
 
 
-/**
- * Implements hook_workflow_operations().
- * Add an action link to this module.
- */
-function workflow_notify_workflow_operations($op, $workflow = NULL) {
-  switch ($op) {
-    case 'workflow':
-      $wid = $workflow->getWorkflowId();
-
-      $actions = array(
-        'workflow_notify_settings' => array(
-          'title' => t('Notifications'),
-          'href' => "admin/config/workflow/workflow/notify/$wid",
-          'attributes' => array('alt' => t('Notify users about state changes.')),
-        ),
-      );
-
-      $actions['workflow_notify_settings']['attributes']['title'] =
-        $actions['workflow_notify_settings']['attributes']['alt'];
-
-      return $actions;
-  }
-}
-
 /**
 /**
  * Implements hook_workflow().
  * Implements hook_workflow().
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
@@ -118,6 +132,17 @@ function workflow_notify_workflow($op, $old_state, $new_state, $entity, $force,
   }
   }
 }
 }
 
 
+/**
+ * Implements hook_entity_insert().
+ * Calls drupal_mail via _workflow_notify() for Workflow Field;
+ *
+ * @param $entity
+ * @param $entity_type
+ */
+function workflow_notify_entity_insert($entity, $entity_type) {
+  _workflow_notify_entity_update($entity, $entity_type);
+}
+
 /**
 /**
  * Implements hook_entity_update().
  * Implements hook_entity_update().
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
  * Calls drupal_mail via _workflow_notify() for Workflow Field;
@@ -126,6 +151,16 @@ function workflow_notify_workflow($op, $old_state, $new_state, $entity, $force,
  * @param $entity_type
  * @param $entity_type
  */
  */
 function workflow_notify_entity_update($entity, $entity_type) {
 function workflow_notify_entity_update($entity, $entity_type) {
+  _workflow_notify_entity_update($entity, $entity_type);
+}
+
+/**
+ * Calls drupal_mail via _workflow_notify() for Workflow Field;
+ *
+ * @param $entity
+ * @param $entity_type
+ */
+function _workflow_notify_entity_update($entity, $entity_type) {
   if (isset($entity->workflow_transitions)) {
   if (isset($entity->workflow_transitions)) {
     $new_state = workflow_node_current_state($entity, $entity_type, $field_name);
     $new_state = workflow_node_current_state($entity, $entity_type, $field_name);
     foreach ($entity->workflow_transitions as $field_name => &$transition) {
     foreach ($entity->workflow_transitions as $field_name => &$transition) {
@@ -146,6 +181,11 @@ function workflow_notify_mail($key, &$message, $params) {
       $filter = $params['filter'];
       $filter = $params['filter'];
       $message['send'] = TRUE;
       $message['send'] = TRUE;
 
 
+      $entity_type = $params['data']['entity_type'];
+      $entity = isset($params['data']['entity']) ? $params['data']['entity'] : $params['data']['node'];
+      $entity_uri = entity_uri($entity_type, $entity);
+      list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
+
       $message['subject'] = filter_xss(token_replace($params['context']['subject'], $params['data'], $params));
       $message['subject'] = filter_xss(token_replace($params['context']['subject'], $params['data'], $params));
       $message['body'][] = check_markup(token_replace($params['context']['body'], $params['data'], $params), $filter);
       $message['body'][] = check_markup(token_replace($params['context']['body'], $params['data'], $params), $filter);
 
 
@@ -156,12 +196,11 @@ function workflow_notify_mail($key, &$message, $params) {
           '@to' => $message['to'],
           '@to' => $message['to'],
           '@from' => $message['from'],
           '@from' => $message['from'],
         ),
         ),
-        WATCHDOG_INFO, l(t('view'), 'node/' . $params['data']['node']->nid));
+        WATCHDOG_INFO, l(t('view'), $entity_uri['path']));
       return;
       return;
   }
   }
 }
 }
 
 
-
 /**
 /**
  * Calls drupal_mail() to notify users.
  * Calls drupal_mail() to notify users.
  *
  *
@@ -188,12 +227,13 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
 
 
   // Okay, we are notifying someone of this change.
   // Okay, we are notifying someone of this change.
   // So let's get the workflow object.
   // So let's get the workflow object.
+  $entity_uri = entity_uri($entity_type, $entity);
   list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
   list($entity_id, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
   /* @var $workflow Workflow */
   /* @var $workflow Workflow */
   $workflow = workflow_get_workflows_by_type($entity_bundle, $entity_type);
   $workflow = workflow_get_workflows_by_type($entity_bundle, $entity_type);
   $wid = $workflow->getWorkflowId();
   $wid = $workflow->getWorkflowId();
 
 
-    // And all the states.
+  // And all the states.
   $states = $workflow->getStates(TRUE);
   $states = $workflow->getStates(TRUE);
 
 
   // Get the specific roles to notify.
   // Get the specific roles to notify.
@@ -212,7 +252,8 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
       . "WHERE ur.rid IN (:rids) "
       . "WHERE ur.rid IN (:rids) "
       . "AND u.status = 1 ";
       . "AND u.status = 1 ";
     $users = db_query($query, array(':rids' => $notify))->fetchCol();
     $users = db_query($query, array(':rids' => $notify))->fetchCol();
-  } else {
+  }
+  else {
     $users = array();
     $users = array();
   }
   }
 
 
@@ -227,13 +268,13 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
   // Call all modules that want to limit the list.
   // Call all modules that want to limit the list.
   $args = array(
   $args = array(
     'users' => $accounts,
     'users' => $accounts,
-    'node' => $entity,
-    'entity' => $entity, // Preparing for entities, keeping backward compatibility.
     'entity_type' => $entity_type,
     'entity_type' => $entity_type,
     'state' => $new_state,
     'state' => $new_state,
     'roles' => $notify,
     'roles' => $notify,
     'workflow' => $workflow,
     'workflow' => $workflow,
   );
   );
+  // Preparing for entities, keeping backward compatibility.
+  $args += $entity_type == 'node' ? array('node' => $entity) : array('entity' => $entity);
   foreach (module_implements('workflow_notify') as $module) {
   foreach (module_implements('workflow_notify') as $module) {
     $function = $module . '_workflow_notify';
     $function = $module . '_workflow_notify';
     $function('users', $args);
     $function('users', $args);
@@ -241,40 +282,42 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
 
 
   // Retrieve the remaining list without duplicates.
   // Retrieve the remaining list without duplicates.
   $accounts = $args['users'];
   $accounts = $args['users'];
-  $addr_list = array();
-
   // Just quit if there are no users.
   // Just quit if there are no users.
   if (empty($accounts)) {
   if (empty($accounts)) {
     watchdog('workflow_notify', 'No recipients - email skipped.', array(),
     watchdog('workflow_notify', 'No recipients - email skipped.', array(),
-      WATCHDOG_DEBUG, l(t('view'), 'node/' . $entity_id)); // @todo: other entity types.
+      WATCHDOG_DEBUG, l(t('view'), $entity_uri['path']));
     return;
     return;
   }
   }
-
+  $addr_list = array();
   foreach ($accounts as $uid => $account) {
   foreach ($accounts as $uid => $account) {
-    $addr_list[] = format_username($account) . '<' . $account->mail . '>';
+    $addr_list[] = format_username($account) . ' <' . $account->mail . '>';
   }
   }
+  // The to-parameter to drupal_mail is a string, not an array, separated by commas.
+  $to = implode(', ', $addr_list);
 
 
+  // Retrieve the params parameter for drupal_mail.
   $params = array(
   $params = array(
     'clear' => TRUE,
     'clear' => TRUE,
     'sanitize' => FALSE,
     'sanitize' => FALSE,
     'data' => array(
     'data' => array(
-      'node' => $entity,
-      'entity' => $entity, // Preparing for entities, keeping backward compatibility.
-      'entity_type' => $entity_type,
       'user' => $user,
       'user' => $user,
+      'entity_type' => $entity_type,
     ),
     ),
     'filter' => variable_get('workflow_notify_filter_format_' . $wid, 'filtered_html'),
     'filter' => variable_get('workflow_notify_filter_format_' . $wid, 'filtered_html'),
   );
   );
+  // Preparing for entities, keeping backward compatibility.
+  $params['data'] += $entity_type == 'node' ? array('node' => $entity) : array('entity' => $entity);
 
 
   // Build the subject and body of the mail.
   // Build the subject and body of the mail.
   // Token replacement occurs in hook_mail().
   // Token replacement occurs in hook_mail().
-  // @TODO: Currently no translation occurs.
+  // @todo: Currently no translation occurs.
   $params['context']['subject'] = variable_get("workflow_notify_subject_$new_state",
   $params['context']['subject'] = variable_get("workflow_notify_subject_$new_state",
     '[node:title] is now "[workflow:workflow-current-state-name]"');
     '[node:title] is now "[workflow:workflow-current-state-name]"');
 
 
   $params['context']['body'] = variable_get("workflow_notify_body_$new_state",
   $params['context']['body'] = variable_get("workflow_notify_body_$new_state",
     '<a href="[node:url:absolute]">[node:title]</a> is now "@state".');
     '<a href="[node:url:absolute]">[node:title]</a> is now "@state".');
 
 
+  // Retrieve the from-address.
   switch (variable_get('workflow_notify_from_address_' . $wid, 'site')) {
   switch (variable_get('workflow_notify_from_address_' . $wid, 'site')) {
     case 'site':
     case 'site':
       $from = variable_get('site_mail', ini_get('sendmail_from'));
       $from = variable_get('site_mail', ini_get('sendmail_from'));
@@ -285,13 +328,21 @@ function _workflow_notify($new_state, $entity, $entity_type = '', $field_name =
       break;
       break;
   }
   }
 
 
-  // Send the email.
-  drupal_mail('workflow_notify',
-    'workflow_notify',
-    implode(', ', $addr_list),
-    language_default(),
-    $params,
-    $from);
+  // Send the mail, and check for success. Note that this does not guarantee
+  // message delivery; only that there were no PHP-related issues encountered
+  // while sending.
+  $module = 'workflow_notify';
+  $key = 'workflow_notify';
+  $language = language_default();
+  // https://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7.x
+  $result = drupal_mail($module, $key, $to, $language, $params, $from);
+  /*
+  if ($result['result'] == TRUE) {
+    drupal_set_message(t('Your message has been sent.'));
+  }
+  else {
+    drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
+  }
+   */
 
 
-  return;
 }
 }

+ 230 - 0
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify.pages.inc

@@ -0,0 +1,230 @@
+<?php
+
+/**
+ * @file
+ * Admin UI to Notify roles for Workflow state transitions.
+ */
+
+/**
+ * Settings form.
+ */
+function workflow_notify_settings_form($form, &$form_state, Workflow $workflow) {
+  // If we don't have a workflow that goes with this, return to the admin pg.
+  if (!is_object($workflow)) {
+    drupal_set_message(t('Improper worklow ID provided.'), 'error');
+    drupal_goto(WORKFLOW_ADMIN_UI_PATH);
+  }
+
+  // @todo: Let's get a better page title.
+  drupal_set_title(t('@name Notifications', array('@name' => $workflow->label())));
+
+  // Let's add some breadcrumbs.
+ // workflow_admin_ui_breadcrumbs($workflow);
+
+  $form['#tree'] = TRUE;
+  $form['#wid'] = $wid = $workflow->getWorkflowId();
+  $form['#workflow'] = $workflow;
+
+  $noyes = array(t('No'), t('Yes'));
+
+  // Get all the states for this workflow, except the (creation) state.
+  $states = $workflow->getStates();
+  $form['#states'] = $states;
+  if (!$states) {
+    $form['#columns'] = array();
+    $form['error'] = array(
+      '#type' => 'markup',
+      '#value' => t('There are no states defined for this workflow.'),
+    );
+    return $form;
+  }
+
+  // A list of role names keyed by role ID, including the 'author' role.
+  $roles = workflow_get_roles('participate in workflow');
+  // The module_invoke_all function does not allow passing by reference.
+  $args = array('roles' => $roles);
+  foreach (module_implements('workflow_notify') as $module) {
+    $function = $module . '_workflow_notify';
+    // Call the $op='roles' hooks so the list may be modified.
+    $function('roles', $args);
+  }
+  // Get the modified list.
+  $roles = $args['roles'];
+
+  // Setting for "from" address.
+  $form['from_address'] = array(
+    '#title' => t('Set "From" address to'),
+    '#type' => 'radios',
+    '#options' => array(
+      'site' => t('Site email address'),
+      'changer' => t('Current user'),
+    ),
+    '#default_value' => variable_get("workflow_notify_from_address_$wid", 'site'),
+    '#attributes' => array('class' => array('container-inline')),
+    '#description' => t('Determines whether to use the site address or the address of the person
+        causing the state change.'),
+  );
+
+  // Get the list of input formats.
+  $formats = array();
+  foreach (filter_formats() as $fid => $filter) {
+    $formats[$fid] = $filter->name;
+  }
+
+  $form['filter'] = array(
+    '#title' => t('Filter format to use on message'),
+    '#type' => 'radios',
+    '#options' => $formats,
+    '#default_value' => variable_get("workflow_notify_filter_format_$wid", 'filtered_html'),
+    '#attributes' => array('class' => array('container-inline')),
+    '#description' => t('The message body will be processed using this filter format
+        in order to ensure security.'),
+  );
+
+  $form['tokens'] = array(
+    '#theme' => 'token_tree_link',
+    '#token_types' => array('node', 'workflow'),
+  );
+
+  // Column names for theme function.
+  $columns = array(
+    'state' => t('State'),
+    'roles' => t('Roles to notify'),
+  );
+
+  $args = array('columns' => $columns);
+  // The module_invoke_all function does not allow passing by reference.
+  foreach (module_implements('workflow_notify') as $module) {
+    $function = $module . '_workflow_notify';
+    $function('columns', $args);
+  }
+  $form['#columns'] = $args['columns'];
+
+  // We always want subject and body last.
+  $form['#columns']['subject'] = t('Subject');
+  $form['#columns']['body'] = t('Body');
+
+  $notify = variable_get('workflow_notify_roles', array());
+
+  foreach ($states as $sid => $state) {
+    // Allow modules to insert state operations.
+    $state_links = module_invoke_all('workflow_operations', 'state', $workflow, $state);
+
+    $form['states'][$sid] = array(
+      'state' => array(
+        '#type' => 'markup',
+        '#markup' => filter_xss($state->state),
+      ),
+
+      'roles' => array(
+        '#type' => 'checkboxes',
+        '#options' => $roles,
+        '#default_value' => (isset($notify[$sid]) ? $notify[$sid] : array()),
+        '#attributes' => array('class' => array('state-roles')),
+      ),
+
+      'subject' => array(
+        '#type' => 'textarea',
+        '#rows' => 5,
+        '#default_value' => variable_get('workflow_notify_subject_' . $sid,
+          '[node:title] is now "[node:field_workflow_state:new-state:label]"'),
+        '#attributes' => array('class' => array('subject')),
+      ),
+
+      'body' => array(
+        '#type' => 'textarea',
+        '#rows' => 5,
+        '#default_value' => variable_get('workflow_notify_body_' . $sid,
+          '<a href="[node:url:absolute]">[node:title]</a> is now "[node:field_workflow_state:new-state:label]".'),
+        '#attributes' => array('class' => array('body')),
+      ),
+    );
+  }
+
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+
+  return $form;
+}
+
+/**
+ * Theme the settings form.
+ */
+function theme_workflow_notify_settings_form($variables) {
+  $form = $variables['form'];
+  $output = '';
+  $table_id = 'workflow-notify-settings';
+
+  $output .= drupal_render($form['from_address']);
+  $output .= drupal_render($form['filter']);
+  $output .= drupal_render($form['tokens']);
+
+  $table = array(
+    'rows' => array(),
+    'header' => array(),    // To be filled in.
+    'attributes' => array('id' => $table_id, 'style' => 'width: 100%; margin-top: 1em;'),
+  );
+
+  $columns = $form['#columns'];
+  $colspan = count($columns);
+
+  foreach ($columns as $field => $title) {
+    $table['header'][] = $title;
+  }
+
+  // Iterate over each element in our $form['states'] array
+  foreach (element_children($form['states']) as $id) {
+    // We are now ready to add each element of our $form data to the rows
+    // array, so that they end up as individual table cells when rendered
+    // in the final table.
+    $row = array();
+
+    foreach ($columns as $field => $title) {
+      $row[] = array(
+        'data' => drupal_render($form['states'][$id][$field]),
+        'class' => array(drupal_html_class($field)),
+      );
+    }
+
+    // Put the data row into the table.
+    $table['rows'][] = array('data' => $row);
+  }
+
+  $output .= theme('table', $table);
+
+  $output .= drupal_render($form['explain']);
+
+  // And then render any remaining form elements (such as our submit button)
+  $output .= drupal_render_children($form);
+
+  return $output;
+}
+
+function workflow_notify_settings_form_submit($form, &$form_state) {
+  $wid = $form['#wid'];
+  $workflow = $form['#workflow'];
+  $roles = variable_get('workflow_notify_roles', array());
+
+  $form_state['redirect'] = WORKFLOW_ADMIN_UI_PATH;
+
+  variable_set("workflow_notify_from_address_$wid" , $form_state['values']['from_address']);
+  variable_set("workflow_notify_filter_format_$wid" , $form_state['values']['filter']);
+
+  foreach ($form_state['values']['states'] as $sid => $values) {
+    $selected = array_filter($values['roles']);
+    // Are there any roles selected?
+    if ($selected) {
+      $roles[$sid] = $selected;
+    }
+    else {
+      // No, so make sure this state is gone.
+      unset($roles[$sid]);
+    }
+
+    variable_set("workflow_notify_subject_$sid", $values['subject']);
+    variable_set("workflow_notify_body_$sid", $values['body']);
+  }
+
+  variable_set('workflow_notify_roles', $roles);
+
+  drupal_set_message(t('The notification settings have been saved.'));
+}

+ 8 - 6
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.info

@@ -1,12 +1,14 @@
 name = Workflow Notify OG
 name = Workflow Notify OG
 description = Notify roles by OG groups of Workflow transitions.
 description = Notify roles by OG groups of Workflow transitions.
-dependencies[] = workflow_notify
-core = 7.x
 package = Workflow
 package = Workflow
+core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow_notify
+
+configure = admin/config/workflow/workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 14 - 13
sites/all/modules/contrib/admin/workflow/workflow_notify/workflow_notify_og/workflow_notify_og.module

@@ -1,4 +1,5 @@
 <?php
 <?php
+
 /**
 /**
  * @file
  * @file
  * Notify roles by OG Groups for Workflow state transitions.
  * Notify roles by OG Groups for Workflow state transitions.
@@ -6,6 +7,7 @@
 
 
 /**
 /**
  * Implements hook_workflow_notify().
  * Implements hook_workflow_notify().
+ *
  * @param $op - The operation (columns, users).
  * @param $op - The operation (columns, users).
  * @param $args - The arguments for this call.
  * @param $args - The arguments for this call.
  *    - may be:
  *    - may be:
@@ -73,25 +75,26 @@ function workflow_notify_og_workflow_notify($op, &$args) {
 
 
 /**
 /**
  * Implements hook_form_alter().
  * Implements hook_form_alter().
+ *
  * Add a column for limiting user groups by OG group.
  * Add a column for limiting user groups by OG group.
  */
  */
 function workflow_notify_og_form_alter(&$form, &$form_state, $form_id) {
 function workflow_notify_og_form_alter(&$form, &$form_state, $form_id) {
   switch($form_id) {
   switch($form_id) {
     case 'workflow_notify_settings_form':
     case 'workflow_notify_settings_form':
       $limit = variable_get('workflow_notify_og', array());
       $limit = variable_get('workflow_notify_og', array());
-
-      // Add a group limit flag to each state.
-      foreach ($form['states'] as $sid => $element) {
-        $form['states'][$sid]['limit_by_group'] = array(
-          '#type' => 'radios',
-          '#options' => array(t('No'), t('Yes')),
-          '#attributes' => array('class' => array('limit-by-group')),
-          '#default_value' => (isset($limit[$sid]) ? $limit[$sid] : 0),
+      if (!empty($form['states'])) {
+        // Add a group limit flag to each state.
+        foreach ($form['states'] as $sid => $element) {
+          $form['states'][$sid]['limit_by_group'] = array(
+            '#type' => 'radios',
+            '#options' => array(t('No'), t('Yes')),
+            '#attributes' => array('class' => array('limit-by-group')),
+            '#default_value' => (isset($limit[$sid]) ? $limit[$sid] : 0),
           );
           );
+        }
+        // Add our submission handler.
+        $form['#submit'][] = 'workflow_notify_og_form_submit';
       }
       }
-
-      // Add our submission handler.
-      $form['#submit'][] = 'workflow_notify_og_form_submit';
   }
   }
 }
 }
 
 
@@ -109,6 +112,4 @@ function workflow_notify_og_form_submit(&$form, &$form_state) {
 
 
   // Save the new limit flags.
   // Save the new limit flags.
   variable_set('workflow_notify_og', $limit);
   variable_set('workflow_notify_og', $limit);
-
-  $form_state['redirect'] = "admin/config/workflow/workflow/$workflow->wid";
 }
 }

+ 7 - 7
sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.info

@@ -1,12 +1,12 @@
 name = Workflow Revert
 name = Workflow Revert
-description = "Adds a 'Revert' link to the first workflow history row."
-dependencies[] = workflow
-core = 7.x
+description = Adds a 'Revert' link to the first workflow history row.
 package = Workflow
 package = Workflow
+core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 2 - 2
sites/all/modules/contrib/admin/workflow/workflow_revert/workflow_revert.pages.inc

@@ -9,7 +9,7 @@
  *
  *
  * @todo: add support for Field in workflow_revert.
  * @todo: add support for Field in workflow_revert.
  */
  */
-function workflow_revert_form($form, $form_state, $entity_type, $id, $field_name, $previous_sid = NULL) {
+function workflow_revert_form($form, &$form_state, $entity_type, $id, $field_name, $previous_sid = NULL) {
   $entity = entity_load_single($entity_type, $id);
   $entity = entity_load_single($entity_type, $id);
   $uri = entity_uri($entity_type, $entity);
   $uri = entity_uri($entity_type, $entity);
   $return_uri = $uri['path'] . '/workflow';
   $return_uri = $uri['path'] . '/workflow';
@@ -45,7 +45,7 @@ function workflow_revert_form($form, $form_state, $entity_type, $id, $field_name
  *
  *
  * The function is magically called, due to its name <form>_submit.
  * The function is magically called, due to its name <form>_submit.
  */
  */
-function workflow_revert_form_submit($form, $form_state) {
+function workflow_revert_form_submit($form, &$form_state) {
   global $user;
   global $user;
 
 
   $previous_sid = $form['#previous_sid'];
   $previous_sid = $form['#previous_sid'];

+ 5 - 6
sites/all/modules/contrib/admin/workflow/workflow_rules/workflow_rules.info

@@ -1,16 +1,15 @@
 name = Workflow Rules
 name = Workflow Rules
 description = Provides additional, workflow-specific Rules integration.
 description = Provides additional, workflow-specific Rules integration.
-core = 7.x
 package = Workflow
 package = Workflow
+core = 7.x
 
 
-dependencies[] = workflow
 dependencies[] = rules
 dependencies[] = rules
+dependencies[] = workflow
 
 
 configure = admin/config/workflow/rules
 configure = admin/config/workflow/rules
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 8 - 8
sites/all/modules/contrib/admin/workflow/workflow_search_api/workflow_search_api.info

@@ -1,14 +1,14 @@
 name = Workflow Node Search API
 name = Workflow Node Search API
-description = "Adds Workflow Node's state information to Search API index."
+description = Adds Workflow Node's state information to Search API index.
+package = Workflow
+core = 7.x
+
+dependencies[] = entity
 dependencies[] = workflow
 dependencies[] = workflow
 dependencies[] = workflownode
 dependencies[] = workflownode
-dependencies[] = entity
-core = 7.x
-package = Workflow
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 5 - 7
sites/all/modules/contrib/admin/workflow/workflow_vbo/workflow_vbo.info

@@ -2,15 +2,13 @@ name = Workflow Actions
 description = "Provides actions that can be associated to triggers, or
 description = "Provides actions that can be associated to triggers, or
                used as VBO-action. Provided actions are 'set to next state'
                used as VBO-action. Provided actions are 'set to next state'
                and 'set to specific state'."
                and 'set to specific state'."
-
-dependencies[] = workflow
-
 package = Workflow
 package = Workflow
 core = 7.x
 core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+dependencies[] = workflow
+
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 1 - 1
sites/all/modules/contrib/admin/workflow/workflow_views/handlers/workflow_views_handler_field_state.inc

@@ -11,7 +11,7 @@
 class workflow_views_handler_field_state extends views_handler_field {
 class workflow_views_handler_field_state extends views_handler_field {
 
 
   function render($values) {
   function render($values) {
-    return t($values->{$this->field_alias});
+    return t('@alias', array('@alias' => $values->{$this->field_alias}));
   }
   }
 
 
 }
 }

+ 3 - 4
sites/all/modules/contrib/admin/workflow/workflow_views/workflow_views.info

@@ -14,9 +14,8 @@ files[] = handlers/workflow_views_handler_field_node_link_workflow.inc
 files[] = handlers/workflow_views_handler_field_comment_link_edit.inc
 files[] = handlers/workflow_views_handler_field_comment_link_edit.inc
 files[] = handlers/workflow_views_handler_argument_state.inc
 files[] = handlers/workflow_views_handler_argument_state.inc
 
 
-; Information added by Drupal.org packaging script on 2017-01-15
-version = "7.x-2.9+10-dev"
+; Information added by Drupal.org packaging script on 2019-05-23
+version = "7.x-2.13"
 core = "7.x"
 core = "7.x"
 project = "workflow"
 project = "workflow"
-datestamp = "1484510888"
-
+datestamp = "1558597389"

+ 39 - 0
sites/all/modules/contrib/files/imagecache_actions/CHANGELOG.txt

@@ -4,6 +4,45 @@ Imagecache Actions
 Imagecache Actions 7.x-1.x-dev
 Imagecache Actions 7.x-1.x-dev
 ------------------------------
 ------------------------------
 
 
+Imagecache Actions 7.x-1.12
+---------------------------
+- [#3151871]: by DamienMcKenna: EXIF autorotate support for remote images.
+- [#3117901] by jacob.embree: Curly brace syntax for accessing array elements and
+  string offsets has been deprecated in PHP 7.4.
+
+Imagecache Actions 7.x-1.11
+---------------------------
+- [#3072639]: PDOException: SQLSTATE[HY000]: General error: 25 bind or column
+  index out of range: INSERT INTO {menu_router}.
+
+Imagecache Actions 7.x-1.10
+---------------------------
+- Use json for exporting image styles.
+- [#2988487] by AdamEvertsson: Minor spelling error.
+
+Imagecache Actions 7.x-1.9
+--------------------------
+- [#2760121] by lebster, fietserwin: Add a "Perspective" effect.
+- [#2947014]: PHP 7.2 warning that each() has been deprecated.
+
+Imagecache Actions 7.x-1.8
+--------------------------
+- [#2917097]: PHP 7.1 Warning "A non-numeric value encountered".
+- [#2905130] by bserem, fietserwin: Remove animation from moving images.
+- [#2888678] by das-peter: ImageMagick: Add support for invert effect.
+- [#1099300]: Notice: A non well formed numeric value encountered in
+  image_gd_definecanvas() (line 381 of canvasactions.inc).
+- [#2719661] by SKAUGHT: Division by zero.
+- [#2717789]: Prevent exif_read_data() warnings.
+- Warning: Theme hook coloractions_invert_summary not found.
+- [#2696225] by mnlund, fietserwin: Add support for multiply color blending.
+- by fietserwin: image_styles_admin: sort image styles by label.
+- [#2039379]: Add some better examples for using custom actions.
+- Made more contextual information (image style and image effect) available in
+  the custom action and text image effects.
+- [#2690337] by Ajithlal, fietserwin: Would like a feature for converting case
+  in text effect.
+
 Imagecache Actions 7.x-1.7
 Imagecache Actions 7.x-1.7
 --------------------------
 --------------------------
 - [#2671526]: Fatal error on image style flush when image styles are defined in
 - [#2671526]: Fatal error on image style flush when image styles are defined in

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.info

@@ -5,9 +5,8 @@ core = 7.x
 
 
 dependencies[] = image
 dependencies[] = image
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 33 - 3
sites/all/modules/contrib/files/imagecache_actions/autorotate/imagecache_autorotate.module

@@ -129,7 +129,32 @@ function image_gd_imagecache_autorotate(stdClass $image) {
     watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function is not available in this PHP installation. You probably have to enable the exif extension.')));
     watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function is not available in this PHP installation. You probably have to enable the exif extension.')));
     return FALSE;
     return FALSE;
   }
   }
-  $exif = exif_read_data(drupal_realpath($image->source));
+
+  // Read and check result.
+  $path = drupal_realpath($image->source);
+  if ($path) {
+    $exif = @exif_read_data($path);
+  }
+  else {
+    // drupal_realpath and exif fail for remote file systems like S3.
+    // Copy to a local temporary folder and retry.
+    $base = drupal_basename($image->source);
+    $uniq = md5(microtime() . $image->source);
+    $path = file_directory_temp() . '/' . $uniq . '-' . $base;
+    file_unmanaged_copy($image->source, $path);
+    $exif = @exif_read_data($path);
+
+    // Cleanup so we don't leave files behind.
+    // The server would get them later on a reboot, but who knows when that
+    // would be.
+    file_unmanaged_delete($path);
+  }
+
+  if ($exif === FALSE) {
+    watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function returned FALSE.')));
+    return FALSE;
+  }
+
   if (isset($exif['Orientation'])) {
   if (isset($exif['Orientation'])) {
     // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html:
     // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html:
     // 1 = Horizontal (normal)
     // 1 = Horizontal (normal)
@@ -181,7 +206,7 @@ function image_imagemagick_imagecache_autorotate(stdClass $image) {
   // image when it should not, we only pass the auto-orient argument when the
   // image when it should not, we only pass the auto-orient argument when the
   // exif extension could detect the 'Orientation' tag.
   // exif extension could detect the 'Orientation' tag.
   if (function_exists('exif_read_data')) {
   if (function_exists('exif_read_data')) {
-    $exif = exif_read_data(drupal_realpath($image->source));
+    $exif = @exif_read_data(drupal_realpath($image->source));
     if (isset($exif['Orientation'])) {
     if (isset($exif['Orientation'])) {
       switch ($exif['Orientation']) {
       switch ($exif['Orientation']) {
         case 1:
         case 1:
@@ -204,13 +229,18 @@ function image_imagemagick_imagecache_autorotate(stdClass $image) {
           break;
           break;
       }
       }
     }
     }
+    elseif ($exif === FALSE && $image->extension === 'jpg') {
+      watchdog('imagecache_actions', 'Image %file could not be auto-rotated: !message', array('%file' => $image->source, '!message' => t('The exif_read_data() function returned FALSE.')));
+    }
   }
   }
   else {
   else {
     // We do add the auto-orient argument to IM. IM will determine itself
     // We do add the auto-orient argument to IM. IM will determine itself
     // whether to rotate or not.
     // whether to rotate or not.
     $image->ops[] = '-auto-orient';
     $image->ops[] = '-auto-orient';
     // However we cannot keep track of the dimensions anymore.
     // However we cannot keep track of the dimensions anymore.
-    $image->info['width'] = $image->info['height'] = NULL;
+    if ($image->info['width'] !== $image->info['height']) {
+      $image->info['width'] = $image->info['height'] = NULL;;
+    }
   }
   }
   return TRUE;
   return TRUE;
 }
 }

File diff suppressed because it is too large
+ 81 - 24
sites/all/modules/contrib/files/imagecache_actions/canvasactions/canvasactions.inc


+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.info

@@ -6,9 +6,8 @@ core = 7.x
 dependencies[] = imagecache_actions
 dependencies[] = imagecache_actions
 dependencies[] = image
 dependencies[] = image
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 16 - 0
sites/all/modules/contrib/files/imagecache_actions/canvasactions/imagecache_canvasactions.module

@@ -145,6 +145,15 @@ function imagecache_canvasactions_image_effect_info() {
     'form callback' => 'canvasactions_interlace_form',
     'form callback' => 'canvasactions_interlace_form',
   );
   );
 
 
+  $effects['canvasactions_perspective'] = array(
+    'label' => t('Perspective transform'),
+    'help' => t('Adds a perspective transformation to the image.'),
+    'effect callback' => 'canvasactions_perspective_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'canvasactions_perspective_form',
+    'summary theme' => 'canvasactions_perspective_summary',
+  );
+
   return $effects;
   return $effects;
 }
 }
 
 
@@ -191,6 +200,13 @@ function imagecache_canvasactions_theme() {
       'variables' => array('data' => NULL),
       'variables' => array('data' => NULL),
       'file' => 'canvasactions.inc',
       'file' => 'canvasactions.inc',
     ),
     ),
+    'canvasactions_perspective_summary' => array(
+      'variables' => array('data' => NULL),
+      'file' => 'canvasactions.inc',
+    ),
+    'canvasactions_perspective_anchor' => array(
+      'render element' => 'element',
+    ),
   );
   );
 }
 }
 
 

+ 2 - 2
sites/all/modules/contrib/files/imagecache_actions/canvasactions/rounded_corners.inc

@@ -152,8 +152,8 @@ function image_gd_roundedcorners($image, $action) {
     }
     }
 
 
     // key can be 'tl', 'tr', 'bl', 'br'.
     // key can be 'tl', 'tr', 'bl', 'br'.
-    $is_bottom = ($key{0} == 'b');
-    $is_right = ($key{1} == 'r');
+    $is_bottom = ($key[0] == 'b');
+    $is_right = ($key[1] == 'r');
 
 
     // dx and dy are in "continuous coordinates",
     // dx and dy are in "continuous coordinates",
     // and mark the distance of the pixel middle to the image border.
     // and mark the distance of the pixel middle to the image border.

+ 1 - 1
sites/all/modules/contrib/files/imagecache_actions/canvasactions/tests/cheap_dropshadow.imagecache_preset.inc

@@ -98,7 +98,7 @@ $presets['cheap_dropshadow'] = array (
       'data' =>
       'data' =>
       array (
       array (
         'width' => '200',
         'width' => '200',
-        'height' => '100%',
+        'height' => '',
         'upscale' => 0,
         'upscale' => 0,
       ),
       ),
     ),
     ),

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.info

@@ -10,9 +10,8 @@ files[] = imagecache_coloractions.module
 files[] = transparency.inc
 files[] = transparency.inc
 files[] = tests/green.imagecache_preset.inc
 files[] = tests/green.imagecache_preset.inc
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 238 - 8
sites/all/modules/contrib/files/imagecache_actions/coloractions/imagecache_coloractions.module

@@ -51,6 +51,15 @@ function imagecache_coloractions_image_effect_info() {
     'summary theme' => 'coloractions_coloroverlay_summary',
     'summary theme' => 'coloractions_coloroverlay_summary',
   );
   );
 
 
+  $effects['imagecache_colormultiply'] = array(
+    'label' => t('Color Multiply'),
+    'help' => t('Apply a multiply blend effect to an image. The result color is always a darker color.'),
+    'effect callback' => 'coloractions_colormultiply_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'coloractions_colormultiply_form',
+    'summary theme' => 'coloractions_colormultiply_summary',
+  );
+
   $effects['coloractions_brightness'] = array(
   $effects['coloractions_brightness'] = array(
     'label' => t('Brightness'),
     'label' => t('Brightness'),
     'help' => t('Adjust image brightness.'),
     'help' => t('Adjust image brightness.'),
@@ -67,7 +76,6 @@ function imagecache_coloractions_image_effect_info() {
     'effect callback' => 'coloractions_invert_effect',
     'effect callback' => 'coloractions_invert_effect',
     'dimensions passthrough' => TRUE,
     'dimensions passthrough' => TRUE,
     'form callback' => 'coloractions_invert_form',
     'form callback' => 'coloractions_invert_form',
-    'summary theme' => 'coloractions_invert_summary',
   );
   );
 
 
   // @todo Convert may need a little more work.
   // @todo Convert may need a little more work.
@@ -116,6 +124,15 @@ function imagecache_coloractions_image_effect_info() {
     'summary theme' => 'coloractions_desaturatealpha_summary',
     'summary theme' => 'coloractions_desaturatealpha_summary',
   );
   );
 
 
+  $effects['imagecache_removeanimation'] = array(
+    'label' => t('Remove animation'),
+    'help' => t('Freezes an animated image, keeping only the first frame.'),
+    'effect callback' => 'coloractions_removeanimation_effect',
+    'dimensions passthrough' => TRUE,
+    'form callback' => 'coloractions_removeanimation_form',
+    'summary theme' => 'coloractions_removeanimation_summary',
+  );
+
   return $effects;
   return $effects;
 }
 }
 
 
@@ -132,6 +149,9 @@ function imagecache_coloractions_theme() {
     'coloractions_coloroverlay_summary' => array(
     'coloractions_coloroverlay_summary' => array(
       'variables' => array('data' => NULL),
       'variables' => array('data' => NULL),
     ),
     ),
+    'coloractions_colormultiply_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
     'coloractions_brightness_summary' => array(
     'coloractions_brightness_summary' => array(
       'variables' => array('data' => NULL),
       'variables' => array('data' => NULL),
     ),
     ),
@@ -151,6 +171,9 @@ function imagecache_coloractions_theme() {
     'coloractions_desaturatealpha_summary' => array(
     'coloractions_desaturatealpha_summary' => array(
       'variables' => array('data' => NULL),
       'variables' => array('data' => NULL),
     ),
     ),
+    'coloractions_removeanimation_summary' => array(
+      'variables' => array('data' => NULL),
+    ),
   );
   );
 }
 }
 
 
@@ -215,7 +238,7 @@ function coloractions_colorshift_form(array $data) {
     desaturate (greyscale) it before colorizing.
     desaturate (greyscale) it before colorizing.
     The hue (color wheel) is the <em>direction</em> the
     The hue (color wheel) is the <em>direction</em> the
     existing colors are shifted. The tone (inner box) is the amount.
     existing colors are shifted. The tone (inner box) is the amount.
-    Keep the tone half-way up the left site of the color box
+    Keep the tone half-way up the left side of the color box
     for best results.
     for best results.
   </p>"));
   </p>"));
   return $form;
   return $form;
@@ -300,7 +323,7 @@ function image_imagemagick_colorshift(stdClass $image, array $data) {
 function coloractions_coloroverlay_form(array $data) {
 function coloractions_coloroverlay_form(array $data) {
   $defaults = array(
   $defaults = array(
     'RGB' => array(
     'RGB' => array(
-      'HEX' => '#E2DB6A',
+      'HEX' => '',
     ),
     ),
   );
   );
   $data = array_merge($defaults, (array) $data);
   $data = array_merge($defaults, (array) $data);
@@ -313,7 +336,7 @@ function coloractions_coloroverlay_form(array $data) {
     desaturate (greyscale) it before colorizing.
     desaturate (greyscale) it before colorizing.
     The hue (color wheel) is the <em>direction</em> the
     The hue (color wheel) is the <em>direction</em> the
     existing colors are shifted. The tone (inner box) is the amount.
     existing colors are shifted. The tone (inner box) is the amount.
-    Keep the tone half-way up the left site of the color box
+    Keep the tone half-way up the left side of the color box
     for best results.
     for best results.
     </p>"));
     </p>"));
   return $form;
   return $form;
@@ -411,6 +434,126 @@ function image_imagemagick_coloroverlay(stdClass $image, array $data) {
   return TRUE;
   return TRUE;
 }
 }
 
 
+/**
+ * Image effect form callback for the color multiply effect.
+ *
+ * @param array $data
+ *   The current configuration for this image effect.
+ *
+ * @return array
+ *   The form definition for this effect.
+ */
+function coloractions_colormultiply_form(array $data) {
+  $defaults = array(
+    'RGB' => array(
+      'HEX' => '',
+    ),
+  );
+  $data = array_merge($defaults, (array) $data);
+  $form = array('#theme' => 'imagecache_rgb_form');
+  $form['RGB'] = imagecache_rgb_form($data['RGB']);
+  $form['note'] = array('#value' => t("<p>
+    Note that color multiply is a mathematical filter that doesn't always
+    have the expected result.
+    To shift an image precisely TO a target color,
+    desaturate (greyscale) it before colorizing.
+    The hue (color wheel) is the <em>direction</em> the
+    existing colors are shifted. The tone (inner box) is the amount.
+    Keep the tone half-way up the left side of the color box
+    for best results.
+    </p>"));
+  return $form;
+}
+
+/**
+ * Implements theme_hook() for the color multiply effect summary.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
+ *
+ * @return string
+ *   The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_coloractions_colormultiply_summary(array $variables) {
+  return theme_imagecacheactions_rgb($variables['data']);
+}
+
+/**
+ * Image effect callback for the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *
+ * @return bool
+ *   true on success, false otherwise.
+ */
+function coloractions_colormultiply_effect(stdClass $image, array $data) {
+  // Convert color from hex (as it is stored in the UI).
+  if ($data['RGB']['HEX'] && $deduced = imagecache_actions_hex2rgba($data['RGB']['HEX'])) {
+    $data['RGB'] = array_merge($data['RGB'], $deduced);
+  }
+  return image_toolkit_invoke('colormultiply', $image, array($data));
+}
+
+/**
+ * GD toolkit specific implementation of the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *   The parameters for this effect.
+ *
+ * @return bool
+ *   true on success, false otherwise.
+ */
+function image_gd_colormultiply(stdClass $image, array $data) {
+  $factor_r = $data['RGB']['red'] / 255;
+  $factor_g = $data['RGB']['green'] / 255;
+  $factor_b = $data['RGB']['blue'] / 255;
+
+  $w = $image->info['width'];
+  $h = $image->info['height'];
+
+  for ($y = 0; $y < $h; $y++) {
+    for ($x = 0; $x < $w; $x++) {
+      $rgb = imagecolorat($image->resource, $x, $y);
+      $source = imagecolorsforindex($image->resource, $rgb);
+
+      $final_r = (int) ($source['red'] * $factor_r);
+      $final_g = (int) ($source['green'] * $factor_g);
+      $final_b = (int) ($source['blue'] * $factor_b);
+
+      $final_colour = imagecolorallocate($image->resource, $final_r, $final_g, $final_b);
+      if ($final_colour === FALSE) {
+        return FALSE;
+      }
+      if (!imagesetpixel($image->resource, $x, $y, $final_colour)) {
+        return FALSE;
+      }
+    }
+  }
+
+  return TRUE;
+}
+
+/**
+ * Imagemagick toolkit specific implementation of the color multiply effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *   The parameters for this effect.
+ *
+ * @return bool
+ *   true on success, false otherwise.
+ */
+function image_imagemagick_colormultiply(stdClass $image, array $data) {
+  $multiply_color = $data['RGB']['HEX'] != '' ? '#' . ltrim($data['RGB']['HEX'], '#') : 'None';
+  $image->ops[] = escapeshellcmd('(') . ' +clone -fill ' . escapeshellarg($multiply_color) . ' -colorize 100 ' . escapeshellcmd(')');
+  $image->ops[] = '-compose multiply -composite';
+  return TRUE;
+}
+
 
 
 /**
 /**
  * Image effect form callback for the brightness effect.
  * Image effect form callback for the brightness effect.
@@ -545,16 +688,17 @@ function image_gd_invert(stdClass $image/*, array $data*/) {
 /**
 /**
  * Imagemagick toolkit specific implementation of the image invert effect.
  * Imagemagick toolkit specific implementation of the image invert effect.
  *
  *
- * param stdClass $image
+ * @param stdClass $image
  * param array $data
  * param array $data
  *   The parameters for this effect.
  *   The parameters for this effect.
  *
  *
  * @return bool
  * @return bool
  *   true on success, false otherwise.
  *   true on success, false otherwise.
  */
  */
-function image_imagemagick_invert(/*stdClass $image, array $data*/) {
-  // @todo
-  return FALSE;
+function image_imagemagick_invert(stdClass $image/*, array $data*/) {
+  // http://www.imagemagick.org/script/command-line-options.php?#negate
+  $image->ops[] = "-negate";
+  return TRUE;
 }
 }
 
 
 
 
@@ -1100,3 +1244,89 @@ function image_gd_desaturatealpha(stdClass $image/*, array $data*/) {
   imagealphablending($image->resource, TRUE);
   imagealphablending($image->resource, TRUE);
   return $result;
   return $result;
 }
 }
+
+/**
+ * Image effect form callback for the remove animation effect.
+ *
+ * This effect has no parameters.
+ *
+ * param array $data
+ *   The current configuration for this image effect.
+ *
+ * @return array
+ *   The form definition for this effect.
+ */
+function coloractions_removeanimation_form(/*array $data*/) {
+  $form = array();
+  $form['help'] = array(
+    '#markup' => "<p><strong>There are no user-configurable options for this effect.</strong></p>
+      <p>This image effect will remove all animation from a gif image, keeping only the first frame. Some notes:</p>
+      <ul>
+      <li>GD cannot handle animation at all and will always silently remove animation, whether this effect has been added to an image style or not.</li>
+      <li>Thus, this effect will only do something with ImageMagick as image toolkit.</li>
+      <li>Non gif images and non-animated gif images are silently ignored.</li>
+      <li>You can place this effect anywhere in the list of effects for an image style. There may be some performance gains when you add it as first though.</li>
+      </ul>
+      ",
+  );
+  return $form;
+}
+
+/**
+ * Implements theme_hook() for the remove animation effect summary.
+ *
+ * param array $variables
+ *   An associative array containing:
+ *   - data: The current configuration for this image effect.
+ *
+ * @return string
+ *   The HTML for the summary of this image effect.
+ * @ingroup themeable
+ */
+function theme_coloractions_removeanimation_summary(/*array $variables*/) {
+  return t('Remove animation, keeping only the first frame.');
+}
+
+/**
+ * Image effect callback for the remove animation effect.
+ *
+ * @param stdClass $image
+ * @param array $data
+ *
+ * @return bool
+ *   True on success, false otherwise.
+ */
+function coloractions_removeanimation_effect(stdClass $image, array $data) {
+  return image_toolkit_invoke('removeanimation', $image, array($data));
+}
+
+/**
+ * GD toolkit specific implementation of the remove animation effect.
+ *
+ * param stdClass $image
+ * param array $data
+ *   The parameters for this effect.
+ *
+ * @return bool
+ *   Always true, GD removes animations anyway.
+ */
+function image_gd_removeanimation(/*stdClass $image, array $data*/) {
+  return TRUE;
+}
+
+/**
+ * Imagemagick toolkit specific implementation of the remove animation effect.
+ *
+ * @param stdClass $image
+ *  param array $data
+ *   The parameters for this effect.
+ *
+ * @return bool
+ *   True on success, false otherwise.
+ */
+function image_imagemagick_removeanimation(stdClass $image/*, array $data*/) {
+  if ($image->info['mime_type'] === 'image/gif') {
+    $image->ops[] = '-delete 1--1';
+  }
+  return TRUE;
+}

+ 53 - 2
sites/all/modules/contrib/files/imagecache_actions/customactions/README.txt

@@ -58,8 +58,9 @@ record so by changing $image->info['width'] and/or $image->info['height'].
 General
 General
 -------
 -------
 To ease your task, this effect makes some information regarding the image being
 To ease your task, this effect makes some information regarding the image being
-processed available in 2 variables: $image and $image_context. These variables
-are readily available in your snippet.
+processed available in a number of variables: $image, $image_context,
+$image_style, and $image_effect_id. These variables are readily available in
+your snippet.
 
 
 $image is an object containing the following properties:
 $image is an object containing the following properties:
 - source: string, the source of the image, e.g. public://photo.jpg
 - source: string, the source of the image, e.g. public://photo.jpg
@@ -112,6 +113,18 @@ $image_context is an associative array containing:
    - title (string) ...
    - title (string) ...
    - ...
    - ...
 
 
+$image_style is an associative array containing the current image style being
+processed. It ocntians a.o.:
+- isid: the unique image style id
+- name: machine name.
+- label: Human readable name.
+- effects: An array with the effects of this image style, ordered in the way
+  they should be applied.
+
+$image_effect_id is an int containng the unique id of the current image effect
+being applied. This can be used to look the current image effect up in the
+$image_style array.
+
 Of course there are many other possible useful globals. Think of:
 Of course there are many other possible useful globals. Think of:
 - base_url
 - base_url
 - base_path
 - base_path
@@ -143,3 +156,41 @@ foreach ($referring_entities as $field_name => $field_referring_entities) {
   }
   }
 }
 }
 ?>
 ?>
+
+"Dynamic" parameters
+--------------------
+Thee are many requests for adding token support or allowing for dynamic
+parameters in another way. However, the current image style processing does not
+easily allow for this. But for these cases we have the custom action to our
+rescue. It is quite easy to:
+- Create you own array of parameters.
+- Call the effect callback yourself
+
+Exanple, calling the watermark/canvas overlay effect:
+<?php
+$data = array(
+  'xpos' => 'center',
+  'ypos' => 'center',
+  'alpha' => '100',
+  'scale' => '',
+  'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+);
+return canvasactions_file2canvas_effect($image, $data);
+?>
+
+Or, to be on the safe side with effect info altering:
+<?php
+$definition = image_effect_definition_load('canvasactions_file2canvas');
+$callback = $definition['effect callback'];
+if (function_exists($callback)) {
+  $data = array(
+    'xpos' => 'center',
+    'ypos' => 'center',
+    'alpha' => '100',
+    'scale' => '',
+    'path' => 'module://imagecache_actions/tests/black-ribbon.gif',
+  );
+  return $callback($image, $data);
+}
+return FALSE;
+?>

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.info

@@ -6,9 +6,8 @@ core = 7.x
 dependencies[] = imagecache_actions
 dependencies[] = imagecache_actions
 dependencies[] = image
 dependencies[] = image
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 7 - 1
sites/all/modules/contrib/files/imagecache_actions/customactions/imagecache_customactions.module

@@ -156,7 +156,6 @@ function theme_imagecache_customactions_summary(/*array $variables*/) {
  *   true on success, false otherwise.
  *   true on success, false otherwise.
  */
  */
 function imagecache_customactions_effect(stdClass $image, array $data) {
 function imagecache_customactions_effect(stdClass $image, array $data) {
-  // Check that the PHP filter module is enabled.
   $result = module_exists('php');
   $result = module_exists('php');
   if ($result) {
   if ($result) {
     // Get context about the image.
     // Get context about the image.
@@ -164,10 +163,17 @@ function imagecache_customactions_effect(stdClass $image, array $data) {
     $GLOBALS['image_context'] = imagecache_actions_get_image_context($image, $data);
     $GLOBALS['image_context'] = imagecache_actions_get_image_context($image, $data);
     $GLOBALS['image'] = $image;
     $GLOBALS['image'] = $image;
 
 
+    // Get (non-alterable) context about the image style and image effect.
+    $execution_info = imagecache_actions_get_image_effect_context();
+    $GLOBALS['image_style'] = $execution_info['image_style'];
+    $GLOBALS['image_effect_id'] = $execution_info['image_effect_id'];
+
     $result = php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>');
     $result = php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>');
     // php_eval returns '1' if the snippet returns true.
     // php_eval returns '1' if the snippet returns true.
     $result = $result === '1';
     $result = $result === '1';
 
 
+    unset($GLOBALS['image_effect_id']);
+    unset($GLOBALS['image_style']);
     unset($GLOBALS['image']);
     unset($GLOBALS['image']);
     unset($GLOBALS['image_context']);
     unset($GLOBALS['image_context']);
   }
   }

+ 15 - 2
sites/all/modules/contrib/files/imagecache_actions/image_effects_text/README.txt

@@ -150,8 +150,9 @@ PHP snippets to determine the text
 ----------------------------------
 ----------------------------------
 Given the correct permission, you can write your own PHP snippet to compute the
 Given the correct permission, you can write your own PHP snippet to compute the
 text to display. To ease this task, this module makes some information regarding
 text to display. To ease this task, this module makes some information regarding
-the image being processed available in 2 variables: $image and $image_context.
-These variables are readily available in your snippet.
+the image being processed available in a number of variables: $image,
+$image_context, $image_style, and $image_effect_id. These variables are readily
+available in your snippet.
 
 
 $image is an object containing the following properties:
 $image is an object containing the following properties:
 - source: string, the source of the image, e.g. public://photo.jpg
 - source: string, the source of the image, e.g. public://photo.jpg
@@ -214,6 +215,18 @@ $image_context is an associative array containing:
    - title (string) ...
    - title (string) ...
    - ...
    - ...
 
 
+$image_style is an associative array containing the current image style being
+processed. It ocntians a.o.:
+- isid: the unique image style id
+- name: machine name.
+- label: Human readable name.
+- effects: An array with the effects of this image style, ordered in the way
+  they should be applied.
+
+$image_effect_id is an int containng the unique id of the current image effect
+being applied. This can be used to look the current image effect up in the
+$image_style array.
+
 Of course there are many other possible useful globals. Think of:
 Of course there are many other possible useful globals. Think of:
 - base_url
 - base_url
 - base_path
 - base_path

+ 141 - 75
sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.inc

@@ -66,15 +66,6 @@ function image_effects_text_form_inc(array $data) {
   // - Change the 'PHP code' textarea.
   // - Change the 'PHP code' textarea.
   $allow_php = module_exists('php') && user_access('use PHP for settings');
   $allow_php = module_exists('php') && user_access('use PHP for settings');
   $defaults = array(
   $defaults = array(
-    'size' => 50,
-    'angle' => 0,
-    'xpos' => '0',
-    'ypos' => '0',
-    'halign' => 'left',
-    'valign' => 'top',
-    'RGB' => array('HEX' => '#000000'),
-    'alpha' => 100,
-    'fontfile' => drupal_get_path('module', 'image_effects_text') . '/Komika_display.ttf',
     'text_source' => 'text',
     'text_source' => 'text',
     'text' => t('Hello World!'),
     'text' => t('Hello World!'),
     'php' => 'if (!$image_context[\'entity\']) {
     'php' => 'if (!$image_context[\'entity\']) {
@@ -88,77 +79,21 @@ if ($field) {
   return isset($field[0][\'value\']) ? $field[0][\'value\'] : \'' . t('No field value') . '\';
   return isset($field[0][\'value\']) ? $field[0][\'value\'] : \'' . t('No field value') . '\';
 }
 }
 ',
 ',
+    'text_case' => 'none',
+    'fontfile' => drupal_get_path('module', 'image_effects_text') . '/Komika_display.ttf',
+    'size' => 50,
+    'RGB' => array('HEX' => '#000000'),
+    'alpha' => 100,
+    'xpos' => '0',
+    'ypos' => '0',
+    'halign' => 'left',
+    'valign' => 'top',
+    'angle' => 0,
   );
   );
   $data += $defaults;
   $data += $defaults;
   $tokens = token_info();
   $tokens = token_info();
   $tokens = array_keys($tokens['types']);
   $tokens = array_keys($tokens['types']);
   $form = array(
   $form = array(
-    'size' => array(
-      '#type' => 'textfield',
-      '#title' => t('Font size'),
-      '#default_value' => $data['size'],
-      '#description' => t('The font size in points. Only in GD1 this is in pixels.'),
-      '#size' => 3,
-    ),
-    'xpos' => array(
-      '#type' => 'textfield',
-      '#title' => t('X offset'),
-      '#default_value' => $data['xpos'],
-      '#description' => t('Enter an offset in pixels or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>. Syntax like <em>right-20</em> is also valid.'),
-      '#size' => 10,
-    ),
-    'ypos' => array(
-      '#type' => 'textfield',
-      '#title' => t('Y offset'),
-      '#default_value' => $data['ypos'],
-      '#description' => t('Enter an offset in pixels or use a keyword: <em>top</em>, <em>center</em>, or <em>bottom</em>. Syntax like <em>bottom-20</em> is also valid.'),
-      '#size' => 10,
-    ),
-    'halign' => array(
-      '#type' => 'select',
-      '#title' => t('Horizontal alignment'),
-      '#default_value' => $data['halign'],
-      '#description' => t('The horizontal alignment of the text around the given %xpos.', array('%xpos' => t('X offset'))),
-      '#options' => array(
-        'left' => t('Left'),
-        'center' => t('Center'),
-        'right' => t('Right')
-      ),
-    ),
-    'valign' => array(
-      '#type' => 'select',
-      '#title' => t('Vertical alignment'),
-      '#default_value' => $data['valign'],
-      '#description' => t('The vertical alignment of the text around the given %ypos.', array('%ypos' => t('Y offset'))),
-      '#options' => array(
-        'top' => t('Top'),
-        'center' => t('Center'),
-        'bottom' => t('Bottom')
-      ),
-    ),
-    'RGB' => imagecache_rgb_form($data['RGB']),
-    'alpha' => array(
-      '#type' => 'textfield',
-      '#title' => t('Opacity'),
-      '#default_value' => $data['alpha'] ? $data['alpha'] : 100,
-      '#size' => 3,
-      '#description' => t('Opacity: 1-100.'),
-    ),
-    'angle' => array(
-      '#type' => 'textfield',
-      '#title' => t('Angle'),
-      '#default_value' => $data['angle'],
-      '#description' => t('Angle: The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.'),
-      '#size' => 3,
-    ),
-    'fontfile' => array(
-      '#type' => 'textfield',
-      '#title' => t('Font file name'),
-      '#default_value' => $data['fontfile'],
-      '#description' => imagecache_actions_file_field_description(),
-      '#element_validate' => array('image_effects_text_validate_font'),
-      '#size' => 80,
-    ),
     'text_help' => array(
     'text_help' => array(
       '#type' => 'item',
       '#type' => 'item',
       '#title' => t('Text'),
       '#title' => t('Text'),
@@ -221,6 +156,85 @@ if ($field) {
       ),
       ),
       '#wysiwyg' => FALSE,
       '#wysiwyg' => FALSE,
     ),
     ),
+    'text_case' => array(
+      '#title' => t('Capitalization'),
+      '#type' => 'select',
+      '#options' => array(
+        'none' => t('No transform'),
+        'upper' => t('Upper case'),
+        'lower' => t('Lower case'),
+        'ucfirst' => t('Capitalize first letter'),
+        'ucwords' => t('Capitalize each word'),
+      ),
+      '#default_value' => $data['text_case'],
+      '#description' => t('Defines if and how to transform the case of the text to render.'),
+    ),
+    'fontfile' => array(
+      '#type' => 'textfield',
+      '#title' => t('Font file name'),
+      '#default_value' => $data['fontfile'],
+      '#description' => imagecache_actions_file_field_description(),
+      '#element_validate' => array('image_effects_text_validate_font'),
+      '#size' => 80,
+    ),
+    'size' => array(
+      '#type' => 'textfield',
+      '#title' => t('Font size'),
+      '#default_value' => $data['size'],
+      '#description' => t('The font size in points. Only in GD1 this is in pixels.'),
+      '#size' => 3,
+    ),
+    'RGB' => imagecache_rgb_form($data['RGB']),
+    'alpha' => array(
+      '#type' => 'textfield',
+      '#title' => t('Opacity'),
+      '#default_value' => $data['alpha'],
+      '#size' => 3,
+      '#description' => t('Opacity: 1-100.'),
+    ),
+    'xpos' => array(
+      '#type' => 'textfield',
+      '#title' => t('X offset'),
+      '#default_value' => $data['xpos'],
+      '#description' => t('Enter an offset in pixels or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>. Syntax like <em>right-20</em> is also valid.'),
+      '#size' => 10,
+    ),
+    'ypos' => array(
+      '#type' => 'textfield',
+      '#title' => t('Y offset'),
+      '#default_value' => $data['ypos'],
+      '#description' => t('Enter an offset in pixels or use a keyword: <em>top</em>, <em>center</em>, or <em>bottom</em>. Syntax like <em>bottom-20</em> is also valid.'),
+      '#size' => 10,
+    ),
+    'halign' => array(
+      '#type' => 'select',
+      '#title' => t('Horizontal alignment'),
+      '#default_value' => $data['halign'],
+      '#description' => t('The horizontal alignment of the text around the given %xpos.', array('%xpos' => t('X offset'))),
+      '#options' => array(
+        'left' => t('Left'),
+        'center' => t('Center'),
+        'right' => t('Right')
+      ),
+    ),
+    'valign' => array(
+      '#type' => 'select',
+      '#title' => t('Vertical alignment'),
+      '#default_value' => $data['valign'],
+      '#description' => t('The vertical alignment of the text around the given %ypos.', array('%ypos' => t('Y offset'))),
+      '#options' => array(
+        'top' => t('Top'),
+        'center' => t('Center'),
+        'bottom' => t('Bottom')
+      ),
+    ),
+    'angle' => array(
+      '#type' => 'textfield',
+      '#title' => t('Angle'),
+      '#default_value' => $data['angle'],
+      '#description' => t('Angle: The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.'),
+      '#size' => 3,
+    ),
   );
   );
   if (!$allow_php && $data['text_source'] !== 'php') {
   if (!$allow_php && $data['text_source'] !== 'php') {
     unset($form['text_fieldset']['text_source']['#options']['php']);
     unset($form['text_fieldset']['text_source']['#options']['php']);
@@ -717,12 +731,64 @@ function image_effects_text_get_text(stdClass $image, array $data) {
     // variables, so they can be passed successfully.
     // variables, so they can be passed successfully.
     $GLOBALS['image_context'] = $image_context;
     $GLOBALS['image_context'] = $image_context;
     $GLOBALS['image'] = $image;
     $GLOBALS['image'] = $image;
+
+    // Get (non-alterable) context about the image style and image effect.
+    $execution_info = imagecache_actions_get_image_effect_context();
+    $GLOBALS['image_style'] = $execution_info['image_style'];
+    $GLOBALS['image_effect_id'] = $execution_info['image_effect_id'];
+
     // We don't need to check_plain() the resulting text, as the text is not
     // We don't need to check_plain() the resulting text, as the text is not
     // rendered in a browser but processed on the server.
     // rendered in a browser but processed on the server.
     $text = module_exists('php') ? php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>') : '';
     $text = module_exists('php') ? php_eval('<' . '?php global $image, $image_context; ' . $data['php'] . ' ?' . '>') : '';
 
 
+    unset($GLOBALS['image_effect_id']);
+    unset($GLOBALS['image_style']);
     unset($GLOBALS['image']);
     unset($GLOBALS['image']);
     unset($GLOBALS['image_context']);
     unset($GLOBALS['image_context']);
   }
   }
+
+  // Convert case.
+  $text = image_effect_text_case_transform($text, isset($data['text_case']) ? $data['text_case'] : 'none');
+
   return $text;
   return $text;
 }
 }
+
+/**
+ * Transform a string by a certain method.
+ *
+ * Proudly copied from module://views/includes/handlers.inc.
+ *
+ * @param $string
+ *    The input you want to transform.
+ * @param $option
+ *    How do you want to transform it, possible values:
+ *      - upper: Uppercase the string.
+ *      - lower: lowercase the string.
+ *      - ucfirst: Make the first char uppercase.
+ *      - ucwords: Make each word in the string uppercase.
+ *
+ * @return string
+ *    The transformed string.
+ */
+function image_effect_text_case_transform($string, $option) {
+  global $multibyte;
+
+  switch ($option) {
+    default:
+      return $string;
+    case 'upper':
+      return drupal_strtoupper($string);
+    case 'lower':
+      return drupal_strtolower($string);
+    case 'ucfirst':
+      return drupal_strtoupper(drupal_substr($string, 0, 1)) . drupal_substr($string, 1);
+    case 'ucwords':
+      if ($multibyte == UNICODE_MULTIBYTE) {
+        return mb_convert_case($string, MB_CASE_TITLE);
+      }
+      else {
+        return ucwords($string);
+      }
+  }
+}
+

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text.info

@@ -6,9 +6,8 @@ core = 7.x
 dependencies[] = image
 dependencies[] = image
 dependencies[] = imagecache_actions
 dependencies[] = imagecache_actions
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/image_effects_text/image_effects_text_test/image_effects_text_test.info

@@ -8,9 +8,8 @@ dependencies[] = image_effects_text
 dependencies[] = imagecache_canvasactions
 dependencies[] = imagecache_canvasactions
 dependencies[] = system_stream_wrapper
 dependencies[] = system_stream_wrapper
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 5 - 12
sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/README.txt

@@ -1,5 +1,5 @@
-README for the Image styleds admin Drupal module
-------------------------------------------------
+README for the Image styles admin Drupal module
+-----------------------------------------------
 
 
 Project page: https://drupal.org/project/imagecache_actions
 Project page: https://drupal.org/project/imagecache_actions
 
 
@@ -14,14 +14,13 @@ Release notes for 7.x-1.x-dev
 
 
 Introduction
 Introduction
 ------------
 ------------
-The Image style admin module extends the administrative interface for image
+The Image styles admin module extends the administrative interface for image
 styles by providing additional features.
 styles by providing additional features.
 
 
 Currently a duplicate, import and export image style feature are implemented.
 Currently a duplicate, import and export image style feature are implemented.
 More features may be added in the future. These features typically allow you to
 More features may be added in the future. These features typically allow you to
-more easily handle image styles. It allows us to more easily set up
-a test/showcase sute of styles. Finally, it allows everybody to test D8 image
-module features in real life.
+more easily handle image styles. It allows us to more easily set up a
+test/showcase suite of styles.
 
 
 This module is not a replacement for the features module
 This module is not a replacement for the features module
 (https://drupal.org/project/features). If you are serious about configuration
 (https://drupal.org/project/features). If you are serious about configuration
@@ -30,9 +29,3 @@ management and want to distribute styles to other systems, use features.
 Use this module for 1 time export/imports between different sites, "copy &
 Use this module for 1 time export/imports between different sites, "copy &
 paste" reuse within a site, and when reporting issues to the imagecache_actions
 paste" reuse within a site, and when reporting issues to the imagecache_actions
 issue queue.
 issue queue.
-
-
-TODO
-----
-Solving errors in the core image handling?
-- [#1554074]: scale does not work with imagemagick when dimensions are unknown?

+ 35 - 38
sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.inc

@@ -117,7 +117,7 @@ function image_styles_admin_export_form($form, $form_state, $style) {
     '#type' => 'textarea',
     '#type' => 'textarea',
   	'#rows' => 5,
   	'#rows' => 5,
   	'#title' => t('Image style export data'),
   	'#title' => t('Image style export data'),
-  	'#default_value' => image_styles_admin_export_serialize($style),
+  	'#default_value' => image_styles_admin_style_to_string($style),
   	'#attributes' => array('readonly' =>'readonly'),
   	'#attributes' => array('readonly' =>'readonly'),
   	'#description' => t('Copy the contents of this field to the clipboard and, on another site, paste it in the textarea of an %page_title page.',
   	'#description' => t('Copy the contents of this field to the clipboard and, on another site, paste it in the textarea of an %page_title page.',
       array('%page_title' => t('Import image style'))),
       array('%page_title' => t('Import image style'))),
@@ -178,16 +178,16 @@ function image_styles_admin_import_form_submit($form, &$form_state) {
 }
 }
 
 
 /**
 /**
- * Serializes image style data so it can be exported.
+ * Converts image style data into a json string so it can be exported.
  *
  *
  * @param array $style
  * @param array $style
  *   An image style array.
  *   An image style array.
  *
  *
  * @return string
  * @return string
- *   The serialized image style. Keys that are not needed for import are not
- *   serialized.
+ *   The image style converted to a string. Keys that are not needed for import
+ *   are not serialized.
  */
  */
-function image_styles_admin_export_serialize($style) {
+function image_styles_admin_style_to_string($style) {
   $style = array_intersect_key($style, array('name' => 0, 'label' => 0, 'effects' => 0));
   $style = array_intersect_key($style, array('name' => 0, 'label' => 0, 'effects' => 0));
   foreach ($style['effects'] as &$effect) {
   foreach ($style['effects'] as &$effect) {
     $effect = array_intersect_key($effect, array('weight' => 0, 'name' => 0, 'data' => 0));
     $effect = array_intersect_key($effect, array('weight' => 0, 'name' => 0, 'data' => 0));
@@ -198,16 +198,14 @@ function image_styles_admin_export_serialize($style) {
       $value = image_styles_admin_unify_newlines($value);
       $value = image_styles_admin_unify_newlines($value);
     }
     }
   });
   });
-  return serialize($style);
+  return json_encode($style);
 }
 }
 
 
 /**
 /**
  * Unifies newlines in the string to the Unix newline standard.
  * Unifies newlines in the string to the Unix newline standard.
  *
  *
  * #2636314: textareas may convert newlines to the underlying OS style: convert
  * #2636314: textareas may convert newlines to the underlying OS style: convert
- * all new lines to Unix style before unserializing. As string length is in the
- * serialized data, we must ensure that we also do this on each array value
- * before serializing.
+ * all new lines to Unix style before stringifying an image style.
  *
  *
  * @param string $str
  * @param string $str
  *
  *
@@ -220,17 +218,41 @@ function image_styles_admin_unify_newlines($str) {
 }
 }
 
 
 /**
 /**
- * Unserializes and validates a string into image style data.
+ * Decodes and validates a json string into image style data.
+ *
+ * Some notes on any security implications for creating styles like this:
+ * - json_decode() is considered safe regardless of the contents give to it.
+ * - Not expected array entries are subsequently removed (array_intersect_key)
+ *   thus the return will not contain unexpected array entries
+ * - Values with known types are checked.
+ * - Effect data array is not checked as it cannot be checked. Possibly unsafe
+ *   but:
+ *   - Proper checking and/or converting to int/float/bool while processing an
+ *     image derivative is the responsibility of the image effect.
+ *   - Effect data is only shown to a user on the edit form and in the image
+ *     effect summary theme. Proper escaping and/or converting to int/float/bool
+ *     in the theme before rendering it is again the responsibility of the image
+ *     effect. On the form it is the form api that will do so.
+ * - Effect data may contain PHP code and if the image effect is allowing this
+ *   it may get [php_]eval()'ed. The image effects themselves should check for
+ *   the 'use PHP for settings' permission on the create/edit form and check
+ *   that the PHP module is enabled on execution (that is: during image
+ *   derivative creation).
+ *   However, we cannot do so on importing as we cannot know if the imported
+ *   image style contains image effects that allow PHP code. Therefore, we use a
+ *   separate access right for importing styles that is to be considered having
+ *   the same security implications as the 'use PHP for settings' right (from
+ *   the PHP module) and thus should only be given to highly trusted users.
  *
  *
  * @param string $import
  * @param string $import
- *   The string representation of a @see serialize()'d image style array.
+ *   The json representation of an image style array.
  *
  *
  * @return array|false
  * @return array|false
- *   An image style array or false if the string could not be unserialized into
+ *   An image style array or false if the string could not be decoded into
  *   image style data.
  *   image style data.
  */
  */
 function image_styles_admin_import_extract_style($import) {
 function image_styles_admin_import_extract_style($import) {
-  $style = unserialize($import);
+  $style = json_decode($import, TRUE);
 
 
   // Check if the contents of the textarea could be unserialized into an array.
   // Check if the contents of the textarea could be unserialized into an array.
   if (!is_array($style)) {
   if (!is_array($style)) {
@@ -280,30 +302,5 @@ function image_styles_admin_import_extract_style($import) {
     }
     }
   }
   }
 
 
-  // @todo: are there any security implications for creating styles like this?
-  // - Unserialize() is save in itself: it only creates data (except possibly
-  //   for__wakeup(), but that can only be in already existing code: safe
-  // - Not expected array entries are removed (array_intersect_key): safe
-  // - Basic types are checked: safe
-  // - Effect data array is not checked. Possibly unsafe?! The effect data array
-  //   contains the effect parameters. Normally these are entered and validated
-  //   via a form and subsequently saved in the database (serialized as here).
-  //   The form validation is not executed on import and thus the data may
-  //   contain invalid values. This is acceptable as it can also be done by
-  //   operating directly on the database. In Drupal this is not normally
-  //   checked for during processing: error messages will make clear that the
-  //   data has been played with. Can incorrect data be abused? It may contain:
-  //   - incorrect types: we do not know the data structure of the various
-  //     effects, so we cannot check that and have to accept it as it comes.
-  //     Effects should check_plain in summary theme and convert to int/float
-  //     whenever possible before using it in commands.
-  //   - PHP code, but that may be valid content for the text or custom effects:
-  //     Effects should check_plain in summary theme and convert to int/float
-  //     whenever possible before using it in commands.
-  //     @todo: if the style contains an effect that contains PHP code, the user
-  //     should need the 'use PHP for settings' permission.
-  //   - HTML and or JS code: when used as parameter, this normally won't hurt.
-  //     When showing on the screen (summary theme), proper escaping should
-  //     suffice and is needed anyway: responsibility of effect.
   return $style;
   return $style;
 }
 }

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.info

@@ -5,9 +5,8 @@ core = 7.x
 
 
 dependencies[] = image
 dependencies[] = image
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 8 - 0
sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.install

@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * Rebuild the menu.
+ */
+function image_styles_admin_update_7001(&$sandbox) {
+  menu_rebuild();
+}

+ 27 - 2
sites/all/modules/contrib/files/imagecache_actions/image_styles_admin/image_styles_admin.module

@@ -3,6 +3,25 @@
  * @file Hook and callback implementations that must be available at all times.
  * @file Hook and callback implementations that must be available at all times.
  */
  */
 
 
+/**
+ * Implements hook_permission().
+ */
+function image_styles_admin_permission() {
+  return array(
+    'import image styles' => array(
+      'title' => t('Import image styles.') ,
+      'restrict access' => TRUE,
+    ),
+  );
+}
+
+/**
+ * Determines access to the import image style form for the current user.
+ */
+function image_styles_admin_access() {
+  return user_access('import image styles') && user_access('administer image styles');
+}
+
 /**
 /**
  * Implements hook_menu().
  * Implements hook_menu().
  */
  */
@@ -29,7 +48,7 @@ function image_styles_admin_menu() {
     'description' => 'Import an image style.',
     'description' => 'Import an image style.',
     'page callback' => 'drupal_get_form',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('image_styles_admin_import_form'),
     'page arguments' => array('image_styles_admin_import_form'),
-    'access arguments' => array('administer image styles'),
+    'access callback' => 'image_styles_admin_access',
     'type' => MENU_LOCAL_ACTION,
     'type' => MENU_LOCAL_ACTION,
     'weight' => 3,
     'weight' => 3,
     'file' => 'image_styles_admin.inc',
     'file' => 'image_styles_admin.inc',
@@ -41,9 +60,15 @@ function image_styles_admin_menu() {
  * Implements hook_preprocess_HOOK for theme image_style_list.
  * Implements hook_preprocess_HOOK for theme image_style_list.
  */
  */
 function image_styles_admin_preprocess_image_style_list(&$variables) {
 function image_styles_admin_preprocess_image_style_list(&$variables) {
+  // Sort the image styles by name.
+  uasort($variables['styles'], function ($a, $b) {
+    return strcasecmp($a['label'], $b['label']);
+  });
+
   // Tell imagecache_actions_preprocess_table to preprocess the next call to
   // Tell imagecache_actions_preprocess_table to preprocess the next call to
-  // theme_table()
+  // theme_table().
   $image_styles = array_values($variables['styles']);
   $image_styles = array_values($variables['styles']);
+
   image_styles_admin_preprocess_table($image_styles);
   image_styles_admin_preprocess_table($image_styles);
 
 
   // Add CSS and JS files.
   // Add CSS and JS files.

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/imagecache_actions.info

@@ -5,9 +5,8 @@ core = 7.x
 
 
 dependencies[] = image
 dependencies[] = image
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 3 - 4
sites/all/modules/contrib/files/imagecache_actions/tests/imagecache_testsuite.info

@@ -8,9 +8,8 @@ dependencies[] = system_stream_wrapper
 
 
 features[image][] = 'corners_combo'
 features[image][] = 'corners_combo'
 
 
-; Information added by Drupal.org packaging script on 2016-02-19
-version = "7.x-1.7"
+; Information added by Drupal.org packaging script on 2020-06-16
+version = "7.x-1.12"
 core = "7.x"
 core = "7.x"
 project = "imagecache_actions"
 project = "imagecache_actions"
-datestamp = "1455872655"
-
+datestamp = "1592294437"

+ 2 - 2
sites/all/modules/contrib/files/imagecache_actions/utility-form.inc

@@ -19,8 +19,8 @@ function imagecache_actions_pos_form(array $data) {
   );
   );
   $data = array_merge($defaults, (array) $data);
   $data = array_merge($defaults, (array) $data);
 
 
-  $description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>left</em>, <em>center</em>, or <em>right</em> wih an optional offset (e.g. center, right - 10%).');
-  $description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>top</em>, <em>center</em>, or <em>bottom</em> wih an optional offset (e.g. center, bottom - 10%).');
+  $description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>left</em>, <em>center</em>, or <em>right</em> with an optional offset (e.g. center, right - 10%).');
+  $description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>top</em>, <em>center</em>, or <em>bottom</em> with an optional offset (e.g. center, bottom - 10%).');
   $form = array(
   $form = array(
     'xpos' => array(
     'xpos' => array(
       '#type' => 'textfield',
       '#type' => 'textfield',

+ 86 - 25
sites/all/modules/contrib/files/imagecache_actions/utility.inc

@@ -143,7 +143,7 @@ function imagecache_actions_get_style_label($style_name) {
 }
 }
 
 
 /**
 /**
- * Return an array with context information about the image.
+ * Returns an array with context information about the image.
  *
  *
  * This information is called by effects that need contextual information or
  * This information is called by effects that need contextual information or
  * that allow custom PHP:
  * that allow custom PHP:
@@ -192,27 +192,33 @@ function imagecache_actions_get_image_context($image, $data) {
       + file_get_file_references($managed_file, NULL, FIELD_LOAD_CURRENT, 'file');
       + file_get_file_references($managed_file, NULL, FIELD_LOAD_CURRENT, 'file');
 
 
     if ($references) {
     if ($references) {
-      // Load referring entities.
+      // Load referring entities., keep track of 1st reference separately.
+      $entity_type_first = '';
+      $field_name_first = '';
       foreach ($references as $field_name => $field_references) {
       foreach ($references as $field_name => $field_references) {
         foreach ($field_references as $entity_type => $entity_stubs) {
         foreach ($field_references as $entity_type => $entity_stubs) {
-          $image_context['referring_entities'][$field_name][$entity_type] = entity_load($entity_type, array_keys($entity_stubs));
+          $entities = entity_load($entity_type, array_keys($entity_stubs));
+          if (!empty($entities)) {
+            $image_context['referring_entities'][$field_name][$entity_type] = $entities;
+            // Make it easy to access the '1st' entity and its referring image
+            // field, part 1: entity.
+            if (empty($entity_type_first)) {
+              $entity_type_first = $entity_type;
+              $field_name_first = $field_name;
+              $image_context['entity'] = reset($entities);
+            }
+          }
         }
         }
       }
       }
 
 
-      // Make it easy to access the '1st' entity and its referring image field.
-      reset($image_context['referring_entities']);
-      list($field_name, $field_references) = each($image_context['referring_entities']);
-      reset($field_references);
-      list($entity_type, $entities) = each($field_references);
-      reset($entities);
-      list(, $image_context['entity']) = each($entities);
+      // Make it easy to access the '1st' entity and its referring image field,
+      // part 2: image field.
       /** @var array|false $image_field */
       /** @var array|false $image_field */
-      $image_field = field_get_items($entity_type, $image_context['entity'], $field_name);
+      $image_field = field_get_items($entity_type_first, $image_context['entity'], $field_name_first);
       if ($image_field) {
       if ($image_field) {
         // Get referring item.
         // Get referring item.
         foreach ($image_field as $image_field_value) {
         foreach ($image_field as $image_field_value) {
           if ($image_field_value['fid'] === $managed_file->fid) {
           if ($image_field_value['fid'] === $managed_file->fid) {
-            // @todo: file_field as well or just ignore the type of field?
             $image_context['image_field'] = $image_field_value;
             $image_context['image_field'] = $image_field_value;
             break;
             break;
           }
           }
@@ -224,6 +230,53 @@ function imagecache_actions_get_image_context($image, $data) {
   return $image_context;
   return $image_context;
 }
 }
 
 
+
+/**
+ * Returns information about the context, image style and image effect id, of
+ * the current image effect.
+ *
+ * Note that this information is not alterable, that is, it will not have any
+ * effect on the rest of the derivative image generation process including its
+ * subsequent effects.
+ *
+ * This information is called by effects that may need contextual information or
+ * that allow custom PHP:
+ * - Custom action.
+ * - Text from image alt or title.
+ * - Text with tokens.
+ * - Text from PHP code.
+ *
+ * This information is fetched by traversing the backtrace, looking for known
+ * functions that have the image style or effect as argument..
+ *
+ * @return array
+ *   Array with keys 'image_style' and 'image_effect_id' pointing to the current
+ *   image style (array) resp. image effect id (int).
+ */
+function imagecache_actions_get_image_effect_context() {
+  $result = array();
+  $backtrace = debug_backtrace();
+
+  foreach ($backtrace as $function_call) {
+    if ($function_call['function'] && $function_call['function'] === 'image_effect_apply') {
+      $result['image_effect_id'] = isset($function_call['args'][1]['ieid']) ? $function_call['args'][1]['ieid'] : NULL;
+    }
+    else if ($function_call['function'] && $function_call['function'] === 'image_style_create_derivative') {
+      $result['image_style'] = isset($function_call['args'][0]) ? $function_call['args'][0] : NULL;
+    }
+
+    if (count($result) === 2) {
+      break;
+    }
+  }
+
+  $result += array(
+    'image_effect_id' => NULL,
+    'image_style' => NULL,
+  );
+  return $result;
+}
+
 /**
 /**
  * Given two imageapi objects with dimensions, and some positioning values,
  * Given two imageapi objects with dimensions, and some positioning values,
  * calculate a new x,y for the layer to be placed at.
  * calculate a new x,y for the layer to be placed at.
@@ -369,11 +422,14 @@ function imagecache_actions_calculate_offset($keyword, $value, $base_size, $laye
   }
   }
 
 
   // Handle % values.
   // Handle % values.
-  if (substr($value, strlen($value) - 1, 1) == '%') {
-    $value = intval($value / 100 * $base_size);
+  if (substr($value, -1) === '%') {
+    // Explicitly convert $value to prevent warnings in PHP 7.1.
+    $value = intval((int) $value / 100 * $base_size);
     $offset = -1 * ($layer_size / 2);
     $offset = -1 * ($layer_size / 2);
   }
   }
-  $value = $base + ($direction * $value);
+  // $value may contain 'px' at the end: explicitly convert to prevent warnings
+  // in PHP 7.1.
+  $value = $base + ($direction * (int) $value);
 
 
   // Add any extra offset to position the item.
   // Add any extra offset to position the item.
   return $value + $offset;
   return $value + $offset;
@@ -389,16 +445,16 @@ function imagecache_actions_calculate_offset($keyword, $value, $base_size, $laye
  *   A string specifing an RGB color in the formats:
  *   A string specifing an RGB color in the formats:
  *   '#ABC','ABC','#ABCD','ABCD','#AABBCC','AABBCC','#AABBCCDD','AABBCCDD'
  *   '#ABC','ABC','#ABCD','ABCD','#AABBCC','AABBCC','#AABBCCDD','AABBCCDD'
  *
  *
- * @return array
+ * @return array|false
  *   An array with four elements for red, green, blue, and alpha.
  *   An array with four elements for red, green, blue, and alpha.
  */
  */
 function imagecache_actions_hex2rgba($hex) {
 function imagecache_actions_hex2rgba($hex) {
   $hex = ltrim($hex, '#');
   $hex = ltrim($hex, '#');
   if (preg_match('/^[0-9a-f]{3}$/i', $hex)) {
   if (preg_match('/^[0-9a-f]{3}$/i', $hex)) {
     // 'FA3' is the same as 'FFAA33' so r=FF, g=AA, b=33
     // 'FA3' is the same as 'FFAA33' so r=FF, g=AA, b=33
-    $r = str_repeat($hex{0}, 2);
-    $g = str_repeat($hex{1}, 2);
-    $b = str_repeat($hex{2}, 2);
+    $r = str_repeat($hex[0], 2);
+    $g = str_repeat($hex[1], 2);
+    $b = str_repeat($hex[2], 2);
     $a = '0';
     $a = '0';
   }
   }
   elseif (preg_match('/^[0-9a-f]{6}$/i', $hex)) {
   elseif (preg_match('/^[0-9a-f]{6}$/i', $hex)) {
@@ -412,10 +468,10 @@ function imagecache_actions_hex2rgba($hex) {
   }
   }
   elseif (preg_match('/^[0-9a-f]{4}$/i', $hex)) {
   elseif (preg_match('/^[0-9a-f]{4}$/i', $hex)) {
     // 'FA37' is the same as 'FFAA3377' so r=FF, g=AA, b=33, a=77
     // 'FA37' is the same as 'FFAA3377' so r=FF, g=AA, b=33, a=77
-    $r = str_repeat($hex{0}, 2);
-    $g = str_repeat($hex{1}, 2);
-    $b = str_repeat($hex{2}, 2);
-    $a = str_repeat($hex{3}, 2);
+    $r = str_repeat($hex[0], 2);
+    $g = str_repeat($hex[1], 2);
+    $b = str_repeat($hex[2], 2);
+    $a = str_repeat($hex[3], 2);
   }
   }
   else {
   else {
     // error: invalid hex string, @todo: set form error.
     // error: invalid hex string, @todo: set form error.
@@ -468,12 +524,13 @@ function imagecache_actions_keyword_filter($value, $base_size, $layer_size) {
  * Computes a length based on a length specification and an actual length.
  * Computes a length based on a length specification and an actual length.
  *
  *
  * Examples:
  * Examples:
- *  (50, 400) returns 50; (50%, 400) returns 200;
+ *  (50, 400) returns 50; (50px, 400) returns 50; (50%, 400) returns 200;
  *  (50, null) returns 50; (50%, null) returns null;
  *  (50, null) returns 50; (50%, null) returns null;
  *  (null, null) returns null; (null, 100) returns null.
  *  (null, null) returns null; (null, 100) returns null.
  *
  *
  * @param string|null $length_specification
  * @param string|null $length_specification
- *   The length specification. An integer constant or a % specification.
+ *   The length specification. An integer constant optionally followed by 'px'
+ *   or '%'.
  * @param int|null $current_length
  * @param int|null $current_length
  *   The current length. May be null.
  *   The current length. May be null.
  *
  *
@@ -483,5 +540,9 @@ function imagecache_actions_percent_filter($length_specification, $current_lengt
   if (strpos($length_specification, '%') !== FALSE) {
   if (strpos($length_specification, '%') !== FALSE) {
     $length_specification = $current_length !== NULL ? str_replace('%', '', $length_specification) * 0.01 * $current_length : NULL;
     $length_specification = $current_length !== NULL ? str_replace('%', '', $length_specification) * 0.01 * $current_length : NULL;
   }
   }
+  else {
+    // Strips 'px' if available.
+    $length_specification = (int) $length_specification;
+  }
   return $length_specification;
   return $length_specification;
 }
 }

+ 1 - 1
sites/all/modules/contrib/localisation/i18n/README.txt

@@ -20,7 +20,7 @@ For support, please create a support request for this module's project:
 
 
 Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
 Support questions by email to the module maintainer will be simply ignored. Use the issue tracker.
 
 
-Now if you want professional (paid) support the module maintainer may be available occassionally.
+Now if you want professional (paid) support the module maintainer may be available occasionally.
 Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
 Drop me a message to check availability and hourly rates, http://reyero.net/en/contact
 
 
 ====================================================================
 ====================================================================

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n.info

@@ -8,9 +8,8 @@ files[] = i18n_object.inc
 files[] = i18n.test
 files[] = i18n.test
 configure = admin/config/regional/i18n
 configure = admin/config/regional/i18n
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 2 - 1
sites/all/modules/contrib/localisation/i18n/i18n.module

@@ -198,7 +198,8 @@ function i18n_language_field_extra() {
  */
  */
 function i18n_language_list($field = 'name', $mode = NULL) {
 function i18n_language_list($field = 'name', $mode = NULL) {
   $mode = isset($mode) ? $mode : variable_get('i18n_language_list', I18N_LANGUAGE_ENABLED);
   $mode = isset($mode) ? $mode : variable_get('i18n_language_list', I18N_LANGUAGE_ENABLED);
-  return locale_language_list($field, I18N_LANGUAGE_EXTENDED & $mode);
+  $all = I18N_LANGUAGE_EXTENDED & $mode;
+  return locale_language_list($field, $all);
 }
 }
 
 
 /**
 /**

+ 33 - 15
sites/all/modules/contrib/localisation/i18n/i18n_block/README.txt

@@ -13,43 +13,56 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Block languages module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows the user to configure for which languages each block is visible.
+The Block languages module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows the user to configure
+for which languages each block is visible.
 
 
-* For a full description of the module, visit https://www.drupal.org/node/1279698
+* For a full description of the module,
+  visit https://www.drupal.org/node/1279698.
 
 
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+  https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-Internationalization - https://www.drupal.org/project/i18n
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-*  Internationalization Views - https://www.drupal.org/project/i18nviews
-*  Language Icons - https://www.drupal.org/project/languageicons
-*  Translation Overview - https://www.drupal.org/project/translation_overview
-*  Localization Client - https://www.drupal.org/project/l10n_client
-* Internationalization contributions - https://www.drupal.org/project/i18n_contrib
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 
 
 INSTALLATION
 INSTALLATION
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
-The settings for visibility per language are provided under Visibility Settings via the Languages tab when configuring a block.
+The settings for visibility per language are provided under Visibility
+Settings via the Languages tab when configuring a block.
 
 
-The Languages tab also provides a setting for whether the block is translatable. For custom blocks, the block title and the block content will be translatable. For blocks defined by modules, only the block title will be translatable. If "Make this block translatable" is selected, a Translate tab will appear for that block. This tab provides a UI for adding translations of the block in each available language.
+The Languages tab also provides a setting for whether the block is translatable.
+For custom blocks, the block title and the block content will be translatable.
+For blocks defined by modules, only the block title will be translatable. If
+"Make this block translatable" is selected, a Translate tab will appear for that
+block. This tab provides a UI for adding translations of the block in each
+available language.
 
 
 
 
 TROUBLESHOOTING
 TROUBLESHOOTING
@@ -57,11 +70,16 @@ TROUBLESHOOTING
 
 
 Conflicts with Context
 Conflicts with Context
 
 
-The Block languages module conflicts with the Context module, which alters how blocks are rendered. This issue can be tracked in the Internationalization issue queue: http://drupal.org/node/1343044
+The Block languages module conflicts with the Context module, which alters how
+blocks are rendered. This issue can be tracked in the Internationalization
+issue queue: http://drupal.org/node/1343044
 
 
 String Errors
 String Errors
 
 
-The user must allow your used string format to be translated on admin/config/regional/i18n/strings or you are going to have a error message like "The string blocks:block:1:body for textgroup blocks is not allowed for translation because of its text format."
+The user must allow your used string format to be translated on
+admin/config/regional/i18n/strings or you are going to have an error message
+like "The string blocks:block:1:body for textgroup blocks is not allowed for
+translation because of its text format."
 
 
 
 
 MAINTAINERS
 MAINTAINERS

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.info

@@ -8,9 +8,8 @@ files[] = i18n_block.inc
 files[] = i18n_block.test
 files[] = i18n_block.test
 
 
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 13 - 2
sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.module

@@ -37,6 +37,17 @@ function i18n_block_menu() {
   return $items;
   return $items;
 }
 }
 
 
+/**
+ * Implements hook_permission().
+ */
+function i18n_block_permission() {
+  return array(
+    'translate blocks' => array(
+      'title' => t('Translate Blocks'),
+    ),
+  );
+}
+
 /**
 /**
  * Implement hook_menu_alter().
  * Implement hook_menu_alter().
  *
  *
@@ -59,7 +70,7 @@ function i18n_block_menu_alter(&$items) {
  */
  */
 function i18n_block_translate_tab_access($module, $delta) {
 function i18n_block_translate_tab_access($module, $delta) {
   $block = block_load($module, $delta);
   $block = block_load($module, $delta);
-  return user_access('translate interface') && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
+  return (user_access('translate interface') || user_access('translate blocks')) && $block && isset($block->i18n_mode) && ($block->i18n_mode == I18N_MODE_LOCALIZE);
 }
 }
 
 
 /**
 /**
@@ -226,7 +237,7 @@ function i18n_block_form_block_admin_configure_alter(&$form, &$form_state, $form
     '#options' => i18n_language_list(),
     '#options' => i18n_language_list(),
     '#description' => t('If no language is selected, block will show regardless of language.'),
     '#description' => t('If no language is selected, block will show regardless of language.'),
   );
   );
-  if (user_access('translate interface')) {
+  if (user_access('translate interface') || user_access('translate blocks')) {
     $form['actions']['translate'] = array(
     $form['actions']['translate'] = array(
       '#type' => 'submit',
       '#type' => 'submit',
       '#name'   => 'save_translate',
       '#name'   => 'save_translate',

+ 3 - 2
sites/all/modules/contrib/localisation/i18n/i18n_block/i18n_block.test

@@ -72,15 +72,16 @@ class i18nBlocksTestCase extends Drupali18nTestCase {
 
 
     $this->clickLink(t('translate'));
     $this->clickLink(t('translate'));
 
 
+    // Title is a textarea, body is a text_format.
     $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
     $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':title]', $translations['title']['es']);
-    $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body]', $translations['body']['es']);
+    $this->assertFieldByName('strings[blocks:block:' . $box2['delta'] . ':body][value]', $translations['body']['es']);
 
 
     // Update the translation.
     // Update the translation.
     $translations['title']['es'] = $this->randomName(10);
     $translations['title']['es'] = $this->randomName(10);
     $translations['body']['es'] = $this->randomName(20);
     $translations['body']['es'] = $this->randomName(20);
     $edit = array(
     $edit = array(
       'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
       'strings[blocks:block:' . $box2['delta'] . ':title]' => $translations['title']['es'],
-      'strings[blocks:block:' . $box2['delta'] . ':body]' => $translations['body']['es'],
+      'strings[blocks:block:' . $box2['delta'] . ':body][value]' => $translations['body']['es'],
     );
     );
     $this->drupalPost(NULL, $edit, t('Save translation'));
     $this->drupalPost(NULL, $edit, t('Save translation'));
     $this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');
     $this->i18nAssertTranslations($translations['title'], '', 'Updated block title translation displayed.');

+ 25 - 16
sites/all/modules/contrib/localisation/i18n/i18n_contact/README.txt

@@ -12,47 +12,56 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Contact translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site contact forms.  This module makes contact categories and replies available for translation.
+The Contact translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, helps with the multilingual
+configuration of the site contact forms. This module makes contact categories
+and replies available for translation.
 
 
-* For a full description of the module, visit https://www.drupal.org/node/1396984
+* For a full description of the module, visit
+  https://www.drupal.org/node/1396984.
 
 
-* To submit bug reports and feature suggestions, or to track changes, visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes,
+  visit https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 
 
 INSTALLATION
 INSTALLATION
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
-1. Enable the Contact translation module included with the Internationalization module.
+1. Enable the Contact translation module included with the Internationalization
+   module.
 2. Go to Administration > Structure > Contact form.
 2. Go to Administration > Structure > Contact form.
-3. Click edit for the form to configure.
-4. Click the Translate tab.
-5. Click the translate link for a language.
+3. Select edit for the form to configure.
+4. Select the Translate tab.
+5. Select the translate link for a language.
 6. Translate the Category and Auto-reply text.
 6. Translate the Category and Auto-reply text.
-7. Click Save translation.
+7. Select Save translation.
 8. Repeat steps 5 to 7 for each language.
 8. Repeat steps 5 to 7 for each language.
 9. Repeat steps 2 to 8 for all forms.
 9. Repeat steps 2 to 8 for all forms.
 
 

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_contact/i18n_contact.info

@@ -5,9 +5,8 @@ dependencies[] = i18n_string
 package = Multilingual - Internationalization
 package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 28 - 15
sites/all/modules/contrib/localisation/i18n/i18n_field/README.txt

@@ -12,47 +12,60 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Field translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows for translation of text associated with a field's settings including the label, help text, default value, and list options.
+The Field translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows for translation of text
+associated with a field's settings including the label, help text, default
+value, and list options.
 
 
-* For a full description of the module, visit this page https://www.drupal.org/node/1279346
+* For a full description of the module, visit this page
+  https://www.drupal.org/node/1279346.
 
 
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+  https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 
 
 INSTALLATION
 INSTALLATION
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://drupal.org/documentation/install/modules-themes/modules-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
 1. Enable the Field translation module included with Internationalization.
 1. Enable the Field translation module included with Internationalization.
-2. Go to Administration > Configuration > Regional and language > Translate interface.
-3. Click on Filter Translatable Strings field set and limit search to fields.
+2. Go to Administration > Configuration > Regional and language > Translate
+   interface.
+3. Select the Filter Translatable Strings field set and limit search to fields.
 4. Edit the desired field and Save.
 4. Edit the desired field and Save.
-For the translation to be displayed, you need to use some of the Field Formatters provided by this module whose name usually ends up in 'translated'. For most core fields it is Default translated.
 
 
-Note: The Field Translation module does not provide content translation for fields. This functionality is provided by the Entity Translation (ET) module.
+For the translation to be displayed, the user needs to use some of the Field
+Formatters provided by this module whose name usually ends up in 'translated'.
+For most core fields it is Default translated.
+
+Note: The Field Translation module does not provide content translation for
+fields. This functionality is provided by the Entity Translation (ET) module.
 
 
 
 
 MAINTAINERS
 MAINTAINERS

+ 1 - 1
sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.i18n.inc

@@ -72,7 +72,7 @@ function i18n_field_i18n_string_info() {
     'description' => t('Configurable fields descriptions, defaults, options, etc.'),
     'description' => t('Configurable fields descriptions, defaults, options, etc.'),
     'format' => FALSE, // This group doesn't have formatted strings
     'format' => FALSE, // This group doesn't have formatted strings
     'list' => TRUE, // This group can list all strings
     'list' => TRUE, // This group can list all strings
-    'class' => 'i18n_string_textgroup_cached',
+    'class' => variable_get('i18n_string_textgroup_class_field', 'i18n_string_textgroup_cached'),
   );
   );
   return $groups;
   return $groups;
 }
 }

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.info

@@ -6,9 +6,8 @@ package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 files[] = i18n_field.inc
 files[] = i18n_field.inc
 files[] = i18n_field.test
 files[] = i18n_field.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 62 - 4
sites/all/modules/contrib/localisation/i18n/i18n_field/i18n_field.module

@@ -194,6 +194,9 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
     // Single-value file fields and image fields.
     // Single-value file fields and image fields.
     $alter_element = &$element[0];
     $alter_element = &$element[0];
   }
   }
+  elseif ($field['type'] == 'url' && $field['module'] == 'url' && $field['cardinality'] == 1) {
+    $alter_element = &$element;
+  }
   elseif (isset($element['value'])) {
   elseif (isset($element['value'])) {
     // Number fields. Single-value text fields.
     // Number fields. Single-value text fields.
     $alter_element = &$element['value'];
     $alter_element = &$element['value'];
@@ -202,6 +205,10 @@ function i18n_field_field_widget_form_alter(&$element, &$form_state, $context) {
     // Entityreference fields using the entityreference_autocomplete widget.
     // Entityreference fields using the entityreference_autocomplete widget.
     $alter_element = &$element['target_id'];
     $alter_element = &$element['target_id'];
   }
   }
+  elseif ($field['type'] == 'node_reference' && isset($element['nid'])) {
+    // The node_reference fields using the entityreference_autocomplete widget.
+    $alter_element = &$element['nid'];
+  }
   else {
   else {
     // All other fields.
     // All other fields.
     $alter_element = &$element;
     $alter_element = &$element;
@@ -456,6 +463,27 @@ function i18n_field_field_info_alter(&$field_info) {
   }
   }
 }
 }
 
 
+/**
+ * Prime the cache to avoid single db queries for entity fields / properties.
+ *
+ * This is mainly uses when large operations are occuring like a flush of the
+ * entity_property_infos().
+ */
+function i18n_field_prime_caches() {
+  global $language;
+  static $cache_primed;
+
+  // Fill the cache. This should avoid single db queries when filling the
+  // properties.
+  if (empty($cache_primed)) {
+    $cache_primed = TRUE;
+    $text_group = i18n_string_textgroup('field');
+    // Load all strings at once to avoid callbacks for each individual string.
+    $text_group->load_strings();
+    $text_group->multiple_translation_search(array('type' => '*', 'objectid' => '*', 'property' => '*'), $language->language);
+  }
+}
+
 /**
 /**
  * Callback to translate entity property info for a fields.
  * Callback to translate entity property info for a fields.
  *
  *
@@ -478,6 +506,7 @@ function i18n_field_entity_property_callback(&$info, $entity_type, $field, $inst
     return;
     return;
   }
   }
 
 
+  i18n_field_prime_caches();
   $name = $field['field_name'];
   $name = $field['field_name'];
   $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
   $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
   $property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
   $property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
@@ -491,9 +520,38 @@ function i18n_field_i18n_object_info_alter(&$info) {
     if ($info = drupal_static('i18n_object_info')) {
     if ($info = drupal_static('i18n_object_info')) {
       // Clean static and permanent cache of the data and then re-run the property
       // Clean static and permanent cache of the data and then re-run the property
       // building.
       // building.
-      drupal_static_reset('entity_get_property_info');
-      cache_clear_all('entity_property_info:' . $GLOBALS['language']->language, 'cache');
-      entity_get_property_info();
+      // Use a lock to avoid stampeding.
+      $lock_name = 'i18n_field_entity_property_callback_fallback:' . $GLOBALS['language']->language;
+      // See if another request is already doing this. If so we bail out here as
+      // we won't help with anything at the moment.
+      if (!lock_may_be_available($lock_name)) {
+        return;
+      }
+      if (lock_acquire($lock_name)) {
+        i18n_field_prime_caches();
+        // Inject translated properties.
+        $entity_property_info = entity_get_property_info();
+        foreach ($entity_property_info as $entity_type => $properties) {
+          if (isset($properties['bundles'])) {
+            foreach ($properties['bundles'] as $bundle => $bundle_properties) {
+              if ($bundle_properties['properties']) {
+                foreach ($bundle_properties['properties'] as $bundle_property => $bundle_property_info) {
+                  if ($instance = field_info_instance($entity_type, $bundle_property, $bundle)) {
+                    $property = &$entity_property_info[$entity_type]['bundles'][$instance['bundle']]['properties'][$bundle_property];
+                    $property['label'] = i18n_field_translate_property($instance, 'label', $GLOBALS['language']->language);
+                  }
+                }
+              }
+            }
+          }
+        }
+        // Inject into static cache.
+        $entity_get_property_info = &drupal_static('entity_get_property_info', array());
+        $entity_get_property_info = $entity_property_info;
+        // Write permanent cache.
+        cache_set('entity_property_info:' . $GLOBALS['language']->language, $entity_property_info);
+        lock_release($lock_name);
+      }
     }
     }
     else {
     else {
       watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
       watchdog('i18n_field', 'Unable to run fall-back handling for entity property translation due missing "i18n_object_info" cache', array(), WATCHDOG_WARNING);
@@ -511,4 +569,4 @@ function i18n_field_module_implements_alter(&$implementations, $hook) {
     unset($implementations['i18n_field']);
     unset($implementations['i18n_field']);
     $implementations['i18n_field'] = $group;
     $implementations['i18n_field'] = $group;
   }
   }
-}
+}

+ 26 - 20
sites/all/modules/contrib/localisation/i18n/i18n_forum/README.txt

@@ -12,35 +12,41 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Multilingual forum module, part of the Internationalization (https://www.drupal.org/project/i18n) package, helps with the multilingual configuration of the site’s forums.
+The Multilingual forum module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, helps with the multilingual
+configuration of the site’s forums.
 
 
-* For a full description of the module visit https://www.drupal.org/node/1396988
+* For a full description of the module visit
+  https://www.drupal.org/node/1396988.
 
 
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+  https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 INSTALLATION
 INSTALLATION
-
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
@@ -50,22 +56,22 @@ To configure forum vocabulary
 
 
 1. Enable the Multilingual forum module included with Internationalization.
 1. Enable the Multilingual forum module included with Internationalization.
 2. Go to Administration > Structure > Taxonomy.
 2. Go to Administration > Structure > Taxonomy.
-3. Click "edit vocabulary" for the Forums vocabulary.
+3. Select the "edit vocabulary" for the Forums vocabulary.
 4. Choose the translation mode (Localize or Translate).
 4. Choose the translation mode (Localize or Translate).
-5. Click "Save and translate" button.
-6. Click "translate" link for a language.
+5. Select the "Save and translate" button.
+6. Select the "translate" link for a language.
 7. Translate the "Name" and "Description" for the forum.
 7. Translate the "Name" and "Description" for the forum.
-8. Click "Save translation" button.
+8. Select the "Save translation" button.
 9. Repeat steps 6 to 8 for each language.
 9. Repeat steps 6 to 8 for each language.
 
 
 To configure forum terms
 To configure forum terms
 
 
 1. Go to Administration > Structure > Forums.
 1. Go to Administration > Structure > Forums.
-2. Click "edit" link for a forum or container.
-3. Click "Translate" tab.
-4. Click "translate" link for a language.
+2. Select the "edit" link for a forum or container.
+3. Select the "Translate" tab.
+4. Select the "translate" link for a language.
 5. Translate the "Name" and "Description" for the term.
 5. Translate the "Name" and "Description" for the term.
-6. Click "Save translation" button.
+6. Select the "Save translation" button.
 7. Repeat steps 4 to 6 for each language.
 7. Repeat steps 4 to 6 for each language.
 8. Repeat all steps for all terms.
 8. Repeat all steps for all terms.
 
 

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_forum/i18n_forum.info

@@ -7,9 +7,8 @@ package = Multilingual - Internationalization
 core = 7.x
 core = 7.x
 files[] = i18n_forum.test
 files[] = i18n_forum.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 43 - 21
sites/all/modules/contrib/localisation/i18n/i18n_menu/README.txt

@@ -13,62 +13,80 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Menu translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, allows users to select a translation mode for each menu.
+The Menu translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, allows users to select a
+translation mode for each menu.
 
 
 * For a full description of the module, visit this page:
 * For a full description of the module, visit this page:
-https://www.drupal.org/node/1113982
+  https://www.drupal.org/node/1113982.
 
 
 * To submit bug reports and feature suggestions, or to track changes:
 * To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+  https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 To link menu item menus to nodes, it is useful to have the following modules:
 To link menu item menus to nodes, it is useful to have the following modules:
 
 
-* Entity translation i18n menu module, a sub module of Entity translation (https://www.drupal.org/project/entity_translation)
-* Menu translation node module (https://www.drupal.org/project/i18n_menu_node)
+* Entity translation i18n menu module, a submodule of Entity translation -
+  https://www.drupal.org/project/entity_translation
+* Menu translation node module - https://www.drupal.org/project/i18n_menu_node
 
 
 
 
 INSTALLATION
 INSTALLATION
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
 Language-specific menus
 Language-specific menus
-1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) > Edit.
-2. In the Translation mode section, choose Fixed Language and a Language field will appear.
+1. To create or edit a menu, navigate to Structure > Menus > (menu to edit) >
+   Edit.
+2. In the Translation mode section, choose Fixed Language and a Language field
+   will appear.
 3. Select a language, select Save, and add or update the menu items as needed.
 3. Select a language, select Save, and add or update the menu items as needed.
 The menu block will only appear when viewing content in the same language.
 The menu block will only appear when viewing content in the same language.
 
 
-There are three modes available:
+There are three modes available: Translate and Localize, Fixed Language, and No
+Multilingual Options.
 
 
 Translate and Localize:
 Translate and Localize:
-You can create one menu for all languages, and translate or localize each menu item. There are two ways that menu items will be translated.
-1. You can set a language when creating a custom menu item so that the menu item will only show up for that language. Menu items that link to nodes in a particular language will be treated this way.
-2. You can localize other custom menu items without a language (for example, menu items linking to Views pages). Use the Translate tab to translate the menu item title and description. Translators can also use the "Translate interface" pages to translate these menu items.
+The user can create one menu for all languages, and translate or localize each
+menu item. There are two ways that menu items will be translated.
+1. The user can set a language when creating a custom menu item so that the menu
+   item will only show up for that language. Menu items that link to nodes in a
+   particular language will be treated this way.
+2. The user can localize other custom menu items without a language
+   (for example, menu items linking to Views pages). Use the Translate tab to
+   translate the menu item title and description. Translators can also use the
+   "Translate interface" pages to translate these menu items.
 
 
 Fixed Language:
 Fixed Language:
-If you choose Fixed Language, you'll have to set up a separate menu in each language. This could become tedious if have a lot of languages enabled on your site, but is useful if the content or menu structure is different for each language.
+If the user chooses Fixed Language, they'll have to set up a separate menu in
+each language. This could become tedious if have a lot of languages enabled on
+the site, but is useful if the content or menu structure is different for each
+language.
 
 
 No Multilingual Options:
 No Multilingual Options:
 Only the menu will be translatable.
 Only the menu will be translatable.
@@ -76,7 +94,11 @@ Only the menu will be translatable.
 TROUBLESHOOTING
 TROUBLESHOOTING
 ---------------
 ---------------
 
 
-A menu item linked to a node will be displayed only when the node language matches the page language. This is due to how the menu system works and the "Language selection" feature in i18n. Therefore, to get translated menus items that link to nodes, you first need translated content. For more information visit https://www.drupal.org/docs/7/multilingual/translating-content.
+A menu item linked to a node will be displayed only when the node language
+matches the page language. This is due to how the menu system works and the
+"Language selection" feature in i18n. Therefore, to get translated menus items
+that link to nodes, you first need translated content. For more information
+visit https://www.drupal.org/docs/7/multilingual/translating-content.
 
 
 
 
 MAINTAINERS
 MAINTAINERS

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.info

@@ -10,9 +10,8 @@ core = 7.x
 files[] = i18n_menu.inc
 files[] = i18n_menu.inc
 files[] = i18n_menu.test
 files[] = i18n_menu.test
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 5 - 6
sites/all/modules/contrib/localisation/i18n/i18n_menu/i18n_menu.module

@@ -62,8 +62,8 @@ function i18n_menu_menu_alter(&$items) {
  * @param $variables
  * @param $variables
  */
  */
 function i18n_menu_preprocess_menu_admin_overview(&$variables) {
 function i18n_menu_preprocess_menu_admin_overview(&$variables) {
-  $variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title']);
-  $variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description']);
+  $variables['title'] = i18n_string(array('menu', 'menu', $variables['name'], 'title'), $variables['title'], array('sanitize' => FALSE));
+  $variables['description'] = i18n_string(array('menu', 'menu', $variables['name'], 'description'), $variables['description'], array('sanitize' => FALSE));
 }
 }
 
 
 /**
 /**
@@ -198,7 +198,6 @@ function i18n_menu_menu_link_alter(&$item) {
   // We just make sure every link has a valid language property.
   // We just make sure every link has a valid language property.
   if (!i18n_object_langcode($item)) {
   if (!i18n_object_langcode($item)) {
     $item['language'] = LANGUAGE_NONE;
     $item['language'] = LANGUAGE_NONE;
-    $item['i18n_tsid'] = 0;
   }
   }
 }
 }
 
 
@@ -398,7 +397,7 @@ function i18n_menu_localize_tree($tree, $langcode = NULL) {
     if (_i18n_menu_link_process($item['link'])) {
     if (_i18n_menu_link_process($item['link'])) {
       if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
       if (!_i18n_menu_link_is_visible($item['link'], $langcode)) {
         // Remove links for other languages than current.
         // Remove links for other languages than current.
-        // Links with language wont be localized.
+        // Links with language won't be localized.
         unset($tree[$index]);
         unset($tree[$index]);
         // @todo Research whether the above has any advantage over:
         // @todo Research whether the above has any advantage over:
         // $item['hidden'] = TRUE;
         // $item['hidden'] = TRUE;
@@ -523,7 +522,7 @@ function _i18n_menu_link_localize(&$link, $langcode = NULL) {
 function _i18n_menu_link_description($link, $langcode = NULL) {
 function _i18n_menu_link_description($link, $langcode = NULL) {
   if (!empty($link['options']['attributes']['title'])) {
   if (!empty($link['options']['attributes']['title'])) {
     $key = i18n_object_info('menu_link', 'key');
     $key = i18n_object_info('menu_link', 'key');
-    return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode));
+    return i18n_string_translate(array('menu', 'item', $link[$key], 'description'), $link['options']['attributes']['title'], array('langcode' => $langcode, 'sanitize' => FALSE));
   }
   }
   else {
   else {
     return NULL;
     return NULL;
@@ -600,7 +599,7 @@ function _i18n_menu_link_is_visible($link, $langcode = NULL) {
 }
 }
 
 
 /**
 /**
- * Get localizable properties for menu link checking agains the router item.
+ * Get localizable properties for menu link checking against the router item.
  */
  */
 function _i18n_menu_link_localizable_properties($link) {
 function _i18n_menu_link_localizable_properties($link) {
   $props = array();
   $props = array();

+ 45 - 20
sites/all/modules/contrib/localisation/i18n/i18n_node/README.txt

@@ -12,53 +12,78 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Multilingual content module, part of the Internationalization (https://www.drupal.org/project/i18n) package, provides extended multilingual options for nodes. These options help accommodate a variety of translation workflows by controlling how the language for nodes is set.
+The Multilingual content module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, provides extended multilingual
+options for nodes. These options help accommodate a variety of translation
+workflows by controlling how the language for nodes is set.
 
 
-Note that the Multilingual content module lives in the i18n_node directory in the Internationalization package. Don't confuse this module with the core Content translation module.
+Note that the Multilingual content module lives in the i18n_node directory
+in the Internationalization package. Don't confuse this module with the core
+Content translation module.
 
 
-* For a full description of the module visit https://www.drupal.org/node/1279644
+* For a full description of the module visit:
+  https://www.drupal.org/node/1279644.
 
 
-* To submit bug reports and feature suggestions, or to track changes visit https://www.drupal.org/project/issues/i18n
+* To submit bug reports and feature suggestions, or to track changes visit
+  https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 
 
 INSTALLATION
 INSTALLATION
-
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. See https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
-For each content type, the following Extended language options are available under the Multilingual Settings tab
-1. "Set current language as default for new content" can be useful for content that is community-generated.
+For each content type, the following Extended language options are available
+under the Multilingual Settings tab.
+1. "Set current language as default for new content" can be useful for content
+   that is community-generated.
 2. "Require language" prevents users from creating 'Language neutral' nodes.
 2. "Require language" prevents users from creating 'Language neutral' nodes.
-3. "Lock language" prevents users from changing the language of a node after it's created.
+3. "Lock language" prevents users from changing the language of a node after
+   it's created.
 
 
 Site-wide Settings for Node Translation
 Site-wide Settings for Node Translation
-1. There are also site-wide settings provided to help streamline how multilingual content is created. Navigate to Config > Regional and language > Multilingual settings > Node Options.
-2. "Switch interface for translating" switches the language of the user interface to the chosen language when a user translates a node. This is useful if users speak the language in which the translation is written. It means that after the node translation is saved, the language of the UI will match the language of the node.
-3. "Hide content translation links" will prevent the language switcher links from appearing in nodes and teasers. This is useful if a language switcher block is enabled on the site.
-4.You can also select the default language for new nodes if the corresponding content type doesn't have language support. By default, it is set to be in the default language of the site, but this can be changed to be language neutral. This is a useful option when thinking about forward compatibility for adding multilingual support to these content types in the future.
+1. There are also site-wide settings provided to help streamline how
+   multilingual content is created. Navigate to Config > Regional and language >
+   Multilingual settings > Node Options.
+2. "Switch interface for translating" switches the language of the user
+   interface to the chosen language when a user translates a node. This is
+   useful if users speak the language in which the translation is written. It
+   means that after the node translation is saved, the language of the UI will
+   match the language of the node.
+3. "Hide content translation links" will prevent the language switcher links
+   from appearing in nodes and teasers. This is useful if a language switcher
+   block is enabled on the site.
+4. The user can also select the default language for new nodes if the
+   corresponding content type doesn't have language support. By default, it is
+   set to be in the default language of the site, but this can be changed to be
+   language neutral. This is a useful option when thinking about forward
+   compatibility for adding multilingual support to these content types in the
+   future.
 
 
 
 
 MAINTAINERS
 MAINTAINERS

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.info

@@ -9,9 +9,8 @@ configure = admin/config/regional/i18n/node
 files[]=i18n_node.test
 files[]=i18n_node.test
 files[]=i18n_node.variable.inc
 files[]=i18n_node.variable.inc
 
 
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 31 - 9
sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.module

@@ -222,8 +222,16 @@ function i18n_node_language_mode($type) {
 function i18n_node_node_prepare($node) {
 function i18n_node_node_prepare($node) {
   $options = variable_get('i18n_node_options_' . $node->type, array());
   $options = variable_get('i18n_node_options_' . $node->type, array());
   if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
   if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
+    $default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --');
+
     // Set current language for new nodes if option enabled
     // Set current language for new nodes if option enabled
-    $node->language = i18n_language_content()->language;
+    if ($default === '-- current --') {
+      $node->language = i18n_language_content()->language;
+    }
+    // If a custom language was specified, apply it.
+    else {
+      $node->language = $default;
+    }
   }
   }
 }
 }
 
 
@@ -249,13 +257,16 @@ function i18n_node_permission() {
 /**
 /**
  * Implements hook_node_view()
  * Implements hook_node_view()
  */
  */
-function i18n_node_node_view($node) {
+function i18n_node_node_view($node, $view_mode, $langcode) {
   if (i18n_node_type_enabled($node)) {
   if (i18n_node_type_enabled($node)) {
-    $node->content['language'] = array(
-      '#type' => 'item',
-      '#title' => t('Language'),
-      '#markup' => i18n_language_name($node->language),
-    );
+    $extra_fields_display_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
+    if ($extra_fields_display_settings['language']['visible']) {
+      $node->content['language'] = array(
+        '#type' => 'item',
+        '#title' => t('Language'),
+        '#markup' => i18n_language_name($node->language),
+      );
+    }
   }
   }
 }
 }
 
 
@@ -265,7 +276,9 @@ function i18n_node_node_view($node) {
  * Handles links for extended languages. Sets current interface language.
  * Handles links for extended languages. Sets current interface language.
  */
  */
 function i18n_node_node_view_alter(&$build) {
 function i18n_node_node_view_alter(&$build) {
-  $node = $build['#node'];
+  if (isset($build['#node'])) {
+    $node = $build['#node'];
+  }
   // Hide node translation links.
   // Hide node translation links.
   if (variable_get('i18n_hide_translation_links', 0)) {
   if (variable_get('i18n_hide_translation_links', 0)) {
     if (isset($build['links']['translation'])) {
     if (isset($build['links']['translation'])) {
@@ -417,7 +430,16 @@ function i18n_node_form_node_type_form_alter(&$form, &$form_state) {
     // Some settings about node languages. Add variables for node type from variable definition
     // Some settings about node languages. Add variables for node type from variable definition
     if ($form['#node_type']->type) {
     if ($form['#node_type']->type) {
       variable_type_include('node_type');
       variable_type_include('node_type');
-      $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_extended'));
+      $form['i18n'] += node_variable_type_subform($form['#node_type']->type, array('i18n_node_options', 'i18n_node_default_language_for', 'i18n_node_extended'));
+      // Only show custom default language field if "current" is checked.
+      $form['i18n']['i18n_node_default_language_for']['#states'] = array(
+        'visible' => array(
+          ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+        ),
+        'required' => array(
+          ':input[name="i18n_node_options[current]"]' => array('checked' => TRUE),
+        ),
+      );
     }
     }
     // Add disabled message
     // Add disabled message
     if ($disabled) {
     if ($disabled) {

+ 18 - 1
sites/all/modules/contrib/localisation/i18n/i18n_node/i18n_node.variable.inc

@@ -45,13 +45,30 @@ function i18n_node_variable_info($options = array()) {
     'repeat' => array(
     'repeat' => array(
       'type' => 'options',
       'type' => 'options',
       'options' => array(
       'options' => array(
-        'current' => t('Set current language as default for new content.', array(), $options),
+        // Note: this was previously used only to mark new, translatable nodes
+        // with the current language of the user. Now, this setting is extended
+        // to allow a specific language to be chosen (defaulting to the current
+        // language). This was done for backwards compatibility reasons.
+        'current' => t('Set custom language as default for new content.', array(), $options),
         'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
         'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
         'lock' => t('Lock language (Cannot be changed).', array(), $options),
         'lock' => t('Lock language (Cannot be changed).', array(), $options),
       ),
       ),
     ),
     ),
     'group' => 'i18n',
     'group' => 'i18n',
   );
   );
+  // This field will only be displayed if "current" is checked above.
+  $variables['i18n_node_default_language_for_[node_type]'] = array(
+    'type' => 'multiple',
+    'title' => t('Custom default language', array(), $options),
+    'repeat' => array(
+      'type' => 'select',
+      'options' => array_merge(array(
+        '-- current --' => t('Current language')
+      ), locale_language_list('name')),
+      'default' => '-- current --',
+    ),
+    'group' => 'i18n',
+  );
   $variables['i18n_node_extended_[node_type]'] = array(
   $variables['i18n_node_extended_[node_type]'] = array(
     'type' => 'multiple',
     'type' => 'multiple',
     'title' => t('Extended language support'),
     'title' => t('Extended language support'),

+ 3 - 4
sites/all/modules/contrib/localisation/i18n/i18n_path/i18n_path.info

@@ -6,9 +6,8 @@ core = 7.x
 
 
 files[] = i18n_path.inc
 files[] = i18n_path.inc
 files[] = i18n_path.test
 files[] = i18n_path.test
-; Information added by Drupal.org packaging script on 2017-01-31
-version = "7.x-1.15"
+; Information added by Drupal.org packaging script on 2020-06-17
+version = "7.x-1.27"
 core = "7.x"
 core = "7.x"
 project = "i18n"
 project = "i18n"
-datestamp = "1485834792"
-
+datestamp = "1592373390"

+ 31 - 17
sites/all/modules/contrib/localisation/i18n/i18n_redirect/README.txt

@@ -1,5 +1,5 @@
 CONTENTS OF THIS FILE
 CONTENTS OF THIS FILE
----------------------------
+---------------------
   
   
 * Introduction
 * Introduction
 * Requirements
 * Requirements
@@ -12,50 +12,64 @@ CONTENTS OF THIS FILE
 INTRODUCTION
 INTRODUCTION
 ------------
 ------------
 
 
-The Redirect translation module, part of the Internationalization (https://www.drupal.org/project/i18n) package, improves search engine optimization (SEO) for multilingual websites. 
+The Redirect translation module, part of the Internationalization
+(https://www.drupal.org/project/i18n) package, improves search engine
+optimization (SEO) for multilingual websites.
 
 
-It redirects anonymous users (including web crawlers) to the translation of the page in the requested language, if it exists, using a 301 redirect code. 
+It redirects anonymous users (including web crawlers) to the translation of the
+page in the requested language, if it exists, using a 301 redirect code.
 
 
 * For a full description of the module, visit this page:
 * For a full description of the module, visit this page:
-https://www.drupal.org/node/1280468
+  https://www.drupal.org/node/1280468.
 
 
 * To submit bug reports and feature suggestions, or to track changes:
 * To submit bug reports and feature suggestions, or to track changes:
-https://www.drupal.org/project/issues/i18n
+   https://www.drupal.org/project/issues/i18n.
 
 
 
 
 REQUIREMENTS
 REQUIREMENTS
 ------------
 ------------
 
 
-This module requires the following modules:
+This module requires the following module:
 
 
-* Internationalization (https://www.drupal.org/project/i18n)
+* Internationalization - https://www.drupal.org/project/i18n
 
 
-The Translation redirect module requires the implementation of hook_i18n_translate_path by another module for the redirect page to be determined. Currently, the Multilingual content, Path translation, and Taxonomy translation modules implement this hook. 
+The Translation redirect module requires the implementation of
+hook_i18n_translate_path by another module for the redirect page to be
+determined. Currently, the Multilingual content, Path translation, and Taxonomy
+translation modules implement this hook.
 
 
 
 
 RECOMMENDED MODULES
 RECOMMENDED MODULES
 -------------------
 -------------------
 
 
-* Internationalization Views (https://www.drupal.org/project/i18nviews)
-* Language Icons (https://www.drupal.org/project/languageicons)
-* Translation Overview (https://www.drupal.org/project/translation_overview)
-* Localization Client (https://www.drupal.org/project/l10n_client)
-* Internationalization contributions (https://www.drupal.org/project/i18n_contrib)
+* Internationalization Views - https://www.drupal.org/project/i18nviews
+* Language Icons - https://www.drupal.org/project/languageicons
+* Translation Overview - https://www.drupal.org/project/translation_overview
+* Localization Client - https://www.drupal.org/project/l10n_client
+* Internationalization contributions -
+  https://www.drupal.org/project/i18n_contrib
 
 
 
 
 INSTALLATION
 INSTALLATION
 ------------
 ------------
 
 
-* This is a submodule of the Internationalization module. Install the Internationalization module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/docs/7/extending-drupal-7/installing-contributed-modules-find-import-enable-configure-drupal-7 for further information.
+This is a submodule of the Internationalization module. Install the
+Internationalization module as you would normally install a contributed Drupal
+module. Visit https://www.drupal.org/node/895232 for further information.
 
 
 
 
 CONFIGURATION
 CONFIGURATION
 -------------
 -------------
 
 
-No configuration is necessary.  
+No configuration is necessary.
 
 
-For node translation, enable the Multilingual content and the Translation redirect modules. For non-node pages, the redirection hook must be implemented by the relevant module.
-For example, for taxonomy pages, you should enable the Taxonomy translation module because the module provides the necessary hook code. If you are using the Path translation module to create translation sets for non-node pages, then it implements the hook code for determining the redirection page.
+For node translation, enable the Multilingual content and the Translation
+redirect modules. For non-node pages, the redirection hook must be implemented
+by the relevant module.
+For example, for taxonomy pages, you should enable the Taxonomy translation
+module because the module provides the necessary hook code. If you are using the
+Path translation module to create translation sets for non-node pages, then it
+implements the hook code for determining the redirection page.
 
 
 
 
 MAINTAINERS
 MAINTAINERS

Some files were not shown because too many files changed in this diff