diff --git a/sites/all/modules/contrib/admin/rules/DEVELOPER.txt b/sites/all/modules/contrib/admin/rules/DEVELOPER.txt
index dee65569..d5d0f478 100644
--- a/sites/all/modules/contrib/admin/rules/DEVELOPER.txt
+++ b/sites/all/modules/contrib/admin/rules/DEVELOPER.txt
@@ -23,4 +23,4 @@ Terminology & Overview
outside of the rule admin module too. In fact the rules admin module is
pretty small, as it just relies on the provided UI of the components.
* The UI is incorporated using the faces object extension mechanism, see
- rules_rules_plugin_info() for an overview of the used UI extenders.
\ No newline at end of file
+ rules_rules_plugin_info() for an overview of the used UI extenders.
diff --git a/sites/all/modules/contrib/admin/rules/README.txt b/sites/all/modules/contrib/admin/rules/README.txt
index a4a56319..ee5360e6 100644
--- a/sites/all/modules/contrib/admin/rules/README.txt
+++ b/sites/all/modules/contrib/admin/rules/README.txt
@@ -9,7 +9,7 @@ Maintainers:
The Rules module allows site administrators to define conditionally executed
actions based on occurring events (ECA-rules).
-Project homepage: http://drupal.org/project/rules
+Project homepage: https://www.drupal.org/project/rules
Installation
@@ -18,10 +18,10 @@ Installation
*Before* starting, make sure that you have read at least the introduction - so
you know at least the basic concepts. You can find it here:
- http://drupal.org/node/298480
+ https://www.drupal.org/node/298480
* Rules depends on the Entity API module, download and install it from
- http://drupal.org/project/entity
+ https://www.drupal.org/project/entity
* Copy the whole rules directory to your modules directory
(e.g. DRUPAL_ROOT/sites/all/modules) and activate the Rules and Rules UI
modules.
@@ -30,8 +30,8 @@ you know at least the basic concepts. You can find it here:
Documentation
-------------
-* Check out the general docs at http://drupal.org/node/298476
-* Check out the developer targeted docs at http://drupal.org/node/878718
+* Check out the general docs at https://www.drupal.org/node/298476
+* Check out the developer targeted docs at https://www.drupal.org/node/878718
Rules Scheduler
@@ -41,9 +41,9 @@ Rules Scheduler
to schedule the execution of Rules components.
* Make sure that you have configured cron for your drupal installation as cron
is used for scheduling the Rules components. For help see
- http://drupal.org/cron
- * If the Views module (http://drupal.org/project/views) is installed, the module
- displays the list of scheduled tasks in the UI.
+ https://www.drupal.org/cron
+ * If the Views module (https://www.drupal.org/project/views) is installed, the
+ module displays the list of scheduled tasks in the UI.
Upgrade from Rules 6.x-1.x to Rules 7.x-2.x
@@ -60,7 +60,7 @@ Upgrade from Rules 6.x-1.x to Rules 7.x-2.x
* Note that for importing an export the export needs to pass the
configuration integrity check, what might be troublesome if the
conversion was not 100% successful. In that case, try choosing the
- immediate saving method and correct the configuration after conversion.
+ immediate saving method and correct the configuration after conversion.
* A rule configuration might require multiple modules to be in place and
upgraded to work properly. E.g. if you used an action provided
by a third party module, make sure the module is in place and upgraded
@@ -85,7 +85,7 @@ Upgrade from Rules 6.x-1.x to Rules 7.x-2.x
for Drupal 7. The Drupal 6 tasks are preserved in the database as long as
you do not clear your Rules 1.x configuration though.
* The Rules Forms module has not been updated to Drupal 7 and there are no
- plans to do so, as unfortuntely the module's design does not allow for
+ plans to do so, as unfortunately the module's design does not allow for
automatic configuration updates.
Thus, a possible future Rules 2.x Forms module is likely to work
different, e.g. by working only for entity forms on the field level.
diff --git a/sites/all/modules/contrib/admin/rules/includes/faces.inc b/sites/all/modules/contrib/admin/rules/includes/faces.inc
index 213cd818..d0fe8ce1 100644
--- a/sites/all/modules/contrib/admin/rules/includes/faces.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/faces.inc
@@ -1,7 +1,8 @@
object = $object;
}
@@ -63,17 +65,17 @@ if (!class_exists('FacesExtender', FALSE)) {
}
/**
- * Invokes any method on the extended object. May be used to invoke
- * protected methods.
+ * Invokes any method on the extended object, including protected methods.
*
- * @param $name
+ * @param string $name
* The method name.
- * @param $arguments
+ * @param array $args
* An array of arguments to pass to the method.
*/
protected function call($name, array $args = array()) {
return $this->object->call($name, $args);
}
+
}
}
@@ -108,7 +110,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
/**
* Magic method: Invoke the dynamically implemented methods.
*/
- function __call($name, $arguments = array()) {
+ public function __call($name, $arguments = array()) {
if (isset($this->facesMethods[$name])) {
$method = $this->facesMethods[$name];
// Include code, if necessary.
@@ -134,9 +136,11 @@ if (!class_exists('FacesExtendable', FALSE)) {
}
/**
- * Returns the extender object for the given class. May be used to
- * explicitly invoke a specific extender, e.g. a function overriding a
- * method may use that to explicitly invoke the original extender.
+ * Returns the extender object for the given class.
+ *
+ * May be used to explicitly invoke a specific extender, e.g. a function
+ * overriding a method may use that to explicitly invoke the original
+ * extender.
*/
public function extender($class) {
if (!isset($this->facesClassInstances[$class])) {
@@ -146,14 +150,17 @@ if (!class_exists('FacesExtendable', FALSE)) {
}
/**
+ * Returns whether the object can face as the given interface.
+ *
* Returns whether the object can face as the given interface, thus it
- * returns TRUE if this oject has been extended by an appropriate
+ * returns TRUE if this object has been extended by an appropriate
* implementation.
*
* @param $interface
- * Optional. A interface to test for. If it's omitted, all interfaces that
- * the object can be faced as are returned.
- * @return
+ * Optional. An interface to test for. If it's omitted, all interfaces
+ * that the object can be faced as are returned.
+ *
+ * @return bool
* Whether the object can face as the interface or an array of interface
* names.
*/
@@ -169,9 +176,9 @@ if (!class_exists('FacesExtendable', FALSE)) {
*
* @param $interface
* The interface name or an array of interface names.
- * @param $class
+ * @param $className
* The extender class, which has to implement the FacesExtenderInterface.
- * @param $include
+ * @param array $includes
* An optional array describing the file to include before invoking the
* class. The array entries known are 'type', 'module', and 'name'
* matching the parameters of module_load_include(). Only 'module' is
@@ -206,10 +213,10 @@ if (!class_exists('FacesExtendable', FALSE)) {
* @param $interface
* The interface name or FALSE to extend the object without a given
* interface.
- * @param $methods
+ * @param array $callbacks
* An array, where the keys are methods of the given interface and the
* values the callback functions to use.
- * @param $includes
+ * @param array $includes
* An optional array to describe files to include before invoking the
* callbacks. You may pass a single array describing one include for all
* callbacks or an array of arrays, keyed by the method names. Look at the
@@ -234,11 +241,11 @@ if (!class_exists('FacesExtendable', FALSE)) {
/**
* Override the implementation of an extended method.
*
- * @param $methods
- * An array of methods of the interface, that should be overriden, where
+ * @param array $callbacks
+ * An array of methods of the interface, that should be overridden, where
* the keys are methods to override and the values the callback functions
* to use.
- * @param $includes
+ * @param array $includes
* An optional array to describe files to include before invoking the
* callbacks. You may pass a single array describing one include for all
* callbacks or an array of arrays, keyed by the method names. Look at the
@@ -257,6 +264,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
/**
* Adds in include files for the given methods while removing any old files.
+ *
* If a single include file is described, it's added for all methods.
*/
protected function addIncludes($methods, $includes) {
@@ -272,6 +280,8 @@ if (!class_exists('FacesExtendable', FALSE)) {
}
/**
+ * Destroys all references to created instances.
+ *
* Destroys all references to created instances so that PHP's garbage
* collection can do its work. This is needed as PHP's gc has troubles with
* circular references until PHP < 5.3.
@@ -296,9 +306,9 @@ if (!class_exists('FacesExtendable', FALSE)) {
* This also allows to pass arguments by reference, so it may be used to
* pass arguments by reference to dynamically extended methods.
*
- * @param $name
+ * @param string $name
* The method name.
- * @param $arguments
+ * @param array $args
* An array of arguments to pass to the method.
*/
public function call($name, array $args = array()) {
@@ -307,5 +317,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
}
return $this->__call($name, $args);
}
+
}
-}
\ No newline at end of file
+
+}
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.core.inc b/sites/all/modules/contrib/admin/rules/includes/rules.core.inc
index 559d1cff..b00ed410 100644
--- a/sites/all/modules/contrib/admin/rules/includes/rules.core.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.core.inc
@@ -7,8 +7,7 @@
// This is not necessary as the classes are autoloaded via the registry. However
// it saves some possible update headaches until the registry is rebuilt.
-// @todo
-// Remove for a future release.
+// @todo Remove for a future release.
require_once dirname(__FILE__) . '/faces.inc';
/**
@@ -29,10 +28,11 @@ class RulesEntityController extends EntityAPIControllerExportable {
/**
* Overridden.
+ *
* @see DrupalDefaultEntityController::attachLoad()
*/
protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
- // Retrieve stdClass records and turn them in rules objects stored in 'data'
+ // Retrieve stdClass records and store them as rules objects in 'data'.
$ids = array_keys($queried_entities);
$result = db_select('rules_tags')
->fields('rules_tags', array('id', 'tag'))
@@ -68,7 +68,8 @@ class RulesEntityController extends EntityAPIControllerExportable {
/**
* Override to support having events and tags as conditions.
- * @see EntityAPIController::applyConditions($entities, $conditions)
+ *
+ * @see EntityAPIController::applyConditions()
* @see rules_query_rules_config_load_multiple_alter()
*/
protected function applyConditions($entities, $conditions = array()) {
@@ -106,6 +107,8 @@ class RulesEntityController extends EntityAPIControllerExportable {
* @param $export
* A serialized string in JSON format as produced by the
* RulesPlugin::export() method, or the PHP export as usual PHP array.
+ * @param string $error_msg
+ * The error message.
*/
public function import($export, &$error_msg = '') {
$export = is_array($export) ? $export : drupal_json_decode($export);
@@ -113,8 +116,9 @@ class RulesEntityController extends EntityAPIControllerExportable {
$error_msg = t('Unable to parse the pasted export.');
return FALSE;
}
- // The key ist the configuration name and the value the actual export.
- list($name, $export) = each($export);
+ // The key is the configuration name and the value the actual export.
+ $name = key($export);
+ $export = current($export);
if (!isset($export['PLUGIN'])) {
$error_msg = t('Export misses plugin information.');
return FALSE;
@@ -201,10 +205,10 @@ class RulesEntityController extends EntityAPIControllerExportable {
foreach ($rules_config->events() as $event) {
db_insert('rules_trigger')
->fields(array(
- 'id' => $rules_config->id,
- 'event' => $event,
- ))
- ->execute();
+ 'id' => $rules_config->id,
+ 'event' => $event,
+ ))
+ ->execute();
}
}
@@ -216,16 +220,17 @@ class RulesEntityController extends EntityAPIControllerExportable {
foreach ($rules_config->dependencies as $dependency) {
db_insert('rules_dependencies')
->fields(array(
- 'id' => $rules_config->id,
- 'module' => $dependency,
- ))
- ->execute();
+ 'id' => $rules_config->id,
+ 'module' => $dependency,
+ ))
+ ->execute();
}
}
}
/**
* Overridden to support tags and events in $conditions.
+ *
* @see EntityAPIControllerExportable::buildQuery()
*/
protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
@@ -233,7 +238,7 @@ class RulesEntityController extends EntityAPIControllerExportable {
$query_conditions =& $query->conditions();
foreach ($query_conditions as &$condition) {
// One entry in $query_conditions is a string with key '#conjunction'.
- // @see QueryConditionInterface::conditions().
+ // @see QueryConditionInterface::conditions()
if (is_array($condition)) {
// Support using 'tags' => array('tag1', 'tag2') as condition.
if ($condition['field'] == 'base.tags') {
@@ -254,6 +259,7 @@ class RulesEntityController extends EntityAPIControllerExportable {
/**
* Overridden to also delete tags and events.
+ *
* @see EntityAPIControllerExportable::delete()
*/
public function delete($ids, DatabaseTransaction $transaction = NULL) {
@@ -304,9 +310,12 @@ class RulesEntityController extends EntityAPIControllerExportable {
return $return;
}
+
}
/**
+ * Base class for RulesExtendables.
+ *
* The RulesExtendable uses the rules cache to setup the defined extenders
* and overrides automatically.
* As soon faces is used the faces information is autoloaded using setUp().
@@ -315,6 +324,7 @@ abstract class RulesExtendable extends FacesExtendable {
/**
* The name of the info definitions associated with info about this class.
+ *
* This would be defined abstract, if possible. Common rules hooks with class
* info are e.g. plugin_info and data_info.
*/
@@ -325,8 +335,8 @@ abstract class RulesExtendable extends FacesExtendable {
*/
protected $itemName;
- protected $cache, $itemInfo = array();
-
+ protected $cache;
+ protected $itemInfo = array();
public function __construct() {
$this->setUp();
@@ -339,14 +349,14 @@ abstract class RulesExtendable extends FacesExtendable {
if (isset($this->cache[$this->hook][$this->itemName])) {
$this->itemInfo = &$this->cache[$this->hook][$this->itemName];
}
- // Set up the Faces Extenders
+ // Set up the Faces Extenders.
if (!empty($this->itemInfo['faces_cache'])) {
list($this->facesMethods, $this->facesIncludes, $this->faces) = $this->itemInfo['faces_cache'];
}
}
/**
- * Force the object to be setUp, this executes setUp() if not done yet.
+ * Forces the object to be setUp, this executes setUp() if not done yet.
*/
public function forceSetUp() {
if (!isset($this->cache) || (!empty($this->itemInfo['faces_cache']) && !$this->faces)) {
@@ -401,12 +411,14 @@ abstract class RulesExtendable extends FacesExtendable {
* The info about the item as specified in the hook.
* @param $interface
* The interface to check for.
- * @return
+ *
+ * @return bool
* Whether it supports the given interface.
*/
public static function itemFacesAs(&$itemInfo, $interface) {
return in_array($interface, class_implements($itemInfo['class'])) || isset($itemInfo['faces_cache'][2][$interface]);
}
+
}
/**
@@ -438,11 +450,13 @@ abstract class RulesPlugin extends RulesExtendable {
/**
* The parent element, if any.
+ *
* @var RulesContainerPlugin
*/
protected $parent = NULL;
- protected $cache = NULL, $hook = 'plugin_info';
+ protected $cache = NULL;
+ protected $hook = 'plugin_info';
/**
* Identifies an element inside a configuration.
@@ -454,7 +468,6 @@ abstract class RulesPlugin extends RulesExtendable {
*/
protected $availableVariables;
-
/**
* Sets a new parent element.
*/
@@ -532,7 +545,7 @@ abstract class RulesPlugin extends RulesExtendable {
* Iterate over all elements nested below the current element.
*
* This helper can be used to recursively iterate over all elements of a
- * configuration. To iterate over the children only, just regulary iterate
+ * configuration. To iterate over the children only, just regularly iterate
* over the object.
*
* @param $mode
@@ -585,7 +598,7 @@ abstract class RulesPlugin extends RulesExtendable {
/**
* Evaluate the element on a given rules evaluation state.
*/
- abstract function evaluate(RulesState $state);
+ abstract public function evaluate(RulesState $state);
protected static function compare(RulesPlugin $a, RulesPlugin $b) {
if ($a->weight == $b->weight) {
@@ -610,7 +623,7 @@ abstract class RulesPlugin extends RulesExtendable {
/**
* Returns info about parameters needed for executing the configured plugin.
*
- * @param $optional
+ * @param bool $optional
* Whether optional parameters should be included.
*
* @see self::pluginParameterInfo()
@@ -743,19 +756,21 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Returns asserted additions to the available variable info. Any returned
- * info is merged into the variable info, in case the execution flow passes
- * the element.
+ * Returns asserted additions to the available variable info.
+ *
+ * Any returned info is merged into the variable info, in case the execution
+ * flow passes the element.
* E.g. this is used to assert the content type of a node if the condition
- * is met, such that the per node type properties are available.
+ * is met, such that the per-node type properties are available.
*/
protected function variableInfoAssertions() {
return array();
}
/**
- * Get the name of this plugin instance. The returned name should identify
- * the code which drives this plugin.
+ * Gets the name of this plugin instance.
+ *
+ * The returned name should identify the code which drives this plugin.
*/
public function getPluginName() {
return $this->itemName;
@@ -812,7 +827,6 @@ abstract class RulesPlugin extends RulesExtendable {
* Usually settings get processed automatically, however if $this->settings
* has been altered manually after element construction, it needs to be
* invoked explicitly with $force set to TRUE.
- *
*/
public function processSettings($force = FALSE) {
// Process if not done yet.
@@ -838,14 +852,15 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Makes sure the plugin is configured right, e.g. all needed variables
- * are available in the element's scope and dependent modules are enabled.
+ * Makes sure the plugin is configured right.
*
- * @return RulesPlugin
- * Returns $this to support chained usage.
+ * "Configured right" means all needed variables are available in the
+ * element's scope and dependent modules are enabled.
+ *
+ * @return $this
*
* @throws RulesIntegrityException
- * In case of a failed integraty check, a RulesIntegrityException exception
+ * In case of a failed integrity check, a RulesIntegrityException exception
* is thrown.
*/
public function integrityCheck() {
@@ -900,21 +915,24 @@ abstract class RulesPlugin extends RulesExtendable {
elseif (!$this->isRoot() && !isset($this->settings[$name]) && empty($info['optional']) && $info['type'] != 'hidden') {
throw new RulesIntegrityException(t('Missing configuration for parameter %name.', array('%name' => $name)), array($this, 'parameter', $name));
}
- //TODO: Make sure used values are allowed. (key/value pairs + allowed values)
+ // @todo Make sure used values are allowed.
+ // (key/value pairs + allowed values).
}
}
/**
+ * Returns the argument for the parameter $name described with $info.
+ *
* Returns the argument as configured in the element settings for the
* parameter $name described with $info.
*
- * @param $name
+ * @param string $name
* The name of the parameter for which to get the argument.
* @param $info
* Info about the parameter.
* @param RulesState $state
* The current evaluation state.
- * @param $langcode
+ * @param string $langcode
* (optional) The language code used to get the argument value if the
* argument value should be translated. By default (NULL) the current
* interface language will be used.
@@ -967,7 +985,7 @@ abstract class RulesPlugin extends RulesExtendable {
if (!empty($this->settings[$name . ':process'])) {
// For processing, make sure the data is unwrapped now.
$return = rules_unwrap_data(array($arg), array($info));
- // @todo for Drupal 8: Refactor to add the name and language code as
+ // @todo For Drupal 8: Refactor to add the name and language code as
// separate parameter to process().
$info['#name'] = $name;
$info['#langcode'] = $langcode;
@@ -1004,10 +1022,12 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Apply the given data selector by using the info about available variables.
- * Thus it doesn't require an actual evaluation state.
+ * Applies the given data selector.
*
- * @param $selector
+ * Applies the given data selector by using the info about available
+ * variables. Thus it doesn't require an actual evaluation state.
+ *
+ * @param string $selector
* The selector string, e.g. "node:author:mail".
*
* @return EntityMetadataWrapper
@@ -1029,7 +1049,7 @@ abstract class RulesPlugin extends RulesExtendable {
}
}
}
- // In case of an exception or we were unable to get a wrapper, return FALSE.
+ // Return FALSE if there is no wrappper or we get an exception.
catch (EntityMetadataWrapperException $e) {
return FALSE;
}
@@ -1064,8 +1084,10 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Saves the configuration to the database, regardless whether this is invoked
- * on the rules configuration or a contained rule element.
+ * Saves the configuration to the database.
+ *
+ * The configuration is saved regardless whether this method is invoked on
+ * the rules configuration or a contained rule element.
*/
public function save($name = NULL, $module = 'rules') {
if (isset($this->parent)) {
@@ -1095,7 +1117,7 @@ abstract class RulesPlugin extends RulesExtendable {
// default configurations 'module' points to the module providing the
// default configuration, so the module via which the rules is configured
// is stored in the "owner" property.
- // @todo: For Drupal 8 use "owner" for generating machine names also and
+ // @todo For Drupal 8 use "owner" for generating machine names also and
// module only for the modules providing default configurations.
$this->module = !isset($this->module) || $module != 'rules' ? $module : $this->module;
if (!isset($this->owner)) {
@@ -1190,6 +1212,8 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
+ * Deletes configuration from database.
+ *
* If invoked on a rules configuration it is deleted from database. If
* invoked on a contained rule element, it's removed from the configuration.
*/
@@ -1234,7 +1258,7 @@ abstract class RulesPlugin extends RulesExtendable {
* A status constant, i.e. one of ENTITY_CUSTOM, ENTITY_IN_CODE,
* ENTITY_OVERRIDDEN or ENTITY_FIXED.
*
- * @return
+ * @return bool
* TRUE if the configuration has the status, else FALSE.
*
* @see entity_has_status()
@@ -1244,8 +1268,7 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Remove circular object references so the PHP garbage collector does its
- * work.
+ * Removes circular object references so PHP garbage collector can work.
*/
public function destroy() {
parent::destroy();
@@ -1253,8 +1276,9 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Seamlessy invokes the method implemented via faces without having to think
- * about references.
+ * Seamlessly invokes the method implemented via faces.
+ *
+ * Frees the caller from having to think about references.
*/
public function form(&$form, &$form_state, array $options = array()) {
$this->__call('form', array(&$form, &$form_state, $options));
@@ -1338,13 +1362,14 @@ abstract class RulesPlugin extends RulesExtendable {
/**
* Exports a rule configuration.
*
- * @param $prefix
+ * @param string $prefix
* An optional prefix for each line.
- * @param $php
+ * @param bool $php
* Optional. Set to TRUE to format the export using PHP arrays. By default
* JSON is used.
+ *
* @return
- * The exported confiugration.
+ * The exported configuration.
*
* @see rules_import()
*/
@@ -1394,8 +1419,17 @@ abstract class RulesPlugin extends RulesExtendable {
}
/**
- * Finalizies the configuration export by adding general attributes regarding
- * the configuration and returns it in the right format.
+ * Finalizes the configuration export.
+ *
+ * Adds general attributes regarding the configuration and returns it in the
+ * right format for export.
+ *
+ * @param $export
+ * @param string $prefix
+ * An optional prefix for each line.
+ * @param bool $php
+ * Optional. Set to TRUE to format the export using PHP arrays. By default
+ * JSON is used.
*/
protected function returnExport($export, $prefix = '', $php = FALSE) {
$this->ensureNameExists();
@@ -1441,11 +1475,13 @@ abstract class RulesPlugin extends RulesExtendable {
public function resetInternalCache() {
$this->availableVariables = NULL;
}
+
}
/**
- * Defines a common base class for so called "Abstract Plugins" like actions.
- * Thus modules have to provide the concrete plugin implementation.
+ * Defines a common base class for so-called "Abstract Plugins" like actions.
+ *
+ * Modules have to provide the concrete plugin implementation.
*/
abstract class RulesAbstractPlugin extends RulesPlugin {
@@ -1454,14 +1490,14 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
protected $infoLoaded = FALSE;
/**
- * @param $name
+ * @param string $name
* The plugin implementation's name.
- * @param $info
+ * @param $settings
* Further information provided about the plugin. Optional.
* @throws RulesException
* If validation of the passed settings fails RulesExceptions are thrown.
*/
- function __construct($name = NULL, $settings = array()) {
+ public function __construct($name = NULL, $settings = array()) {
$this->elementName = $name;
$this->settings = (array) $settings + array('#_needs_processing' => TRUE);
$this->setUp();
@@ -1472,7 +1508,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
if (isset($this->cache[$this->itemName . '_info'][$this->elementName])) {
$this->info = $this->cache[$this->itemName . '_info'][$this->elementName];
// Remember that the info has been correctly setup.
- // @see self::forceSetup().
+ // @see self::forceSetup()
$this->infoLoaded = TRUE;
// Register the defined class, if any.
@@ -1652,7 +1688,6 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
*/
abstract protected function executeCallback(array $args, RulesState $state = NULL);
-
public function evaluate(RulesState $state) {
$this->processSettings();
try {
@@ -1676,7 +1711,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
}
public function getPluginName() {
- return $this->itemName ." ". $this->elementName;
+ return $this->itemName . " " . $this->elementName;
}
/**
@@ -1696,8 +1731,8 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
self::includeFiles();
// Get the plugin's own info data.
- $cache[$this->itemName .'_info'] = rules_fetch_data($this->itemName .'_info');
- foreach ($cache[$this->itemName .'_info'] as $name => &$info) {
+ $cache[$this->itemName . '_info'] = rules_fetch_data($this->itemName . '_info');
+ foreach ($cache[$this->itemName . '_info'] as $name => &$info) {
$info += array(
'parameter' => isset($info['arguments']) ? $info['arguments'] : array(),
'provides' => isset($info['new variables']) ? $info['new variables'] : array(),
@@ -1715,7 +1750,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
// RulesPluginImplInterface.
unset($this->faces['RulesPluginHandlerInterface']);
- // Build up the per plugin implementation faces cache.
+ // Build up the per-plugin implementation faces cache.
foreach ($this->faces as $interface) {
$methods = $file_names = array();
$includes = self::getIncludeFiles($info['module']);
@@ -1738,7 +1773,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
// Cache only the plugin implementation specific callbacks.
$info['faces_cache'][$interface] = array($methods, array_filter($file_names));
}
- // Filter out interfaces with no overriden methods.
+ // Filter out interfaces with no overridden methods.
$info['faces_cache'] = rules_filter_array($info['faces_cache'], 0, TRUE);
// We don't need that any more.
unset($info['callbacks'], $info['base']);
@@ -1746,7 +1781,9 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
}
/**
- * Makes sure the providing modules' .rules.inc file is included as diverse
+ * Loads this module's .rules.inc file.
+ *
+ * Makes sure the providing modules' .rules.inc file is included, as diverse
* callbacks may reside in that file.
*/
protected function loadBasicInclude() {
@@ -1760,7 +1797,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
}
/**
- * Make sure all supported destinations are included.
+ * Makes sure all supported destinations are included.
*/
public static function includeFiles() {
static $included;
@@ -1782,8 +1819,11 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
$dirs += $result;
}
foreach ($dirs as $module => $directory) {
- foreach (glob(drupal_get_path('module', $module) . "/$directory/*.{inc,php}", GLOB_BRACE) as $filename) {
- include_once $filename;
+ $module_path = drupal_get_path('module', $module);
+ foreach (array('inc', 'php') as $extension) {
+ foreach (glob("$module_path/$directory/*.$extension") as $filename) {
+ include_once $filename;
+ }
}
}
$included = TRUE;
@@ -1791,11 +1831,18 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
}
/**
- * Returns all include files for a module. If $all is set to FALSE the
- * $module.rules.inc file isn't added.
+ * Returns all include files for a module.
+ *
+ * @param string $module
+ * The module name.
+ * @param bool $all
+ * If FALSE, the $module.rules.inc file isn't added.
+ *
+ * @return string[]
+ * An array containing the names of all the include files for a module.
*/
protected static function getIncludeFiles($module, $all = TRUE) {
- $files = (array)module_invoke($module, 'rules_file_info');
+ $files = (array) module_invoke($module, 'rules_file_info');
// Automatically add "$module.rules_forms.inc" and "$module.rules.inc".
$files[] = $module . '.rules_forms';
if ($all) {
@@ -1805,40 +1852,49 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
}
protected function getFileName($function, $includes) {
- $reflector = new ReflectionFunction($function);
- // On windows the path contains backslashes instead of slashes, fix that.
- $file = str_replace('\\', '/', $reflector->getFileName());
- foreach ($includes as $include) {
- $pos = strpos($file, $include . '.inc');
- // Test whether the file ends with the given filename.inc.
- if ($pos !== FALSE && strlen($file) - $pos == strlen($include) + 4) {
- return $include;
+ static $filenames;
+ if (!isset($filenames) || !array_key_exists($function, $filenames)) {
+ $filenames[$function] = NULL;
+ $reflector = new ReflectionFunction($function);
+ // On windows the path contains backslashes instead of slashes, fix that.
+ $file = str_replace('\\', '/', $reflector->getFileName());
+ foreach ($includes as $include) {
+ $pos = strpos($file, $include . '.inc');
+ // Test whether the file ends with the given filename.inc.
+ if ($pos !== FALSE && strlen($file) - $pos == strlen($include) + 4) {
+ $filenames[$function] = $include;
+ return $include;
+ }
}
}
+ return $filenames[$function];
}
+
}
/**
- * Interface for objects that can be used as action.
+ * Interface for objects that can be used as actions.
*/
interface RulesActionInterface {
/**
- * @return As specified.
+ * @return
+ * As specified.
*
* @throws RulesEvaluationException
* Throws an exception if not all necessary arguments have been provided.
*/
public function execute();
+
}
/**
- * Interface for objects that can be used as condition.
+ * Interface for objects that can be used as conditions.
*/
interface RulesConditionInterface {
/**
- * @return Boolean.
+ * @return bool
*
* @throws RulesEvaluationException
* Throws an exception if not all necessary arguments have been provided.
@@ -1854,8 +1910,12 @@ interface RulesConditionInterface {
* Returns whether the element is configured to negate the result.
*/
public function isNegated();
+
}
+/**
+ * Interface for objects that are triggerable.
+ */
interface RulesTriggerableInterface {
/**
@@ -1866,8 +1926,9 @@ interface RulesTriggerableInterface {
/**
* Removes an event from the rule configuration.
*
- * @param $event
+ * @param string $event_name
* The name of the (configured) event to remove.
+ *
* @return RulesTriggerableInterface
* The object instance itself, to allow chaining.
*/
@@ -1889,7 +1950,7 @@ interface RulesTriggerableInterface {
/**
* Gets the event settings associated with the given (configured) event.
*
- * @param $event_name
+ * @param string $event_name
* The (configured) event's name.
*
* @return array|null
@@ -1915,7 +1976,8 @@ interface RulesPluginHandlerInterface {
/**
* Processes settings independent from a form submission.
*
- * Processing results may be stored and accessed on execution time in $settings.
+ * Processing results may be stored and accessed on execution time
+ * in $settings.
*/
public function process();
@@ -1947,7 +2009,7 @@ interface RulesPluginHandlerInterface {
public function dependencies();
/**
- * Alter the generated configuration form of the element.
+ * Alters the generated configuration form of the element.
*
* Validation and processing of the settings should be untied from the form
* and implemented in validate() and process() wherever it makes sense.
@@ -1956,11 +2018,11 @@ interface RulesPluginHandlerInterface {
*/
public function form_alter(&$form, $form_state, $options);
-
/**
- * Optionally returns an array of info assertions for the specified
- * parameters. This allows conditions to assert additional metadata, such as
- * info about the fields of a bundle.
+ * Returns an array of info assertions for the specified parameters.
+ *
+ * This allows conditions to assert additional metadata, such as info about
+ * the fields of a bundle.
*
* @see RulesPlugin::variableInfoAssertions()
*/
@@ -1999,6 +2061,7 @@ interface RulesConditionHandlerInterface extends RulesPluginHandlerInterface {}
interface RulesActionHandlerInterface extends RulesPluginHandlerInterface {}
/**
+ * Interface used for implementing an abstract plugin via Faces.
*
* Provides the interface used for implementing an abstract plugin by using
* the Faces extension mechanism.
@@ -2006,9 +2069,10 @@ interface RulesActionHandlerInterface extends RulesPluginHandlerInterface {}
interface RulesPluginImplInterface extends RulesPluginHandlerInterface {
/**
- * Execute the action or condition making use of the parameters as specified.
+ * Executes the action or condition making use of the parameters as specified.
*/
public function execute();
+
}
/**
@@ -2017,10 +2081,12 @@ interface RulesPluginImplInterface extends RulesPluginHandlerInterface {
* @see RulesContainerPlugin::optimize()
*/
interface RulesOptimizationInterface {
+
/**
* Optimizes a rule configuration in order to speed up evaluation.
*/
public function optimize();
+
}
/**
@@ -2049,11 +2115,17 @@ abstract class RulesPluginHandlerBase extends FacesExtender implements RulesPlug
}
public function validate() {}
+
public function process() {}
+
public function info_alter(&$element_info) {}
+
public function dependencies() {}
+
public function form_alter(&$form, $form_state, $options) {}
+
public function assertions() {}
+
}
/**
@@ -2067,7 +2139,7 @@ abstract class RulesConditionHandlerBase extends RulesPluginHandlerBase implemen
abstract class RulesActionHandlerBase extends RulesPluginHandlerBase implements RulesActionHandlerInterface {}
/**
- * Class providing default implementations of the methods of the RulesPluginImplInterface.
+ * Provides default implementations of all RulesPluginImplInterface methods.
*
* If a plugin implementation does not provide a function for a method, the
* default method of this class will be invoked.
@@ -2078,8 +2150,9 @@ abstract class RulesActionHandlerBase extends RulesPluginHandlerBase implements
class RulesAbstractPluginDefaults extends RulesPluginHandlerBase implements RulesPluginImplInterface {
public function execute() {
- throw new RulesEvaluationException($this->object->getPluginName() .": Execution implementation is missing.", array(), $this->object, RulesLog::ERROR);
+ throw new RulesEvaluationException($this->object->getPluginName() . ": Execution implementation is missing.", array(), $this->object, RulesLog::ERROR);
}
+
}
/**
@@ -2087,13 +2160,14 @@ class RulesAbstractPluginDefaults extends RulesPluginHandlerBase implements Rule
*/
class RulesRecursiveElementIterator extends ArrayIterator implements RecursiveIterator {
- public function getChildren() {
- return $this->current()->getIterator();
- }
+ public function getChildren() {
+ return $this->current()->getIterator();
+ }
+
+ public function hasChildren() {
+ return $this->current() instanceof IteratorAggregate;
+ }
- public function hasChildren() {
- return $this->current() instanceof IteratorAggregate;
- }
}
/**
@@ -2124,7 +2198,7 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
}
/**
- * Allow access to the children through the iterator.
+ * Allows access to the children through the iterator.
*
* @return RulesRecursiveElementIterator
*/
@@ -2186,6 +2260,8 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
}
/**
+ * Returns available state variables for an element.
+ *
* Returns info about variables available in the evaluation state for any
* children elements or if given for a special child element.
*
@@ -2228,6 +2304,8 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
}
/**
+ * Executes container with the given arguments.
+ *
* Condition containers just return a boolean while action containers return
* the configured provided variables as an array of variables.
*/
@@ -2282,7 +2360,7 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
}
/**
- * Override delete to keep the children alive, if possible.
+ * Overrides delete to keep the children alive, if possible.
*/
public function delete($keep_children = TRUE) {
if (isset($this->parent) && $keep_children) {
@@ -2300,13 +2378,13 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
/**
* Sorts all child elements by their weight.
*
- * @param $deep
+ * @param bool $deep
* If enabled a deep sort is performed, thus the whole element tree below
* this element is sorted.
*/
public function sortChildren($deep = FALSE) {
// Make sure the array order is kept in case two children have the same
- // weight by ensuring later childrens would have higher weights.
+ // weight by ensuring later children would have higher weights.
foreach (array_values($this->children) as $i => $child) {
$child->weight += $i / 1000;
}
@@ -2335,9 +2413,10 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
}
/**
- * Determines whether the element should be exported in flat style. Flat style
- * means that the export keys are written directly into the export array,
- * whereas else the export is written into a sub-array.
+ * Determines whether the element should be exported in flat style.
+ *
+ * Flat style means that the export keys are written directly into the export
+ * array, whereas else the export is written into a sub-array.
*/
protected function exportFlat() {
// By default we always use flat style for plugins without any parameters
@@ -2399,6 +2478,7 @@ abstract class RulesContainerPlugin extends RulesPlugin implements IteratorAggre
$element->optimize();
}
}
+
}
/**
@@ -2416,11 +2496,12 @@ abstract class RulesActionContainer extends RulesContainerPlugin implements Rule
}
/**
- * Add an action. Pass either an instance of the RulesActionInterface
- * or the arguments as needed by rules_action().
+ * Adds an action to the container.
*
- * @return RulesActionContainer
- * Returns $this to support chained usage.
+ * Pass in either an instance of the RulesActionInterface or the arguments
+ * as needed by rules_action().
+ *
+ * @return $this
*/
public function action($name, $settings = array()) {
$action = (is_object($name) && $name instanceof RulesActionInterface) ? $name : rules_action($name, $settings);
@@ -2452,6 +2533,8 @@ abstract class RulesActionContainer extends RulesContainerPlugin implements Rule
}
/**
+ * Returns an array of provided variable names.
+ *
* Returns an array of variable names, which are provided by passing through
* the provided variables of the children.
*/
@@ -2474,6 +2557,7 @@ abstract class RulesActionContainer extends RulesContainerPlugin implements Rule
$this->info['provides'] = $export['PROVIDES VARIABLES'];
}
}
+
}
/**
@@ -2484,11 +2568,12 @@ abstract class RulesConditionContainer extends RulesContainerPlugin implements R
protected $negate = FALSE;
/**
- * Add a condition. Pass either an instance of the RulesConditionInterface
- * or the arguments as needed by rules_condition().
+ * Adds a condition to the container.
*
- * @return RulesConditionContainer
- * Returns $this to support chained usage.
+ * Pass in either an instance of the RulesConditionInterface or the arguments
+ * as needed by rules_condition().
+ *
+ * @return $this
*/
public function condition($name, $settings = array()) {
$condition = (is_object($name) && $name instanceof RulesConditionInterface) ? $name : rules_condition($name, $settings);
@@ -2556,6 +2641,7 @@ abstract class RulesConditionContainer extends RulesContainerPlugin implements R
}
return $vars;
}
+
}
/**
@@ -2573,7 +2659,7 @@ class RulesLog {
* @return RulesLog
* Returns the rules logger instance.
*/
- static function logger() {
+ public static function logger() {
if (!isset(self::$logger)) {
$class = __CLASS__;
self::$logger = new $class(variable_get('rules_log_level', self::INFO));
@@ -2582,7 +2668,8 @@ class RulesLog {
}
protected $log = array();
- protected $logLevel, $line = 0;
+ protected $logLevel;
+ protected $line = 0;
/**
* This is a singleton.
@@ -2609,7 +2696,7 @@ class RulesLog {
/**
* Checks the log and throws an exception if there were any problems.
*/
- function checkLog($logLevel = self::WARN) {
+ public function checkLog($logLevel = self::WARN) {
foreach ($this->log as $entry) {
if ($entry[2] >= $logLevel) {
throw new Exception($this->render());
@@ -2618,9 +2705,13 @@ class RulesLog {
}
/**
- * Checks the log for (error) messages with a log level equal or higher than the given one.
+ * Checks the log for error messages.
*
- * @return
+ * @param int $logLevel
+ * Lowest log level to return. Values lower than $logLevel will not be
+ * returned.
+ *
+ * @return bool
* Whether the an error has been logged.
*/
public function hasErrors($logLevel = self::WARN) {
@@ -2666,20 +2757,20 @@ class RulesLog {
// messages here.
$vars['head'] = t($this->log[$line][0], $this->log[$line][1]);
if (isset($this->log[$line][5])) {
- $vars['link'] = '[' . l('edit', $this->log[$line][5]) . ']';
+ $vars['link'] = '[' . l(t('edit'), $this->log[$line][5]) . ']';
}
$vars['log'] = $this->renderHelper($line);
$output[] = theme('rules_debug_element', $vars);
}
else {
- $formatted_diff = round(($this->log[$line][3] - $startTime) * 1000, 3) .' ms';
- $msg = $formatted_diff .' '. t($this->log[$line][0], $this->log[$line][1]);
+ $formatted_diff = round(($this->log[$line][3] - $startTime) * 1000, 3) . ' ms';
+ $msg = $formatted_diff . ' ' . t($this->log[$line][0], $this->log[$line][1]);
if ($this->log[$line][2] >= RulesLog::WARN) {
$level = $this->log[$line][2] == RulesLog::WARN ? 'warn' : 'error';
- $msg = ''. $msg .'';
+ $msg = '' . $msg . '';
}
if (isset($this->log[$line][5]) && !isset($this->log[$line][4])) {
- $msg .= ' [' . l('edit', $this->log[$line][5]) . ']';
+ $msg .= ' [' . l(t('edit'), $this->log[$line][5]) . ']';
}
$output[] = $msg;
@@ -2699,12 +2790,14 @@ class RulesLog {
public function clear() {
$this->log = array();
}
+
}
/**
- * A common exception for Rules.
+ * A base exception class for Rules.
*
- * This class can be used to catch all exceptions thrown by Rules.
+ * This class can be used to catch all exceptions thrown by Rules, and it
+ * may be subclassed to describe more specific exceptions.
*/
abstract class RulesException extends Exception {}
@@ -2717,21 +2810,27 @@ abstract class RulesException extends Exception {}
*/
class RulesEvaluationException extends RulesException {
- public $msg, $args, $severity, $element, $keys = array();
+ public $msg;
+ public $args;
+ public $severity;
+ public $element;
+ public $keys = array();
/**
- * @param $msg
+ * Constructor.
+ *
+ * @param string $msg
* The exception message containing placeholder as t().
- * @param $args
+ * @param array $args
* Replacement arguments such as for t().
* @param $element
* The element of a configuration causing the exception or an array
* consisting of the element and keys specifying a setting value causing
* the exception.
- * @param $severity
+ * @param int $severity
* The RulesLog severity. Defaults to RulesLog::WARN.
*/
- function __construct($msg, array $args = array(), $element = NULL, $severity = RulesLog::WARN) {
+ public function __construct($msg, array $args = array(), $element = NULL, $severity = RulesLog::WARN) {
$this->element = is_array($element) ? array_shift($element) : $element;
$this->keys = is_array($element) ? $element : array();
$this->msg = $msg;
@@ -2747,34 +2846,40 @@ class RulesEvaluationException extends RulesException {
rules_clear_cache();
}
}
- // @todo fix _drupal_decode_exception() to use __toString() and override it.
+ // @todo Fix _drupal_decode_exception() to use __toString() and override it.
$this->message = t($this->msg, $this->args);
}
+
}
/**
- * An exception that is thrown for Rules configurations that fail the integrity check.
+ * Indicates the Rules configuration failed the integrity check.
*
* @see RulesPlugin::integrityCheck()
*/
class RulesIntegrityException extends RulesException {
- public $msg, $element, $keys = array();
+ public $msg;
+ public $element;
+ public $keys = array();
/**
+ * Constructs a RulesIntegrityException object.
+ *
* @param string $msg
* The exception message, already translated.
* @param $element
* The element of a configuration causing the exception or an array
* consisting of the element and keys specifying a parameter or provided
* variable causing the exception, e.g.
- * @code array($element, 'parameter', 'node') @endcode.
+ * @code array($element, 'parameter', 'node') @endcode
*/
- function __construct($msg, $element = NULL) {
+ public function __construct($msg, $element = NULL) {
$this->element = is_array($element) ? array_shift($element) : $element;
$this->keys = is_array($element) ? $element : array();
parent::__construct($msg);
}
+
}
/**
@@ -2785,9 +2890,9 @@ class RulesDependencyException extends RulesIntegrityException {}
/**
* Determines the plugin to be used for importing a child element.
*
- * @param $key
+ * @param string $key
* The key to look for, e.g. 'OR' or 'DO'.
- * @param $default
+ * @param string $default
* The default to return if no special plugin can be found.
*/
function _rules_import_get_plugin($key, $default = 'action') {
@@ -2803,7 +2908,7 @@ function _rules_import_get_plugin($key, $default = 'action') {
}
}
}
- // Cut of any leading NOT from the key.
+ // Cut off any leading NOT from the key.
if (strpos($key, 'NOT ') === 0) {
$key = substr($key, 4);
}
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.event.inc b/sites/all/modules/contrib/admin/rules/includes/rules.event.inc
old mode 100755
new mode 100644
index 27f6a336..f97dec1e
--- a/sites/all/modules/contrib/admin/rules/includes/rules.event.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.event.inc
@@ -70,6 +70,7 @@ interface RulesEventHandlerInterface {
* Returns an array of default settings.
*
* @return array
+ * The array of default settings.
*/
public function getDefaults();
@@ -145,6 +146,7 @@ interface RulesEventHandlerInterface {
* The info array of the event the event handler belongs to.
*/
public function getEventInfo();
+
}
/**
@@ -169,6 +171,7 @@ interface RulesEventDispatcherInterface extends RulesEventHandlerInterface {
* TRUE if the event dispatcher is currently active, FALSE otherwise.
*/
public function isWatching();
+
}
/**
@@ -198,7 +201,7 @@ abstract class RulesEventHandlerBase implements RulesEventHandlerInterface {
protected $settings = array();
/**
- * Implements RulesEventHandlerInterface::__construct()
+ * Implements RulesEventHandlerInterface::__construct().
*/
public function __construct($event_name, $info) {
$this->eventName = $event_name;
@@ -207,14 +210,14 @@ abstract class RulesEventHandlerBase implements RulesEventHandlerInterface {
}
/**
- * Implements RulesEventHandlerInterface::getSettings()
+ * Implements RulesEventHandlerInterface::getSettings().
*/
public function getSettings() {
return $this->settings;
}
/**
- * Implements RulesEventHandlerInterface::setSettings()
+ * Implements RulesEventHandlerInterface::setSettings().
*/
public function setSettings(array $settings) {
$this->settings = $settings + $this->getDefaults();
@@ -222,14 +225,14 @@ abstract class RulesEventHandlerBase implements RulesEventHandlerInterface {
}
/**
- * Implements RulesEventHandlerInterface::validate()
+ * Implements RulesEventHandlerInterface::validate().
*/
public function validate() {
// Nothing to check by default.
}
/**
- * Implements RulesEventHandlerInterface::extractFormValues()
+ * Implements RulesEventHandlerInterface::extractFormValues().
*/
public function extractFormValues(array &$form, array &$form_state) {
foreach ($this->getDefaults() as $key => $setting) {
@@ -238,66 +241,68 @@ abstract class RulesEventHandlerBase implements RulesEventHandlerInterface {
}
/**
- * Implements RulesEventHandlerInterface::availableVariables()
+ * Implements RulesEventHandlerInterface::availableVariables().
*/
public function availableVariables() {
return isset($this->eventInfo['variables']) ? $this->eventInfo['variables'] : array();
}
/**
- * Implements RulesEventHandlerInterface::getEventName()
+ * Implements RulesEventHandlerInterface::getEventName().
*/
public function getEventName() {
return $this->eventName;
}
/**
- * Implements RulesEventHandlerInterface::getEventInfo()
+ * Implements RulesEventHandlerInterface::getEventInfo().
*/
public function getEventInfo() {
return $this->eventInfo;
}
+
}
/**
* A handler for events having no settings. This is the default handler.
*/
-class RulesEventDefaultHandler extends RulesEventHandlerBase {
+class RulesEventDefaultHandler extends RulesEventHandlerBase {
/**
- * Implements RulesEventHandlerInterface::buildForm()
+ * Implements RulesEventHandlerInterface::buildForm().
*/
public function buildForm(array &$form_state) {
return array();
}
/**
- * Implements RulesEventHandlerInterface::getConfiguredEventName()
+ * Implements RulesEventHandlerInterface::getConfiguredEventName().
*/
public function getEventNameSuffix() {
return '';
}
/**
- * Implements RulesEventHandlerInterface::summary()
+ * Implements RulesEventHandlerInterface::summary().
*/
public function summary() {
return check_plain($this->eventInfo['label']);
}
/**
- * Implements RulesEventHandlerInterface::getDefaults()
+ * Implements RulesEventHandlerInterface::getDefaults().
*/
public function getDefaults() {
return array();
}
/**
- * Implements RulesEventHandlerInterface::getSettings()
+ * Implements RulesEventHandlerInterface::getSettings().
*/
public function getSettings() {
return NULL;
}
+
}
/**
@@ -305,10 +310,12 @@ class RulesEventDefaultHandler extends RulesEventHandlerBase {
*/
class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
- protected $entityType, $entityInfo, $bundleKey;
+ protected $entityType;
+ protected $entityInfo;
+ protected $bundleKey;
/**
- * Implements RulesEventHandlerInterface::__construct()
+ * Implements RulesEventHandlerInterface::__construct().
*/
public function __construct($event_name, $info) {
parent::__construct($event_name, $info);
@@ -321,7 +328,7 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
}
/**
- * Implements RulesEventHandlerInterface::summary()
+ * Implements RulesEventHandlerInterface::summary().
*/
public function summary() {
$bundle = &$this->settings['bundle'];
@@ -331,7 +338,7 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
}
/**
- * Implements RulesEventHandlerInterface::buildForm()
+ * Implements RulesEventHandlerInterface::buildForm().
*/
public function buildForm(array &$form_state) {
$form['bundle'] = array(
@@ -340,6 +347,7 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
'#description' => t('If you need to filter for multiple values, either add multiple events or use the "Entity is of bundle" condition instead.'),
'#default_value' => $this->settings['bundle'],
'#empty_value' => '',
+ '#options' => array(),
);
foreach ($this->entityInfo['bundles'] as $name => $bundle_info) {
$form['bundle']['#options'][$name] = $bundle_info['label'];
@@ -351,20 +359,21 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
* Returns the label to use for the bundle property.
*
* @return string
+ * The label to use for the bundle property.
*/
protected function getBundlePropertyLabel() {
return $this->entityInfo['entity keys']['bundle'];
}
/**
- * Implements RulesEventHandlerInterface::extractFormValues()
+ * Implements RulesEventHandlerInterface::extractFormValues().
*/
public function extractFormValues(array &$form, array &$form_state) {
$this->settings['bundle'] = !empty($form_state['values']['bundle']) ? $form_state['values']['bundle'] : NULL;
}
/**
- * Implements RulesEventHandlerInterface::validate()
+ * Implements RulesEventHandlerInterface::validate().
*/
public function validate() {
if ($this->settings['bundle'] && empty($this->entityInfo['bundles'][$this->settings['bundle']])) {
@@ -373,19 +382,19 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
'%bundle' => $this->settings['bundle'],
'%entity_type' => $this->entityInfo['label'],
'@bundle' => $this->getBundlePropertyLabel(),
- )), array(NULL, 'bundle'));
+ )), array(NULL, 'bundle'));
}
}
/**
- * Implements RulesEventHandlerInterface::getConfiguredEventName()
+ * Implements RulesEventHandlerInterface::getConfiguredEventName().
*/
public function getEventNameSuffix() {
return $this->settings['bundle'];
}
/**
- * Implements RulesEventHandlerInterface::getDefaults()
+ * Implements RulesEventHandlerInterface::getDefaults().
*/
public function getDefaults() {
return array(
@@ -394,7 +403,7 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
}
/**
- * Implements RulesEventHandlerInterface::availableVariables()
+ * Implements RulesEventHandlerInterface::availableVariables().
*/
public function availableVariables() {
$variables = $this->eventInfo['variables'];
@@ -408,4 +417,5 @@ class RulesEventHandlerEntityBundle extends RulesEventHandlerBase {
}
return $variables;
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.plugins.inc b/sites/all/modules/contrib/admin/rules/includes/rules.plugins.inc
index 90b306d7..62fda469 100644
--- a/sites/all/modules/contrib/admin/rules/includes/rules.plugins.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.plugins.inc
@@ -1,15 +1,18 @@
negate ? t('NOT @condition', array('@condition' => $label)) : $label;
+ return $this->negate ? t('NOT !condition', array('!condition' => $label)) : $label;
}
+
}
/**
* An actual rule.
+ *
* Note: A rule also implements the RulesActionInterface (inherited).
*/
class Rule extends RulesActionContainer {
protected $conditions = NULL;
+
+ /**
+ * @var string
+ */
protected $itemName = 'rule';
+ /**
+ * @var string
+ */
public $label = 'unlabeled';
public function __construct($variables = array(), $providesVars = array()) {
@@ -159,8 +179,9 @@ class Rule extends RulesActionContainer {
}
/**
- * Get an iterator over all contained conditions. Note that this iterator also
- * implements the ArrayAcces interface.
+ * Gets an iterator over all contained conditions.
+ *
+ * Note that this iterator also implements the ArrayAccess interface.
*
* @return RulesRecursiveElementIterator
*/
@@ -183,8 +204,9 @@ class Rule extends RulesActionContainer {
}
/**
- * Get an iterator over all contained actions. Note that this iterator also
- * implements the ArrayAccess interface.
+ * Gets an iterator over all contained actions.
+ *
+ * Note that this iterator also implements the ArrayAccess interface.
*
* @return RulesRecursiveElementIterator
*/
@@ -193,11 +215,12 @@ class Rule extends RulesActionContainer {
}
/**
- * Add a condition. Pass either an instance of the RulesConditionInterface
- * or the arguments as needed by rules_condition().
+ * Adds a condition.
*
- * @return Rule
- * Returns $this to support chained usage.
+ * Pass either an instance of the RulesConditionInterface or the arguments as
+ * needed by rules_condition().
+ *
+ * @return $this
*/
public function condition($name, $settings = array()) {
$this->conditions->condition($name, $settings);
@@ -309,7 +332,9 @@ class Rule extends RulesActionContainer {
}
/**
- * Rules may not provided any variable info assertions, as Rules are only
+ * Overrides RulesPlugin::variableInfoAssertions().
+ *
+ * Rules may not provide any variable info assertions, as Rules are only
* conditionally executed.
*/
protected function variableInfoAssertions() {
@@ -324,7 +349,7 @@ class Rule extends RulesActionContainer {
}
/**
- * Overriden to expose the variables of all actions for embedded rules.
+ * Overridden to expose the variables of all actions for embedded rules.
*/
public function providesVariables() {
$provides = parent::providesVariables();
@@ -340,6 +365,7 @@ class Rule extends RulesActionContainer {
parent::resetInternalCache();
$this->conditions->resetInternalCache();
}
+
}
/**
@@ -347,8 +373,20 @@ class Rule extends RulesActionContainer {
*/
class RulesReactionRule extends Rule implements RulesTriggerableInterface {
+ /**
+ * @var string
+ */
protected $itemName = 'reaction rule';
- protected $events = array(), $eventSettings = array();
+
+ /**
+ * @var array
+ */
+ protected $events = array();
+
+ /**
+ * @var array
+ */
+ protected $eventSettings = array();
/**
* Implements RulesTriggerableInterface::events().
@@ -516,6 +554,7 @@ class RulesReactionRule extends Rule implements RulesTriggerableInterface {
// No need to keep event settings for evaluation.
$this->eventSettings = array();
}
+
}
/**
@@ -523,6 +562,9 @@ class RulesReactionRule extends Rule implements RulesTriggerableInterface {
*/
class RulesAnd extends RulesConditionContainer {
+ /**
+ * @var string
+ */
protected $itemName = 'and';
public function evaluate(RulesState $state) {
@@ -539,6 +581,7 @@ class RulesAnd extends RulesConditionContainer {
public function label() {
return !empty($this->label) ? $this->label : ($this->negate ? t('NOT AND') : t('AND'));
}
+
}
/**
@@ -546,6 +589,9 @@ class RulesAnd extends RulesConditionContainer {
*/
class RulesOr extends RulesConditionContainer {
+ /**
+ * @var string
+ */
protected $itemName = 'or';
public function evaluate(RulesState $state) {
@@ -564,6 +610,8 @@ class RulesOr extends RulesConditionContainer {
}
/**
+ * Overrides RulesContainerPlugin::stateVariables().
+ *
* Overridden to exclude all variable assertions as in an OR we cannot assert
* the children are successfully evaluated.
*/
@@ -580,6 +628,7 @@ class RulesOr extends RulesConditionContainer {
}
return $vars;
}
+
}
/**
@@ -587,6 +636,9 @@ class RulesOr extends RulesConditionContainer {
*/
class RulesLoop extends RulesActionContainer {
+ /**
+ * @var string
+ */
protected $itemName = 'loop';
protected $listItemInfo;
@@ -693,6 +745,7 @@ class RulesLoop extends RulesActionContainer {
$this->settings['item:label'] = reset($export['ITEM']);
}
}
+
}
/**
@@ -700,6 +753,9 @@ class RulesLoop extends RulesActionContainer {
*/
class RulesActionSet extends RulesActionContainer {
+ /**
+ * @var string
+ */
protected $itemName = 'action set';
}
@@ -709,6 +765,9 @@ class RulesActionSet extends RulesActionContainer {
*/
class RulesRuleSet extends RulesActionContainer {
+ /**
+ * @var string
+ */
protected $itemName = 'rule set';
/**
@@ -725,6 +784,7 @@ class RulesRuleSet extends RulesActionContainer {
protected function importChildren($export, $key = 'RULES') {
parent::importChildren($export, $key);
}
+
}
/**
@@ -732,8 +792,16 @@ class RulesRuleSet extends RulesActionContainer {
*/
class RulesEventSet extends RulesRuleSet {
+ /**
+ * @var string
+ */
protected $itemName = 'event set';
- // Event sets may recurse as we block recursions on rule-level.
+
+ /**
+ * Event sets may recurse as we block recursions on rule-level.
+ *
+ * @var bool
+ */
public $recursion = TRUE;
public function __construct($info = array()) {
@@ -751,7 +819,10 @@ class RulesEventSet extends RulesRuleSet {
}
/**
- * Cache event-sets per event to allow efficient usage via rules_invoke_event().
+ * Rebuilds the event cache.
+ *
+ * We cache event-sets per event in order to allow efficient usage via
+ * rules_invoke_event().
*
* @see rules_get_cache()
* @see rules_invoke_event()
@@ -824,4 +895,5 @@ class RulesEventSet extends RulesRuleSet {
public function save($name = NULL, $module = 'rules') {
return FALSE;
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.processor.inc b/sites/all/modules/contrib/admin/rules/includes/rules.processor.inc
index 468bea0b..42ca45d8 100644
--- a/sites/all/modules/contrib/admin/rules/includes/rules.processor.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.processor.inc
@@ -1,7 +1,8 @@
access() && (!isset($this->processor) || $this->processor->editAccess());
}
-
/**
* Prepares the processor for parameters.
*
- * It turns the settings into a suiting processor object, which gets invoked
+ * It turns the settings into a suitable processor object, which gets invoked
* on evaluation time.
*
* @param $setting
* The processor settings which are to be prepared.
* @param $param_info
* The info about the parameter to prepare the processor for.
- * @param $var_info
+ * @param array $var_info
* An array of info about the available variables.
*/
public static function prepareSetting(&$setting, $param_info, $var_info = array()) {
@@ -88,17 +92,22 @@ abstract class RulesDataProcessor {
/**
* Returns defined data processors applicable for the given parameter.
- * Optionally also access to the processors is checked.
+ *
+ * Optionally also checks access to the processors.
*
* @param $param_info
* If given, only processors valid for this parameter are returned.
+ * @param bool $access_check
+ * @param string $hook
*/
public static function processors($param_info = NULL, $access_check = TRUE, $hook = 'data_processor_info') {
static $items = array();
if (!isset($items[$hook]['all'])) {
$items[$hook]['all'] = rules_fetch_data($hook);
- uasort($items[$hook]['all'], array(__CLASS__, '_item_sort'));
+ if (isset($items[$hook]['all'])) {
+ uasort($items[$hook]['all'], array(__CLASS__, '_item_sort'));
+ }
}
// Data processing isn't supported for multiple types.
if (isset($param_info) && is_array($param_info['type'])) {
@@ -182,17 +191,20 @@ abstract class RulesDataProcessor {
}
/**
- * Processes the value. If $this->processor is set, invoke this processor
- * first so chaining multiple processors is working.
+ * Processes the value.
+ *
+ * If $this->processor is set, invoke this processor first so chaining
+ * multiple processors is working.
*
* @param $value
* The value to process.
* @param $info
* Info about the parameter for which we process the value.
- * @param $state RulesState
+ * @param RulesState $state
* The rules evaluation state.
- * @param $element RulesPlugin
+ * @param RulesPlugin $element
* The element for which we process the value.
+ *
* @return
* The processed value.
*/
@@ -200,6 +212,9 @@ abstract class RulesDataProcessor {
/**
* Return whether the current user has permission to use the processor.
+ *
+ * @return bool
+ * Whether the current user has permission to use the processor.
*/
public static function access() {
return TRUE;
@@ -210,7 +225,7 @@ abstract class RulesDataProcessor {
*
* @param $settings
* The settings of the processor.
- * @param $var_info
+ * @param array $var_info
* An array of info about the available variables.
*
* @return
@@ -219,13 +234,15 @@ abstract class RulesDataProcessor {
protected static function form($settings, $var_info) {
return array();
}
+
}
/**
- * A base processor for use as input evaluators. Input evaluators are not listed
- * in hook_rules_data_processor_info(). Instead they use
- * hook_rules_evaluator_info() and get attached to input forms.
+ * A base processor for use by input evaluators.
+ *
+ * Input evaluators are not listed in hook_rules_data_processor_info(). Instead
+ * they use hook_rules_evaluator_info() and get attached to input forms.
*/
abstract class RulesDataInputEvaluator extends RulesDataProcessor {
@@ -266,9 +283,10 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
}
/**
- * Overriden to prepare input evaluator processors. The setting is expected
- * to be the input value to be evaluated later on and is replaced by the
- * suiting processor.
+ * Overridden to prepare input evaluator processors.
+ *
+ * The setting is expected to be the input value to be evaluated later on
+ * and is replaced by the suitable processor.
*/
public static function prepareSetting(&$setting, $param_info, $var_info = array()) {
$processor = NULL;
@@ -284,7 +302,9 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
}
/**
- * Overriden to just attach the help() of evaluators.
+ * Overrides RulesDataProcessor::attachForm().
+ *
+ * Overridden to just attach the help() of evaluators.
*/
public static function attachForm(&$form, $settings, $param_info, $var_info, $access_check = TRUE) {
foreach (self::evaluators($param_info, $access_check) as $name => $info) {
@@ -294,14 +314,15 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
}
/**
- * Returns all input evaluators that can be applied to the parameters needed
- * type.
+ * Returns all input evaluators that can be applied to the parameters type.
*/
public static function evaluators($param_info = NULL, $access_check = TRUE) {
return parent::processors($param_info, $access_check, 'evaluator_info');
}
/**
+ * Overrides RulesDataProcessor::processors().
+ *
* Overridden to default to our hook, thus being equivalent to
* self::evaluators().
*/
@@ -310,14 +331,16 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
}
/**
- * Prepares the evalution, e.g. to determine whether the input evaluator has
- * been used. If this evaluator should be skipped just unset $this->setting.
+ * Prepares the evaluation.
*
- * @param $text
+ * For example, to determine whether the input evaluator has been used.
+ * If this evaluator should be skipped just unset $this->setting.
+ *
+ * @param string $text
* The text to evaluate later on.
- * @param $variables
+ * @param array $variables
* An array of info about available variables.
- * @param $param_info
+ * @param array $param_info
* (optional) An array of information about the handled parameter value.
* For backward compatibility, this parameter is not required.
*/
@@ -326,9 +349,9 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
/**
* Apply the input evaluator.
*
- * @param $text
+ * @param string $text
* The text to evaluate.
- * @param $options
+ * @param array $options
* A keyed array of settings and flags to control the processing.
* Supported options are:
* - language: A language object to be used when processing.
@@ -337,7 +360,7 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
* certain way.
* - sanitize: A boolean flag indicating whether incorporated replacements
* should be sanitized.
- * @param RulesState
+ * @param RulesState $state
* The rules evaluation state.
*
* @return
@@ -348,13 +371,13 @@ abstract class RulesDataInputEvaluator extends RulesDataProcessor {
/**
* Provide some usage help for the evaluator.
*
- * @param $variables
+ * @param array $variables
* An array of info about available variables.
- * @param $param_info
+ * @param array $param_info
* (optional) An array of information about the handled parameter value.
* For backward compatibility, this parameter is not required.
*
- * @return
+ * @return array
* A renderable array.
*/
public static function help($variables) {
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.state.inc b/sites/all/modules/contrib/admin/rules/includes/rules.state.inc
index 98ef0161..2e9213e3 100644
--- a/sites/all/modules/contrib/admin/rules/includes/rules.state.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.state.inc
@@ -1,7 +1,8 @@
language($langcode);
@@ -312,30 +325,37 @@ class RulesState {
/**
* Magic method. Only serialize variables and their info.
+ *
* Additionally we remember currently blocked configs, so we can restore them
* upon deserialization using restoreBlocks().
*/
- public function __sleep () {
+ public function __sleep() {
$this->currentlyBlocked = self::$blocked;
return array('info', 'variables', 'currentlyBlocked');
}
+ /**
+ * Magic method. Unserialize variables and their info.
+ */
public function __wakeup() {
$this->save = new ArrayObject();
}
/**
- * Restore the before serialization blocked configurations.
+ * Restores the before-serialization blocked configurations.
*
* Warning: This overwrites any possible currently blocked configs. Thus
- * do not invoke this method, if there might be evaluations active.
+ * do not invoke this method if there might be evaluations active.
*/
public function restoreBlocks() {
self::$blocked = $this->currentlyBlocked;
}
/**
- * Defines always available variables.
+ * Defines always-available variables.
+ *
+ * @param $key
+ * (optional)
*/
public static function defaultVariables($key = NULL) {
// Add a variable for accessing site-wide data properties.
@@ -350,12 +370,13 @@ class RulesState {
);
return isset($key) ? $vars[$key] : $vars;
}
+
}
/**
* A class holding static methods related to data.
*/
-class RulesData {
+class RulesData {
/**
* Returns whether the type match. They match if type1 is compatible to type2.
@@ -364,11 +385,11 @@ class RulesData {
* The name of the type to check for whether it is compatible to type2.
* @param $param_info
* The type expression to check for.
- * @param $ancestors
- * Whether sub-type relationships for checking type compatibility should be
- * taken into account. Defaults to TRUE.
+ * @param bool $ancestors
+ * (optional) Whether sub-type relationships for checking type compatibility
+ * should be taken into account. Defaults to TRUE.
*
- * @return
+ * @return bool
* Whether the types match.
*/
public static function typesMatch($var_info, $param_info, $ancestors = TRUE) {
@@ -395,7 +416,7 @@ class RulesData {
$cache = &rules_get_cache();
self::typeCalcAncestors($cache, $var_type);
// If one of the types is an ancestor return TRUE.
- return (bool)array_intersect_key($cache['data_info'][$var_type]['ancestors'], array_flip($valid_types));
+ return (bool) array_intersect_key($cache['data_info'][$var_type]['ancestors'], array_flip($valid_types));
}
return FALSE;
}
@@ -417,25 +438,27 @@ class RulesData {
}
/**
- * Returns matching data variables or properties for the given info and the to
- * be configured parameter.
+ * Returns data for the given info and the to-be-configured parameter.
+ *
+ * Returns matching data variables or properties for the given info and the
+ * to-be-configured parameter.
*
* @param $source
* Either an array of info about available variables or a entity metadata
* wrapper.
* @param $param_info
* The information array about the to be configured parameter.
- * @param $prefix
+ * @param string $prefix
* An optional prefix for the data selectors.
- * @param $recursions
+ * @param int $recursions
* The number of recursions used to go down the tree. Defaults to 2.
- * @param $suggestions
+ * @param bool $suggestions
* Whether possibilities to recurse are suggested as soon as the deepest
* level of recursions is reached. Defaults to TRUE.
*
- * @return
- * An array of info about matching variables or properties that match, keyed
- * with the data selector.
+ * @return array
+ * An array of info about matching variables or properties that match, keyed
+ * with the data selector.
*/
public static function matchingDataSelector($source, $param_info, $prefix = '', $recursions = 2, $suggestions = TRUE) {
// If an array of info is given, get entity metadata wrappers first.
@@ -467,7 +490,8 @@ class RulesData {
$matches += self::matchingDataSelector($wrapper, $param_info, $prefix . $name . ':', $recursions - 1, $suggestions);
}
elseif ($suggestions) {
- // We may not recurse any more, but indicate the possibility to recurse.
+ // We may not recurse any more,
+ // but indicate the possibility to recurse.
$matches[$prefix . $name . ':'] = $wrapper->info();
if (!is_array($source) && $source instanceof EntityListWrapper) {
// Add some more possible list items.
@@ -482,8 +506,10 @@ class RulesData {
}
/**
- * Adds asserted metadata to the variable info. In case there are already
- * assertions for a variable, the assertions are merged such that both apply.
+ * Adds asserted metadata to the variable info.
+ *
+ * In case there are already assertions for a variable, the assertions are
+ * merged such that both apply.
*
* @see RulesData::applyMetadataAssertions()
*/
@@ -546,8 +572,9 @@ class RulesData {
}
/**
- * Property info alter callback for the entity metadata wrapper for applying
- * the rules metadata assertions.
+ * Property info alter callback for the entity metadata wrapper.
+ *
+ * Used for applying the rules metadata assertions.
*
* @see RulesData::addMetadataAssertions()
*/
@@ -585,7 +612,8 @@ class RulesData {
$property_info['properties'][$key]['rules assertion'] = $assertion[$key];
$property_info['properties'][$key]['property info alter'] = array('RulesData', 'applyMetadataAssertions');
- // Apply any 'type' and 'bundle' assertion directly to the propertyinfo.
+ // Apply any 'type' and 'bundle' assertion directly to the property
+ // info.
if (isset($assertion[$key]['#info']['type'])) {
$type = $assertion[$key]['#info']['type'];
// Support asserting a type in case of generic entity references only.
@@ -607,9 +635,10 @@ class RulesData {
}
/**
- * Property info alter callback for the entity metadata wrapper to inject
- * metadata for the 'site' variable. In contrast to doing this via
- * hook_rules_data_info() this callback makes use of the already existing
+ * Property info alter callback for the entity metadata wrapper.
+ *
+ * Used to inject metadata for the 'site' variable. In contrast to doing this
+ * via hook_rules_data_info() this callback makes use of the already existing
* property info cache for site information of entity metadata.
*
* @see RulesPlugin::availableVariables()
@@ -621,6 +650,7 @@ class RulesData {
// have specified further metadata.
return RulesData::applyMetadataAssertions($wrapper, $property_info);
}
+
}
/**
@@ -652,7 +682,7 @@ abstract class RulesIdentifiableDataWrapper extends EntityStructureWrapper {
* The type of the passed data.
* @param $data
* Optional. The data to wrap or its identifier.
- * @param $info
+ * @param array $info
* Optional. Used internally to pass info about properties down the tree.
*/
public function __construct($type, $data = NULL, $info = array()) {
@@ -721,7 +751,7 @@ abstract class RulesIdentifiableDataWrapper extends EntityStructureWrapper {
}
/**
- * Prepare for serializiation.
+ * Prepare for serialization.
*/
public function __sleep() {
$vars = parent::__sleep();
@@ -733,6 +763,9 @@ abstract class RulesIdentifiableDataWrapper extends EntityStructureWrapper {
return $vars;
}
+ /**
+ * Prepare for unserialization.
+ */
public function __wakeup() {
if ($this->id !== FALSE) {
// Make sure data is set, so the data will be loaded when needed.
@@ -755,10 +788,11 @@ abstract class RulesIdentifiableDataWrapper extends EntityStructureWrapper {
* The loaded data object, or FALSE if loading failed.
*/
abstract protected function load($id);
+
}
/**
- * Interface that allows custom wrapper classes to declare that they are savable.
+ * Used to declare custom wrapper classes as savable.
*/
interface RulesDataWrapperSavableInterface {
@@ -766,4 +800,5 @@ interface RulesDataWrapperSavableInterface {
* Save the currently wrapped data.
*/
public function save();
+
}
diff --git a/sites/all/modules/contrib/admin/rules/includes/rules.upgrade.inc b/sites/all/modules/contrib/admin/rules/includes/rules.upgrade.inc
index e70d3ec9..2eb2cade 100644
--- a/sites/all/modules/contrib/admin/rules/includes/rules.upgrade.inc
+++ b/sites/all/modules/contrib/admin/rules/includes/rules.upgrade.inc
@@ -28,8 +28,8 @@ function rules_upgrade_form($form, &$form_state) {
'#prefix' => '
',
'#suffix' => '
',
'#markup' => t('This form allows you to convert rules or rule sets from Rules 1.x to Rules 2.x.') . ' ' .
- t('In order to convert a rule or rule set make sure you have all dependend modules installed and upgraded, i.e. modules which provide Rules integration that has been used in your rules or rule sets. In addition those modules may need to implement some Rules specific update hooks for the conversion to properly work.') . ' ' .
- t('After conversion, the old rules and rule sets will stay in the database until you manually delete them. That way you can make sure the conversion has gone right before you delete the old rules and rule sets.')
+ t('In order to convert a rule or rule set make sure you have all dependent modules installed and upgraded, i.e. modules which provide Rules integration that has been used in your rules or rule sets. In addition those modules may need to implement some Rules specific update hooks for the conversion to properly work.') . ' ' .
+ t('After conversion, the old rules and rule sets will stay in the database until you manually delete them. That way you can make sure the conversion has gone right before you delete the old rules and rule sets.'),
);
$option_rules = $option_sets = array();
@@ -51,7 +51,7 @@ function rules_upgrade_form($form, &$form_state) {
$form['clear'] = array(
'#prefix' => '',
'#suffix' => '
',
- '#markup' => t('Once you have successfully converted your configuration, you can clean up your database and delete all Rules 1.x configurations.', array('!url' => url('admin/config/workflow/rules/upgrade/clear')))
+ '#markup' => t('Once you have successfully converted your configuration, you can clean up your database and delete all Rules 1.x configurations.', array('!url' => url('admin/config/workflow/rules/upgrade/clear'))),
);
}
@@ -72,8 +72,8 @@ function rules_upgrade_form($form, &$form_state) {
'#type' => 'radios',
'#title' => t('Method'),
'#options' => array(
- 'export' => t('Convert configuration and export it.'),
- 'save' => t('Convert configuration and save it.'),
+ 'export' => t('Convert configuration and export it.'),
+ 'save' => t('Convert configuration and save it.'),
),
'#default_value' => 'export',
);
@@ -81,7 +81,7 @@ function rules_upgrade_form($form, &$form_state) {
$form['actions']['convert'] = array(
'#type' => 'submit',
'#value' => t('Convert'),
- '#disabled' => !db_table_exists('rules_rules')
+ '#disabled' => !db_table_exists('rules_rules'),
);
return $form;
}
@@ -137,6 +137,9 @@ function rules_upgrade_confirm_clear_form($form, $form_state) {
return confirm_form($form, $confirm_question, 'admin/config/workflow/rules/upgrade', $confirm_question_long, t('Delete data'), t('Cancel'));
}
+/**
+ * Submit handler for deleting data.
+ */
function rules_upgrade_confirm_clear_form_submit($form, &$form_state) {
db_drop_table('rules_rules');
db_drop_table('rules_sets');
@@ -206,7 +209,7 @@ function rules_upgrade_convert_rule_set($name, $cfg_old) {
}
// Add in all rules of the set.
- foreach(_rules_upgrade_fetch_all_rules() as $rule_name => $rule) {
+ foreach (_rules_upgrade_fetch_all_rules() as $rule_name => $rule) {
if ($rule['#set'] == $name) {
drupal_set_message(' >> ' . t('Converting %plugin %name...', array('%plugin' => t('rule'), '%name' => $rule_name . ': ' . $rule['#label'])));
$new_rule = rules_upgrade_plugin_factory($rule);
@@ -220,9 +223,9 @@ function rules_upgrade_convert_rule_set($name, $cfg_old) {
/**
* Convert a single element.
*
- * @param $element
+ * @param array $element
* The element to convert.
- * @param $target
+ * @param RulesPlugin $target
* The converted element to write to.
*/
function rules_upgrade_convert_element(array $element, RulesPlugin $target) {
@@ -235,7 +238,7 @@ function rules_upgrade_convert_element(array $element, RulesPlugin $target) {
foreach ($target->pluginParameterInfo() as $name => $info) {
rules_upgrade_element_parameter_settings($element, $target, $name);
}
- // @todo: Care about php input evaluator for non-text parameters.
+ // @todo Care about php input evaluator for non-text parameters.
// Take care of variable names and labels.
foreach ($target->pluginProvidesVariables() as $name => $info) {
@@ -268,10 +271,10 @@ function rules_upgrade_convert_element(array $element, RulesPlugin $target) {
// Invoke action/condition specific hooks and a general one.
if (($element['#type'] == 'action' || $element['#type'] == 'condition')) {
- if (function_exists($function = $element['#name'] .'_upgrade')) {
+ if (function_exists($function = $element['#name'] . '_upgrade')) {
$element_name = $function($element, $target);
}
- elseif (isset($element['#info']['base']) && function_exists($function = $element['#info']['base'] .'_upgrade')) {
+ elseif (isset($element['#info']['base']) && function_exists($function = $element['#info']['base'] . '_upgrade')) {
$element_name = $function($element, $target);
}
}
@@ -299,8 +302,10 @@ function rules_upgrade_plugin_factory($element) {
switch ($element['#type']) {
case 'OR':
return rules_plugin_factory('or');
+
case 'AND':
return rules_plugin_factory('and');
+
default:
return rules_plugin_factory($element['#type']);
@@ -329,7 +334,7 @@ function rules_upgrade_plugin_factory($element) {
}
// Call the upgrade callback if one has been defined.
- if (function_exists($function = $element['#name'] .'_upgrade_map_name') || (isset($element['#info']['base']) && function_exists($function = $element['#info']['base'] .'_upgrade_map_name'))) {
+ if (function_exists($function = $element['#name'] . '_upgrade_map_name') || (isset($element['#info']['base']) && function_exists($function = $element['#info']['base'] . '_upgrade_map_name'))) {
$element_name = $function($element);
}
if (!isset($element_name)) {
@@ -380,59 +385,77 @@ function rules_upgrade_element_variable_settings($element, $target, $name, $new_
* Upgrade callbacks for upgrading the provided Rules 1.x integration.
*/
-// Comment.module integration.
+/**
+ * Comment.module integration.
+ */
function rules_action_load_comment_upgrade_map_name($element) {
return 'entity_fetch';
}
+
function rules_action_load_comment_upgrade($element, $target) {
$target->settings['type'] = 'comment';
rules_upgrade_element_parameter_settings($element, $target, 'cid', 'id');
rules_upgrade_element_variable_settings($element, $target, 'comment_loaded', 'entity_fetched');
}
-// Node.module integration.
+/**
+ * Node.module integration.
+ */
function rules_condition_content_is_type_upgrade_map_name($element) {
return 'node_is_of_type';
}
+
function rules_condition_content_is_published_upgrade_map_name($element) {
return 'node_is_published';
}
+
function rules_condition_content_is_sticky_upgrade_map_name($element) {
return 'node_is_sticky';
}
+
function rules_condition_content_is_promoted_upgrade_map_name($element) {
return 'node_is_promoted';
}
+
function rules_condition_content_is_new_upgrade_map_name($element) {
return 'entity_is_new';
}
+
function rules_condition_content_is_new_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'node', 'entity');
}
+
function rules_action_node_set_author_upgrade_map_name($element) {
return 'data_set';
}
+
function rules_action_node_set_author_upgrade($element, $target) {
$target->settings['data:select'] = $element['#settings']['#argument map']['node'] . ':author';
$target->settings['value:select'] = $element['#settings']['#argument map']['author'];
}
+
function rules_action_node_load_author_upgrade_map_name($element) {
return 'entity_fetch';
}
+
function rules_action_node_load_author_upgrade($element, $target) {
$target->settings['type'] = 'user';
$target->settings['id'] = $element['#settings']['#argument map']['node'] . ':author:uid';
}
+
function rules_action_set_node_title_upgrade_map_name($element) {
return 'data_set';
}
+
function rules_action_set_node_title_upgrade($element, $target) {
$target->settings['data:select'] = $element['#settings']['#argument map']['node'] . ':title';
$target->settings['value'] = $element['#settings']['title'];
}
+
function rules_action_add_node_upgrade_map_name($element) {
return 'entity_create';
}
+
function rules_action_add_node_upgrade($element, $target) {
$target->settings['type'] = 'node';
rules_upgrade_element_parameter_settings($element, $target, 'title', 'param_title');
@@ -443,105 +466,135 @@ function rules_action_add_node_upgrade($element, $target) {
drupal_set_message(t('Warning: The node-access check option for the node creation action is not supported any more.'));
}
}
+
function rules_action_load_node_upgrade_map_name($element) {
return 'entity_fetch';
}
+
function rules_action_load_node_upgrade($element, $target) {
$target->settings['type'] = 'node';
rules_upgrade_element_parameter_settings($element, $target, 'nid', 'id');
rules_upgrade_element_parameter_settings($element, $target, 'vid', 'revision_id');
rules_upgrade_element_variable_settings($element, $target, 'node_loaded', 'entity_fetched');
}
+
function rules_action_delete_node_upgrade_map_name($element) {
return 'entity_delete';
}
+
function rules_action_delete_node_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'node', 'entity');
}
+
function rules_core_node_publish_action_upgrade_map_name($element) {
return 'node_publish';
}
+
function rules_core_node_unpublish_action_upgrade_map_name($element) {
return 'node_unpublish';
}
+
function rules_core_node_make_sticky_action_upgrade_map_name($element) {
return 'node_make_sticky_action';
}
+
function rules_core_node_make_unsticky_action_upgrade_map_name($element) {
return 'node_make_unsticky_action';
}
+
function rules_core_node_promote_action_upgrade_map_name($element) {
return 'node_promote_action';
}
+
function rules_core_node_unpromote_action_upgrade_map_name($element) {
return 'node_unpromote_action';
}
-
-// Path.module integration.
+/**
+ * Path.module integration.
+ */
function rules_condition_url_has_alias_upgrade_map_name($element) {
return 'path_has_alias';
}
+
function rules_condition_url_has_alias_upgrade($element, $target) {
$target->settings['source'] = $element['#settings']['src'];
$target->settings['alias'] = $element['#settings']['dst'];
}
+
function rules_condition_alias_exists_upgrade_map_name($element) {
return 'path_alias_exists';
}
+
function rules_condition_alias_exists_upgrade($element, $target) {
$target->settings['alias'] = $element['#settings']['dst'];
}
+
function rules_action_path_alias_upgrade($element, $target) {
$target->settings['source'] = $element['#settings']['src'];
$target->settings['alias'] = $element['#settings']['dst'];
}
+
function rules_action_node_path_alias_upgrade($element, $target) {
$target->settings['alias'] = $element['#settings']['dst'];
}
-// PHP.module integration.
+/**
+ * PHP.module integration.
+ */
function rules_condition_custom_php_upgrade_map_name($element) {
return 'php_eval';
}
+
function rules_action_custom_php_upgrade_map_name($element) {
return 'php_eval';
}
-// General Rules integration.
+/**
+ * General Rules integration.
+ */
function rules_condition_text_compare_upgrade_map_name($element) {
- // @todo: Support regex.
+ // @todo Support regex.
return 'data_is';
}
+
function rules_condition_text_compare_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'text1', 'data');
rules_upgrade_element_parameter_settings($element, $target, 'text2', 'value');
}
+
function rules_condition_number_compare_upgrade_map_name($element) {
return 'data_is';
}
+
function rules_condition_number_compare_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'number1', 'data');
rules_upgrade_element_parameter_settings($element, $target, 'number2', 'value');
}
+
function rules_condition_check_boolean_upgrade_map_name($element) {
return 'data_is';
}
+
function rules_condition_check_boolean_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'boolean', 'data');
$target->settings['value'] = TRUE;
}
+
function rules_action_invoke_set_upgrade_map_name($element) {
return 'component_' . $element['#info']['set'];
}
+
function rules_action_invoke_set_upgrade($element, $target) {
foreach ($element['#info']['arguments'] as $name => $info) {
rules_upgrade_element_parameter_settings($element, $target, $name);
}
}
+
function rules_action_save_variable_upgrade_map_name($element) {
return isset($element['#info']['new variables']) ? 'variable_add' : 'entity_save';
}
+
function rules_action_save_variable_upgrade($element, $target) {
$type = $element['#info']['arguments']['var_name']['default value'];
if (isset($element['#info']['new variables'])) {
@@ -554,20 +607,25 @@ function rules_action_save_variable_upgrade($element, $target) {
}
}
-
-// System.module integration.
+/**
+ * System.module integration.
+ */
function rules_action_set_breadcrumb_upgrade_map_name($element) {
- return 'breadcumb_set';
+ return 'breadcrumb_set';
}
+
function rules_action_mail_to_user_upgrade_map_name($element) {
return 'mail';
}
+
function rules_action_mail_to_user_upgrade($element, $target) {
$target->settings['to:select'] = $element['#settings']['#argument map']['user'] . ':mail';
}
+
function rules_action_drupal_goto_upgrade_map_name($element) {
return 'redirect';
}
+
function rules_action_drupal_goto_upgrade($element, $target) {
$settings = $element['#settings'];
$target->settings['url'] = $settings['path'];
@@ -579,86 +637,109 @@ function rules_action_drupal_goto_upgrade($element, $target) {
}
function rules_action_watchdog_upgrade_map_name($element) {
- // @todo: Support action in Rules 2.x!
+ // @todo Support action in Rules 2.x!
return NULL;
}
-// Taxonomy.module integration.
-// @todo: Finish.
+/**
+ * Taxonomy.module integration.
+ *
+ * @todo Finish.
+ */
function rules_action_taxonomy_load_term_upgrade_map_name($element) {
return 'entity_fetch';
}
+
function rules_action_taxonomy_add_term_upgrade_map_name($element) {
return 'entity_create';
}
+
function rules_action_taxonomy_delete_term_upgrade_map_name($element) {
return 'entity_delete';
}
+
function rules_action_taxonomy_term_assign_to_content_upgrade_map_name($element) {
- // @todo : list.
+ // @todo List.
return NULL;
}
+
function rules_action_taxonomy_term_remove_from_content_upgrade_map_name($element) {
- // @todo : list.
+ // @todo List.
return NULL;
}
+
function rules_action_taxonomy_load_vocab_upgrade_map_name($element) {
return 'entity_fetch';
}
+
function rules_action_taxonomy_add_vocab_upgrade_map_name($element) {
return 'data_set';
}
-// User.module integration.
+/**
+ * User.module integration.
+ */
function rules_condition_user_hasrole_upgrade_map_name($element) {
return 'user_has_role';
}
+
function rules_condition_user_hasrole_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'user', 'account');
}
+
function rules_condition_user_comparison_upgrade_map_name($element) {
return 'data_is';
}
+
function rules_condition_user_comparison_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'user1', 'data');
rules_upgrade_element_parameter_settings($element, $target, 'user2', 'value');
}
+
function rules_action_user_addrole_upgrade_map_name($element) {
return 'user_add_role';
}
+
function rules_action_user_addrole_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'user', 'account');
}
+
function rules_action_user_removerole_upgrade_map_name($element) {
return 'user_remove_role';
}
+
function rules_action_user_removerole_upgrade($element, $target) {
rules_upgrade_element_parameter_settings($element, $target, 'user', 'account');
}
+
function rules_action_load_user_upgrade_map_name($element) {
if (!empty($element['#settings']['username'])) {
drupal_set_message(t('Warning: Directly upgrading the load user by name action is not supported.'));
}
return 'entity_fetch';
}
+
function rules_action_load_user_upgrade($element, $target) {
$target->settings['type'] = 'user';
rules_upgrade_element_parameter_settings($element, $target, 'userid', 'id');
rules_upgrade_element_variable_settings($element, $target, 'user_loaded', 'entity_fetched');
}
+
function rules_action_user_create_upgrade_map_name($element) {
return 'entity_create';
}
+
function rules_action_user_create_upgrade($element, $target) {
$target->settings['type'] = 'user';
rules_upgrade_element_parameter_settings($element, $target, 'username', 'param_name');
rules_upgrade_element_parameter_settings($element, $target, 'email', 'param_mail');
rules_upgrade_element_variable_settings($element, $target, 'user_added', 'entity_created');
-
}
+
function rules_core_user_block_user_action_upgrade_map_name($element) {
return 'user_block';
}
+
function rules_core_user_block_user_action_upgrade($element, $target) {
$target->settings['account:select'] = $element['#settings']['#argument map']['user'];
}
diff --git a/sites/all/modules/contrib/admin/rules/modules/comment.rules.inc b/sites/all/modules/contrib/admin/rules/modules/comment.rules.inc
index 770be7e1..2052e6f9 100644
--- a/sites/all/modules/contrib/admin/rules/modules/comment.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/comment.rules.inc
@@ -1,14 +1,16 @@
$defaults + array(
'label' => t('After updating an existing comment'),
'variables' => array(
- 'comment' => array('type' => 'comment', 'label' => t('updated comment')),
- 'comment_unchanged' => array('type' => 'comment', 'label' => t('unchanged comment'), 'handler' => 'rules_events_entity_unchanged'),
+ 'comment' => array(
+ 'type' => 'comment',
+ 'label' => t('updated comment'),
+ ),
+ 'comment_unchanged' => array(
+ 'type' => 'comment',
+ 'label' => t('unchanged comment'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'comment_presave' => $defaults + array(
'label' => t('Before saving a comment'),
'variables' => array(
- 'comment' => array('type' => 'comment', 'label' => t('saved comment'), 'skip save' => TRUE),
- 'comment_unchanged' => array('type' => 'comment', 'label' => t('unchanged comment'), 'handler' => 'rules_events_entity_unchanged'),
+ 'comment' => array(
+ 'type' => 'comment',
+ 'label' => t('saved comment'),
+ 'skip save' => TRUE,
+ ),
+ 'comment_unchanged' => array(
+ 'type' => 'comment',
+ 'label' => t('unchanged comment'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'comment_view' => $defaults + array(
@@ -72,10 +89,12 @@ class RulesCommentEventHandler extends RulesEventHandlerEntityBundle {
* Returns the label to use for the bundle property.
*
* @return string
+ * Returns the label to use for the bundle property.
*/
protected function getBundlePropertyLabel() {
return t('type');
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/modules/data.eval.inc b/sites/all/modules/contrib/admin/rules/modules/data.eval.inc
index 0d5841cb..b3b67592 100644
--- a/sites/all/modules/contrib/admin/rules/modules/data.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/data.eval.inc
@@ -5,6 +5,7 @@
* Contains rules integration for the data module needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -43,7 +44,7 @@ function rules_action_data_set_info_alter(&$element_info, $element) {
if ($wrapper = $element->applyDataSelector($element->settings['data:select'])) {
$info = $wrapper->info();
$element_info['parameter']['value']['type'] = $wrapper->type();
- $element_info['parameter']['value']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
+ $element_info['parameter']['value']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
}
}
@@ -62,18 +63,23 @@ function rules_action_data_calc($input1, $op, $input2, $settings, $state, $eleme
case '+':
$result = $input1 + $input2;
break;
+
case '-':
$result = $input1 - $input2;
break;
+
case '*':
$result = $input1 * $input2;
break;
+
case '/':
$result = $input1 / $input2;
break;
+
case 'min':
$result = min($input1, $input2);
break;
+
case 'max':
$result = max($input1, $input2);
break;
@@ -142,7 +148,7 @@ function rules_data_list_info_alter(&$element_info, RulesAbstractPlugin $element
if ($type = entity_property_list_extract_type($wrapper->type())) {
$info = $wrapper->info();
$element_info['parameter']['item']['type'] = $type;
- $element_info['parameter']['item']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
+ $element_info['parameter']['item']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
}
}
}
@@ -197,9 +203,11 @@ function rules_action_data_convert($arguments, RulesPlugin $element, $state) {
case 'up':
$arguments['value'] = ceil($arguments['value']);
break;
+
case 'down':
$arguments['value'] = floor($arguments['value']);
break;
+
default:
case 'round':
$arguments['value'] = round($arguments['value']);
@@ -211,12 +219,15 @@ function rules_action_data_convert($arguments, RulesPlugin $element, $state) {
case 'decimal':
$result = floatval($arguments['value']);
break;
+
case 'integer':
$result = intval($arguments['value']);
break;
+
case 'text':
$result = strval($arguments['value']);
break;
+
case 'token':
$result = strval($arguments['value']);
break;
@@ -233,8 +244,19 @@ function rules_action_data_convert_info_alter(&$element_info, RulesAbstractPlugi
if (isset($element->settings['type']) && $type = $element->settings['type']) {
$element_info['provides']['conversion_result']['type'] = $type;
- if ($type != 'integer') {
- // Only support the rounding behavior option for integers.
+ // Only support the rounding behavior option for integers.
+ if ($type == 'integer') {
+ $element_info['parameter']['rounding_behavior'] = array(
+ 'type' => 'token',
+ 'label' => t('Rounding behavior'),
+ 'description' => t('The rounding behavior the conversion should use.'),
+ 'options list' => 'rules_action_data_convert_rounding_behavior_options',
+ 'restriction' => 'input',
+ 'default value' => 'round',
+ 'optional' => TRUE,
+ );
+ }
+ else {
unset($element_info['parameter']['rounding_behavior']);
}
@@ -243,12 +265,15 @@ function rules_action_data_convert_info_alter(&$element_info, RulesAbstractPlugi
case 'integer':
$sources = array('decimal', 'text', 'token', 'uri', 'date', 'duration', 'boolean');
break;
+
case 'decimal':
$sources = array('integer', 'text', 'token', 'uri', 'date', 'duration', 'boolean');
break;
+
case 'text':
$sources = array('integer', 'decimal', 'token', 'uri', 'date', 'duration', 'boolean');
break;
+
case 'token':
$sources = array('integer', 'decimal', 'text', 'uri', 'date', 'duration', 'boolean');
break;
@@ -296,7 +321,8 @@ function rules_action_data_create_info_alter(&$element_info, RulesAbstractPlugin
if (isset($type_info['property info'])) {
// Add the data type's properties as parameters.
foreach ($type_info['property info'] as $property => $property_info) {
- // Prefix parameter names to avoid name clashes with existing parameters.
+ // Prefix parameter names to avoid name clashes with
+ // existing parameters.
$element_info['parameter']['param_' . $property] = array_intersect_key($property_info, array_flip(array('type', 'label', 'allow null')));
if (empty($property_info['required'])) {
$element_info['parameter']['param_' . $property]['optional'] = TRUE;
@@ -329,13 +355,17 @@ function rules_condition_data_is($data, $op, $value) {
return (isset($data) && isset($value)) || (!isset($data) && !isset($value));
}
return $data == $value;
+
case '<':
return $data < $value;
+
case '>':
return $data > $value;
- // Note: This is deprecated by the text comparison condition and IN below.
+
+ // Note: This is deprecated by the text comparison condition and IN below.
case 'contains':
return is_string($data) && strpos($data, $value) !== FALSE || is_array($data) && in_array($value, $data);
+
case 'IN':
return is_array($value) && in_array($data, $value);
}
@@ -352,7 +382,7 @@ function rules_condition_data_is_info_alter(&$element_info, RulesAbstractPlugin
if ($wrapper = $element->applyDataSelector($element->settings['data:select'])) {
$info = $wrapper->info();
$element_info['parameter']['value']['type'] = $element->settings['op'] == 'IN' ? 'list<' . $wrapper->type() . '>' : $wrapper->type();
- $element_info['parameter']['value']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
+ $element_info['parameter']['value']['options list'] = !empty($info['options list']) ? 'rules_data_selector_options_list' : FALSE;
}
}
@@ -374,15 +404,17 @@ function rules_condition_data_list_contains($list, $item, $settings, $state) {
}
/**
-* Condition: List count comparison.
-*/
+ * Condition: List count comparison.
+ */
function rules_condition_data_list_count_is($list, $op = '==', $value) {
switch ($op) {
case '==':
return count($list) == $value;
- case '<';
+
+ case '<':
return count($list) < $value;
- case '>';
+
+ case '>':
return count($list) > $value;
}
}
@@ -415,11 +447,18 @@ function rules_data_text_comparison($text, $text2, $op = 'contains') {
switch ($op) {
case 'contains':
return strpos($text, $text2) !== FALSE;
+
case 'starts':
return strpos($text, $text2) === 0;
+
case 'ends':
- return strrpos($text, $text2) === (strlen($text) - strlen($text2));
+ return strrpos($text, $text2) === (strlen($text) - strlen($text2));
+
case 'regex':
- return (bool) preg_match('/'. str_replace('/', '\\/', $text2) .'/', $text);
+ return (bool) preg_match('/' . str_replace('/', '\\/', $text2) . '/', $text);
}
}
+
+/**
+ * @}
+ */
diff --git a/sites/all/modules/contrib/admin/rules/modules/data.rules.inc b/sites/all/modules/contrib/admin/rules/modules/data.rules.inc
index e063bfc6..8143e779 100644
--- a/sites/all/modules/contrib/admin/rules/modules/data.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/data.rules.inc
@@ -1,9 +1,11 @@
'unknown',
'label' => t('Value'),
'optional' => TRUE,
- 'description' => t('Optionally, specify the initial value of the variable.')
+ 'description' => t('Optionally, specify the initial value of the variable.'),
),
),
'provides' => array(
@@ -220,16 +224,6 @@ function rules_data_action_info() {
'label' => t('Value to convert'),
'default mode' => 'selector',
),
- // For to-integer conversion only.
- 'rounding_behavior' => array(
- 'type' => 'token',
- 'label' => t('Rounding behavior'),
- 'description' => t('The rounding behavior the conversion should use.'),
- 'options list' => 'rules_action_data_convert_rounding_behavior_options',
- 'restriction' => 'input',
- 'default value' => 'round',
- 'optional' => TRUE,
- ),
),
'provides' => array(
'conversion_result' => array(
@@ -312,7 +306,7 @@ function rules_action_data_set_form_alter(&$form, &$form_state, $options, RulesA
else {
// Change the data parameter to be not editable.
$form['parameter']['data']['settings']['#access'] = FALSE;
- // TODO: improve display
+ // @todo Improve display.
$form['parameter']['data']['info'] = array(
'#prefix' => '',
'#markup' => t('Selected data: %selector', array('%selector' => $element->settings['data:select'])),
@@ -338,8 +332,7 @@ function rules_action_data_calc_form_alter(&$form, &$form_state, $options, Rules
}
/**
- * Custom validate callback for entity create, add variable and data create
- * action.
+ * Validate callback for entity create, add variable and data create actions.
*/
function rules_action_create_type_validate($element) {
if (!isset($element->settings['type'])) {
@@ -379,7 +372,6 @@ function rules_data_list_form_alter(&$form, &$form_state, $options, RulesAbstrac
}
}
-
/**
* Form alter callback for actions relying on the entity type or the data type.
*/
@@ -410,7 +402,7 @@ function rules_action_type_form_alter(&$form, &$form_state, $options, RulesAbstr
unset($form['submit']);
unset($form['provides']);
// Disable #ajax for the first step as it has troubles with lazy-loaded JS.
- // @todo: Re-enable once JS lazy-loading is fixed in core.
+ // @todo Re-enable once JS lazy-loading is fixed in core.
unset($form['parameter']['type']['settings']['type']['#ajax']);
unset($form['reload']['#ajax']);
}
@@ -489,6 +481,7 @@ function rules_data_action_data_create_options() {
/**
* Implements hook_rules_condition_info() on behalf of the pseudo data module.
+ *
* @see rules_core_modules()
*/
function rules_data_condition_info() {
@@ -611,11 +604,13 @@ function rules_data_condition_info() {
}
/**
+ * Asserts the bundle of entities, if it's compared.
+ *
* If the bundle is compared, add the metadata assertion so other elements
* can make use of properties specific to the bundle.
*/
function rules_condition_data_is_assertions($element) {
- // Assert the bundle of entities, if its compared.
+ // Assert the bundle of entities, if it's compared.
if ($wrapper = $element->applyDataSelector($element->settings['data:select'])) {
$info = $wrapper->info();
if (isset($info['parent']) && $info['parent'] instanceof EntityDrupalWrapper) {
@@ -655,7 +650,7 @@ function rules_condition_data_is_form_alter(&$form, &$form_state, $options, Rule
else {
// Change the data parameter to be not editable.
$form['parameter']['data']['settings']['#access'] = FALSE;
- // TODO: improve display
+ // @todo Improve display.
$form['parameter']['data']['info'] = array(
'#prefix' => '
',
'#markup' => t('Selected data: %selector', array('%selector' => $element->settings['data:select'])),
diff --git a/sites/all/modules/contrib/admin/rules/modules/entity.eval.inc b/sites/all/modules/contrib/admin/rules/modules/entity.eval.inc
index 0bea4690..edd18a40 100644
--- a/sites/all/modules/contrib/admin/rules/modules/entity.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/entity.eval.inc
@@ -5,6 +5,7 @@
* Contains rules integration for entities needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -67,8 +68,14 @@ function rules_action_entity_query_info_alter(&$element_info, RulesAbstractPlugi
if ($element->settings['property']) {
$wrapper = rules_get_entity_metadata_wrapper_all_properties($element);
if (isset($wrapper->{$element->settings['property']}) && $property = $wrapper->{$element->settings['property']}) {
- $element_info['parameter']['value']['type'] = $property->type();
- $element_info['parameter']['value']['options list'] = $property->optionsList() ? 'rules_action_entity_query_value_options_list' : FALSE;
+ $property_type = $property->type();
+ // If the cardinality of the property > 1, i.e. of type 'list<{type}>',
+ // we will also accept a parameter of type {type}.
+ if (substr($property_type, 0, strlen('list<')) === 'list<' && substr($property_type, -strlen('>')) === '>') {
+ $property_type = array($property_type, substr($property_type, strlen('list<'), strlen($property_type) - strlen('list<>')));
+ }
+ $element_info['parameter']['value']['type'] = $property_type;
+ $element_info['parameter']['value']['options list'] = $property->optionsList() ? 'rules_action_entity_query_value_options_list' : FALSE;
}
}
}
@@ -106,9 +113,10 @@ function rules_action_entity_create_info_alter(&$element_info, RulesAbstractPlug
$info = $child->info();
if (!empty($info['required'])) {
$info += array('type' => 'text');
- // Prefix parameter names to avoid name clashes with existing parameters.
+ // Prefix parameter names to avoid name clashes
+ // with existing parameters.
$element_info['parameter']['param_' . $name] = array_intersect_key($info, array_flip(array('type', 'label', 'description')));
- $element_info['parameter']['param_' . $name]['options list'] = $child->optionsList() ? 'rules_action_entity_parameter_options_list' : FALSE;
+ $element_info['parameter']['param_' . $name]['options list'] = $child->optionsList() ? 'rules_action_entity_parameter_options_list' : FALSE;
}
}
$element_info['provides']['entity_created']['type'] = $element->settings['type'];
@@ -172,3 +180,7 @@ function rules_condition_entity_field_access(EntityDrupalWrapper $wrapper, $fiel
$field = field_info_field($field_name);
return !empty($field) && field_access($op, $field, $wrapper->type(), $wrapper->value(), $account = NULL);
}
+
+/**
+ * @}
+ */
diff --git a/sites/all/modules/contrib/admin/rules/modules/entity.rules.inc b/sites/all/modules/contrib/admin/rules/modules/entity.rules.inc
index f25249e0..97b3f697 100644
--- a/sites/all/modules/contrib/admin/rules/modules/entity.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/entity.rules.inc
@@ -1,14 +1,17 @@
getArgumentInfo('entity')) && $info['type'] != 'entity') {
// Hide the entity type parameter if not needed.
diff --git a/sites/all/modules/contrib/admin/rules/modules/events.inc b/sites/all/modules/contrib/admin/rules/modules/events.inc
index 4ac97602..01d8aedb 100644
--- a/sites/all/modules/contrib/admin/rules/modules/events.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/events.inc
@@ -1,19 +1,24 @@
node_type, $entity, $view_mode);
rules_invoke_event('comment_view', $entity, $view_mode);
break;
+
case 'node':
rules_invoke_event('node_view--' . $entity->type, $entity, $view_mode);
rules_invoke_event('node_view', $entity, $view_mode);
break;
+
case 'user':
rules_invoke_event('user_view', $entity, $view_mode);
break;
@@ -60,14 +66,17 @@ function rules_entity_presave($entity, $type) {
rules_invoke_event('comment_presave--' . $entity->node_type, $entity);
rules_invoke_event('comment_presave', $entity);
break;
+
case 'node':
rules_invoke_event('node_presave--' . $entity->type, $entity);
rules_invoke_event('node_presave', $entity);
break;
+
case 'taxonomy_term':
rules_invoke_event('taxonomy_term_presave--' . $entity->vocabulary_machine_name, $entity);
rules_invoke_event('taxonomy_term_presave', $entity);
break;
+
case 'taxonomy_vocabulary':
case 'user':
rules_invoke_event($type . '_presave', $entity);
@@ -84,14 +93,17 @@ function rules_entity_update($entity, $type) {
rules_invoke_event('comment_update--' . $entity->node_type, $entity);
rules_invoke_event('comment_update', $entity);
break;
+
case 'node':
rules_invoke_event('node_update--' . $entity->type, $entity);
rules_invoke_event('node_update', $entity);
break;
+
case 'taxonomy_term':
rules_invoke_event('taxonomy_term_update--' . $entity->vocabulary_machine_name, $entity);
rules_invoke_event('taxonomy_term_update', $entity);
break;
+
case 'taxonomy_vocabulary':
case 'user':
rules_invoke_event($type . '_update', $entity);
@@ -108,14 +120,17 @@ function rules_entity_insert($entity, $type) {
rules_invoke_event('comment_insert--' . $entity->node_type, $entity);
rules_invoke_event('comment_insert', $entity);
break;
+
case 'node':
rules_invoke_event('node_insert--' . $entity->type, $entity);
rules_invoke_event('node_insert', $entity);
break;
+
case 'taxonomy_term':
rules_invoke_event('taxonomy_term_insert--' . $entity->vocabulary_machine_name, $entity);
rules_invoke_event('taxonomy_term_insert', $entity);
break;
+
case 'taxonomy_vocabulary':
case 'user':
rules_invoke_event($type . '_insert', $entity);
@@ -132,14 +147,17 @@ function rules_entity_delete($entity, $type) {
rules_invoke_event('comment_delete--' . $entity->node_type, $entity);
rules_invoke_event('comment_delete', $entity);
break;
+
case 'node':
rules_invoke_event('node_delete--' . $entity->type, $entity);
rules_invoke_event('node_delete', $entity);
break;
+
case 'taxonomy_term':
rules_invoke_event('taxonomy_term_delete--' . $entity->vocabulary_machine_name, $entity);
rules_invoke_event('taxonomy_term_delete', $entity);
break;
+
case 'taxonomy_vocabulary':
case 'user':
rules_invoke_event($type . '_delete', $entity);
@@ -161,8 +179,10 @@ function rules_user_logout($account) {
rules_invoke_event('user_logout', $account);
}
-/**
- * System events. Note that rules_init() is the main module file is used to
+/*
+ * System events.
+ *
+ * Note that rules_init() is the main module file is used to
* invoke the init event.
*/
@@ -184,7 +204,7 @@ function rules_watchdog($log_entry) {
* Getter callback for the log entry message property.
*/
function rules_system_log_get_message($log_entry) {
- return t($log_entry['message'], (array)$log_entry['variables']);
+ return t($log_entry['message'], (array) $log_entry['variables']);
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/modules/node.eval.inc b/sites/all/modules/contrib/admin/rules/modules/node.eval.inc
index 50940a7a..49450dc9 100644
--- a/sites/all/modules/contrib/admin/rules/modules/node.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/node.eval.inc
@@ -5,6 +5,7 @@
* Contains rules integration for the node module needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -22,10 +23,11 @@ abstract class RulesNodeConditionBase extends RulesConditionHandlerBase {
'access callback' => 'rules_node_integration_access',
);
}
+
}
/**
- * Condition: Check for selected content types
+ * Condition: Check for selected content types.
*/
class RulesNodeConditionType extends RulesNodeConditionBase {
@@ -58,9 +60,10 @@ class RulesNodeConditionType extends RulesNodeConditionBase {
/**
* Provides the content type of a node as asserted metadata.
*/
- function assertions() {
+ public function assertions() {
return array('node' => array('bundle' => $this->element->settings['type']));
}
+
}
/**
@@ -84,6 +87,7 @@ class RulesNodeConditionPublished extends RulesNodeConditionBase {
public function execute($node) {
return $node->status == 1;
}
+
}
/**
@@ -107,10 +111,11 @@ class RulesNodeConditionSticky extends RulesNodeConditionBase {
public function execute($node) {
return $node->sticky == 1;
}
+
}
/**
- * Condition: Check if the node is promoted to the frontpage
+ * Condition: Check if the node is promoted to the frontpage.
*/
class RulesNodeConditionPromoted extends RulesNodeConditionBase {
@@ -130,6 +135,7 @@ class RulesNodeConditionPromoted extends RulesNodeConditionBase {
public function execute($node) {
return $node->promote == 1;
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/modules/node.rules.inc b/sites/all/modules/contrib/admin/rules/modules/node.rules.inc
index 26298403..97aa00ba 100644
--- a/sites/all/modules/contrib/admin/rules/modules/node.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/node.rules.inc
@@ -1,9 +1,11 @@
array(
'type' => 'text',
'label' => t('Existing system path'),
- 'description' => t('Specifies the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.') .' '. t('Leave it empty to delete URL aliases pointing to the given path alias.'),
+ 'description' => t('Specifies the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.') . ' ' . t('Leave it empty to delete URL aliases pointing to the given path alias.'),
'optional' => TRUE,
),
'alias' => array(
'type' => 'text',
'label' => t('URL alias'),
- 'description' => t('Specify an alternative path by which this data can be accessed. For example, "about" for an about page. Use a relative path and do not add a trailing slash.') .' '. t('Leave it empty to delete URL aliases pointing to the given system path.'),
+ 'description' => t('Specify an alternative path by which this data can be accessed. For example, "about" for an about page. Use a relative path and do not add a trailing slash.') . ' ' . t('Leave it empty to delete URL aliases pointing to the given system path.'),
'optional' => TRUE,
'cleaning callback' => 'rules_path_clean_replacement_values',
),
@@ -61,7 +63,7 @@ function rules_path_action_info() {
'alias' => array(
'type' => 'text',
'label' => t('URL alias'),
- 'description' => t('Specify an alternative path by which the content can be accessed. For example, "about" for an about page. Use a relative path and do not add a trailing slash.') .' '. t('Leave it empty to delete the URL alias.'),
+ 'description' => t('Specify an alternative path by which the content can be accessed. For example, "about" for an about page. Use a relative path and do not add a trailing slash.') . ' ' . t('Leave it empty to delete the URL alias.'),
'optional' => TRUE,
'cleaning callback' => 'rules_path_clean_replacement_values',
),
@@ -82,7 +84,7 @@ function rules_path_action_info() {
'alias' => array(
'type' => 'text',
'label' => t('URL alias'),
- 'description' => t('Specify an alternative path by which the term can be accessed. For example, "content/drupal" for a Drupal term. Use a relative path and do not add a trailing slash.') .' '. t('Leave it empty to delete the URL alias.'),
+ 'description' => t('Specify an alternative path by which the term can be accessed. For example, "content/drupal" for a Drupal term. Use a relative path and do not add a trailing slash.') . ' ' . t('Leave it empty to delete the URL alias.'),
'optional' => TRUE,
'cleaning callback' => 'rules_path_clean_replacement_values',
),
@@ -168,4 +170,4 @@ function rules_path_condition_info() {
/**
* @}
- */
\ No newline at end of file
+ */
diff --git a/sites/all/modules/contrib/admin/rules/modules/php.eval.inc b/sites/all/modules/contrib/admin/rules/modules/php.eval.inc
index 9e705465..ac400b08 100644
--- a/sites/all/modules/contrib/admin/rules/modules/php.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/php.eval.inc
@@ -5,6 +5,7 @@
* Contains rules integration for the php module needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -13,10 +14,21 @@
*/
class RulesPHPEvaluator extends RulesDataInputEvaluator {
- public static function access() {
- return user_access('use PHP for settings');
+ /**
+ * Overrides RulesDataProcessor::editAccess().
+ */
+ public function editAccess() {
+ return parent::editAccess() && (user_access('use PHP for settings') || drupal_is_cli());
}
+ /**
+ * Helper function to find variables in PHP code.
+ *
+ * @param string $text
+ * The PHP code.
+ * @param array $var_info
+ * Array with variable names as keys.
+ */
public static function getUsedVars($text, $var_info) {
if (strpos($text, '') !== FALSE) {
$used_vars = array();
@@ -29,14 +41,19 @@ class RulesPHPEvaluator extends RulesDataInputEvaluator {
}
}
+ /**
+ * Overrides RulesDataInputEvaluator::prepare().
+ */
public function prepare($text, $var_info) {
// A returned NULL skips the evaluator.
$this->setting = self::getUsedVars($text, $var_info);
}
/**
- * Evaluates PHP code contained in $text. This doesn't apply $options, thus
- * the PHP code is responsible for behaving appropriately.
+ * Evaluates PHP code contained in $text.
+ *
+ * This method doesn't apply $options, thus the PHP code is responsible for
+ * behaving appropriately.
*/
public function evaluate($text, $options, RulesState $state) {
$vars['eval_options'] = $options;
@@ -46,6 +63,9 @@ class RulesPHPEvaluator extends RulesDataInputEvaluator {
return rules_php_eval($text, rules_unwrap_data($vars));
}
+ /**
+ * Overrides RulesDataInputEvaluator::help().
+ */
public static function help($var_info) {
module_load_include('inc', 'rules', 'rules/modules/php.rules');
@@ -58,6 +78,7 @@ class RulesPHPEvaluator extends RulesDataInputEvaluator {
return $render;
}
+
}
/**
@@ -65,6 +86,9 @@ class RulesPHPEvaluator extends RulesDataInputEvaluator {
*/
class RulesPHPDataProcessor extends RulesDataProcessor {
+ /**
+ * Overrides RulesDataProcessor::form().
+ */
protected static function form($settings, $var_info) {
$settings += array('code' => '');
$form = array(
@@ -84,14 +108,21 @@ class RulesPHPDataProcessor extends RulesDataProcessor {
return $form;
}
- public static function access() {
- return user_access('use PHP for settings');
+ /**
+ * Overrides RulesDataProcessor::editAccess().
+ */
+ public function editAccess() {
+ return parent::editAccess() && (user_access('use PHP for settings') || drupal_is_cli());
}
+ /**
+ * Overrides RulesDataProcessor::process().
+ */
public function process($value, $info, RulesState $state, RulesPlugin $element) {
$value = isset($this->processor) ? $this->processor->process($value, $info, $state, $element) : $value;
return rules_php_eval_return($this->setting['code'], array('value' => $value));
}
+
}
/**
@@ -108,11 +139,11 @@ function rules_execute_php_eval($code, $settings, $state, $element) {
}
/**
- * Evalutes the given PHP code, with the given variables defined.
+ * Evaluates the given PHP code, with the given variables defined.
*
- * @param $code
- * The PHP code to run, with
- * @param $arguments
+ * @param string $code
+ * The PHP code to run, including
+ * @param array $arguments
* Array containing variables to be extracted to the code.
*
* @return
@@ -122,7 +153,7 @@ function rules_php_eval($code, $arguments = array()) {
extract($arguments);
ob_start();
- print eval('?>'. $code);
+ print eval('?>' . $code);
$output = ob_get_contents();
ob_end_clean();
@@ -130,13 +161,15 @@ function rules_php_eval($code, $arguments = array()) {
}
/**
- * Evalutes the given PHP code, with the given variables defined. This is like
- * rules_php_eval() but does return the returned data from the PHP code.
+ * Evaluates the given PHP code, with the given variables defined.
*
- * @param $code
- * The PHP code to run, without
- * @param $arguments
- * Array containing variables to be extracted to the code.
+ * This is like rules_php_eval(), but does return the returned data from
+ * the PHP code.
+ *
+ * @param string $code
+ * The PHP code to run, without
+ * @param array $arguments
+ * Array containing variables to be extracted to the code.
*
* @return
* The return value of the evaled code.
diff --git a/sites/all/modules/contrib/admin/rules/modules/php.rules.inc b/sites/all/modules/contrib/admin/rules/modules/php.rules.inc
index 742b8ce8..d00c00ec 100644
--- a/sites/all/modules/contrib/admin/rules/modules/php.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/php.rules.inc
@@ -1,9 +1,11 @@
array(
'class' => 'RulesPHPDataProcessor',
- 'type' => array('text', 'token', 'decimal', 'integer', 'date', 'duration', 'boolean', 'uri'),
+ 'type' => array('text', 'token', 'decimal', 'integer', 'date', 'duration', 'boolean', 'uri'),
'weight' => 10,
'module' => 'php',
),
@@ -124,8 +126,7 @@ function rules_php_evaluator_help($var_info, $action_help = FALSE) {
$render['top'] = array(
'#prefix' => '
',
'#suffix' => '
',
- '#markup' => t('PHP code inside of <?php ?> delimiters will be evaluated and replaced by its output. E.g. <? echo 1+1?> will be replaced by 2.')
- . ' ' . t('Furthermore you can make use of the following variables:'),
+ '#markup' => t('PHP code inside of <?php ?> delimiters will be evaluated and replaced by its output. E.g. <? echo 1+1?> will be replaced by 2.') . ' ' . t('Furthermore you can make use of the following variables:'),
);
$render['vars'] = array(
'#theme' => 'table',
@@ -136,7 +137,7 @@ function rules_php_evaluator_help($var_info, $action_help = FALSE) {
$cache = rules_get_cache();
foreach ($var_info as $name => $info) {
$row = array();
- $row[] = '$'. check_plain($name);
+ $row[] = '$' . check_plain($name);
$label = isset($cache['data_info'][$info['type']]['label']) ? $cache['data_info'][$info['type']]['label'] : $info['type'];
$row[] = check_plain(drupal_ucfirst($label));
$row[] = check_plain($info['label']);
@@ -155,4 +156,4 @@ function rules_php_evaluator_help($var_info, $action_help = FALSE) {
/**
* @}
- */
\ No newline at end of file
+ */
diff --git a/sites/all/modules/contrib/admin/rules/modules/rules_core.eval.inc b/sites/all/modules/contrib/admin/rules/modules/rules_core.eval.inc
index 2738c9f4..c0e9f246 100644
--- a/sites/all/modules/contrib/admin/rules/modules/rules_core.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/rules_core.eval.inc
@@ -5,6 +5,7 @@
* Contains rules core integration needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -46,7 +47,7 @@ function rules_element_invoke_component($arguments, RulesPlugin $element) {
$state->mergeSaveVariables($new_state, $component, $element->settings);
$state->unblock($component);
- // Cleanup the state, what saves not mergable variables now.
+ // Cleanup the state, what saves not mergeable variables now.
$new_state->cleanup();
rules_log('Finished evaluation of @plugin %label.', $replacements, RulesLog::INFO, $component, FALSE);
return $return;
@@ -57,13 +58,18 @@ function rules_element_invoke_component($arguments, RulesPlugin $element) {
}
/**
- * A class implementing a rules input evaluator processing date input. This is
- * needed to treat relative date inputs for strtotime right, consider "now".
+ * A class implementing a rules input evaluator processing date input.
+ *
+ * This is needed to treat relative date inputs for strtotime() correctly.
+ * Consider for example "now".
*/
class RulesDateInputEvaluator extends RulesDataInputEvaluator {
const DATE_REGEX_LOOSE = '/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})?)?$/';
+ /**
+ * Overrides RulesDataInputEvaluator::prepare().
+ */
public function prepare($text, $var_info) {
if (is_numeric($text)) {
// Let rules skip this input evaluators in case it's already a timestamp.
@@ -71,6 +77,9 @@ class RulesDateInputEvaluator extends RulesDataInputEvaluator {
}
}
+ /**
+ * Overrides RulesDataInputEvaluator::evaluate().
+ */
public function evaluate($text, $options, RulesState $state) {
return self::gmstrtotime($text);
}
@@ -89,14 +98,19 @@ class RulesDateInputEvaluator extends RulesDataInputEvaluator {
public static function isFixedDateString($date) {
return is_string($date) && preg_match(self::DATE_REGEX_LOOSE, $date);
}
+
}
/**
- * A class implementing a rules input evaluator processing URI inputs to make
- * sure URIs are absolute and path aliases get applied.
+ * A class implementing a rules input evaluator processing URI inputs.
+ *
+ * Makes sure URIs are absolute and path aliases get applied.
*/
class RulesURIInputEvaluator extends RulesDataInputEvaluator {
+ /**
+ * Overrides RulesDataInputEvaluator::prepare().
+ */
public function prepare($uri, $var_info) {
if (!isset($this->processor) && valid_url($uri, TRUE)) {
// Only process if another evaluator is used or the url is not absolute.
@@ -104,6 +118,9 @@ class RulesURIInputEvaluator extends RulesDataInputEvaluator {
}
}
+ /**
+ * Overrides RulesDataInputEvaluator::evaluate().
+ */
public function evaluate($uri, $options, RulesState $state) {
if (!url_is_external($uri)) {
// Extract the path and build the URL using the url() function, so URL
@@ -119,6 +136,7 @@ class RulesURIInputEvaluator extends RulesDataInputEvaluator {
}
throw new RulesEvaluationException('Input evaluation generated an invalid URI.', array(), NULL, RulesLog::WARN);
}
+
}
/**
@@ -126,6 +144,9 @@ class RulesURIInputEvaluator extends RulesDataInputEvaluator {
*/
class RulesDateOffsetProcessor extends RulesDataProcessor {
+ /**
+ * Overrides RulesDataProcessor::form().
+ */
protected static function form($settings, $var_info) {
$settings += array('value' => '');
$form = array(
@@ -145,6 +166,9 @@ class RulesDateOffsetProcessor extends RulesDataProcessor {
return $form;
}
+ /**
+ * Overrides RulesDataProcessor::process().
+ */
public function process($value, $info, RulesState $state, RulesPlugin $element) {
$value = isset($this->processor) ? $this->processor->process($value, $info, $state, $element) : $value;
return RulesDateOffsetProcessor::applyOffset($value, $this->setting['value']);
@@ -178,6 +202,7 @@ class RulesDateOffsetProcessor extends RulesDataProcessor {
return $timestamp + $offset;
}
}
+
}
/**
@@ -185,6 +210,9 @@ class RulesDateOffsetProcessor extends RulesDataProcessor {
*/
class RulesNumericOffsetProcessor extends RulesDataProcessor {
+ /**
+ * Overrides RulesDataProcessor::form().
+ */
protected static function form($settings, $var_info) {
$settings += array('value' => '');
$form = array(
@@ -205,15 +233,20 @@ class RulesNumericOffsetProcessor extends RulesDataProcessor {
return $form;
}
+ /**
+ * Overrides RulesDataProcessor::process().
+ */
public function process($value, $info, RulesState $state, RulesPlugin $element) {
$value = isset($this->processor) ? $this->processor->process($value, $info, $state, $element) : $value;
return $value + $this->setting['value'];
}
+
}
-
/**
- * A custom wrapper class for vocabularies that is capable of loading vocabularies by machine name.
+ * A custom wrapper class for vocabularies.
+ *
+ * This class is capable of loading vocabularies by machine name.
*/
class RulesTaxonomyVocabularyWrapper extends EntityDrupalWrapper {
@@ -231,7 +264,7 @@ class RulesTaxonomyVocabularyWrapper extends EntityDrupalWrapper {
}
/**
- * Overriden to permit machine names as values.
+ * Overridden to permit machine names as values.
*/
public function validate($value) {
if (isset($value) && is_string($value)) {
@@ -239,4 +272,9 @@ class RulesTaxonomyVocabularyWrapper extends EntityDrupalWrapper {
}
return parent::validate($value);
}
+
}
+
+/**
+ * @}
+ */
diff --git a/sites/all/modules/contrib/admin/rules/modules/rules_core.rules.inc b/sites/all/modules/contrib/admin/rules/modules/rules_core.rules.inc
index d4215fa2..01215d56 100644
--- a/sites/all/modules/contrib/admin/rules/modules/rules_core.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/rules_core.rules.inc
@@ -1,10 +1,13 @@
'RulesDateInputEvaluator',
'type' => 'date',
'weight' => -10,
- ),
+ ),
// Post-process any input value to absolute URIs.
'uri' => array(
'class' => 'RulesURIInputEvaluator',
'type' => 'uri',
'weight' => 50,
- ),
+ ),
);
}
@@ -213,12 +216,12 @@ function rules_rules_core_data_processor_info() {
'class' => 'RulesDateOffsetProcessor',
'type' => 'date',
'weight' => -2,
- ),
+ ),
'num_offset' => array(
'class' => 'RulesNumericOffsetProcessor',
'type' => array('integer', 'decimal'),
'weight' => -2,
- ),
+ ),
);
}
@@ -306,7 +309,7 @@ function rules_element_invoke_component_validate(RulesPlugin $element) {
}
/**
- * Implements the features export callback of the RulesPluginFeaturesIntegrationInterace.
+ * Implements the features export callback of the RulesPluginFeaturesIntegrationInterface.
*/
function rules_element_invoke_component_features_export(&$export, &$pipe, $module_name = '', $element) {
// Add the used component to the pipe.
diff --git a/sites/all/modules/contrib/admin/rules/modules/system.eval.inc b/sites/all/modules/contrib/admin/rules/modules/system.eval.inc
index 0de887c1..d784db80 100644
--- a/sites/all/modules/contrib/admin/rules/modules/system.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/system.eval.inc
@@ -5,6 +5,7 @@
* Contains rules integration for the system module needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
@@ -42,8 +43,8 @@ function rules_action_drupal_goto($url, $force = FALSE, $destination = FALSE) {
if ($force && isset($_GET['destination'])) {
unset($_GET['destination']);
}
- // We don't invoke drupal_goto() right now, as this would end the the current
- // page execution unpredictly for modules. So we'll take over drupal_goto()
+ // We don't invoke drupal_goto() right now, as this would end the current
+ // page execution unpredictably for modules. So we'll take over drupal_goto()
// calls from somewhere else via hook_drupal_goto_alter() and make sure
// a drupal_goto() is invoked before the page is output with
// rules_page_build().
@@ -106,9 +107,8 @@ function rules_action_mail_to_users_of_role($roles, $subject, $message, $from =
$result = db_query('SELECT mail FROM {users} WHERE uid > 0');
}
else {
- $rids = implode(',', $roles);
// Avoid sending emails to members of two or more target role groups.
- $result = db_query('SELECT DISTINCT u.mail FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid WHERE r.rid IN ('. $rids .')');
+ $result = db_query('SELECT DISTINCT u.mail FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid WHERE r.rid IN (:rids)', array(':rids' => $roles));
}
// Now, actually send the mails.
@@ -125,7 +125,7 @@ function rules_action_mail_to_users_of_role($roles, $subject, $message, $from =
$message = drupal_mail('rules', $key, $row->mail, language_default(), $params, $from);
// If $message['result'] is FALSE, then it's likely that email sending is
// failing at the moment, and we should just abort sending any more. If
- // however, $mesage['result'] is NULL, then it's likely that a module has
+ // however, $message['result'] is NULL, then it's likely that a module has
// aborted sending this particular email to this particular user, and we
// should just keep on sending emails to the other users.
// For more information on the result value, see drupal_mail().
@@ -142,7 +142,7 @@ function rules_action_mail_to_users_of_role($roles, $subject, $message, $from =
/**
* Implements hook_mail().
*
- * Set's the message subject and body as configured.
+ * Sets the message subject and body as configured.
*/
function rules_mail($key, &$message, $params) {
@@ -166,6 +166,9 @@ function rules_action_block_ip($ip_address = NULL) {
*/
class RulesTokenEvaluator extends RulesDataInputEvaluator {
+ /**
+ * Overrides RulesDataInputEvaluator::prepare().
+ */
public function prepare($text, $var_info) {
$text = is_array($text) ? implode('', $text) : $text;
// Skip this evaluator if there are no tokens.
@@ -173,6 +176,8 @@ class RulesTokenEvaluator extends RulesDataInputEvaluator {
}
/**
+ * Evaluate tokens.
+ *
* We replace the tokens on our own as we cannot use token_replace(), because
* token usually assumes that $data['node'] is a of type node, which doesn't
* hold in general in our case.
@@ -262,6 +267,7 @@ class RulesTokenEvaluator extends RulesDataInputEvaluator {
}
return $render;
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/modules/system.rules.inc b/sites/all/modules/contrib/admin/rules/modules/system.rules.inc
index 2df01a3a..3f41dd4e 100644
--- a/sites/all/modules/contrib/admin/rules/modules/system.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/system.rules.inc
@@ -1,9 +1,11 @@
'RulesTokenEvaluator',
'type' => array('text', 'uri', 'list', 'list'),
'weight' => 0,
- ),
+ ),
);
}
diff --git a/sites/all/modules/contrib/admin/rules/modules/taxonomy.rules.inc b/sites/all/modules/contrib/admin/rules/modules/taxonomy.rules.inc
index a3caf1bc..69c3c3ec 100644
--- a/sites/all/modules/contrib/admin/rules/modules/taxonomy.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/taxonomy.rules.inc
@@ -1,9 +1,11 @@
t('After updating an existing term'),
'variables' => array(
'term' => array('type' => 'taxonomy_term', 'label' => t('updated term')),
- 'term_unchanged' => array('type' => 'taxonomy_term', 'label' => t('unchanged term'), 'handler' => 'rules_events_entity_unchanged'),
+ 'term_unchanged' => array(
+ 'type' => 'taxonomy_term',
+ 'label' => t('unchanged term'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'taxonomy_term_presave' => $defaults_term + array(
'label' => t('Before saving a taxonomy term'),
'variables' => array(
- 'term' => array('type' => 'taxonomy_term', 'label' => t('saved term'), 'skip save' => TRUE),
- 'term_unchanged' => array('type' => 'taxonomy_term', 'label' => t('unchanged term'), 'handler' => 'rules_events_entity_unchanged'),
+ 'term' => array(
+ 'type' => 'taxonomy_term',
+ 'label' => t('saved term'),
+ 'skip save' => TRUE,
+ ),
+ 'term_unchanged' => array(
+ 'type' => 'taxonomy_term',
+ 'label' => t('unchanged term'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'taxonomy_term_delete' => $defaults_term + array(
@@ -58,21 +72,39 @@ function rules_taxonomy_event_info() {
'taxonomy_vocabulary_update' => $defaults_vocab + array(
'label' => t('After updating an existing vocabulary'),
'variables' => array(
- 'vocabulary' => array('type' => 'taxonomy_vocabulary', 'label' => t('updated vocabulary')),
- 'vocabulary_unchanged' => array('type' => 'taxonomy_vocabulary', 'label' => t('unchanged vocabulary'), 'handler' => 'rules_events_entity_unchanged'),
+ 'vocabulary' => array(
+ 'type' => 'taxonomy_vocabulary',
+ 'label' => t('updated vocabulary'),
+ ),
+ 'vocabulary_unchanged' => array(
+ 'type' => 'taxonomy_vocabulary',
+ 'label' => t('unchanged vocabulary'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'taxonomy_vocabulary_presave' => $defaults_vocab + array(
'label' => t('Before saving a vocabulary'),
'variables' => array(
- 'vocabulary' => array('type' => 'taxonomy_vocabulary', 'label' => t('saved vocabulary'), 'skip save' => TRUE),
- 'vocabulary_unchanged' => array('type' => 'taxonomy_vocabulary', 'label' => t('unchanged vocabulary'), 'handler' => 'rules_events_entity_unchanged'),
+ 'vocabulary' => array(
+ 'type' => 'taxonomy_vocabulary',
+ 'label' => t('saved vocabulary'),
+ 'skip save' => TRUE,
+ ),
+ 'vocabulary_unchanged' => array(
+ 'type' => 'taxonomy_vocabulary',
+ 'label' => t('unchanged vocabulary'),
+ 'handler' => 'rules_events_entity_unchanged',
+ ),
),
),
'taxonomy_vocabulary_delete' => $defaults_vocab + array(
'label' => t('After deleting a vocabulary'),
'variables' => array(
- 'vocabulary' => array('type' => 'taxonomy_vocabulary', 'label' => t('deleted vocabulary')),
+ 'vocabulary' => array(
+ 'type' => 'taxonomy_vocabulary',
+ 'label' => t('deleted vocabulary'),
+ ),
),
),
);
@@ -105,10 +137,12 @@ class RulesTaxonomyEventHandler extends RulesEventHandlerEntityBundle {
* Returns the label to use for the bundle property.
*
* @return string
+ * The label to use for the bundle property.
*/
protected function getBundlePropertyLabel() {
return t('vocabulary');
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/modules/user.eval.inc b/sites/all/modules/contrib/admin/rules/modules/user.eval.inc
index a990bfb9..395c454c 100644
--- a/sites/all/modules/contrib/admin/rules/modules/user.eval.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/user.eval.inc
@@ -5,11 +5,12 @@
* Contains rules integration for the user module needed during evaluation.
*
* @addtogroup rules
+ *
* @{
*/
/**
- * Condition user: condition to check whether user has particular roles
+ * Condition user: condition to check whether user has particular roles.
*/
function rules_condition_user_has_role($account, $roles, $operation = 'AND') {
switch ($operation) {
@@ -43,7 +44,7 @@ function rules_condition_user_is_blocked($account) {
*/
function rules_action_user_add_role($account, $roles) {
if ($account->uid || !empty($account->is_new)) {
- // Get role list (minus the anonymous)
+ // Get role list (minus the anonymous).
$role_list = user_roles(TRUE);
foreach ($roles as $rid) {
diff --git a/sites/all/modules/contrib/admin/rules/modules/user.rules.inc b/sites/all/modules/contrib/admin/rules/modules/user.rules.inc
index 3e06b1a8..9feb1ce6 100644
--- a/sites/all/modules/contrib/admin/rules/modules/user.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/modules/user.rules.inc
@@ -1,9 +1,11 @@
'text',
'label' => t('view mode'),
'options list' => 'rules_get_entity_view_modes',
+ // Add the entity-type for the options list callback.
+ 'options list entity type' => 'user',
),
),
'access callback' => 'rules_user_integration_access',
@@ -88,7 +92,8 @@ function rules_user_event_info() {
/**
* Options list for user cancel methods.
- * @todo: Use for providing a user_cancel action.
+ *
+ * @todo Use for providing a user_cancel action.
*/
function rules_user_cancel_methods() {
module_load_include('inc', 'user', 'user.pages');
@@ -171,7 +176,7 @@ function rules_user_condition_operations() {
*/
function rules_user_action_info() {
$defaults = array(
- 'parameter' => array(
+ 'parameter' => array(
'account' => array(
'type' => 'user',
'label' => t('User'),
@@ -196,7 +201,7 @@ function rules_user_action_info() {
'base' => 'rules_action_user_remove_role',
);
$defaults = array(
- 'parameter' => array(
+ 'parameter' => array(
'account' => array(
'type' => 'user',
'label' => t('User'),
diff --git a/sites/all/modules/contrib/admin/rules/rules.api.php b/sites/all/modules/contrib/admin/rules/rules.api.php
index cabe313c..f8af7bd4 100644
--- a/sites/all/modules/contrib/admin/rules/rules.api.php
+++ b/sites/all/modules/contrib/admin/rules/rules.api.php
@@ -2,19 +2,20 @@
/**
* @file
+ * Documentation for hooks provided by the Rules API.
+ *
* This file contains no working PHP code; it exists to provide additional
* documentation for doxygen as well as to document hooks in the standard
* Drupal manner.
*/
-
/**
* @defgroup rules Rules module integrations.
*
* Module integrations with the rules module.
*
* The Rules developer documentation describes how modules can integrate with
- * rules: http://drupal.org/node/298486.
+ * rules: https://www.drupal.org/node/298486.
*/
/**
@@ -34,7 +35,7 @@
* handlers may be provided by implementing RulesActionHandlerInterface. See
* the interface for details.
*
- * @return
+ * @return array
* An array of information about the module's provided rules actions.
* The array contains a sub-array for each action, with the action name as
* the key. Actions names may only contain lowercase alpha-numeric characters
@@ -66,7 +67,7 @@
* - 'access callback': (optional) A callback which has to return whether the
* currently logged in user is allowed to configure this action. See
* rules_node_integration_access() for an example callback.
- * Each 'parameter' array may contain the following properties:
+ * Each 'parameter' array may contain the following properties:
* - label: The label of the parameter. Start capitalized. Required.
* - type: The rules data type of the parameter, which is to be passed to the
* action. All types declared in hook_rules_data_info() may be specified, as
@@ -114,7 +115,7 @@
* to clean inserted replacements; e.g. this is used by the token evaluator.
* - wrapped: (optional) Set this to TRUE in case the data should be passed
* wrapped. This only applies to wrapped data types, e.g. entities.
- * Each 'provides' array may contain the following properties:
+ * Each 'provides' array may contain the following properties:
* - label: The label of the variable. Start capitalized. Required.
* - type: The rules data type of the variable. All types declared in
* hook_rules_data_info() may be specified. Types may be parametrized e.g.
@@ -122,21 +123,20 @@
* - save: (optional) If this is set to TRUE, the provided variable is saved
* by rules when the rules evaluation ends. Only possible for savable data
* types. Defaults to FALSE.
+ * The module has to provide an implementation for each action, being a
+ * function named as specified in the 'base' key or for the execution callback.
+ * All other possible callbacks are optional.
+ * Supported action callbacks by rules are defined and documented in the
+ * RulesPluginImplInterface. However any module may extend the action plugin
+ * based upon a defined interface using hook_rules_plugin_info(). All methods
+ * defined in those interfaces can be overridden by the action implementation.
+ * The callback implementations for those interfaces may reside in any file
+ * specified in hook_rules_file_info().
*
- * The module has to provide an implementation for each action, being a
- * function named as specified in the 'base' key or for the execution callback.
- * All other possible callbacks are optional.
- * Supported action callbacks by rules are defined and documented in the
- * RulesPluginImplInterface. However any module may extend the action plugin
- * based upon a defined interface using hook_rules_plugin_info(). All methods
- * defined in those interfaces can be overridden by the action implementation.
- * The callback implementations for those interfaces may reside in any file
- * specified in hook_rules_file_info().
- *
- * @see hook_rules_file_info()
- * @see rules_action_execution_callback()
- * @see hook_rules_plugin_info()
- * @see RulesPluginImplInterface
+ * @see hook_rules_file_info()
+ * @see rules_action_execution_callback()
+ * @see hook_rules_plugin_info()
+ * @see RulesPluginImplInterface
*/
function hook_rules_action_info() {
return array(
@@ -167,7 +167,7 @@ function hook_rules_action_info() {
* will be treated as grouping in the given category (e.g. group "paypal" in
* category "commerce payment").
*
- * @return
+ * @return array
* An array of information about the module's provided categories.
* The array contains a sub-array for each category, with the category name as
* the key. Names may only contain lowercase alpha-numeric characters
@@ -176,18 +176,18 @@ function hook_rules_action_info() {
* - label: The label of the category. Start capitalized. Required.
* - weight: (optional) A weight for sorting the category. Defaults to 0.
* - equals group: (optional) For BC, categories may be defined that equal
- * a previsouly used 'group'.
+ * a previously used 'group'.
* - icon: (optional) The file path of an icon to use, relative to the module
* or specified icon path. The icon should be a transparent SVG containing
- * no colors (only #fff). See https://drupal.org/node/2090265 for
- * instructions on how to create a suiting icon.
+ * no colors (only #fff). See https://www.drupal.org/node/2090265 for
+ * instructions on how to create a suitable icon.
* Note that the icon is currently not used by Rules, however other UIs
* building upon Rules (like fluxkraft) do, and future releases of Rules
* might do as well. Consequently, the definition of an icon is optional.
* However, if both an icon font and icon is given, the icon is preferred.
* - icon path: (optional) The base path for the icon. Defaults to the
* providing module's directory.
- * - icon font class: (optional) An icon font class referring to a suiting
+ * - icon font class: (optional) An icon font class referring to a suitable
* icon. Icon font class names should map to the ones as defined by Font
* Awesome, while themes might want to choose to provide another icon font.
* See http://fortawesome.github.io/Font-Awesome/cheatsheet/.
@@ -221,7 +221,7 @@ function hook_rules_category_info() {
* plugin method callbacks in any file without having to care about file
* inclusion.
*
- * @return
+ * @return array
* An array of file names without the file ending which defaults to '.inc'.
*/
function hook_rules_file_info() {
@@ -259,10 +259,11 @@ function hook_rules_directory() {
* The callback gets arguments passed as described as parameter in
* hook_rules_action_info() as well as an array containing the action's
* configuration settings.
- * @return
- * The action may return an array containg parameter or provided variables
+ *
+ * @return array
+ * The action may return an array containing parameter or provided variables
* with their names as key. This is used update the value of a parameter or to
- * provdide the value for a provided variable.
+ * provide the value for a provided variable.
* Apart from that any parameters which have the key 'save' set to TRUE will
* be remembered to be saved by rules unless the action returns FALSE.
* Conditions have to return a boolean value in any case.
@@ -321,7 +322,7 @@ function hook_rules_condition_info() {
* handlers may be provided by implementing RulesEventHandlerInterface. See
* the interface for details.
*
- * @return
+ * @return array
* An array of information about the module's provided rules events. The array
* contains a sub-array for each event, with the event name as the key. The
* name may only contain lower case alpha-numeric characters and underscores
@@ -360,11 +361,11 @@ function hook_rules_condition_info() {
* - handler: (optional) A handler to load the actual variable value. This
* is useful for lazy loading variables. The handler gets all so far
* available variables passed in the order as defined. Also see
- * http://drupal.org/node/884554.
+ * https://www.drupal.org/node/884554.
* Note that for lazy-loading entities just the entity id may be passed
* as variable value, so a handler is not necessary in that case.
*
- * @see rules_invoke_event()
+ * @see rules_invoke_event()
*/
function hook_rules_event_info() {
$items = array(
@@ -413,8 +414,7 @@ function hook_rules_event_info() {
* module.
* For a list of data types defined by rules see rules_rules_core_data_info().
*
- *
- * @return
+ * @return array
* An array of information about the module's provided data types. The array
* contains a sub-array for each data type, with the data type name as the
* key. The name may only contain lower case alpha-numeric characters and
@@ -446,7 +446,7 @@ function hook_rules_event_info() {
* makes use of the class for wrapping the data of the given type. However
* note that if data is already wrapped when it is passed to Rules, the
* existing wrappers will be kept.
- * For modules implementing identifiable data types being non-entites the
+ * For modules implementing identifiable data types being non-entities the
* class RulesIdentifiableDataWrapper is provided, which can be used as base
* for a custom wrapper class. See RulesIdentifiableDataWrapper for details.
* - property info: (optional) May be used for non-entity data structures to
@@ -470,9 +470,9 @@ function hook_rules_event_info() {
* - cleaning callback: (optional) A callback that input evaluators may use
* to clean inserted replacements; e.g. this is used by the token evaluator.
*
- * @see entity_metadata_wrapper()
- * @see hook_rules_data_info_alter()
- * @see rules_rules_core_data_info()
+ * @see entity_metadata_wrapper()
+ * @see hook_rules_data_info_alter()
+ * @see rules_rules_core_data_info()
*/
function hook_rules_data_info() {
return array(
@@ -497,7 +497,7 @@ function hook_rules_data_info() {
* A rules configuration may consist of elements being instances of any rules
* plugin. This hook can be used to define new or to extend rules plugins.
*
- * @return
+ * @return array
* An array of information about the module's provided rules plugins. The
* array contains a sub-array for each plugin, with the plugin name as the
* key. The name may only contain lower case alpha-numeric characters,
@@ -543,8 +543,8 @@ function hook_rules_data_info() {
* of the 'or' plugin. Note that only uppercase values are allowed, as
* lower case values are treated as action or condition exports.
*
- * @see class RulesPlugin
- * @see hook_rules_plugin_info_alter()
+ * @see RulesPlugin
+ * @see hook_rules_plugin_info_alter()
*/
function hook_rules_plugin_info() {
return array(
@@ -583,7 +583,7 @@ function hook_rules_plugin_info() {
* and help() could be overridden in order to control access permissions or to
* provide some usage help.
*
- * @return
+ * @return array
* An array of information about the module's provided input evaluators. The
* array contains a sub-array for each evaluator, with the evaluator name as
* the key. The name may only contain lower case alpha-numeric characters and
@@ -597,8 +597,8 @@ function hook_rules_plugin_info() {
* used. Defaults to 'text'. Multiple data types may be specified using an
* array.
*
- * @see class RulesDataInputEvaluator
- * @see hook_rules_evaluator_info_alter()
+ * @see RulesDataInputEvaluator
+ * @see hook_rules_evaluator_info_alter()
*/
function hook_rules_evaluator_info() {
return array(
@@ -606,7 +606,7 @@ function hook_rules_evaluator_info() {
'class' => 'RulesTokenEvaluator',
'type' => array('text', 'uri'),
'weight' => 0,
- ),
+ ),
);
}
@@ -621,7 +621,7 @@ function hook_rules_evaluator_info() {
* access() could be overridden in order to provide a configuration form or
* to control access permissions.
*
- * @return
+ * @return array
* An array of information about the module's provided data processors. The
* array contains a sub-array for each processor, with the processor name as
* the key. The name may only contain lower case alpha-numeric characters and
@@ -636,8 +636,8 @@ function hook_rules_evaluator_info() {
* used. Defaults to 'text'. Multiple data types may be specified using an
* array.
*
- * @see class RulesDataProcessor
- * @see hook_rules_data_processor_info_alter()
+ * @see RulesDataProcessor
+ * @see hook_rules_data_processor_info_alter()
*/
function hook_rules_data_processor_info() {
return array(
@@ -645,7 +645,7 @@ function hook_rules_data_processor_info() {
'class' => 'RulesDateOffsetProcessor',
'type' => 'date',
'weight' => -2,
- ),
+ ),
);
}
@@ -658,10 +658,10 @@ function hook_rules_data_processor_info() {
* @param $actions
* The items of all modules as returned from hook_rules_action_info().
*
- * @see hook_rules_action_info().
+ * @see hook_rules_action_info()
*/
function hook_rules_action_info_alter(&$actions) {
- // The rules action is more powerful, so hide the core action
+ // The rules action is more powerful, so hide the core action.
unset($actions['rules_core_node_assign_owner_action']);
// We prefer handling saving by rules - not by the user.
unset($actions['rules_core_node_save_action']);
@@ -691,7 +691,7 @@ function hook_rules_condition_info_alter(&$conditions) {
* @param $events
* The items of all modules as returned from hook_rules_event_info().
*
- * @see hook_rules_event_info().
+ * @see hook_rules_event_info()
*/
function hook_rules_event_info_alter(&$events) {
// Change events.
@@ -763,7 +763,7 @@ function hook_rules_data_processor_info_alter(&$processor_info) {
* This hook is invoked during rules configuration loading, which is handled
* by entity_load(), via classes RulesEntityController and EntityCRUDController.
*
- * @param $configs
+ * @param array $configs
* An array of rules configurations being loaded, keyed by id.
*/
function hook_rules_config_load($configs) {
@@ -857,7 +857,7 @@ function hook_rules_config_execute($config) {
* should be placed into the file MODULENAME.rules_defaults.inc, which gets
* automatically included when the hook is invoked.
*
- * @return
+ * @return array
* An array of rules configurations with the configuration names as keys.
*
* @see hook_default_rules_configuration_alter()
@@ -866,6 +866,8 @@ function hook_rules_config_execute($config) {
function hook_default_rules_configuration() {
$rule = rules_reaction_rule();
$rule->label = 'example default rule';
+ // Add rules tags.
+ $rule->tags = array('Admin', 'Tag2');
$rule->active = FALSE;
$rule->event('node_update')
->condition(rules_condition('data_is', array('data:select' => 'node:status', 'value' => TRUE))->negate())
@@ -873,6 +875,7 @@ function hook_default_rules_configuration() {
->action('drupal_message', array('message' => 'A node has been updated.'));
$configs['rules_test_default_1'] = $rule;
+
return $configs;
}
@@ -900,10 +903,10 @@ function hook_default_rules_configuration_alter(&$configs) {
* This hook is invoked by the entity module after default rules configurations
* have been rebuilt; i.e. defaults have been saved to the database.
*
- * @param $rules_configs
+ * @param array $rules_configs
* The array of default rules configurations which have been inserted or
* updated, keyed by name.
- * @param $originals
+ * @param array $originals
* An array of original rules configurations keyed by name; i.e. the rules
* configurations before the current defaults have been applied. For inserted
* rules configurations no original is available.
@@ -982,7 +985,8 @@ function hook_rules_event_set_alter($event_name, RulesEventSet $event_set) {
* @param $element
* The element array of a configured condition or action which is to be
* upgraded.
- * @return
+ *
+ * @return string
* The name of the action or condition which should be used.
*/
function hook_rules_action_base_upgrade_map_name($element) {
@@ -990,13 +994,13 @@ function hook_rules_action_base_upgrade_map_name($element) {
}
/**
- * D6 to D7 upgrade procedure hook for mapping action or condition configuration.
+ * D6 to D7 upgrade process hook for mapping action or condition configuration.
*
* During upgrading Drupal 6 rule configurations to Drupal 7 Rules is taking
* care of upgrading the configuration of all known parameters, which only works
* if the parameter name has not changed.
* If something changed, this callback can be used to properly apply the
- * configruation of the Drupal 6 action ($element) to the Drupal 7 version
+ * configuration of the Drupal 6 action ($element) to the Drupal 7 version
* ($target).
*
* This is no real hook, but a callback that is invoked for each Drupal 6
@@ -1018,7 +1022,7 @@ function hook_rules_action_base_upgrade($element, RulesPlugin $target) {
}
/**
- * D6 to D7 upgrade procedure hook for mapping action or condition configuration.
+ * D6 to D7 upgrade process hook for mapping action or condition configuration.
*
* A alter hook that is called after the action/condition specific callback for
* each element of a configuration that is upgraded.
@@ -1068,7 +1072,7 @@ function hook_rules_ui_menu_alter(&$items, $base_path, $base_count) {
* a given user has access to perform a given operation on a Rules
* configuration.
*
- * @param $op
+ * @param string $op
* The operation being performed. One of 'view', 'create', 'update' or
* 'delete'.
* @param $rules_config
@@ -1077,7 +1081,8 @@ function hook_rules_ui_menu_alter(&$items, $base_path, $base_count) {
* @param $account
* (optional) The user to check for. If no account is passed, access is
* determined for the current user.
- * @return boolean
+ *
+ * @return bool|null
* Return TRUE to grant access, FALSE to explicitly deny access. Return NULL
* or nothing to not affect the operation.
* Access is granted as soon as a module grants access and no one denies
diff --git a/sites/all/modules/contrib/admin/rules/rules.drush.inc b/sites/all/modules/contrib/admin/rules/rules.drush.inc
index dc30de4c..9d4c18dc 100644
--- a/sites/all/modules/contrib/admin/rules/rules.drush.inc
+++ b/sites/all/modules/contrib/admin/rules/rules.drush.inc
@@ -7,22 +7,29 @@
/**
* Implements hook_drush_command().
- *
- * @return
- * An associative array describing your command(s).
- *
- * @see drush_parse_command()
*/
function rules_drush_command() {
$items = array();
$items['rules-list'] = array(
- 'description' => "List all the active and inactive rules for your site.",
+ 'description' => 'List all the active and inactive rules for your site.',
'drupal dependencies' => array('rules'),
'aliases' => array('rules'),
+ 'outputformat' => array(
+ 'default' => 'table',
+ 'pipe-format' => 'list',
+ 'field-labels' => array(
+ 'rule' => dt('Rule'),
+ 'label' => dt('Label'),
+ 'event' => dt('Event'),
+ 'active' => dt('Active'),
+ 'status' => dt('Status'),
+ ),
+ 'output-data-type' => 'format-table',
+ ),
);
$items['rules-enable'] = array(
- 'description' => "Enable a rule on your site.",
+ 'description' => 'Enable a rule on your site.',
'arguments' => array(
'rule' => 'Rule name to enable.',
),
@@ -30,13 +37,34 @@ function rules_drush_command() {
'aliases' => array('re'),
);
$items['rules-disable'] = array(
- 'description' => "Disable a rule on your site.",
+ 'description' => 'Disable a rule on your site.',
'arguments' => array(
'rule' => 'Rule name to export.',
),
'drupal dependencies' => array('rules'),
'aliases' => array('rd'),
);
+ $items['rules-revert'] = array(
+ 'description' => 'Revert a rule to its original state on your site.',
+ 'arguments' => array(
+ 'rule' => 'Rule name to revert.',
+ ),
+ 'drupal dependencies' => array('rules'),
+ );
+ $items['rules-delete'] = array(
+ 'description' => 'Delete a rule on your site.',
+ 'arguments' => array(
+ 'rule' => 'Rules name to delete.',
+ ),
+ 'drupal dependencies' => array('rules'),
+ );
+ $items['rules-export'] = array(
+ 'description' => 'Export a rule.',
+ 'arguments' => array(
+ 'rule' => 'Rules name to export.',
+ ),
+ 'drupal dependencies' => array('rules'),
+ );
return $items;
}
@@ -46,12 +74,23 @@ function rules_drush_command() {
*/
function rules_drush_help($section) {
switch ($section) {
- case 'drush:rules':
- return dt("List all the rules on your site.");
+ case 'drush:rules-list':
+ return dt('List all the rules on your site.');
+
case 'drush:rules-enable':
- return dt("Enable/activate a rule on your site.");
+ return dt('Enable/activate a rule on your site.');
+
case 'drush:rules-disable':
- return dt("Disable/deactivate a rule on your site.");
+ return dt('Disable/deactivate a rule on your site.');
+
+ case 'drush:rules-revert':
+ return dt('Revert a module-provided rule to its original state on your site.');
+
+ case 'drush:rules-delete':
+ return dt('Delete a rule on your site.');
+
+ case 'drush:rules-export':
+ return dt('Export a rule.');
}
}
@@ -60,27 +99,34 @@ function rules_drush_help($section) {
*/
function drush_rules_list() {
$rules = rules_config_load_multiple(FALSE);
- $rows = array(array(dt('Rule'), dt('Label'), dt('Event'), dt('Active'), dt('Status')));
+ $rows = array();
foreach ($rules as $rule) {
if (!empty($rule->name) && !empty($rule->label)) {
$events = array();
$event_info = rules_fetch_data('event_info');
if ($rule instanceof RulesTriggerableInterface) {
foreach ($rule->events() as $event_name) {
- $event_info += array($event_name => array('label' => dt('Unknown event "!event_name"', array('!event_name' => $event_name))));
+ $event_info += array(
+ $event_name => array(
+ 'label' => dt('Unknown event "!event_name"', array('!event_name' => $event_name)),
+ ),
+ );
$events[] = check_plain($event_info[$event_name]['label']);
}
}
- $rows[] = array(
- $rule->name,
- $rule->label,
- implode(', ', $events),
- $rule->active ? dt('Enabled') : dt('Disabled'),
- $rule->status ? theme('entity_status', array('status' => $rule->status, 'html' => FALSE)) : '',
+ $rows[$rule->name] = array(
+ 'rule' => $rule->name,
+ 'label' => $rule->label,
+ 'event' => implode(', ', $events),
+ 'active' => $rule->active ? dt('Enabled') : dt('Disabled'),
+ 'status' => $rule->status ? theme('entity_status', array('status' => $rule->status, 'html' => FALSE)) : '',
);
}
}
- drush_print_table($rows, TRUE);
+ if (version_compare(DRUSH_VERSION, '6.0', '<')) {
+ drush_print_table($rows, TRUE);
+ }
+ return $rows;
}
/**
@@ -132,3 +178,75 @@ function drush_rules_disable() {
drush_log(dt('The rule "!name" is already disabled.', array('!name' => $rule_name)), 'warning');
}
}
+
+/**
+ * Reverts a rule on the site.
+ */
+function drush_rules_revert() {
+ $args = func_get_args();
+ $rule_name = (!empty($args) && is_array($args)) ? array_shift($args) : '';
+ if (empty($rule_name)) {
+ return drush_set_error('', 'No rule name given.');
+ }
+
+ $rule = rules_config_load($rule_name);
+ if (empty($rule)) {
+ return drush_set_error('', dt('Could not load rule named "!rule-name".', array('!rule-name' => $rule_name)));
+ }
+
+ if (($rule->status & ENTITY_OVERRIDDEN) == ENTITY_OVERRIDDEN) {
+ if (drush_confirm(dt('Are you sure you want to revert the rule named "!rule-name"? This action cannot be undone.', array('!rule-name' => $rule_name)))) {
+ $rule->delete();
+ drush_log(dt('The rule "!name" has been reverted to its default state.', array('!name' => $rule_name)), 'success');
+ }
+ else {
+ drush_user_abort();
+ }
+ }
+ else {
+ drush_log(dt('The rule "!name" has not been overridden and can\'t be reverted.', array('!name' => $rule_name)), 'warning');
+ }
+}
+
+/**
+ * Deletes a rule on the site.
+ */
+function drush_rules_delete() {
+ $args = func_get_args();
+ $rule_name = (!empty($args) && is_array($args)) ? array_shift($args) : '';
+ if (empty($rule_name)) {
+ return drush_set_error('', 'No rule name given.');
+ }
+
+ $rule = rules_config_load($rule_name);
+ if (empty($rule)) {
+ return drush_set_error('', dt('Could not load rule named "!rule-name".', array('!rule-name' => $rule_name)));
+ }
+
+ if (drush_confirm(dt('Are you sure you want to delete the rule named "!rule-name"? This action cannot be undone.', array('!rule-name' => $rule_name)))) {
+ $rule->delete();
+ drush_log(dt('The rule "!name" has been deleted.', array('!name' => $rule_name)), 'success');
+ }
+ else {
+ drush_user_abort();
+ }
+}
+
+/**
+ * Exports a single rule.
+ */
+function drush_rules_export() {
+ $args = func_get_args();
+ $rule_name = (!empty($args) && is_array($args)) ? array_shift($args) : '';
+ if (empty($rule_name)) {
+ return drush_set_error('', dt('No rule name given.'));
+ }
+
+ $rule = rules_config_load($rule_name);
+ if (empty($rule)) {
+ return drush_set_error('', dt('Could not load rule named "!rule-name".', array('!rule-name' => $rule_name)));
+ }
+
+ drush_print($rule->export());
+ drush_log(dt('The rule "!name" has been exported.', array('!name' => $rule_name)), 'success');
+}
diff --git a/sites/all/modules/contrib/admin/rules/rules.features.inc b/sites/all/modules/contrib/admin/rules/rules.features.inc
index d34c8d60..e3224b56 100644
--- a/sites/all/modules/contrib/admin/rules/rules.features.inc
+++ b/sites/all/modules/contrib/admin/rules/rules.features.inc
@@ -2,11 +2,11 @@
/**
* @file
- * Provides Features integration for the Rules module, based upon the features
- * integration provided by the Entity API.
+ * Provides Features integration for the Rules module.
+ *
+ * This code is based upon the features integration provided by the Entity API.
*/
-
/**
* Controller handling the features integration.
*/
@@ -24,7 +24,8 @@ class RulesFeaturesController extends EntityDefaultFeaturesController {
/**
* Generates the result for hook_features_export().
- * Overridden to add in rules specific stuff.
+ *
+ * Overridden to add in rules-specific stuff.
*/
public function export($data, &$export, $module_name = '') {
$pipe = parent::export($data, $export, $module_name);
@@ -34,28 +35,32 @@ class RulesFeaturesController extends EntityDefaultFeaturesController {
// Add in plugin / element specific additions.
$iterator = new RecursiveIteratorIterator($rules_config, RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $element) {
- if ($element->facesAs('RulesPluginFeaturesIntegrationInterace')) {
- // Directly use __call() so we cann pass $export by reference.
+ if ($element->facesAs('RulesPluginFeaturesIntegrationInterface')) {
+ // Directly use __call() so we can pass $export by reference.
$element->__call('features_export', array(&$export, &$pipe, $module_name));
}
}
}
return $pipe;
}
+
}
/**
* Default extension callback used as default for the abstract plugin class.
- * Actions / conditions may override this with their own implementation, which
+ *
+ * Actions and conditions may override this with an implementation which
* actually does something.
*
- * @see RulesPluginFeaturesIntegrationInterace
+ * @see RulesPluginFeaturesIntegrationInterface
*/
function rules_features_abstract_default_features_export(&$export, &$pipe, $module_name = '', $element) {
-
+ // Do nothing.
}
/**
+ * Interface to give features access to the faces extensions mechanism.
+ *
* Interface that allows rules plugins or actions/conditions to customize the
* features export by implementing the interface using the faces extensions
* mechanism.
@@ -63,10 +68,24 @@ function rules_features_abstract_default_features_export(&$export, &$pipe, $modu
* @see hook_rules_plugin_info()
* @see hook_rules_action_info()
*/
-interface RulesPluginFeaturesIntegrationInterace {
+interface RulesPluginFeaturesIntegrationInterface {
/**
* Allows customizing the features export for a given rule element.
*/
- function features_export(&$export, &$pipe, $module_name = '');
+ public function features_export(&$export, &$pipe, $module_name = '');
+
+}
+
+/**
+ * Interface for backwards compatibility with older versions of Rules.
+ *
+ * Mis-spelled interface provided so that contributed modules which were
+ * implementing the wrong spelling (corrected in Rules 7.x-2.12) will not stop
+ * working now that the interface is spelled correctly.
+ *
+ * @todo Remove this when we can be sure that no contributed modules are
+ * still using the wrong spelling.
+ */
+interface RulesPluginFeaturesIntegrationInterace extends RulesPluginFeaturesIntegrationInterface {
}
diff --git a/sites/all/modules/contrib/admin/rules/rules.info b/sites/all/modules/contrib/admin/rules/rules.info
index 0a744d5f..123805da 100644
--- a/sites/all/modules/contrib/admin/rules/rules.info
+++ b/sites/all/modules/contrib/admin/rules/rules.info
@@ -3,28 +3,33 @@ description = React on events and conditionally evaluate actions.
package = Rules
core = 7.x
files[] = rules.features.inc
-files[] = tests/rules.test
files[] = includes/faces.inc
files[] = includes/rules.core.inc
files[] = includes/rules.event.inc
files[] = includes/rules.processor.inc
files[] = includes/rules.plugins.inc
files[] = includes/rules.state.inc
-files[] = includes/rules.dispatcher.inc
+files[] = modules/comment.rules.inc
files[] = modules/node.eval.inc
+files[] = modules/node.rules.inc
files[] = modules/php.eval.inc
files[] = modules/rules_core.eval.inc
files[] = modules/system.eval.inc
+files[] = modules/taxonomy.rules.inc
files[] = ui/ui.controller.inc
files[] = ui/ui.core.inc
files[] = ui/ui.data.inc
files[] = ui/ui.plugins.inc
+
+; Test cases
+files[] = tests/rules.test
+files[] = tests/rules_test.rules.inc
+
dependencies[] = entity_token
dependencies[] = entity
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/rules.install b/sites/all/modules/contrib/admin/rules/rules.install
index 8485df3b..b852bae1 100644
--- a/sites/all/modules/contrib/admin/rules/rules.install
+++ b/sites/all/modules/contrib/admin/rules/rules.install
@@ -1,7 +1,8 @@
condition('name', 'rules_debug_region_%', 'LIKE')
+ ->execute();
+ cache_clear_all('variables', 'cache_bootstrap');
}
/**
@@ -54,7 +69,7 @@ function rules_schema() {
'description' => 'The label of the configuration.',
'default' => 'unlabeled',
),
- 'plugin' => array(
+ 'plugin' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
@@ -122,7 +137,7 @@ function rules_schema() {
'name' => array('name'),
),
'indexes' => array(
- 'plugin' => array('plugin'),
+ 'plugin' => array('plugin', 'active'),
),
);
$schema['rules_trigger'] = array(
@@ -222,7 +237,7 @@ function rules_update_7200() {
'description' => 'The label of the configuration.',
'default' => 'unlabeled',
),
- 'plugin' => array(
+ 'plugin' => array(
'type' => 'varchar',
'length' => 127,
'not null' => TRUE,
@@ -492,7 +507,7 @@ function rules_update_7212() {
* Recover the "owner" property for broken configurations.
*/
function rules_update_7213() {
- $rows= db_select('rules_config', 'c')
+ $rows = db_select('rules_config', 'c')
->fields('c')
->condition('status', ENTITY_OVERRIDDEN)
->condition('owner', 'rules', '<>')
@@ -513,6 +528,12 @@ function rules_update_7213() {
* Switch out the rules_event_whitelist variable for a cache equivalent.
*/
function rules_update_7214() {
+ // Enable Rules if currently disabled so that this update won't fail.
+ $disable_rules = FALSE;
+ if (!module_exists('rules')) {
+ module_enable(array('rules'));
+ $disable_rules = TRUE;
+ }
// Set new event_whitelist cache cid.
rules_set_cache('rules_event_whitelist', variable_get('rules_event_whitelist', array()));
// Delete old conf variable.
@@ -525,4 +546,18 @@ function rules_update_7214() {
rules_get_cache();
_rules_rebuild_component_cache();
RulesEventSet::rebuildEventCache();
+ // Disable Rules again if it was disabled before this update started.
+ if ($disable_rules) {
+ module_disable(array('rules'));
+ }
+}
+
+/**
+ * Add an index for retrieving active config of a certain plugin.
+ */
+function rules_update_7215() {
+ if (db_index_exists('rules_config', 'plugin')) {
+ db_drop_index('rules_config', 'plugin');
+ }
+ db_add_index('rules_config', 'plugin', array('plugin', 'active'));
}
diff --git a/sites/all/modules/contrib/admin/rules/rules.module b/sites/all/modules/contrib/admin/rules/rules.module
index 719852c4..e713cd95 100644
--- a/sites/all/modules/contrib/admin/rules/rules.module
+++ b/sites/all/modules/contrib/admin/rules/rules.module
@@ -1,9 +1,15 @@
getFileName())));
$path = DIRECTORY_SEPARATOR != '/' ? str_replace(DIRECTORY_SEPARATOR, '/', $path) : $path;
- // Go up the path until we match a module up.
+ // Go up the path until we match a module.
$parts = explode('/', $path);
while (!isset($paths[$path]) && array_pop($parts)) {
$path = dirname($path);
@@ -366,9 +388,8 @@ function &rules_get_cache($cid = 'data') {
// Prevent stampeding by ensuring the cache is rebuilt just once at the
// same time.
while (!lock_acquire(__FUNCTION__ . $cid . $cid_suffix, 60)) {
- rules_log('Cache rebuild lock hit: !cid', array('!cid' => $cid), RulesLog::WARN);
// Now wait until the lock is released.
- lock_wait(__FUNCTION__ . $cid . $cid_suffix, 10);
+ lock_wait(__FUNCTION__ . $cid . $cid_suffix, 30);
// If the lock is released it's likely the cache was rebuild. Thus check
// again if we can fetch it from the persistent cache.
if ($get = cache_get($cid . $cid_suffix, 'cache_rules')) {
@@ -377,9 +398,10 @@ function &rules_get_cache($cid = 'data') {
}
}
if ($cid === 'data') {
- // There is no 'data' cache so we need to rebuild it. Make sure subsequent
- // cache gets of the main 'data' cache during rebuild get the interim
- // cache by passing in the reference of the static cache variable.
+ // There is no 'data' cache so we need to rebuild it. Make sure
+ // subsequent cache gets of the main 'data' cache during rebuild get
+ // the interim cache by passing in the reference of the static cache
+ // variable.
_rules_rebuild_cache($cache['data']);
}
elseif (strpos($cid, 'comp_') === 0) {
@@ -415,7 +437,7 @@ function &rules_get_cache($cid = 'data') {
* @see entity_defaults_rebuild()
*/
function _rules_rebuild_cache(&$cache) {
- foreach(array('data_info', 'plugin_info') as $hook) {
+ foreach (array('data_info', 'plugin_info') as $hook) {
$cache[$hook] = rules_fetch_data($hook);
}
foreach ($cache['plugin_info'] as $name => &$info) {
@@ -477,7 +499,7 @@ function rules_flush_caches() {
}
/**
- * Clears the rule set cache
+ * Clears the rule set cache.
*/
function rules_clear_cache() {
cache_clear_all('*', 'cache_rules', TRUE);
@@ -490,16 +512,17 @@ function rules_clear_cache() {
/**
* Imports the given export and returns the imported configuration.
*
- * @param $export
+ * @param string $export
* A serialized string in JSON format as produced by the RulesPlugin::export()
* method, or the PHP export as usual PHP array.
+ * @param string $error_msg
+ *
* @return RulesPlugin
*/
function rules_import($export, &$error_msg = '') {
return entity_get_controller('rules_config')->import($export, $error_msg);
}
-
/**
* Wraps the given data.
*
@@ -507,9 +530,10 @@ function rules_import($export, &$error_msg = '') {
* If available, the actual data, else NULL.
* @param $info
* An array of info about this data.
- * @param $force
+ * @param bool $force
* Usually data is only wrapped if really needed. If set to TRUE, wrapping the
* data is forced, so primitive data types are also wrapped.
+ *
* @return EntityMetadataWrapper
* An EntityMetadataWrapper or the unwrapped data.
*
@@ -550,11 +574,12 @@ function &rules_wrap_data($data = NULL, $info, $force = FALSE) {
/**
* Unwraps the given data, if it's wrapped.
*
- * @param $data
+ * @param array $data
* An array of wrapped data.
- * @param $info
+ * @param array $info
* Optionally an array of info about how to unwrap the data. Keyed as $data.
- * @return
+ *
+ * @return array
* An array containing unwrapped or passed through data.
*/
function rules_unwrap_data(array $data, $info = array()) {
@@ -622,6 +647,9 @@ function rules_get_event_info($event_name) {
* For a configured event name like node_view--article the base event name
* node_view is returned.
*
+ * @param string $event_name
+ * A (configured) event name.
+ *
* @return string
* The event base name.
*/
@@ -668,7 +696,7 @@ function rules_plugin_factory($plugin_name, $arg1 = NULL, $arg2 = NULL) {
}
/**
- * Implementation of hook_rules_plugin_info().
+ * Implements hook_rules_plugin_info().
*
* Note that the cache is rebuilt in the order of the plugins. Therefore the
* condition and action plugins must be at the top, so that any components
@@ -680,11 +708,11 @@ function rules_rules_plugin_info() {
'condition' => array(
'class' => 'RulesCondition',
'embeddable' => 'RulesConditionContainer',
- 'extenders' => array (
+ 'extenders' => array(
'RulesPluginImplInterface' => array(
'class' => 'RulesAbstractPluginDefaults',
),
- 'RulesPluginFeaturesIntegrationInterace' => array(
+ 'RulesPluginFeaturesIntegrationInterface' => array(
'methods' => array(
'features_export' => 'rules_features_abstract_default_features_export',
),
@@ -697,11 +725,11 @@ function rules_rules_plugin_info() {
'action' => array(
'class' => 'RulesAction',
'embeddable' => 'RulesActionContainer',
- 'extenders' => array (
+ 'extenders' => array(
'RulesPluginImplInterface' => array(
'class' => 'RulesAbstractPluginDefaults',
),
- 'RulesPluginFeaturesIntegrationInterace' => array(
+ 'RulesPluginFeaturesIntegrationInterface' => array(
'methods' => array(
'features_export' => 'rules_features_abstract_default_features_export',
),
@@ -793,7 +821,7 @@ function rules_rules_plugin_info() {
}
/**
- * Implementation of hook_entity_info().
+ * Implements hook_entity_info().
*/
function rules_entity_info() {
return array(
@@ -822,10 +850,10 @@ function rules_entity_info() {
}
/**
- * Implementation of hook_hook_info().
+ * Implements hook_hook_info().
*/
function rules_hook_info() {
- foreach(array('plugin_info', 'rules_directory', 'data_info', 'condition_info', 'action_info', 'event_info', 'file_info', 'evaluator_info', 'data_processor_info') as $hook) {
+ foreach (array('plugin_info', 'rules_directory', 'data_info', 'condition_info', 'action_info', 'event_info', 'file_info', 'evaluator_info', 'data_processor_info') as $hook) {
$hooks['rules_' . $hook] = array(
'group' => 'rules',
);
@@ -852,12 +880,12 @@ function rules_hook_info() {
* @see hook_entity_info()
* @see RulesEntityController
*
- * @param $names
+ * @param array|false $names
* An array of rules configuration names or FALSE to load all.
- * @param $conditions
+ * @param array $conditions
* An array of conditions in the form 'field' => $value.
*
- * @return
+ * @return array
* An array of rule configurations indexed by their ids.
*/
function rules_config_load_multiple($names = array(), $conditions = array()) {
@@ -885,10 +913,10 @@ function rules_config_load($name) {
* Whether to return only the label or the whole component object.
* @param $type
* Optionally filter for 'action' or 'condition' components.
- * @param $conditions
+ * @param array $conditions
* An array of additional conditions as required by rules_config_load().
*
- * @return
+ * @return array
* An array keyed by component name containing either the label or the config.
*/
function rules_get_components($label = FALSE, $type = NULL, $conditions = array()) {
@@ -911,7 +939,7 @@ function rules_get_components($label = FALSE, $type = NULL, $conditions = array(
/**
* Delete rule configurations from database.
*
- * @param $ids
+ * @param array $ids
* An array of entity IDs.
*/
function rules_config_delete(array $ids) {
@@ -921,13 +949,13 @@ function rules_config_delete(array $ids) {
/**
* Ensures the configuration's 'dirty' flag is up to date by running an integrity check.
*
- * @param $update
+ * @param bool $update
* (optional) Whether the dirty flag is also updated in the database if
* necessary. Defaults to TRUE.
*/
function rules_config_update_dirty_flag($rules_config, $update = TRUE) {
// Keep a log of already check configurations to avoid repetitive checks on
- // oftent used components.
+ // often used components.
// @see rules_element_invoke_component_validate()
$checked = &drupal_static(__FUNCTION__, array());
if (!empty($checked[$rules_config->name])) {
@@ -974,7 +1002,7 @@ function rules_config_update_dirty_flag($rules_config, $update = TRUE) {
* @param ...
* Arguments to pass to the hook / event.
*
- * @return
+ * @return array
* An array of return values of the hook implementations. If modules return
* arrays from their implementations, those are merged into one array.
*/
@@ -1021,10 +1049,10 @@ function rules_invoke_event() {
$event_name = $args[0];
unset($args[0]);
// We maintain a whitelist of configured events to reduces the number of cache
- // reads. If the whitelist is empty we proceed and it is rebuilt.
+ // reads. If the whitelist is not in the cache we proceed and it is rebuilt.
if (rules_event_invocation_enabled()) {
$whitelist = rules_get_cache('rules_event_whitelist');
- if ((empty($whitelist) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
+ if ((($whitelist === FALSE) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
$event->executeByArgs($args);
}
}
@@ -1035,7 +1063,7 @@ function rules_invoke_event() {
*
* @param $event_name
* The event's name.
- * @param $args
+ * @param array $args
* An array of parameters for the variables provided by the event, as defined
* in hook_rules_event_info(). Either pass an array keyed by the variable
* names or a numerically indexed array, in which case the ordering of the
@@ -1066,7 +1094,7 @@ function rules_invoke_event_by_args($event_name, $args = array()) {
* @param $args
* Pass further parameters as required for the invoked component.
*
- * @return
+ * @return array
* An array of variables as provided by the component, or FALSE in case the
* component could not be executed.
*/
@@ -1080,10 +1108,12 @@ function rules_invoke_component() {
}
/**
- * Filters the given array of arrays by keeping only entries which have $key set
- * to the value of $value.
+ * Filters the given array of arrays.
*
- * @param $array
+ * This filter operates by keeping only entries which have $key set to the
+ * value of $value.
+ *
+ * @param array $array
* The array of arrays to filter.
* @param $key
* The key used for the comparison.
@@ -1105,10 +1135,11 @@ function rules_filter_array($array, $key, $value) {
}
/**
- * Merges the $update array into $array making sure no values of $array not
- * appearing in $update are lost.
+ * Merges the $update array into $array.
*
- * @return
+ * Makes sure no values of $array not appearing in $update are lost.
+ *
+ * @return array
* The updated array.
*/
function rules_update_array(array $array, array $update) {
@@ -1126,12 +1157,13 @@ function rules_update_array(array $array, array $update) {
/**
* Extracts the property with the given name.
*
- * @param $arrays
+ * @param array $arrays
* An array of arrays from which a property is to be extracted.
* @param $key
* The name of the property to extract.
*
- * @return An array of extracted properties, keyed as in $arrays-
+ * @return array
+ * An array of extracted properties, keyed as in $arrays.
*/
function rules_extract_property($arrays, $key) {
$data = array();
@@ -1156,9 +1188,9 @@ function rules_array_key($array) {
*
* @param $replacements
* An array of token replacements that need to be "cleaned" for use in the URL.
- * @param $data
+ * @param array $data
* An array of objects used to generate the replacements.
- * @param $options
+ * @param array $options
* An array of options used to generate the replacements.
*
* @see rules_path_action_info()
@@ -1265,6 +1297,7 @@ function rules_permissions_by_component(array $components = array()) {
/**
* Menu callback for loading rules configuration elements.
+ *
* @see RulesUIController::config_menu()
*/
function rules_element_load($element_id, $config_name) {
@@ -1274,6 +1307,7 @@ function rules_element_load($element_id, $config_name) {
/**
* Menu callback for getting the title as configured.
+ *
* @see RulesUIController::config_menu()
*/
function rules_get_title($text, $element) {
@@ -1292,6 +1326,7 @@ function rules_get_title($text, $element) {
* Menu callback for getting the title for the add element page.
*
* Uses a work-a-round for accessing the plugin name.
+ *
* @see RulesUIController::config_menu()
*/
function rules_menu_add_element_title($array) {
@@ -1384,11 +1419,14 @@ function rules_drupal_goto_alter(&$path, &$options, &$http_response_code) {
* Returns whether the debug log should be shown.
*/
function rules_show_debug_output() {
- if (variable_get('rules_debug', FALSE) == RulesLog::INFO && user_access('access rules debug')) {
+ // For performance avoid unnecessary auto-loading of the RulesLog class.
+ if (!class_exists('RulesLog', FALSE)) {
+ return FALSE;
+ }
+ if (variable_get('rules_debug', 0) == RulesLog::INFO && user_access('access rules debug')) {
return TRUE;
}
- // For performance avoid unnecessary auto-loading of the RulesLog class.
- return variable_get('rules_debug', FALSE) == RulesLog::WARN && user_access('access rules debug') && class_exists('RulesLog', FALSE) && RulesLog::logger()->hasErrors();
+ return variable_get('rules_debug', 0) == RulesLog::WARN && user_access('access rules debug') && RulesLog::logger()->hasErrors();
}
/**
@@ -1495,11 +1533,13 @@ function rules_modules_disabled($modules) {
->fields('r')
->condition('id', $ids, 'IN')
->condition('active', 1)
- ->execute()->rowCount();
+ ->countQuery()
+ ->execute()
+ ->fetchField();
if ($count > 0) {
$message = format_plural($count,
'1 Rules configuration requires some of the disabled modules to function and cannot be executed any more.',
- '@count Rules configuration require some of the disabled modules to function and cannot be executed any more.'
+ '@count Rules configurations require some of the disabled modules to function and cannot be executed any more.'
);
drupal_set_message($message, 'warning');
}
@@ -1580,25 +1620,25 @@ function rules_menu() {
/**
* Helper function to keep track of external documentation pages for Rules.
*
- * @param $topic
+ * @param string $topic
* The topic key for used for identifying help pages.
*
- * @return
+ * @return string|array|false
* Either a URL for the given page, or the full list of external help pages.
*/
function rules_external_help($topic = NULL) {
$help = array(
- 'rules' => 'http://drupal.org/node/298480',
- 'terminology' => 'http://drupal.org/node/1299990',
- 'condition-components' => 'http://drupal.org/node/1300034',
- 'data-selection' => 'http://drupal.org/node/1300042',
- 'chained-tokens' => 'http://drupal.org/node/1300042',
- 'loops' => 'http://drupal.org/node/1300058',
- 'components' => 'http://drupal.org/node/1300024',
- 'component-types' => 'http://drupal.org/node/1300024',
- 'variables' => 'http://drupal.org/node/1300024',
- 'scheduler' => 'http://drupal.org/node/1300068',
- 'coding' => 'http://drupal.org/node/878720',
+ 'rules' => 'https://www.drupal.org/node/298480',
+ 'terminology' => 'https://www.drupal.org/node/1299990',
+ 'condition-components' => 'https://www.drupal.org/node/1300034',
+ 'data-selection' => 'https://www.drupal.org/node/1300042',
+ 'chained-tokens' => 'https://www.drupal.org/node/1300042',
+ 'loops' => 'https://www.drupal.org/node/1300058',
+ 'components' => 'https://www.drupal.org/node/1300024',
+ 'component-types' => 'https://www.drupal.org/node/1300024',
+ 'variables' => 'https://www.drupal.org/node/1300024',
+ 'scheduler' => 'https://www.drupal.org/node/1300068',
+ 'coding' => 'https://www.drupal.org/node/878720',
);
if (isset($topic)) {
@@ -1700,7 +1740,7 @@ function rules_entity_metadata_wrapper_all_properties_callback(EntityMetadataWra
* when Drupal is not fully bootstrapped. It gets enabled in rules_init() and
* rules_enable().
*
- * @param bool|NULL $enable
+ * @param bool|null $enable
* NULL to leave the setting as is and TRUE / FALSE to change the behaviour.
*
* @return bool
diff --git a/sites/all/modules/contrib/admin/rules/rules.rules.inc b/sites/all/modules/contrib/admin/rules/rules.rules.inc
index 3beb76eb..b828c1d3 100644
--- a/sites/all/modules/contrib/admin/rules/rules.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/rules.rules.inc
@@ -1,7 +1,8 @@
'markup',
'#markup' => t('Reaction rules, listed below, react on selected events on the site. Each reaction rule may fire any number of actions, and may have any number of conditions that must be met for the actions to be executed. You can also set up components – stand-alone sets of Rules configuration that can be used in Rules and other parts of your site. See the online documentation for an introduction on how to use Rules.',
array('@url1' => url('admin/config/workflow/rules/components'),
'@url2' => rules_external_help('rules'))),
@@ -105,7 +104,6 @@ function rules_admin_components_overview($form, &$form_state, $base_path) {
$collapsed = FALSE;
}
$form['help'] = array(
- '#type' => 'markup',
'#markup' => t('Components are stand-alone sets of Rules configuration that can be used by Rules and other modules on your site. Components are for example useful if you want to use the same conditions, actions or rules in multiple places, or call them from your custom module. You may also export each component separately. See the online documentation for more information about how to use components.',
array('@url' => rules_external_help('components'))),
);
@@ -162,7 +160,7 @@ function rules_admin_settings($form, &$form_state) {
$pathauto_help = t("Note that Pathauto's URL path cleaning method can be configured at admin/config/search/path/settings.", array('!url' => url('admin/config/search/path/settings')));
}
else {
- $pathauto_help = t('Install the Pathauto module in order to get a configurable URL path cleaning method.');
+ $pathauto_help = t('Install the Pathauto module in order to get a configurable URL path cleaning method.');
}
$form['path']['rules_path_cleaning_callback'] = array(
@@ -192,7 +190,7 @@ function rules_admin_settings($form, &$form_state) {
$form['debug']['rules_debug_log'] = array(
'#type' => 'checkbox',
'#title' => t('Log debug information to the system log'),
- '#default_value' => variable_get('rules_debug_log', 0),
+ '#default_value' => variable_get('rules_debug_log', FALSE),
);
$form['debug']['rules_debug'] = array(
'#type' => 'radios',
@@ -211,7 +209,7 @@ function rules_admin_settings($form, &$form_state) {
'#states' => array(
// Hide the regions settings when the debug log is disabled.
'invisible' => array(
- 'input[name="rules_debug"]' => array('value' => '0'),
+ 'input[name="rules_debug"]' => array('value' => 0),
),
),
);
@@ -281,7 +279,7 @@ function rules_admin_settings_integrity_check_submit($form, &$form_state) {
rules_config_update_dirty_flag($rules_config, TRUE, TRUE);
if ($rules_config->dirty) {
$count++;
- $variables = array('%label' => $rules_config->label(), '%name' => $rules_config->name, '@plugin' => $rules_config->plugin(), '!uri'=> url(RulesPluginUI::path($rules_config->name)));
+ $variables = array('%label' => $rules_config->label(), '%name' => $rules_config->name, '@plugin' => $rules_config->plugin(), '!uri' => url(RulesPluginUI::path($rules_config->name)));
drupal_set_message(t('The @plugin %label (%name) fails the integrity check and cannot be executed.', $variables), 'error');
}
diff --git a/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.info b/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.info
index 350c0e3a..6bce2396 100644
--- a/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.info
+++ b/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.info
@@ -2,13 +2,14 @@ name = Rules UI
description = Administrative interface for managing rules.
package = Rules
core = 7.x
-files[] = rules_admin.module
-files[] = rules_admin.inc
dependencies[] = rules
+configure = admin/config/workflow/rules
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Test cases
+files[] = tests/rules_admin.test
+
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.module b/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.module
index 8966ded5..f5a38e75 100644
--- a/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.module
+++ b/sites/all/modules/contrib/admin/rules/rules_admin/rules_admin.module
@@ -1,7 +1,8 @@
'Rules UI Tests ',
+ 'description' => 'Tests Rules UI.',
+ 'group' => 'Rules',
+ );
+ }
+
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
+ parent::setUp('rules', 'rules_admin', 'rules_test');
+ RulesLog::logger()->clear();
+ variable_set('rules_debug_log', TRUE);
+ }
+
+ /**
+ * Tests that NOT condition labels are not HTML-encoded in the UI.
+ *
+ * @see https://www.drupal.org/project/rules/issues/1945006
+ */
+ public function testConditionLabel() {
+ // Create a simple user account with permission to create a rule.
+ $user = $this->drupalCreateUser(array('access administration pages', 'administer rules'));
+ $this->drupalLogin($user);
+
+ // First we need an event.
+ $this->drupalGet('admin/config/workflow/rules/reaction/add');
+ $edit = array(
+ 'settings[label]' => 'Test node event',
+ 'settings[name]' => 'test_node_event',
+ 'event' => 'node_insert',
+ );
+ $this->drupalPost(NULL, $edit, 'Save');
+ $this->assertText('Editing reaction rule', 'Rule edit page is shown.');
+
+ // Now add a condition with a special character in the label.
+ $this->clickLink('Add condition');
+ $this->assertText('Add a new condition', 'Condition edit page is shown.');
+ $edit = array(
+ 'element_name' => 'rules_test_condition_apostrophe',
+ );
+ $this->drupalPost(NULL, $edit, 'Continue');
+
+ // Negate the condition, as this is how it gets improperly HTML encoded.
+ $edit = array(
+ 'negate' => TRUE,
+ );
+ $this->drupalPost(NULL, $edit, 'Save');
+ $this->assertNoRaw("'", 'Apostrophe is not HTML-encoded.');
+ }
+
+}
+
+/**
+ * UI test cases for the minimal profile.
+ *
+ * The minimal profile is useful for testing because it has fewer dependencies
+ * so the tests run faster. Also, removing the profile-specific configuration
+ * reveals assumptions in the code. For example, the minimal profile doesn't
+ * define any content types, so when Rules expects to have content types to
+ * operate on that assumpation may cause errors.
+ */
+class RulesMinimalProfileTestCase extends DrupalWebTestCase {
+
+ protected $profile = 'minimal';
+
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
+ return array(
+ 'name' => 'Rules UI Minimal Profile Tests ',
+ 'description' => 'Tests UI support for minimal profile.',
+ 'group' => 'Rules',
+ );
+ }
+
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
+ parent::setUp('rules', 'rules_admin');
+ RulesLog::logger()->clear();
+ variable_set('rules_debug_log', TRUE);
+ }
+
+ /**
+ * Tests node event UI without content types.
+ *
+ * @see https://www.drupal.org/project/rules/issues/2267341
+ */
+ public function testNodeEventUi() {
+ // Create a simple user account with permission to create a rule.
+ $user = $this->drupalCreateUser(array('access administration pages', 'administer rules'));
+ $this->drupalLogin($user);
+
+ $this->drupalGet('admin/config/workflow/rules/reaction/add');
+ $edit = array(
+ 'settings[label]' => 'Test node event',
+ 'settings[name]' => 'test_node_event',
+ 'event' => 'node_insert',
+ );
+ $this->drupalPostAJAX(NULL, $edit, 'event');
+ $this->assertText('Restrict by type', 'Restrict by type selection is visible.');
+ $this->drupalPost(NULL, $edit, 'Save');
+ $this->assertText('Editing reaction rule', 'Rule edit page is shown.');
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.i18n.inc b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.i18n.inc
index 003540d8..da49f39b 100644
--- a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.i18n.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.i18n.inc
@@ -11,7 +11,7 @@
class RulesI18nStringController extends EntityDefaultI18nStringController {
/**
- * Overriden to customize i18n object info.
+ * Overridden to customize i18n object info.
*
* @see EntityDefaultI18nStringController::hook_object_info()
*/
@@ -22,7 +22,7 @@ class RulesI18nStringController extends EntityDefaultI18nStringController {
}
/**
- * Overriden to customize the used menu wildcard.
+ * Overridden to customize the used menu wildcard.
*/
protected function menuWildcard() {
return '%rules_config';
@@ -34,6 +34,7 @@ class RulesI18nStringController extends EntityDefaultI18nStringController {
protected function menuBasePath() {
return 'admin/config/workflow/rules/reaction';
}
+
}
/**
@@ -42,7 +43,7 @@ class RulesI18nStringController extends EntityDefaultI18nStringController {
class RulesI18nStringObjectWrapper extends i18n_string_object_wrapper {
/**
- * Get translatable properties
+ * Get translatable properties.
*/
protected function build_properties() {
$strings = parent::build_properties();
@@ -91,4 +92,5 @@ class RulesI18nStringObjectWrapper extends i18n_string_object_wrapper {
}
}
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.info b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.info
index 297650e7..835d413f 100644
--- a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.info
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.info
@@ -7,9 +7,9 @@ core = 7.x
files[] = rules_i18n.i18n.inc
files[] = rules_i18n.rules.inc
files[] = rules_i18n.test
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.install b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.install
new file mode 100644
index 00000000..7debfd98
--- /dev/null
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.install
@@ -0,0 +1,19 @@
+language;
+ drupal_static_reset('i18n_object_info');
+ drupal_static_reset('entity_get_info');
+ drupal_static_reset('entity_i18n_controller');
+ cache_clear_all("entity_info:$langcode", 'cache');
+}
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.module b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.module
index 8a87615e..e7cea79d 100644
--- a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.module
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.module
@@ -5,7 +5,6 @@
* Rules i18n integration.
*/
-
/**
* Implements hook_menu().
*/
@@ -111,7 +110,10 @@ function rules_i18n_rules_config_update($rules_config, $original = NULL) {
* Implements hook_rules_config_delete().
*/
function rules_i18n_rules_config_delete($rules_config) {
- i18n_string_object_remove('rules_config', $rules_config);
+ // Only react on real delete, not revert.
+ if (!$rules_config->hasStatus(ENTITY_IN_CODE)) {
+ i18n_string_object_remove('rules_config', $rules_config);
+ }
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.rules.inc b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.rules.inc
index 4f5d0eeb..b4c4f9ce 100644
--- a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.rules.inc
@@ -115,7 +115,7 @@ function rules_i18n_rules_evaluator_info() {
'type' => array('text', 'list', 'token', 'list'),
// Be sure to translate after doing PHP evaluation.
'weight' => -8,
- ),
+ ),
);
}
@@ -128,6 +128,9 @@ class RulesI18nStringEvaluator extends RulesDataInputEvaluator {
return user_access('translate admin strings');
}
+ /**
+ * Overrides RulesDataInputEvaluator::prepare().
+ */
public function prepare($text, $var_info, $param_info = NULL) {
if (!empty($param_info['translatable'])) {
$this->setting = TRUE;
@@ -177,9 +180,12 @@ class RulesI18nStringEvaluator extends RulesDataInputEvaluator {
return $value;
}
+ /**
+ * Overrides RulesDataInputEvaluator::help().
+ */
public static function help($var_info, $param_info = array()) {
if (!empty($param_info['translatable'])) {
- if ($param_info['custom translation language']) {
+ if (!empty($param_info['custom translation language'])) {
$text = t('Translations can be provided at the %translate tab. The argument value is translated to the configured language.', array('%translate' => t('Translate')));
}
else {
@@ -193,4 +199,5 @@ class RulesI18nStringEvaluator extends RulesDataInputEvaluator {
return $render;
}
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.test b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.test
index 1cb7a0da..615d3dda 100644
--- a/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.test
+++ b/sites/all/modules/contrib/admin/rules/rules_i18n/rules_i18n.test
@@ -10,6 +10,9 @@
*/
class RulesI18nTestCase extends DrupalWebTestCase {
+ /**
+ * Declares test metadata.
+ */
public static function getInfo() {
return array(
'name' => 'Rules I18n',
@@ -19,7 +22,10 @@ class RulesI18nTestCase extends DrupalWebTestCase {
);
}
- public function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules_i18n');
$this->admin_user = $this->drupalCreateUser(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages'));
$this->drupalLogin($this->admin_user);
@@ -52,11 +58,11 @@ class RulesI18nTestCase extends DrupalWebTestCase {
}
elseif ($this->xpath('//input[@type="checkbox" and @name=:name and @checked="checked"]', array(':name' => 'enabled[' . $language_code . ']'))) {
// It's installed and enabled. No need to do anything.
- $this->assertTrue(true, 'Language [' . $language_code . '] already installed and enabled.');
+ $this->assertTrue(TRUE, 'Language [' . $language_code . '] already installed and enabled.');
}
else {
// It's installed but not enabled. Enable it.
- $this->assertTrue(true, 'Language [' . $language_code . '] already installed.');
+ $this->assertTrue(TRUE, 'Language [' . $language_code . '] already installed.');
$this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration'));
$this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.'));
}
@@ -139,7 +145,7 @@ class RulesI18nTestCase extends DrupalWebTestCase {
$messages = drupal_get_messages();
$this->assertEqual($messages['status'][0], 'text-de', 'Text has been successfully translated.');
- // Enable the PHP module and make sure PHP in translations is not evaluted.
+ // Enable the PHP module and make sure PHP in translations is not evaluated.
module_enable(array('php'));
i18n_string_textgroup('rules')->update_translation("rules_config:{$set->name}:$id:text", 'de', 'text ');
@@ -162,9 +168,9 @@ class RulesI18nTestCase extends DrupalWebTestCase {
$set = rules_action_set(array('node' => array('type' => 'node')));
$set->action('rules_i18n_select', array(
- 'data:select' => 'node:body:value',
- 'language' => 'de',
- 'data_translated:var' => 'body',
+ 'data:select' => 'node:body:value',
+ 'language' => 'de',
+ 'data_translated:var' => 'body',
));
$set->action('drupal_message', array('message:select' => 'body'));
$set->save();
@@ -180,4 +186,5 @@ class RulesI18nTestCase extends DrupalWebTestCase {
$messages = drupal_get_messages();
$this->assertEqual($messages['status'][0], "German body.\n", 'Translated text has been selected.');
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler.handler.inc b/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler.handler.inc
index 07e36521..60341576 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler.handler.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler.handler.inc
@@ -1,5 +1,10 @@
name = 'rules_scheduler';
$view->description = 'Scheduled Rules components';
$view->tag = '';
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler_views_filter.inc b/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler_views_filter.inc
index 3945407e..5994d832 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler_views_filter.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/includes/rules_scheduler_views_filter.inc
@@ -4,8 +4,10 @@
* @file
* An extended subclass for component filtering.
*/
+
class rules_scheduler_views_filter extends views_handler_filter_in_operator {
- function get_value_options() {
+
+ public function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Component');
$result = db_select('rules_scheduler', 'r')
@@ -19,4 +21,5 @@ class rules_scheduler_views_filter extends views_handler_filter_in_operator {
$this->value_options = $config_names;
}
}
-}
\ No newline at end of file
+
+}
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.admin.inc b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.admin.inc
index 2956a474..dfc36188 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.admin.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.admin.inc
@@ -9,7 +9,7 @@
* Schedule page with a view for the scheduled tasks.
*/
function rules_scheduler_schedule_page() {
- // Display view for all scheduled tasks
+ // Display view for all scheduled tasks.
if (module_exists('views')) {
// We cannot use views_embed_view() here as we need to set the path for the
// component filter form.
@@ -18,7 +18,7 @@ function rules_scheduler_schedule_page() {
$task_list = $view->preview();
}
else {
- $task_list = t('To display scheduled tasks you have to install the Views module.');
+ $task_list = t('To display scheduled tasks you have to install the Views module.');
}
$page['task_view'] = array(
'#markup' => $task_list,
@@ -44,7 +44,7 @@ function rules_scheduler_form($form, &$form_state) {
$form['delete_by_config'] = array(
'#type' => 'fieldset',
'#title' => t('Delete tasks by component name'),
- '#disabled' => empty($config_options)
+ '#disabled' => empty($config_options),
);
$form['delete_by_config']['config'] = array(
'#title' => t('Component'),
@@ -57,7 +57,7 @@ function rules_scheduler_form($form, &$form_state) {
'#type' => 'submit',
'#value' => t('Delete tasks'),
'#submit' => array('rules_scheduler_form_delete_by_config_submit'),
- );
+ );
return $form;
}
@@ -90,7 +90,6 @@ function rules_scheduler_delete_task($form, &$form_state, $task) {
else {
$msg = t('This task executes component %label and will be executed on %date. The action cannot be undone.', array(
'%label' => $config->label(),
- '%id' => $task['identifier'],
'%date' => format_date($task['date']),
));
}
@@ -116,7 +115,7 @@ function rules_scheduler_schedule_form($form, &$form_state, $rules_config, $base
$form_state['component'] = $rules_config->name;
$action = rules_action('schedule', array('component' => $rules_config->name));
$action->form($form, $form_state);
- // The component should be fixed, so hide the paramter for it.
+ // The component should be fixed, so hide the parameter for it.
$form['parameter']['component']['#access'] = FALSE;
$form['submit'] = array(
'#type' => 'submit',
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.drush.inc b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.drush.inc
index 24405b2a..a6ed7956 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.drush.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.drush.inc
@@ -12,7 +12,7 @@ function rules_scheduler_drush_command() {
$items = array();
$items['rules-scheduler-tasks'] = array(
- 'description' => 'Checks for scheduled tasks to be added to the queue.',
+ 'description' => 'Check for scheduled tasks to be added to the queue.',
'options' => array(
'claim' => 'Optionally claim tasks from the queue to work on. Any value set will override the default time spent on this queue.',
),
@@ -21,7 +21,7 @@ function rules_scheduler_drush_command() {
'examples' => array(
'drush rusch' => 'Add scheduled tasks to the queue.',
'drush rusch --claim' => 'Add scheduled tasks to the queue and claim items for the default amount of time.',
- 'drush rusch --claim=30' => 'Add schedules tasks to the queue and claim items for 30 seconds.',
+ 'drush rusch --claim=30' => 'Add scheduled tasks to the queue and claim items for 30 seconds.',
),
);
@@ -41,8 +41,8 @@ function rules_scheduler_drush_help($section) {
/**
* Command callback for processing the rules_scheduler_tasks queue.
*
- * @see rules_scheduler_cron_queue_info().
- * @see rules_scheduler_cron().
+ * @see rules_scheduler_cron_queue_info()
+ * @see rules_scheduler_cron()
*/
function drush_rules_scheduler_tasks() {
if (rules_scheduler_queue_tasks()) {
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.info b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.info
index accdf0bc..44731c29 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.info
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.info
@@ -3,19 +3,17 @@ description = Schedule the execution of Rules components using actions.
dependencies[] = rules
package = Rules
core = 7.x
-files[] = rules_scheduler.admin.inc
-files[] = rules_scheduler.module
-files[] = rules_scheduler.install
-files[] = rules_scheduler.rules.inc
-files[] = rules_scheduler.test
files[] = includes/rules_scheduler.handler.inc
-files[] = includes/rules_scheduler.views_default.inc
-files[] = includes/rules_scheduler.views.inc
+
+; Views handlers
files[] = includes/rules_scheduler_views_filter.inc
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Test cases
+files[] = tests/rules_scheduler.test
+files[] = tests/rules_scheduler_test.inc
+
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.install b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.install
index 202c861a..0aa81432 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.install
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.install
@@ -31,7 +31,8 @@ function rules_scheduler_schema() {
'not null' => TRUE,
),
'data' => array(
- 'type' => 'text',
+ 'type' => 'blob',
+ 'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
'description' => 'The whole, serialized evaluation data.',
@@ -47,7 +48,7 @@ function rules_scheduler_schema() {
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
- 'description' => 'The fully qualified class name of a the queue item handler.',
+ 'description' => 'The fully-qualified class name of the queue item handler.',
),
),
'primary key' => array('tid'),
@@ -61,6 +62,24 @@ function rules_scheduler_schema() {
return $schema;
}
+/**
+ * Implements hook_install().
+ */
+function rules_scheduler_install() {
+ // Create the queue to hold scheduled tasks.
+ $queue = DrupalQueue::get('rules_scheduler_tasks', TRUE);
+ $queue->createQueue();
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function rules_scheduler_uninstall() {
+ // Clean up after ourselves by deleting the queue and all items in it.
+ $queue = DrupalQueue::get('rules_scheduler_tasks');
+ $queue->deleteQueue();
+}
+
/**
* Upgrade from Rules scheduler 6.x-1.x to 7.x.
*/
@@ -136,7 +155,7 @@ function rules_scheduler_update_7203() {
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
- 'description' => 'The fully qualified class name of a the queue item handler.',
+ 'description' => 'The fully-qualified class name of the queue item handler.',
));
}
@@ -154,6 +173,21 @@ function rules_scheduler_update_7204() {
}
}
+/**
+ * Use blob:big for rules_scheduler.data for compatibility with PostgreSQL.
+ */
+function rules_scheduler_update_7205() {
+ if (db_field_exists('rules_scheduler', 'data')) {
+ db_change_field('rules_scheduler', 'data', 'data', array(
+ 'type' => 'blob',
+ 'size' => 'big',
+ 'not null' => FALSE,
+ 'serialize' => TRUE,
+ 'description' => 'The whole, serialized evaluation data.',
+ ));
+ }
+}
+
/**
* Rules upgrade callback for mapping the action name.
*/
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.module b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.module
index b74973d5..a4c3e4b9 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.module
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.module
@@ -103,7 +103,7 @@ function rules_scheduler_menu() {
'access arguments' => array('administer rules'),
'file' => 'rules_scheduler.admin.inc',
);
- $items[RULES_SCHEDULER_PATH .'/%rules_scheduler_task/delete'] = array(
+ $items[RULES_SCHEDULER_PATH . '/%rules_scheduler_task/delete'] = array(
'title' => 'Delete a scheduled task',
'type' => MENU_CALLBACK,
'page callback' => 'drupal_get_form',
@@ -115,7 +115,10 @@ function rules_scheduler_menu() {
}
/**
- * Load a task by a given task ID.
+ * Loads a task by a given task ID.
+ *
+ * @param int $tid
+ * The task ID.
*/
function rules_scheduler_task_load($tid) {
$result = db_select('rules_scheduler', 'r')
@@ -126,7 +129,10 @@ function rules_scheduler_task_load($tid) {
}
/**
- * Delete a task by a given task ID.
+ * Deletes a task by a given task ID.
+ *
+ * @param int $tid
+ * The task ID.
*/
function rules_scheduler_task_delete($tid) {
db_delete('rules_scheduler')
@@ -137,9 +143,9 @@ function rules_scheduler_task_delete($tid) {
/**
* Schedule a task to be executed later on.
*
- * @param $task
+ * @param array $task
* An array representing the task with the following keys:
- * - config: The machine readable name of the to be scheduled component.
+ * - config: The machine readable name of the to-be-scheduled component.
* - date: Timestamp when the component should be executed.
* - state: (deprecated) Rules evaluation state to use for scheduling.
* - data: Any additional data to store with the task.
@@ -166,8 +172,8 @@ function rules_scheduler_schedule_task($task) {
/**
* Queue tasks that are ready for execution.
*
- * @return boolean
- * Returns TRUE if any queue items where created, otherwise FALSE.
+ * @return bool
+ * TRUE if any queue items where created, otherwise FALSE.
*/
function rules_scheduler_queue_tasks() {
$items_created = FALSE;
@@ -209,6 +215,6 @@ function rules_scheduler_rules_config_delete($rules_config) {
function rules_scheduler_views_api() {
return array(
'api' => '3.0-alpha1',
- 'path' => drupal_get_path('module', 'rules_scheduler') .'/includes',
+ 'path' => drupal_get_path('module', 'rules_scheduler') . '/includes',
);
}
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.rules.inc b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.rules.inc
index 473a810a..4f31f70a 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.rules.inc
@@ -5,6 +5,7 @@
* Rules integration for the rules scheduler module.
*
* @addtogroup rules
+ *
* @{
*/
@@ -115,7 +116,9 @@ function rules_scheduler_action_schedule_info_alter(&$element_info, RulesPlugin
}
/**
- * Validate callback for the schedule action to make sure the component exists and is not dirty.
+ * Validate callback for the schedule action.
+ *
+ * Makes sure the component exists and is not dirty.
*
* @see rules_element_invoke_component_validate()
*/
@@ -137,7 +140,7 @@ function rules_scheduler_action_schedule_validate(RulesPlugin $element) {
*/
function rules_scheduler_action_schedule_help() {
return t("Note that component evaluation is triggered by cron – make sure cron is configured correctly by checking your site's !status. The scheduling time accuracy depends on your configured cron interval. See the online documentation for more information on how to schedule evaluation of components.",
- array('!status' => l('Status report', 'admin/reports/status'),
+ array('!status' => l(t('Status report'), 'admin/reports/status'),
'@url' => rules_external_help('scheduler')));
}
@@ -192,7 +195,7 @@ function rules_scheduler_action_delete($component_name = NULL, $task_identifier
}
/**
- * Cancel scheduled task action validation callback.
+ * Cancels scheduled task action validation callback.
*/
function rules_scheduler_action_delete_validate($element) {
if (empty($element->settings['task']) && empty($element->settings['task:select']) &&
@@ -206,7 +209,7 @@ function rules_scheduler_action_delete_validate($element) {
* Help for the cancel action.
*/
function rules_scheduler_action_delete_help() {
- return t('This action allows you to delete scheduled tasks that are waiting for future execution.') .' '. t('They can be addressed by an identifier or by the component name, whereas if both are specified only tasks fulfilling both requirements will be deleted.');
+ return t('This action allows you to delete scheduled tasks that are waiting for future execution.') . ' ' . t('They can be addressed by an identifier or by the component name, whereas if both are specified only tasks fulfilling both requirements will be deleted.');
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.test b/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler.test
similarity index 68%
rename from sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.test
rename to sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler.test
index 957ce0ce..4e19e80c 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/rules_scheduler.test
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler.test
@@ -5,9 +5,15 @@
* Rules Scheduler tests.
*/
+/**
+ * Test cases for the Rules Scheduler module.
+ */
class RulesSchedulerTestCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Rules Scheduler tests',
'description' => 'Test scheduling components.',
@@ -15,10 +21,13 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules_scheduler', 'rules_scheduler_test');
RulesLog::logger()->clear();
- variable_set('rules_debug_log', 1);
+ variable_set('rules_debug_log', TRUE);
}
/**
@@ -27,7 +36,7 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
* Note that this also makes sure Rules properly handles timezones, else this
* test could fail due to a wrong 'now' timestamp.
*/
- function testComponentSchedule() {
+ public function testComponentSchedule() {
$set = rules_rule_set(array(
'node1' => array('type' => 'node', 'label' => 'node'),
));
@@ -51,7 +60,7 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
$rule->execute($node);
// Run cron to let the rules scheduler do its work.
- drupal_cron_run();
+ $this->cronRun();
$node = node_load($node->nid, NULL, TRUE);
$this->assertFalse($node->status, 'The component has been properly scheduled.');
@@ -59,9 +68,9 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
}
/**
- * Make sure recurion prevention is working fine for scheduled rule sets.
+ * Makes sure recursion prevention is working fine for scheduled rule sets.
*/
- function testRecursionPrevention() {
+ public function testRecursionPrevention() {
$set = rules_rule_set(array(
'node1' => array('type' => 'node', 'label' => 'node'),
));
@@ -78,7 +87,7 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
$rule->event('node_update');
$rule->action('schedule', array(
'component' => 'rules_test_set_2',
- 'identifier' => '',
+ 'identifier' => 'test_recursion_prevention',
'date' => 'now',
'param_node1:select' => 'node',
));
@@ -87,13 +96,32 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
// Create a node, what triggers the rule.
$node = $this->drupalCreateNode(array('title' => 'The title.', 'status' => 1));
// Run cron to let the rules scheduler do its work.
- drupal_cron_run();
+ $this->cronRun();
$node = node_load($node->nid, NULL, TRUE);
$this->assertFalse($node->status, 'The component has been properly scheduled.');
- $text1 = RulesLog::logger()->render();
- $text2 = RulesTestCase::t('Not evaluating reaction rule %unlabeled to prevent recursion.', array('unlabeled' => $rule->name));
- $this->assertTrue((strpos($text1, $text2) !== FALSE), "Scheduled recursion prevented.");
+
+ // Create a simple user account with permission to see the dblog.
+ $user = $this->drupalCreateUser(array('access site reports'));
+ $this->drupalLogin($user);
+
+ // View the database log.
+ $this->drupalGet('admin/reports/dblog');
+
+ // Can't use
+ // $this->clickLink('Rules debug information: " Scheduled evaluation...')
+ // because xpath doesn't allow : or " in the string.
+ // So instead, use our own xpath to figure out the href of the second link
+ // on the page (the first link is the most recent log entry, which is the
+ // log entry for the user login, above.)
+
+ // All links.
+ $links = $this->xpath('//a[contains(@href, :href)]', array(':href' => 'admin/reports/event/'));
+ // Strip off /?q= from href.
+ $href = explode('=', $links[1]['href']);
+ // Click the link for the RulesLog entry.
+ $this->drupalGet($href[1]);
+ $this->assertRaw(RulesTestCase::t('Not evaluating reaction rule %unlabeled to prevent recursion.', array('unlabeled' => $rule->name)), "Scheduled recursion prevented.");
RulesLog::logger()->checkLog();
}
@@ -112,10 +140,10 @@ class RulesSchedulerTestCase extends DrupalWebTestCase {
));
// Run cron to let the rules scheduler do its work.
- drupal_cron_run();
+ $this->cronRun();
// The task handler should have set the variable to TRUE now.
$this->assertTrue(variable_get($variable));
}
-}
+}
diff --git a/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler_test.info b/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler_test.info
index 3ce5f836..b5b2bc31 100644
--- a/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler_test.info
+++ b/sites/all/modules/contrib/admin/rules/rules_scheduler/tests/rules_scheduler_test.info
@@ -5,9 +5,8 @@ core = 7.x
files[] = rules_scheduler_test.inc
hidden = TRUE
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules.test b/sites/all/modules/contrib/admin/rules/tests/rules.test
index 3b034e8e..fe0a1d93 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules.test
+++ b/sites/all/modules/contrib/admin/rules/tests/rules.test
@@ -5,9 +5,15 @@
* Rules tests.
*/
+/**
+ * Rules test cases.
+ */
class RulesTestCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Rules Engine tests',
'description' => 'Test using the rules API to create and evaluate rules.',
@@ -15,16 +21,19 @@ class RulesTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules', 'rules_test');
RulesLog::logger()->clear();
- variable_set('rules_debug_log', 1);
+ variable_set('rules_debug_log', TRUE);
}
/**
* Calculates the output of t() given an array of placeholders to replace.
*/
- static function t($text, $strings) {
+ public static function t($text, $strings) {
$placeholders = array();
foreach ($strings as $key => $string) {
$key = !is_numeric($key) ? $key : $string;
@@ -33,6 +42,9 @@ class RulesTestCase extends DrupalWebTestCase {
return strtr($text, $placeholders);
}
+ /**
+ * Helper function to create a test Rule.
+ */
protected function createTestRule() {
$rule = rule();
$rule->condition('rules_test_condition_true')
@@ -53,7 +65,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests creating a rule and iterating over the rule elements.
*/
- function testRuleCreation() {
+ public function testRuleCreation() {
$rule = $this->createTestRule();
$rule->integrityCheck();
$rule->execute();
@@ -78,9 +90,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test handling dependencies.
+ * Tests handling dependencies.
*/
- function testdependencies() {
+ public function testDependencies() {
$action = rules_action('rules_node_publish_action');
$this->assertEqual($action->dependencies(), array('rules_test'), 'Providing module is returned as dependency.');
@@ -147,10 +159,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test setting up an action with some action_info and serializing and
- * executing it.
+ * Tests setting up an action, serializing, and executing it.
*/
- function testActionSetup() {
+ public function testActionSetup() {
$action = rules_action('rules_node_publish_action');
$s = serialize($action);
@@ -168,7 +179,7 @@ class RulesTestCase extends DrupalWebTestCase {
$action2->executeByArgs(array('node' => $node));
$this->assertEqual($node->status, 1, 'Action executed correctly');
- // Test calling an extended + overriden method.
+ // Test calling an extended + overridden method.
$this->assertEqual($action2->help(), 'custom', 'Using custom help callback.');
// Inspect the cache
@@ -177,23 +188,23 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test executing with wrong arguments.
+ * Tests executing with wrong arguments.
*/
- function testActionExecutionFails() {
+ public function testActionExecutionFails() {
$action = rules_action('rules_node_publish_action');
try {
$action->execute();
$this->fail("Execution hasn't created an exception.");
}
catch (RulesEvaluationException $e) {
- $this->pass("RulesEvaluationException was thrown: ". $e);
+ $this->pass("RulesEvaluationException was thrown: " . $e);
}
}
/**
- * Test setting up a rule and mapping variables.
+ * Tests setting up a rule and mapping variables.
*/
- function testVariableMapping() {
+ public function testVariableMapping() {
$rule = rule(array(
'node' => array('type' => 'node'),
'node_unchanged' => array('type' => 'node'),
@@ -215,7 +226,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests making use of class based actions.
*/
- function testClassBasedActions() {
+ public function testClassBasedActions() {
$cache = rules_get_cache();
$this->assertTrue(!empty($cache['action_info']['rules_test_class_action']), 'Action has been discovered.');
$action = rules_action('rules_test_class_action');
@@ -235,7 +246,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests CRUD functionality.
*/
- function testRulesCRUD() {
+ public function testRulesCRUD() {
$rule = $this->createTestRule();
$rule->integrityCheck()->save('test');
@@ -296,16 +307,16 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test automatic saving of variables.
+ * Tests automatic saving of variables.
*/
- function testActionSaving() {
+ public function testActionSaving() {
// Test saving a parameter.
$action = rules_action('rules_node_publish_action_save');
$node = $this->drupalCreateNode(array('status' => 0, 'type' => 'page'));
$action->executeByArgs(array('node' => $node));
$this->assertEqual($node->status, 1, 'Action executed correctly on node.');
- // Sync node_load cache with node_save
+ // Sync node_load cache with node_save.
entity_get_controller('node')->resetCache();
$node = node_load($node->nid);
@@ -335,9 +346,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test adding a variable and optional parameters.
+ * Tests adding a variable and optional parameters.
*/
- function testVariableAdding() {
+ public function testVariableAdding() {
$node = $this->drupalCreateNode();
$rule = rule(array('nid' => array('type' => 'integer')));
$rule->condition('rules_test_condition_true')
@@ -351,7 +362,6 @@ class RulesTestCase extends DrupalWebTestCase {
$vars = $rule->conditions()->offsetGet(0)->availableVariables();
$this->assertEqual(!isset($vars['node_loaded']), 'Loaded variable is not available to conditions.');
-
// Test adding a variable with a custom variable name.
$node = $this->drupalCreateNode();
$rule = rule(array('nid' => array('type' => 'integer')));
@@ -364,9 +374,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test custom access for using component actions/conditions.
+ * Tests custom access for using component actions/conditions.
*/
- function testRuleComponentAccess() {
+ public function testRuleComponentAccess() {
// Create a normal user.
$normal_user = $this->drupalCreateUser();
// Create a role for granting access to the rule component.
@@ -388,15 +398,15 @@ class RulesTestCase extends DrupalWebTestCase {
user_role_change_permissions($this->normal_role, array('use Rules component rules_test_roles' => TRUE));
$this->assertTrue(rules_action('component_rules_test_roles')->access(), 'Authenticated user with the correct role can use the rule component.');
- // Reset global user to anonyous.
+ // Reset global user to anonymous.
$user = user_load(0);
$this->assertFalse(rules_action('component_rules_test_roles')->access(), 'Anonymous user can\'t use the rule component.');
}
/**
- * Test passing arguments by reference to an action.
+ * Tests passing arguments by reference to an action.
*/
- function testPassingByReference() {
+ public function testPassingByReference() {
// Keeping references of variables is unsupported, though the
// EntityMetadataArrayObject may be used to achieve that.
$array = array('foo' => 'bar');
@@ -406,9 +416,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test sorting rule elements.
+ * Tests sorting rule elements.
*/
- function testSorting() {
+ public function testSorting() {
$rule = $this->createTestRule();
$conditions = $rule->conditions();
$conditions[0]->weight = 10;
@@ -427,7 +437,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests using data selectors.
*/
- function testDataSelectors() {
+ public function testDataSelectors() {
$body[LANGUAGE_NONE][0] = array('value' => 'The body & nothing.');
$node = $this->drupalCreateNode(array('body' => $body, 'type' => 'page', 'summary' => ''));
@@ -468,7 +478,7 @@ class RulesTestCase extends DrupalWebTestCase {
$this->fail("Validation hasn't created an exception.");
}
catch (RulesIntegrityException $e) {
- $this->pass("Validation error correctly detected: ". $e);
+ $this->pass("Validation error correctly detected: " . $e);
}
// Test auto creation of nested data structures, like the node body field.
@@ -508,7 +518,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests making use of rule sets.
*/
- function testRuleSets() {
+ public function testRuleSets() {
$set = rules_rule_set(array(
'node' => array('type' => 'node', 'label' => 'node'),
));
@@ -543,7 +553,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests invoking components from the action.
*/
- function testComponentInvocations() {
+ public function testComponentInvocations() {
$set = rules_rule_set(array(
'node1' => array('type' => 'node', 'label' => 'node'),
));
@@ -591,12 +601,12 @@ class RulesTestCase extends DrupalWebTestCase {
$this->assertTrue($node->status == 1, 'Component provided in code has been executed.');
}
-
/**
- * Test asserting metadata, customizing action info and make sure integrity
- * is checked.
+ * Tests asserting metadata.
+ *
+ * Customizes action info and makes sure integrity is checked.
*/
- function testMetadataAssertion() {
+ public function testMetadataAssertion() {
$action = rules_action('rules_node_make_sticky_action');
// Test failing integrity check.
@@ -614,9 +624,9 @@ class RulesTestCase extends DrupalWebTestCase {
// Test asserting additional metadata.
$rule = rule(array('node' => array('type' => 'node')));
// Customize action info using the settings.
- $rule->condition('data_is', array('data:select' => 'node:type', 'value' => 'page'))
+ $rule->condition('data_is', array('data:select' => 'node:type', 'value' => 'page'))
// Configure an condition using the body. As the body is a field,
- // tis requires the bundle to be correctly asserted.
+ // this requires the bundle to be correctly asserted.
->condition(rules_condition('data_is', array('data:select' => 'node:body:value', 'value' => 'foo'))->negate())
// The action also requires the page bundle in order to work.
->action($action);
@@ -627,7 +637,6 @@ class RulesTestCase extends DrupalWebTestCase {
$rule->execute($node);
$this->assertTrue($node->sticky, 'Rule with asserted metadata executed.');
-
// Test asserting metadata on a derived property, i.e. not a variable.
$rule = rule(array('node' => array('type' => 'node')));
$rule->condition('entity_is_of_type', array('entity:select' => 'node:reference', 'type' => 'node'))
@@ -676,9 +685,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test using loops.
+ * Tests using loops.
*/
- function testLoops() {
+ public function testLoops() {
// Test passing the list parameter as argument to ensure that is working
// generally for plugin container too.
drupal_get_messages(NULL, TRUE);
@@ -701,7 +710,7 @@ class RulesTestCase extends DrupalWebTestCase {
'list' => array(
'type' => 'list',
'label' => 'A list of nodes',
- )
+ ),
));
$loop = rules_loop(array('list:select' => 'list', 'item:var' => 'node'));
$loop->action('data_set', array('data:select' => 'node:sticky', 'value' => TRUE));
@@ -717,9 +726,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test access checks.
+ * Tests access checks.
*/
- function testAccessCheck() {
+ public function testAccessCheck() {
$rule = rule();
// Try to set a property which is provided by the test module and is not
// accessible, so the access check has to return FALSE.
@@ -728,9 +737,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test returning provided variables.
+ * Tests returning provided variables.
*/
- function testReturningVariables() {
+ public function testReturningVariables() {
$node = $this->drupalCreateNode();
$action = rules_action('entity_fetch', array('type' => 'node', 'id' => $node->nid));
list($node2) = $action->execute();
@@ -773,7 +782,7 @@ class RulesTestCase extends DrupalWebTestCase {
/**
* Tests using input evaluators.
*/
- function testInputEvaluators() {
+ public function testInputEvaluators() {
$node = $this->drupalCreateNode(array('title' => 'The body & nothing.', 'type' => 'page'));
$rule = rule(array('nid' => array('type' => 'integer')));
@@ -796,9 +805,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test importing and exporting a rule.
+ * Tests importing and exporting a rule.
*/
- function testRuleImportExport() {
+ public function testRuleImportExport() {
$rule = rule(array('nid' => array('type' => 'integer')));
$rule->name = "rules_export_test";
$rule->action('rules_action_load_node')
@@ -899,9 +908,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Test the named parameter mode.
+ * Tests the named parameter mode.
*/
- function testNamedParameters() {
+ public function testNamedParameters() {
$rule = rule(array('node' => array('type' => 'node')));
$rule->action('rules_action_node_set_title', array('title' => 'foo'));
$rule->integrityCheck();
@@ -914,9 +923,9 @@ class RulesTestCase extends DrupalWebTestCase {
}
/**
- * Make sure Rules aborts when NULL values are used.
+ * Makes sure Rules aborts when NULL values are used.
*/
- function testAbortOnNULLValues() {
+ public function testAbortOnNULLValues() {
$rule = rule(array('node' => array('type' => 'node')));
$rule->action('drupal_message', array('message:select' => 'node:log'));
$rule->integrityCheck();
@@ -930,6 +939,7 @@ class RulesTestCase extends DrupalWebTestCase {
$msg = RulesTestCase::t('The variable or parameter %message is empty.', array('message'));
$this->assertTrue(strpos($text, $msg) !== FALSE, 'Evaluation aborted due to an empty argument value.');
}
+
}
/**
@@ -937,7 +947,10 @@ class RulesTestCase extends DrupalWebTestCase {
*/
class RulesTestDataCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Rules Data tests',
'description' => 'Tests rules data saving and type matching.',
@@ -945,9 +958,12 @@ class RulesTestDataCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules', 'rules_test');
- variable_set('rules_debug_log', 1);
+ variable_set('rules_debug_log', TRUE);
// Make sure we don't ran over issues with the node_load static cache.
entity_get_controller('node')->resetCache();
}
@@ -955,7 +971,7 @@ class RulesTestDataCase extends DrupalWebTestCase {
/**
* Tests intelligently saving data.
*/
- function testDataSaving() {
+ public function testDataSaving() {
$node = $this->drupalCreateNode();
$state = new RulesState(rule());
$state->addVariable('node', $node, array('type' => 'node'));
@@ -988,9 +1004,9 @@ class RulesTestDataCase extends DrupalWebTestCase {
}
/**
- * Test type matching
+ * Tests type matching.
*/
- function testTypeMatching() {
+ public function testTypeMatching() {
$entity = array('type' => 'entity');
$node = array('type' => 'node');
$this->assertTrue(RulesData::typesMatch($node, $entity), 'Types match.');
@@ -1010,7 +1026,7 @@ class RulesTestDataCase extends DrupalWebTestCase {
/**
* Tests making use of custom wrapper classes.
*/
- function testCustomWrapperClasses() {
+ public function testCustomWrapperClasses() {
// Test loading a vocabulary by name, which is done by a custom wrapper.
$set = rules_action_set(array('vocab' => array('type' => 'taxonomy_vocabulary')), array('vocab'));
$set->action('drupal_message', array('message:select' => 'vocab:name'));
@@ -1040,7 +1056,7 @@ class RulesTestDataCase extends DrupalWebTestCase {
/**
* Makes sure the RulesIdentifiableDataWrapper is working correctly.
*/
- function testRulesIdentifiableDataWrapper() {
+ public function testRulesIdentifiableDataWrapper() {
$node = $this->drupalCreateNode();
$wrapper = new RulesTestTypeWrapper('rules_test_type', $node);
$this->assertTrue($wrapper->value() == $node, 'Data correctly wrapped.');
@@ -1062,7 +1078,7 @@ class RulesTestDataCase extends DrupalWebTestCase {
$this->fail("Loading hasn't created an exception.");
}
catch (EntityMetadataWrapperException $e) {
- $this->pass("Exception was thrown: ". $e->getMessage());
+ $this->pass("Exception was thrown: " . $e->getMessage());
}
// Test saving a savable custom, identifiable wrapper.
@@ -1075,6 +1091,7 @@ class RulesTestDataCase extends DrupalWebTestCase {
$node = node_load($node->nid, NULL, TRUE);
$this->assertEqual($node->status, 1, 'Savable non-entity has been saved.');
}
+
}
/**
@@ -1082,7 +1099,10 @@ class RulesTestDataCase extends DrupalWebTestCase {
*/
class RulesTriggerTestCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Reaction Rules',
'description' => 'Tests triggering reactive rules.',
@@ -1090,12 +1110,18 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules', 'rules_test');
RulesLog::logger()->clear();
- variable_set('rules_debug_log', 1);
+ variable_set('rules_debug_log', TRUE);
}
+ /**
+ * Helper function to create a test Rule.
+ */
protected function createTestRule($action = TRUE, $event = 'node_presave') {
$rule = rules_reaction_rule();
$rule->event($event)
@@ -1110,7 +1136,7 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
/**
* Tests CRUD for reaction rules - making sure the events are stored properly.
*/
- function testReactiveRuleCreation() {
+ public function testReactiveRuleCreation() {
$rule = $this->createTestRule();
$rule->save();
$result = db_query("SELECT event FROM {rules_trigger} WHERE id = :id", array(':id' => $rule->id));
@@ -1132,7 +1158,7 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
/**
* Tests creating and triggering a basic reaction rule.
*/
- function testBasicReactionRule() {
+ public function testBasicReactionRule() {
$node = $this->drupalCreateNode(array('type' => 'page'));
$rule = $this->createTestRule();
$rule->integrityCheck()->save();
@@ -1147,13 +1173,13 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
RulesLog::logger()->checkLog();
$this->assertFalse(node_load($nid), 'Rule successfully triggered and executed');
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
}
/**
- * Test a rule using a handler to load a variable.
+ * Tests a rule using a handler to load a variable.
*/
- function testVariableHandler() {
+ public function testVariableHandler() {
$node = $this->drupalCreateNode(array('type' => 'page', 'sticky' => 0, 'status' => 0));
$rule = $this->createTestRule(FALSE, 'node_update');
$rule->action('rules_node_publish_action_save', array('node:select' => 'node_unchanged'));
@@ -1174,19 +1200,19 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
$this->assertFalse($node->sticky, 'Parameter has been loaded and saved.');
$this->assertTrue($node->status, 'Action has been executed.');
- // Ensure the rule was evaluated a second time
+ // Ensure the rule was evaluated a second time.
$text = RulesLog::logger()->render();
$msg = RulesTestCase::t('Evaluating conditions of rule %rule 1', array('rule 1'));
$pos = strpos($text, $msg);
$pos = ($pos !== FALSE) ? strpos($text, $msg, $pos) : FALSE;
$this->assertTrue($pos !== FALSE, "Recursion prevented.");
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
}
/**
- * Test aborting silently when handlers are not able to load.
+ * Tests aborting silently when handlers are not able to load.
*/
- function testVariableHandlerFailing() {
+ public function testVariableHandlerFailing() {
$rule = $this->createTestRule(FALSE, 'node_presave');
$rule->action('rules_node_publish_action_save', array('node:select' => 'node_unchanged'));
$rule->integrityCheck()->save();
@@ -1194,16 +1220,18 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
// On insert it's not possible to get the unchanged node during presave.
$node = $this->drupalCreateNode(array('type' => 'page', 'sticky' => 0, 'status' => 0));
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
$text = RulesTestCase::t('Unable to load variable %node_unchanged, aborting.', array('node_unchanged'));
$this->assertTrue(strpos(RulesLog::logger()->render(), $text) !== FALSE, "Aborted evaluation.");
}
/**
- * Tests preventing recursive rule invocations by creating a rule that reacts
- * on node-update and generates a node update that would trigger it itself.
+ * Tests preventing recursive rule invocations.
+ *
+ * Creates a rule that reacts on node-update then generates a node update
+ * that would trigger it itself.
*/
- function testRecursionPrevention() {
+ public function testRecursionPrevention() {
$rule = $this->createTestRule(FALSE, 'node_update');
$rule->action('rules_node_make_sticky_action');
$rule->integrityCheck()->save();
@@ -1213,17 +1241,19 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
node_save($node);
$text = RulesTestCase::t('Not evaluating reaction rule %label to prevent recursion.', array('label' => $rule->name));
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
$this->assertTrue((strpos(RulesLog::logger()->render(), $text) !== FALSE), "Recursion prevented.");
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
}
/**
- * Ensure the recursion prevention still allows to let the rule trigger again
+ * Tests recursion prevention with altered arguments.
+ *
+ * Ensure the recursion prevention still allows the rule to trigger again
* during evaluation of the same event set, if the event isn't caused by the
- * rule itself - thus we won't run in an infinte loop.
+ * rule itself - thus we won't run in an infinite loop.
*/
- function testRecursionOnDifferentArguments() {
+ public function testRecursionOnDifferentArguments() {
// Create rule1 - which might recurse.
$rule = $this->createTestRule(FALSE, 'node_update');
$rule->action('rules_node_make_sticky_action');
@@ -1242,7 +1272,7 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array('type' => 'page', 'sticky' => 0, 'status' => 0));
node_save($node);
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
$text = RulesLog::logger()->render();
$pos = strpos($text, RulesTestCase::t('Evaluating conditions of rule %rule 1', array('rule 1')));
$pos = ($pos !== FALSE) ? strpos($text, RulesTestCase::t('Evaluating conditions of rule %rule 2', array('rule 2')), $pos) : FALSE;
@@ -1255,9 +1285,10 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
/**
* Tests the provided default rule 'rules_test_default_1'.
*/
- function testDefaultRule() {
+ public function testDefaultRule() {
$rule = rules_config_load('rules_test_default_1');
$this->assertTrue($rule->status & ENTITY_IN_CODE && !($rule->status & ENTITY_IN_DB), 'Default rule can be loaded and has the right status.');
+ $this->assertTrue($rule->tags == array('Admin', 'Tag2'), 'Default rule has correct tags.');
// Enable.
$rule->active = TRUE;
$rule->save();
@@ -1276,7 +1307,7 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
/**
* Tests creating and triggering a reaction rule with event settings.
*/
- function testEventSettings() {
+ public function testEventSettings() {
$rule = rules_reaction_rule();
$rule->event('node_presave', array('bundle' => 'article'))
->condition('data_is_empty', array('data:select' => 'node:field-tags'))
@@ -1299,6 +1330,7 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
$this->pass('Integrity check failed: ' . $e);
}
}
+
}
/**
@@ -1306,7 +1338,10 @@ class RulesTriggerTestCase extends DrupalWebTestCase {
*/
class RulesIntegrationTestCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Rules Core Integration',
'description' => 'Tests provided integration for drupal core.',
@@ -1314,16 +1349,19 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules', 'rules_test', 'php', 'path');
RulesLog::logger()->clear();
- variable_set('rules_debug_log', 1);
+ variable_set('rules_debug_log', TRUE);
}
/**
- * Just make sure the access callback run without errors.
+ * Just makes sure the access callback run without errors.
*/
- function testAccessCallbacks() {
+ public function testAccessCallbacks() {
$cache = rules_get_cache();
foreach (array('action', 'condition', 'event') as $type) {
foreach (rules_fetch_data($type . '_info') as $name => $info) {
@@ -1335,9 +1373,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test data integration.
+ * Tests data integration.
*/
- function testDataIntegration() {
+ public function testDataIntegration() {
// Test data_create action.
$action = rules_action('data_create', array(
'type' => 'log_entry',
@@ -1353,14 +1391,13 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$pos = strpos($text, RulesTestCase::t('Added the provided variable %data_created of type %log_entry', array('data_created', 'log_entry')));
$this->assertTrue($pos !== FALSE, 'Data of type log entry has been created.');
-
// Test variable_add action.
$action = rules_action('variable_add', array(
'type' => 'text_formatted',
'value' => array(
'value' => 'test text',
'format' => 1,
- )
+ ),
));
$action->access();
$action->execute();
@@ -1368,13 +1405,12 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$pos = strpos($text, RulesTestCase::t('Added the provided variable %variable_added of type %text_formatted', array('variable_added', 'text_formatted')));
$this->assertTrue($pos !== FALSE, 'Data of type text formatted has been created.');
-
// Test using the list actions.
$rule = rule(array(
'list' => array(
'type' => 'list',
'label' => 'A list of text',
- )
+ ),
));
$rule->action('list_add', array('list:select' => 'list', 'item' => 'bar2'));
$rule->action('list_add', array('list:select' => 'list', 'item' => 'bar', 'pos' => 'start'));
@@ -1386,7 +1422,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$this->assertEqual($list->value(), array('bar', 'foo', 'foo2'), 'List items removed and added.');
$this->assertFalse(rules_condition('list_contains')->execute($list, 'foo-bar'), 'Condition "List item contains" evaluates to FALSE');
$this->assertTrue(rules_condition('list_contains')->execute($list, 'foo'), 'Condition "List item contains" evaluates to TRUE');
- //debug(RulesLog::logger()->render());
+ // debug(RulesLog::logger()->render());
// Test data_is condition with IN operation.
$rule = rule(array('node' => array('type' => 'node')));
@@ -1396,8 +1432,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array('title' => 'foo'));
$rule->execute($node);
- $this->assertEqual($node->title, 'bar', "Data comparision using IN operation evaluates to TRUE.");
-
+ $this->assertEqual($node->title, 'bar', "Data comparison using IN operation evaluates to TRUE.");
// Test Condition: Data is empty.
$rule = rule(array('node' => array('type' => 'node')));
@@ -1468,7 +1503,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$set->action('data_convert', array('type' => 'integer', 'value:select' => 'source', 'rounding_behavior' => 'down'));
$set->action('data_set', array('data:select' => 'result', 'value:select' => 'conversion_result'));
list($result) = $set->execute('9.6');
- $this->assertEqual($result, 9, 'Converted decimal to integer using roundin behavio down.');
+ $this->assertEqual($result, 9, 'Converted decimal to integer using rounding behavior down.');
$set = rules_action_set(array(
'result' => array('type' => 'integer', 'parameter' => FALSE),
@@ -1500,7 +1535,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
/**
* Tests entity related integration.
*/
- function testEntityIntegration() {
+ public function testEntityIntegration() {
global $user;
$page = $this->drupalCreateNode(array('type' => 'page'));
@@ -1510,7 +1545,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
->execute(entity_metadata_wrapper('node', $article), 'field_tags');
$this->assertTrue($result);
- // Test entiy_is_of_bundle condition.
+ // Test entity_is_of_bundle condition.
$result = rules_condition('entity_is_of_bundle', array(
'type' => 'node',
'bundle' => array('article'),
@@ -1582,9 +1617,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$pos = ($pos !== FALSE) ? strpos($text, RulesTestCase::t('Saved %node of type %node.', array('node')), $pos) : FALSE;
$pos = ($pos !== FALSE) ? strpos($text, RulesTestCase::t('Evaluating the action %entity_delete.', array('entity_delete')), $pos) : FALSE;
$this->assertTrue($pos !== FALSE, 'Data has been fetched, saved and deleted.');
- //debug(RulesLog::logger()->render());
-
-
+ // debug(RulesLog::logger()->render());
$node = entity_property_values_create_entity('node', array(
'type' => 'article',
@@ -1621,7 +1654,6 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$this->assertEqual(entity_metadata_wrapper('node', $node->nid)->title->value(), 'bar', 'Entity is of type condition correctly asserts the entity type.');
-
// Test the entity_query action.
$node = $this->drupalCreateNode(array('type' => 'page', 'title' => 'foo2'));
$rule = rule();
@@ -1637,9 +1669,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test integration for the taxonomy module.
+ * Tests integration for the taxonomy module.
*/
- function testTaxonomyIntegration() {
+ public function testTaxonomyIntegration() {
$term = entity_property_values_create_entity('taxonomy_term', array(
'name' => $this->randomName(),
'vocabulary' => 1,
@@ -1733,9 +1765,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test integration for the node module.
+ * Tests integration for the node module.
*/
- function testNodeIntegration() {
+ public function testNodeIntegration() {
$tests = array(
array('node_unpublish', 'node_is_published', 'node_publish', 'status'),
array('node_make_unsticky', 'node_is_sticky', 'node_make_sticky', 'sticky'),
@@ -1748,15 +1780,15 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
rules_action($action1)->execute($node);
$node = node_load($node->nid, NULL, TRUE);
- $this->assertFalse($node->$property, 'Action has permanently disabled node '. $property);
+ $this->assertFalse($node->$property, 'Action has permanently disabled node ' . $property);
$return = rules_condition($condition)->execute($node);
- $this->assertFalse($return, 'Condition determines node '. $property . ' is disabled.');
+ $this->assertFalse($return, 'Condition determines node ' . $property . ' is disabled.');
rules_action($action2)->execute($node);
$node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue($node->$property, 'Action has permanently enabled node '. $property);
+ $this->assertTrue($node->$property, 'Action has permanently enabled node ' . $property);
$return = rules_condition($condition)->execute($node);
- $this->assertTrue($return, 'Condition determines node '. $property . ' is enabled.');
+ $this->assertTrue($return, 'Condition determines node ' . $property . ' is enabled.');
}
$return = rules_condition('node_is_of_type', array('type' => array('page', 'article')))->execute($node);
@@ -1764,7 +1796,6 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$return = rules_condition('node_is_of_type', array('type' => array('article')))->execute($node);
$this->assertFalse($return, 'Condition determines node is not of type article.');
-
// Test auto saving of a new node after it has been inserted into the DB.
$rule = rules_reaction_rule();
$rand = $this->randomName();
@@ -1778,9 +1809,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test integration for the user module.
+ * Tests integration for the user module.
*/
- function testUserIntegration() {
+ public function testUserIntegration() {
$rid = $this->drupalCreateRole(array('administer nodes'), 'foo');
$user = $this->drupalCreateUser();
@@ -1827,9 +1858,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test integration for the php module.
+ * Tests integration for the php module.
*/
- function testPHPIntegration() {
+ public function testPHPIntegration() {
$node = $this->drupalCreateNode(array('title' => 'foo'));
$rule = rule(array('var_name' => array('type' => 'node')));
$rule->condition('php_eval', array('code' => 'return TRUE;'))
@@ -1843,12 +1874,12 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$this->assertEqual(array_pop($msg['status']), "Title: foo Token: foo", 'PHP input evaluation has been applied.');
$this->assertEqual(array_pop($msg['status']), "Executed-foo", 'PHP code condition and action have been evaluated.');
- // Test PHP data processor
+ // Test PHP data processor.
$rule = rule(array('var_name' => array('type' => 'node')));
$rule->action('drupal_message', array(
'message:select' => 'var_name:title',
'message:process' => array(
- 'php' => array('code' => 'return "Title: $value";')
+ 'php' => array('code' => 'return "Title: $value";'),
),
));
$rule->execute($node);
@@ -1859,9 +1890,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test the "rules_core" integration.
+ * Tests the "rules_core" integration.
*/
- function testRulesCoreIntegration() {
+ public function testRulesCoreIntegration() {
// Make sure the date input evaluator evaluates properly using strtotime().
$node = $this->drupalCreateNode(array('title' => 'foo'));
$rule = rule(array('node' => array('type' => 'node')));
@@ -1930,9 +1961,9 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
}
/**
- * Test site/system integration.
+ * Tests site/system integration.
*/
- function testSystemIntegration() {
+ public function testSystemIntegration() {
// Test using the 'site' variable.
$condition = rules_condition('data_is', array('data:select' => 'site:current-user:name', 'value' => $GLOBALS['user']->name));
$this->assertTrue($condition->execute(), 'Retrieved the current user\'s name.');
@@ -1969,7 +2000,6 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $node->nid);
$this->assertEqual($this->getUrl(), url('user', array('absolute' => TRUE, 'fragment' => 'fragment')), 'Redirect has been issued.');
-
// Test sending mail.
$settings = array('to' => 'mail@example.com', 'subject' => 'subject', 'message' => 'hello.');
rules_action('mail', $settings)->execute();
@@ -1979,15 +2009,44 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
rules_action('mail', $settings + array('from' => 'sender@example.com'))->execute();
$this->assertMail('from', 'sender@example.com', 'Specified from address has been used');
- // Test sending mail to all users of a role. First make sure there is a
- // custom role and a user for it.
- $user = $this->drupalCreateUser(array('administer nodes'));
- $roles = $user->roles;
- // Remove the authenticate role so we only use the new role created by
+ // Test sending mail to all users of a role. First clear the mail
+ // collector to remove the mail sent in the previous line of code.
+ variable_set('drupal_test_email_collector', array());
+
+ // Now make sure there is a custom role and two users with that role.
+ $user1 = $this->drupalCreateUser(array('administer nodes'));
+ $roles = $user1->roles;
+ // Remove the authenticated role so we only use the new role created by
// drupalCreateUser().
unset($roles[DRUPAL_AUTHENTICATED_RID]);
+
+ // Now create a second user with the same role.
+ $user2 = $this->drupalCreateUser();
+ user_save($user2, array('roles' => $roles));
+
+ // Now create a third user without the same role - this user should NOT
+ // receive the role email.
+ $user3 = $this->drupalCreateUser(array('administer blocks'));
+ $additional_roles = $user3->roles;
+ unset($additional_roles[DRUPAL_AUTHENTICATED_RID]);
+
+ // Execute action and check that only two mails were sent.
rules_action('mail_to_users_of_role', $settings + array('roles' => array_keys($roles)))->execute();
- $this->assertMail('to', $user->mail, 'Mail to users of a role has been sent.');
+ $mails = $this->drupalGetMails();
+ $this->assertEqual(count($mails), 2, '2 e-mails were sent to users of a role.');
+
+ // Check each mail to ensure that only $user1 and $user2 got the mail.
+ $mail = array_pop($mails);
+ $this->assertTrue($mail['to'] == $user2->mail, 'Mail to user of a role has been sent.');
+ $mail = array_pop($mails);
+ $this->assertTrue($mail['to'] == $user1->mail, 'Mail to user of a role has been sent.');
+
+ // Execute action again, this time to send mail to both roles.
+ // This time check that three mails were sent - one for each user..
+ variable_set('drupal_test_email_collector', array());
+ rules_action('mail_to_users_of_role', $settings + array('roles' => array_keys($roles + $additional_roles)))->execute();
+ $mails = $this->drupalGetMails();
+ $this->assertEqual(count($mails), 3, '3 e-mails were sent to users of multiple roles.');
// Test reacting on new log entries and make sure the log entry is usable.
$rule = rules_reaction_rule();
@@ -2003,7 +2062,7 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
/**
* Tests the path module integration.
*/
- function testPathIntegration() {
+ public function testPathIntegration() {
rules_action('path_alias')->execute('foo', 'bar');
$path = path_load('foo');
$this->assertTrue($path['alias'] == 'bar', 'URL alias has been created.');
@@ -2031,14 +2090,18 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
RulesLog::logger()->checkLog();
}
+
}
/**
- * Test event dispatcher functionality.
+ * Tests event dispatcher functionality.
*/
class RulesEventDispatcherTestCase extends DrupalWebTestCase {
- static function getInfo() {
+ /**
+ * Declares test metadata.
+ */
+ public static function getInfo() {
return array(
'name' => 'Rules event dispatchers',
'description' => 'Tests event dispatcher functionality.',
@@ -2046,7 +2109,10 @@ class RulesEventDispatcherTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
+ /**
+ * Overrides DrupalWebTestCase::setUp().
+ */
+ protected function setUp() {
parent::setUp('rules', 'rules_test');
}
@@ -2098,6 +2164,7 @@ class RulesEventDispatcherTestCase extends DrupalWebTestCase {
$this->assertEqual($key !== 5, $handler->isWatching());
}
}
+
}
/**
@@ -2106,7 +2173,7 @@ class RulesEventDispatcherTestCase extends DrupalWebTestCase {
class RulesInvocationEnabledTestCase extends DrupalWebTestCase {
/**
- * {@inheritdoc}
+ * Declares test metadata.
*/
public static function getInfo() {
return array(
@@ -2117,9 +2184,9 @@ class RulesInvocationEnabledTestCase extends DrupalWebTestCase {
}
/**
- * {@inheritdoc}
+ * Overrides DrupalWebTestCase::setUp().
*/
- public function setUp() {
+ protected function setUp() {
parent::setUp('dblog', 'rules', 'rules_test', 'rules_test_invocation');
}
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test.info b/sites/all/modules/contrib/admin/rules/tests/rules_test.info
index b06516c1..740f0a62 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test.info
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test.info
@@ -3,12 +3,10 @@ description = "Support module for the Rules tests."
package = Testing
core = 7.x
files[] = rules_test.rules.inc
-files[] = rules_test.rules_defaults.inc
hidden = TRUE
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test.module b/sites/all/modules/contrib/admin/rules/tests/rules_test.module
index 3abecd72..4c54fafe 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test.module
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test.module
@@ -1,7 +1,8 @@
nid);
}
+/**
+ * Access callback. Returns TRUE except when $op == 'edit'.
+ */
function rules_test_no_access($op) {
return $op == 'edit' ? FALSE : TRUE;
}
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test.rules.inc b/sites/all/modules/contrib/admin/rules/tests/rules_test.rules.inc
index dd236a9b..3f302f46 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test.rules.inc
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test.rules.inc
@@ -1,17 +1,20 @@
array(
- 'label' => t('Test event'),
- 'class' => 'RulesTestEventHandler',
- ));
+ return array(
+ 'rules_test_event' => array(
+ 'label' => t('Test event'),
+ 'class' => 'RulesTestEventHandler',
+ ),
+ );
}
/**
@@ -51,6 +54,10 @@ function rules_test_rules_condition_info() {
'label' => t('Test condition returning false'),
'group' => t('Rules test'),
);
+ $items['rules_test_condition_apostrophe'] = array(
+ 'label' => t("Test use of an apostrophe (') in a condition label"),
+ 'group' => t('Rules test'),
+ );
// A condition for testing passing entities wrapped.
$items['rules_test_condition_node_wrapped'] = array(
'label' => t('Content is published'),
@@ -85,6 +92,20 @@ function rules_test_condition_false() {
return FALSE;
}
+/**
+ * Condition testing use of an apostrophe in a condition label.
+ *
+ * Specifically, we want to ensure that special characters do not show up as
+ * HTML-encoded in the user interface.
+ */
+function rules_test_condition_apostrophe($settings, $state, $element) {
+ if (!$element instanceof RulesCondition) {
+ throw new Exception('Rules element has not been passed to condition.');
+ }
+ rules_log('condition apostrophe called');
+ return TRUE;
+}
+
/**
* Condition implementation receiving the node wrapped.
*/
@@ -198,7 +219,11 @@ function rules_test_rules_action_info() {
'base' => 'rules_test_type_save',
'label' => t('Save test type'),
'parameter' => array(
- 'node' => array('type' => 'rules_test_type', 'label' => t('Test content'), 'save' => TRUE),
+ 'node' => array(
+ 'type' => 'rules_test_type',
+ 'label' => t('Test content'),
+ 'save' => TRUE,
+ ),
),
'group' => t('Node'),
),
@@ -240,6 +265,7 @@ class RulesTestClassAction extends RulesActionHandlerBase {
public function execute($node) {
rules_log('Action called with node ' . $node->nid);
}
+
}
/**
@@ -269,17 +295,27 @@ function rules_test_rules_data_info_alter(&$data_info) {
*/
class RulesTestTypeWrapper extends RulesIdentifiableDataWrapper implements RulesDataWrapperSavableInterface {
+ /**
+ * Overrides RulesIdentifiableDataWrapper::extractIdentifier().
+ */
protected function extractIdentifier($data) {
return $data->nid;
}
+ /**
+ * Overrides RulesIdentifiableDataWrapper::load().
+ */
protected function load($id) {
return node_load($id);
}
+ /**
+ * Implements RulesDataWrapperSavableInterface::save().
+ */
public function save() {
node_save($this->value());
}
+
}
/**
@@ -307,6 +343,7 @@ class RulesTestContainer extends RulesContainerPlugin {
public function evaluate(RulesState $state) {
// Do nothing.
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test.rules_defaults.inc b/sites/all/modules/contrib/admin/rules/tests/rules_test.rules_defaults.inc
index a2016f29..8e9f0f13 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test.rules_defaults.inc
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test.rules_defaults.inc
@@ -1,16 +1,18 @@
label = 'example default rule';
+ // Add rules tags.
+ $rule->tags = array('Admin', 'Tag2');
$rule->active = FALSE;
$rule->event('node_update')
->condition(rules_condition('data_is', array('data:select' => 'node:status', 'value' => TRUE))->negate())
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test.test.inc b/sites/all/modules/contrib/admin/rules/tests/rules_test.test.inc
index 2067c805..7c242438 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test.test.inc
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test.test.inc
@@ -1,7 +1,8 @@
type, $type);
}
/**
- * Condition: Check if the node is published
+ * Condition: Check if the node is published.
*/
function rules_condition_content_is_published($node, $settings) {
return $node->status == 1;
}
/**
- * Loads a node
+ * Loads a node.
*/
function rules_action_load_node($nid, $vid = NULL) {
return array('node_loaded' => node_load($nid, $vid ? $vid : NULL));
diff --git a/sites/all/modules/contrib/admin/rules/tests/rules_test_invocation.info b/sites/all/modules/contrib/admin/rules/tests/rules_test_invocation.info
index 51aea33e..22b53a8d 100644
--- a/sites/all/modules/contrib/admin/rules/tests/rules_test_invocation.info
+++ b/sites/all/modules/contrib/admin/rules/tests/rules_test_invocation.info
@@ -4,9 +4,8 @@ package = Testing
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2015-03-16
-version = "7.x-2.9"
+; Information added by Drupal.org packaging script on 2019-01-24
+version = "7.x-2.12"
core = "7.x"
project = "rules"
-datestamp = "1426527210"
-
+datestamp = "1548305586"
diff --git a/sites/all/modules/contrib/admin/rules/ui/rules.autocomplete.js b/sites/all/modules/contrib/admin/rules/ui/rules.autocomplete.js
index 09ce1c54..a6ac9932 100644
--- a/sites/all/modules/contrib/admin/rules/ui/rules.autocomplete.js
+++ b/sites/all/modules/contrib/admin/rules/ui/rules.autocomplete.js
@@ -81,7 +81,7 @@ Drupal.rules = Drupal.rules || {};
this.jqObject.bind("autocompleteselect", function(event, ui) {
// If a group was selected then set the groupSelected to true for the
- // overriden close function from jquery autocomplete.
+ // overridden close function from jquery autocomplete.
if (ui.item.value.substring(ui.item.value.length - 1, ui.item.value.length) == ":") {
instance.groupSelected = true;
}
@@ -180,7 +180,7 @@ Drupal.rules = Drupal.rules || {};
};
/**
- * Toogle the autcomplete window.
+ * Toggle the autocomplete window.
*/
Drupal.rules.autocomplete.prototype.toggle = function() {
if (this.jqObject.autocomplete("widget").is(":visible")) {
diff --git a/sites/all/modules/contrib/admin/rules/ui/rules.ui.css b/sites/all/modules/contrib/admin/rules/ui/rules.ui.css
index b567051e..aa7d2aef 100644
--- a/sites/all/modules/contrib/admin/rules/ui/rules.ui.css
+++ b/sites/all/modules/contrib/admin/rules/ui/rules.ui.css
@@ -1,10 +1,12 @@
-@CHARSET "UTF-8";
+@charset "utf-8";
-.rules-show-js, html.js .rules-hide-js {
+.rules-show-js,
+html.js .rules-hide-js {
display: none;
}
-.rules-hide-js, html.js .rules-show-js {
+.rules-hide-js,
+html.js .rules-show-js {
display: block;
}
@@ -58,7 +60,8 @@ ul.rules-operations-add li {
right: 0px;
}
-.rules-elements-table caption, .rules-overview-table caption {
+.rules-elements-table caption,
+.rules-overview-table caption {
font-size: 110%;
font-weight: bold;
padding-bottom: 0.5em;
@@ -85,8 +88,7 @@ ul.rules-operations-add li {
.rules-debug-collapsible-link {
position: relative;
cursor: pointer;
-
- /* The span element with the icon which opens the log, has a whitepsace.
+ /* The span element with the icon which opens the log, has a whitespace.
Since we don't want the user to mark this white space, we prevent this
using the this code.*/
-moz-user-select: -moz-none;
@@ -191,6 +193,6 @@ ul.rules-autocomplete .ui-corner-all {
}
/* IE 6 hack for max-height. */
-* html ul.rule-autocomplete{
+* html ul.rule-autocomplete {
height: 23em;
}
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.controller.inc b/sites/all/modules/contrib/admin/rules/ui/ui.controller.inc
index e502b0da..e2d1c115 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.controller.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.controller.inc
@@ -1,7 +1,8 @@
'rules_menu_add_element_title',
// Wrap the integer in an array, so it is passed as is.
'title arguments' => array(array($base_count + 4)),
@@ -60,7 +61,7 @@ class RulesUIController {
'file path' => drupal_get_path('module', 'rules'),
);
$items[$base_path . '/manage/%rules_config/delete/event'] = array(
- //@todo: improve title.
+ // @todo Improve title.
'title' => 'Remove event',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_ui_remove_event', $base_count + 1, $base_count + 4, $base_path),
@@ -157,8 +158,10 @@ class RulesUIController {
}
/**
- * Generates the render array for a overview configuration table for arbitrary
- * rule configs that match the given conditions.
+ * Generates the render array for an overview configuration table.
+ *
+ * Generates the render array for an overview configuration table for
+ * arbitrary rule configs that match the given conditions.
*
* Note: The generated overview table contains multiple links for editing the
* rule configurations. For the links to properly work use
@@ -182,7 +185,7 @@ class RulesUIController {
* currently set RulesPluginUI::$basePath. If no base path has been set
* yet, the current path is used by default.
*
- * @return Array
+ * @return array
* A renderable array.
*/
public function overviewTable($conditions = array(), $options = array()) {
@@ -199,7 +202,7 @@ class RulesUIController {
if (!empty($options['base path'])) {
RulesPluginUI::$basePath = $options['base path'];
}
- else if (!isset(RulesPluginUI::$basePath)) {
+ elseif (!isset(RulesPluginUI::$basePath)) {
// Default to the current path, only if no path has been set yet.
RulesPluginUI::$basePath = current_path();
}
@@ -241,7 +244,7 @@ class RulesUIController {
$table['#attributes']['class'][] = 'rules-overview-table';
$table['#attached']['css'][] = drupal_get_path('module', 'rules') . '/ui/rules.ui.css';
- // TODO: hide configs where access() is FALSE.
+ // @todo Hide configs where access() is FALSE.
return $table;
}
@@ -279,9 +282,9 @@ class RulesUIController {
// Add operations depending on the options and the exportable status.
if (!$config->hasStatus(ENTITY_FIXED)) {
- $row[] = l(t('edit'), RulesPluginUI::path($name), array('attributes' => array('class' => array('edit', 'action'))));
+ $row[] = l(t('edit'), RulesPluginUI::path($name), array('attributes' => array('class' => array('edit', 'action'))));
if (module_exists('rules_i18n')) {
- $row[] = l(t('translate'), RulesPluginUI::path($name, 'translate'), array('attributes' => array('class' => array('translate', 'action'))));
+ $row[] = l(t('translate'), RulesPluginUI::path($name, 'translate'), array('attributes' => array('class' => array('translate', 'action'))));
}
}
else {
@@ -321,4 +324,5 @@ class RulesUIController {
$row[] = l(t('export'), RulesPluginUI::path($name, 'export'), array('attributes' => array('class' => array('export', 'action'))));
return $row;
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.core.inc b/sites/all/modules/contrib/admin/rules/ui/ui.core.inc
index a51c6af1..abffb0dc 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.core.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.core.inc
@@ -1,7 +1,8 @@
save() afterwards.
@@ -135,11 +138,13 @@ class RulesElementMap {
}
return isset($this->index[$id]) ? $this->index[$id] : FALSE;
}
+
}
/**
- * Faces UI extender for all kind of Rules plugins. Provides various useful
- * methods for any rules UI.
+ * Faces UI extender for all kind of Rules plugins.
+ *
+ * Provides various useful methods for any rules UI.
*/
class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
@@ -149,10 +154,11 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
protected $element;
/**
- * The base path determines where a Rules overview UI lives. All forms that
- * want to display Rules (overview) forms need to set this variable. This is
- * necessary in order to get correct operation links, paths, redirects, bread
- * crumbs etc. for the form() and overviewTable() methods.
+ * The base path determines where a Rules overview UI lives.
+ *
+ * All forms that want to display Rules (overview) forms need to set this
+ * variable. This is necessary in order to get correct operation links,
+ * paths, redirects, breadcrumbs etc. for the form() and overviewTable() methods.
*
* @see RulesUIController
* @see rules_admin_reaction_overview()
@@ -193,8 +199,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
}
/**
- * Implements RulesPluginUIInterface.
- * Generates the element edit form.
+ * Implements RulesPluginUIInterface. Generates the element edit form.
*
* Note: Make sure that you set RulesPluginUI::$basePath before using this
* method, otherwise paths, links, redirects etc. won't be correct.
@@ -257,7 +262,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
);
}
if (!empty($form['provides'])) {
- $help = '' . t('Adjust the names and labels of provided variables, but note that renaming of already utilizied variables invalidates the existing uses.') . '
';
+ $help = '' . t('Adjust the names and labels of provided variables, but note that renaming of already utilized variables invalidates the existing uses.') . '
';
$form['provides'] += array(
'#tree' => TRUE,
'#prefix' => '' . $help,
@@ -304,8 +309,8 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
}
// For translatable parameters, pre-populate an internal translation source
- // key so data type forms or input evaluators (i18n) may produce suiting
- // help.
+ // key so data type forms or input evaluators (i18n) may show a suitable
+ // help message.
if (drupal_multilingual() && !empty($info['translatable'])) {
$parameter = $this->element->pluginParameterInfo();
$info['custom translation language'] = !empty($parameter['language']);
@@ -320,7 +325,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
}
// Add a link for switching the input mode when JS is enabled and a button
- // to switch it without javascript, in case switching is possible.
+ // to switch it without JavaScript, in case switching is possible.
if ($supports_input_mode && empty($info['restriction'])) {
$value = $mode == 'selector' ? t('Switch to the direct input mode') : t('Switch to data selection');
@@ -420,7 +425,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
'#required' => TRUE,
'#weight' => -5,
);
- // @todo: For Drupal 8 use "owner" for generating machine names and
+ // @todo For Drupal 8 use "owner" for generating machine names and
// module only for the modules providing default configurations.
if (!empty($this->element->module) && !empty($this->element->name) && $this->element->module == 'rules' && strpos($this->element->name, 'rules_') === 0) {
// Remove the Rules module prefix from the machine name.
@@ -457,7 +462,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
$description = t('The variables used by the component. They can not be edited for configurations that are provided in code.');
}
else {
- $description = t('Variables are normally input parameters for the component – data that should be available for the component to act on. Additionaly, action components may provide variables back to the caller. Each variable must have a specified data type, a label and a unique machine readable name containing only lowercase alphanumeric characters and underscores. See the online documentation for more information about variables.',
+ $description = t('Variables are normally input parameters for the component – data that should be available for the component to act on. Additionally, action components may provide variables back to the caller. Each variable must have a specified data type, a label and a unique machine readable name containing only lowercase alphanumeric characters and underscores. See the online documentation for more information about variables.',
array('@url' => rules_external_help('variables'))
);
}
@@ -502,7 +507,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
'#type' => 'checkbox',
'#title' => t('Configure access for using this component with a permission.'),
'#default_value' => !empty($this->element->access_exposed),
- '#description' => t('By default, the @plugin-type for using this component may be only used by users that have access to configure the component. If checked, access is determined by a permission instead.', array('@plugin-type' => $plugin_type))
+ '#description' => t('By default, the @plugin-type for using this component may be only used by users that have access to configure the component. If checked, access is determined by a permission instead.', array('@plugin-type' => $plugin_type)),
);
$form['settings']['access']['permissions'] = array(
'#type' => 'container',
@@ -516,7 +521,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
}
}
- // TODO: Attach field form thus description.
+ // @todo Attach field form thus description.
}
/**
@@ -567,7 +572,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
$form_values = RulesPluginUI::getFormStateValues($form['settings'], $form_state);
$this->element->label = $form_values['label'];
// If the name was changed we have to redirect to the URL that contains
- // the new name, instead of rebuilding on the old URL with the old name
+ // the new name, instead of rebuilding on the old URL with the old name.
if ($form['settings']['name']['#default_value'] != $form_values['name']) {
$module = isset($this->element->module) ? $this->element->module : 'rules';
$this->element->name = $module . '_' . $form_values['name'];
@@ -669,7 +674,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
* Returns the name of class for the given data type.
*
* @param $data_type
- * The name of the data typ
+ * The name of the data type
* @param $parameter_info
* (optional) An array of info about the to be configured parameter. If
* given, this array is complemented with data type defaults also.
@@ -689,7 +694,8 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
/**
* Implements RulesPluginUIInterface.
- * Show a preview of the configuration settings.
+ *
+ * Shows a preview of the configuration settings.
*/
public function buildContent() {
$config_name = $this->element->root()->name;
@@ -698,7 +704,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
'#title' => $this->element->label(),
'#href' => $this->element->isRoot() ? RulesPluginUI::path($config_name) : RulesPluginUI::path($config_name, 'edit', $this->element),
'#prefix' => '',
- '#suffix' => '
'
+ '#suffix' => '',
);
// Put the elements below in a "description" div.
$content['description'] = array(
@@ -712,14 +718,14 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
$element = array();
if (!empty($this->element->settings[$name . ':select'])) {
$element['content'] = array(
- '#markup' => '[' . $this->element->settings[$name . ':select'] . ']',
+ '#markup' => '[' . $this->element->settings[$name . ':select'] . ']',
);
}
elseif (isset($this->element->settings[$name]) && (!isset($parameter['default value']) || $parameter['default value'] != $this->element->settings[$name])) {
$class = $this->getDataTypeClass($parameter['type'], $parameter);
$method = empty($parameter['options list']) ? 'render' : 'renderOptionsLabel';
- // We cannot use method_exists() here as it would trigger a PHP bug,
- // @see http://drupal.org/node/1258284
+ // We cannot use method_exists() here as it would trigger a PHP bug.
+ // @see https://www.drupal.org/node/1258284
$element = call_user_func(array($class, $method), $this->element->settings[$name], $name, $parameter, $this->element);
}
// Only add parameters that are really configured / not default.
@@ -802,7 +808,6 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
*/
public function help() {}
-
/**
* Deprecated by the controllers overviewTable() method.
*/
@@ -811,6 +816,8 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
}
/**
+ * Generates an operation path.
+ *
* Generates a path using the given operation for the element with the given
* id of the configuration with the given name.
*/
@@ -824,12 +831,19 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
else {
$base_path = isset($element) && $element instanceof RulesTriggerableInterface ? 'admin/config/workflow/rules/reaction' : 'admin/config/workflow/rules/components';
}
- return implode('/', array_filter(array($base_path . '/manage', $name, $op, $element_id, $parameter)));
+
+ // Only append the '/manage' path if it is not already present.
+ if (substr($base_path, -strlen('/manage')) != '/manage') {
+ $base_path .= '/manage';
+ }
+
+ return implode('/', array_filter(array($base_path, $name, $op, $element_id, $parameter)));
}
/**
- * Determines the default redirect target for an edited/deleted element. This
- * is a parent element which is either a rule or the configuration root.
+ * Determines the default redirect target for an edited/deleted element.
+ *
+ * This is a parent element which is either a rule or the configuration root.
*/
public static function defaultRedirect(RulesPlugin $element) {
while (!$element->isRoot()) {
@@ -879,6 +893,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
->fetchCol('tag');
return drupal_map_assoc($result);
}
+
}
/**
@@ -887,6 +902,8 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
class RulesAbstractPluginUI extends RulesPluginUI {
/**
+ * Overrides RulesPluginUI::form().
+ *
* Overridden to invoke the abstract plugins form alter callback and to add
* the negation checkbox for conditions.
*/
@@ -923,6 +940,7 @@ class RulesAbstractPluginUI extends RulesPluginUI {
form_set_error(implode('][', $e->keys), $e->getMessage());
}
}
+
}
/**
@@ -941,11 +959,11 @@ class RulesContainerPluginUI extends RulesPluginUI {
'#tree' => TRUE,
'#theme' => 'rules_elements',
'#empty' => t('None'),
- '#caption' => t('Elements')
+ '#caption' => t('Elements'),
);
$form['elements']['#attributes']['class'][] = 'rules-container-plugin';
- // Recurse over all element childrens or use the provided iterator.
+ // Recurse over all element children or use the provided iterator.
$iterator = isset($iterator) ? $iterator : $this->element->elements();
$root_depth = $this->element->depth();
foreach ($iterator as $key => $child) {
@@ -965,7 +983,7 @@ class RulesContainerPluginUI extends RulesPluginUI {
);
$form['elements'][$id]['parent_id'] = array(
'#type' => 'hidden',
- // If another iterator is passed in, the childs parent may not equal
+ // If another iterator is passed in, the child parent may not equal
// the current element. Thus ask the child for its parent.
'#default_value' => $child->parentElement()->elementId(),
);
@@ -1031,12 +1049,10 @@ class RulesContainerPluginUI extends RulesPluginUI {
return $render;
}
-
public function buildContent() {
$content = parent::buildContent();
// Don't link the title for embedded container plugins, except for rules.
if (!$this->element->isRoot() && !($this->element instanceof Rule)) {
- $content['label']['#type'] = 'markup';
$content['label']['#markup'] = check_plain($content['label']['#title']);
unset($content['label']['#title']);
}
@@ -1079,6 +1095,7 @@ class RulesContainerPluginUI extends RulesPluginUI {
}
return $content;
}
+
}
/**
@@ -1093,7 +1110,7 @@ class RulesConditionContainerUI extends RulesContainerPluginUI {
$form['elements']['#attributes']['class'][] = 'rules-condition-container';
$form['elements']['#caption'] = t('Conditions');
- // By default skip
+ // By default skip.
if (!empty($options['init']) && !$this->element->isRoot()) {
$config = $this->element->root();
$form['init_help'] = array(
@@ -1124,6 +1141,7 @@ class RulesConditionContainerUI extends RulesContainerPluginUI {
$this->element->negate($form_values['negate']);
}
}
+
}
/**
@@ -1132,12 +1150,13 @@ class RulesConditionContainerUI extends RulesContainerPluginUI {
class RulesActionContainerUI extends RulesContainerPluginUI {
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
- parent::form($form, $form_state, $options, $iterator);
+ parent::form($form, $form_state, $options, $iterator);
// Add the add-* operation links.
$form['elements']['#add'] = self::addOperations();
$form['elements']['#attributes']['class'][] = 'rules-action-container';
$form['elements']['#caption'] = t('Actions');
}
+
}
/**
@@ -1167,14 +1186,14 @@ class RulesUICategory {
* (optional) Whether group labels for grouping inside a category should be
* return. Defaults to FALSE.
*
- * @return string|boolean
+ * @return string|bool
* The group label to use, or FALSE if none can be found.
*/
public static function getItemGroup($item_info, $in_category = FALSE) {
if (isset($item_info['category']) && !$in_category) {
return self::getCategory($item_info, 'label');
}
- else if (!empty($item_info['group'])) {
+ elseif (!empty($item_info['group'])) {
return $item_info['group'];
}
return FALSE;
@@ -1202,7 +1221,9 @@ class RulesUICategory {
}
/**
- * Returns an array of options to use with a select for the items specified
+ * Returns an array of options to use with a select.
+ *
+ * Returns an array of options to use with a selectfor the items specified
* in the given hook.
*
* @param $item_type
@@ -1211,7 +1232,7 @@ class RulesUICategory {
* @param $items
* (optional) An array of items to restrict the options to.
*
- * @return
+ * @return array
* An array of options.
*/
public static function getOptions($item_type, $items = NULL) {
@@ -1219,7 +1240,7 @@ class RulesUICategory {
$ungrouped = array();
$data = $items ? $items : rules_fetch_data($item_type . '_info');
foreach ($data as $name => $info) {
- // Verfiy the current user has access to use it.
+ // Verify the current user has access to use it.
if (!user_access('bypass rules access') && !empty($info['access callback']) && !call_user_func($info['access callback'], $item_type, $name)) {
continue;
}
@@ -1256,6 +1277,7 @@ class RulesUICategory {
}
return $ungrouped + $sorted_groups;
}
+
}
/**
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.data.inc b/sites/all/modules/contrib/admin/rules/ui/ui.data.inc
index 0f1fde99..35165878 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.data.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.data.inc
@@ -1,10 +1,10 @@
pluginParameterInfo();
return array($parameters[$name]['type'], $parameters[$name]);
}
+
}
/**
@@ -188,10 +190,16 @@ class RulesDataUI {
*/
class RulesDataUIText extends RulesDataUI implements RulesDataDirectInputFormInterface {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
if (!empty($info['options list'])) {
// Make sure the .rules.inc of the providing module is included as the
@@ -205,6 +213,7 @@ class RulesDataUIText extends RulesDataUI implements RulesDataDirectInputFormInt
else {
$form[$name] = array(
'#type' => 'textarea',
+ '#rows' => 3,
);
RulesDataInputEvaluator::attachForm($form, $settings, $info, $element->availableVariables());
}
@@ -214,17 +223,20 @@ class RulesDataUIText extends RulesDataUI implements RulesDataDirectInputFormInt
'#default_value' => $settings[$name],
'#required' => empty($info['optional']),
'#after_build' => array('rules_ui_element_fix_empty_after_build'),
- '#rows' => 3,
);
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
return array(
'content' => array('#markup' => check_plain($value)),
'#attributes' => array('class' => array('rules-parameter-text')),
);
}
+
}
/**
@@ -232,6 +244,9 @@ class RulesDataUIText extends RulesDataUI implements RulesDataDirectInputFormInt
*/
class RulesDataUITextToken extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if ($form[$name]['#type'] == 'textarea') {
@@ -241,6 +256,7 @@ class RulesDataUITextToken extends RulesDataUIText {
}
return $form;
}
+
}
/**
@@ -248,6 +264,9 @@ class RulesDataUITextToken extends RulesDataUIText {
*/
class RulesDataUITextFormatted extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
$settings += array($name => isset($info['default value']) ? $info['default value'] : array('value' => NULL, 'format' => NULL));
@@ -259,21 +278,26 @@ class RulesDataUITextFormatted extends RulesDataUIText {
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
return array(
'content' => array('#markup' => check_plain($value['value'])),
'#attributes' => array('class' => array('rules-parameter-text-formatted')),
);
}
+
}
-
-
/**
* UI for decimal data.
*/
class RulesDataUIDecimal extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if (empty($info['options list'])) {
@@ -283,6 +307,7 @@ class RulesDataUIDecimal extends RulesDataUIText {
$form[$name]['#rows'] = 1;
return $form;
}
+
}
/**
@@ -290,6 +315,9 @@ class RulesDataUIDecimal extends RulesDataUIText {
*/
class RulesDataUIInteger extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if (empty($info['options list'])) {
@@ -298,6 +326,7 @@ class RulesDataUIInteger extends RulesDataUIText {
$form[$name]['#element_validate'][] = 'rules_ui_element_integer_validate';
return $form;
}
+
}
/**
@@ -305,6 +334,9 @@ class RulesDataUIInteger extends RulesDataUIText {
*/
class RulesDataUIIPAddress extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if (empty($info['options list'])) {
@@ -315,6 +347,7 @@ class RulesDataUIIPAddress extends RulesDataUIText {
$form[$name]['#rows'] = 1;
return $form;
}
+
}
/**
@@ -322,10 +355,16 @@ class RulesDataUIIPAddress extends RulesDataUIText {
*/
class RulesDataUIBoolean extends RulesDataUI implements RulesDataDirectInputFormInterface {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$settings += array($name => isset($info['default value']) ? $info['default value'] : NULL);
// Note: Due to the checkbox even optional parameter always receive a value.
@@ -340,12 +379,16 @@ class RulesDataUIBoolean extends RulesDataUI implements RulesDataDirectInputForm
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
return array(
'content' => array('#markup' => !empty($value) ? t('true') : t('false')),
'#attributes' => array('class' => array('rules-parameter-boolean')),
);
}
+
}
/**
@@ -353,6 +396,9 @@ class RulesDataUIBoolean extends RulesDataUI implements RulesDataDirectInputForm
*/
class RulesDataUIDate extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$settings += array($name => isset($info['default value']) ? $info['default value'] : (empty($info['optional']) ? gmdate('Y-m-d H:i:s', time()) : NULL));
@@ -369,11 +415,14 @@ class RulesDataUIDate extends RulesDataUIText {
array('%format' => gmdate('Y-m-d H:i:s', time() + 86400),
'!strtotime' => l('strtotime()', 'http://php.net/strtotime')));
- //TODO: Leverage the jquery datepicker+timepicker once a module providing
- //the timpeicker is available.
+ // @todo Leverage the jquery datepicker+timepicker once a module providing
+ // The timepicker is available.
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
$value = is_numeric($value) ? format_date($value, 'short') : check_plain($value);
return array(
@@ -381,6 +430,7 @@ class RulesDataUIDate extends RulesDataUIText {
'#attributes' => array('class' => array('rules-parameter-date')),
);
}
+
}
/**
@@ -388,6 +438,9 @@ class RulesDataUIDate extends RulesDataUIText {
*/
class RulesDataUIDuration extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
$form[$name]['#type'] = 'rules_duration';
@@ -395,6 +448,9 @@ class RulesDataUIDuration extends RulesDataUIText {
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
$value = is_numeric($value) ? format_interval($value) : check_plain($value);
return array(
@@ -402,6 +458,7 @@ class RulesDataUIDuration extends RulesDataUIText {
'#attributes' => array('class' => array('rules-parameter-duration')),
);
}
+
}
/**
@@ -409,12 +466,16 @@ class RulesDataUIDuration extends RulesDataUIText {
*/
class RulesDataUIURI extends RulesDataUIText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
$form[$name]['#rows'] = 1;
- $form[$name]['#description'] = t('You may enter relative URLs like %url as well as absolute URLs like %absolute-url.', array('%url' => 'user/login?destination=node', '%absolute-url' => 'http://drupal.org'));
+ $form[$name]['#description'] = t('You may enter relative URLs like %url as well as absolute URLs like %absolute-url.', array('%url' => 'user/login?destination=node', '%absolute-url' => 'https://www.drupal.org'));
return $form;
}
+
}
/**
@@ -422,11 +483,16 @@ class RulesDataUIURI extends RulesDataUIText {
*/
class RulesDataUIListText extends RulesDataUIText {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
/**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ *
* @todo This does not work for inputting textual values including "\n".
*/
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
@@ -447,12 +513,16 @@ class RulesDataUIListText extends RulesDataUIText {
return $form;
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::render().
+ */
public static function render($value) {
return array(
'content' => array('#markup' => check_plain(implode(', ', $value))),
'#attributes' => array('class' => array('rules-parameter-list')),
);
}
+
}
/**
@@ -460,6 +530,9 @@ class RulesDataUIListText extends RulesDataUIText {
*/
class RulesDataUIListInteger extends RulesDataUIListText {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$settings += array($name => isset($info['default value']) ? $info['default value'] : NULL);
$form = parent::inputForm($name, $info, $settings, $element);
@@ -473,6 +546,7 @@ class RulesDataUIListInteger extends RulesDataUIListText {
}
return $form;
}
+
}
/**
@@ -480,6 +554,9 @@ class RulesDataUIListInteger extends RulesDataUIListText {
*/
class RulesDataUIListToken extends RulesDataUIListInteger {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
@@ -489,6 +566,7 @@ class RulesDataUIListToken extends RulesDataUIListInteger {
}
return $form;
}
+
}
/**
@@ -496,10 +574,16 @@ class RulesDataUIListToken extends RulesDataUIListInteger {
*/
class RulesDataUIEntity extends RulesDataUIText {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'selector';
}
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if (empty($info['options list'])) {
@@ -515,6 +599,7 @@ class RulesDataUIEntity extends RulesDataUIText {
}
return $form;
}
+
}
/**
@@ -522,9 +607,13 @@ class RulesDataUIEntity extends RulesDataUIText {
*/
class RulesDataUIEntityExportable extends RulesDataUIEntity {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
+
}
/**
@@ -535,6 +624,9 @@ class RulesDataUIEntityExportable extends RulesDataUIEntity {
*/
class RulesDataUIBundleEntity extends RulesDataUIEntity implements RulesDataInputOptionsListInterface {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
@@ -554,6 +646,7 @@ class RulesDataUIBundleEntity extends RulesDataUIEntity implements RulesDataInpu
}
return $bundles;
}
+
}
/**
@@ -563,6 +656,9 @@ class RulesDataUIBundleEntity extends RulesDataUIEntity implements RulesDataInpu
*/
class RulesDataUITaxonomyVocabulary extends RulesDataUIEntity implements RulesDataInputOptionsListInterface {
+ /**
+ * Overrides RulesDataUI::getDefaultMode().
+ */
public static function getDefaultMode() {
return 'input';
}
@@ -577,6 +673,7 @@ class RulesDataUITaxonomyVocabulary extends RulesDataUIEntity implements RulesDa
}
return $options;
}
+
}
/**
@@ -584,6 +681,9 @@ class RulesDataUITaxonomyVocabulary extends RulesDataUIEntity implements RulesDa
*/
class RulesDataUIListEntity extends RulesDataUIListInteger {
+ /**
+ * Implements RulesDataDirectInputFormInterface::inputForm().
+ */
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::inputForm($name, $info, $settings, $element);
if (empty($info['options list'])) {
@@ -598,4 +698,5 @@ class RulesDataUIListEntity extends RulesDataUIListInteger {
}
return $form;
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.forms.inc b/sites/all/modules/contrib/admin/rules/ui/ui.forms.inc
index b01e0f53..b20f8990 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.forms.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.forms.inc
@@ -1,7 +1,8 @@
form_validate($form, $form_state);
@@ -165,13 +167,29 @@ function rules_ui_confirm_operations($op, $rules_config) {
switch ($op) {
case 'enable':
- return array(t('Are you sure you want to enable the %plugin %label?', $vars), '');
+ return array(
+ t('Are you sure you want to enable the %plugin %label?', $vars),
+ '',
+ );
+
case 'disable':
- return array(t('Are you sure you want to disable the %plugin %label?', $vars), '');
+ return array(
+ t('Are you sure you want to disable the %plugin %label?', $vars),
+ '',
+ );
+
case 'revert':
- return array(t('Are you sure you want to revert the %plugin %label?', $vars), t('This action cannot be undone.'));
+ return array(
+ t('Are you sure you want to revert the %plugin %label?', $vars),
+ t('This action cannot be undone.'),
+ );
+
case 'delete':
- return array(t('Are you sure you want to delete the %plugin %label?', $vars), t('This action cannot be undone.'));
+ return array(
+ t('Are you sure you want to delete the %plugin %label?', $vars),
+ t('This action cannot be undone.'),
+ );
+
default:
return FALSE;
}
@@ -193,9 +211,10 @@ function rules_ui_form_rules_config_confirm_op($form, &$form_state, $rules_confi
}
/**
- * Applies the operation and returns the message to show to the user. Also the
- * operation is logged to the watchdog. Note that the string is defined two
- * times so that the translation extractor can find it.
+ * Applies the operation and returns the message to show to the user.
+ *
+ * The operation is also logged to the watchdog. Note that the string is
+ * defined two times so that the translation extractor can find it.
*/
function rules_ui_confirm_operation_apply($op, $rules_config) {
$vars = array('%plugin' => $rules_config->plugin(), '%label' => $rules_config->label());
@@ -290,8 +309,9 @@ function rules_ui_add_element($form, &$form_state, $rules_config, $plugin_name,
/**
* Add element submit callback.
+ *
* Used for "abstract plugins" to create the initial element object with the
- * given implemenation name and rebuild the form.
+ * given implementation name and rebuild the form.
*/
function rules_ui_add_element_submit($form, &$form_state) {
$element = rules_plugin_factory($form_state['plugin'], $form_state['values']['element_name']);
@@ -348,7 +368,10 @@ function rules_ui_delete_element($form, &$form_state, $rules_config, $rules_elem
}
}
- $confirm_question = t('Are you sure you want to delete the %element_plugin %element_name?', array('%element_plugin' => $rules_element->plugin(), '%element_name' => $rules_element->label(), '%plugin' => $rules_config->plugin(), '%label' => $rules_config->label()));
+ $confirm_question = t('Are you sure you want to delete the %element_plugin %element_name?', array(
+ '%element_plugin' => $rules_element->plugin(),
+ '%element_name' => $rules_element->label(),
+ ));
return confirm_form($form, $confirm_question, RulesPluginUI::path($rules_config->name), t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}
@@ -363,7 +386,6 @@ function rules_ui_delete_element_submit($form, &$form_state) {
}
}
-
/**
* Configure a rule element.
*/
@@ -487,7 +509,7 @@ function rules_ui_add_event_apply($form, &$form_state) {
}
/**
- * Form to remove a event from a rule.
+ * Form to remove an event from a rule.
*/
function rules_ui_remove_event($form, &$form_state, $rules_config, $event, $base_path) {
RulesPluginUI::$basePath = $base_path;
@@ -598,6 +620,7 @@ function rules_ui_import_form_submit($form, &$form_state) {
/**
* FAPI process callback for the data selection widget.
+ *
* This finalises the auto completion callback path by appending the form build
* id.
*/
@@ -657,12 +680,12 @@ function rules_ui_form_data_selection_auto_completion($parameter, $form_build_id
drupal_json_output($matches);
}
-
/**
- * FAPI validation of an integer element. Copy of the private function
- * _element_validate_integer().
+ * FAPI validation of an integer element.
+ *
+ * Copy of the core Drupal private function _element_validate_integer().
*/
-function rules_ui_element_integer_validate($element, &$form_state) {;
+function rules_ui_element_integer_validate($element, &$form_state) {
$value = $element['#value'];
if (isset($value) && $value !== '' && (!is_numeric($value) || intval($value) != $value)) {
form_error($element, t('%name must be an integer value.', array('%name' => isset($element['#title']) ? $element['#title'] : t('Element'))));
@@ -670,8 +693,9 @@ function rules_ui_element_integer_validate($element, &$form_state) {;
}
/**
- * FAPI validation of a decimal element. Improved version of the private
- * function _element_validate_number().
+ * FAPI validation of a decimal element.
+ *
+ * Improved version of the private function _element_validate_number().
*/
function rules_ui_element_decimal_validate($element, &$form_state) {
// Substitute the decimal separator ",".
@@ -695,9 +719,11 @@ function rules_ui_element_ip_address_validate($element, &$form_state) {
}
/**
- * FAPI validation of a date element. Makes sure the specified date format is
- * correct and converts date values specifiy a fixed (= non relative) date to
- * a timestamp. Relative dates are handled by the date input evaluator.
+ * FAPI validation of a date element.
+ *
+ * Makes sure the specified date format is correct and converts date values
+ * specify a fixed (= non relative) date to a timestamp. Relative dates are
+ * handled by the date input evaluator.
*/
function rules_ui_element_date_validate($element, &$form_state) {
$value = $element['#value'];
@@ -766,8 +792,9 @@ function rules_ui_element_duration_multipliers() {
}
/**
- * Helper function to determine the value for a rules duration form
- * element.
+ * Helper function a rules duration form element.
+ *
+ * Determines the value for a rules duration form element.
*/
function rules_ui_element_duration_value($element, $input = FALSE) {
// This runs before child elements are processed, so we cannot calculate the
@@ -781,6 +808,7 @@ function rules_ui_element_duration_value($element, $input = FALSE) {
/**
* FAPI after build callback for the duration parameter type form.
+ *
* Fixes up the form value by applying the multiplier.
*/
function rules_ui_element_duration_after_build($element, &$form_state) {
@@ -810,7 +838,6 @@ function rules_ui_element_fix_empty_after_build($element, &$form_state) {
return $element;
}
-
/**
* FAPI after build callback for specifying a list of values.
*
@@ -877,6 +904,7 @@ function rules_ui_element_machine_name_validate($element, &$form_state) {
/**
* FAPI callback to validate the form for editing variable info.
+ *
* @see RulesPluginUI::getVariableForm()
*/
function rules_ui_element_variable_form_validate($elements, &$form_state) {
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.plugins.inc b/sites/all/modules/contrib/admin/rules/ui/ui.plugins.inc
index 1450c105..d3a061af 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.plugins.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.plugins.inc
@@ -1,7 +1,8 @@
rule = $object;
$this->conditions = $this->rule->conditionContainer();
}
- public function form(&$form, &$form_state, $options = array()) {
+ public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
$form_state['rules_element'] = $this->rule;
$label = $this->element->label();
// Automatically add a counter to unlabelled rules.
@@ -58,7 +65,7 @@ class RulesRuleUI extends RulesActionContainerUI {
/**
* Applies the values of the form to the rule configuration.
*/
- function form_extract_values($form, &$form_state) {
+ public function form_extract_values($form, &$form_state) {
$form_values = RulesPluginUI::getFormStateValues($form, $form_state);
// Run condition and action container value extraction.
if (isset($form['conditions'])) {
@@ -70,13 +77,13 @@ class RulesRuleUI extends RulesActionContainerUI {
parent::form_extract_values($form, $form_state);
}
-
public function operations() {
// When rules are listed only show the edit and delete operations.
$ops = parent::operations();
$ops['#links'] = array_intersect_key($ops['#links'], array_flip(array('edit', 'delete')));
return $ops;
}
+
}
/**
@@ -84,7 +91,7 @@ class RulesRuleUI extends RulesActionContainerUI {
*/
class RulesReactionRuleUI extends RulesRuleUI {
- public function form(&$form, &$form_state, $options = array()) {
+ public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
$form['events'] = array(
'#type' => 'container',
'#weight' => -10,
@@ -94,7 +101,7 @@ class RulesReactionRuleUI extends RulesRuleUI {
$form['events']['table'] = array(
'#theme' => 'table',
'#caption' => 'Events',
- '#header' => array('Event', 'Operations'),
+ '#header' => array(t('Event'), t('Operations')),
'#empty' => t('None'),
);
$form['events']['table']['#attributes']['class'][] = 'rules-elements-table';
@@ -170,6 +177,7 @@ class RulesReactionRuleUI extends RulesRuleUI {
$this->rule->active = $form_values['active'];
$this->rule->weight = $form_values['weight'];
}
+
}
/**
@@ -186,6 +194,7 @@ class RulesRuleSetUI extends RulesActionContainerUI {
$form['elements']['#attributes']['class'][] = 'rules-rule-set';
$form['elements']['#caption'] = t('Rules');
}
+
}
/**
@@ -193,7 +202,7 @@ class RulesRuleSetUI extends RulesActionContainerUI {
*/
class RulesLoopUI extends RulesActionContainerUI {
- public function form(&$form, &$form_state, $options = array()) {
+ public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
parent::form($form, $form_state, $options);
$settings = $this->element->settings;
@@ -219,7 +228,7 @@ class RulesLoopUI extends RulesActionContainerUI {
);
}
- function form_extract_values($form, &$form_state) {
+ public function form_extract_values($form, &$form_state) {
parent::form_extract_values($form, $form_state);
$form_values = RulesPluginUI::getFormStateValues($form, $form_state);
@@ -251,4 +260,5 @@ class RulesLoopUI extends RulesActionContainerUI {
);
return $content;
}
+
}
diff --git a/sites/all/modules/contrib/admin/rules/ui/ui.theme.inc b/sites/all/modules/contrib/admin/rules/ui/ui.theme.inc
index 42bf6e82..52212fe3 100644
--- a/sites/all/modules/contrib/admin/rules/ui/ui.theme.inc
+++ b/sites/all/modules/contrib/admin/rules/ui/ui.theme.inc
@@ -1,10 +1,10 @@
t('Weight'), 'class' => array('tabledrag-hide')));
+ $table['#header'] = array(
+ t('Data type'),
+ t('Label'),
+ t('Machine name'),
+ t('Usage'),
+ array('data' => t('Weight'), 'class' => array('tabledrag-hide')),
+ );
$table['#attributes']['id'] = 'rules-' . drupal_html_id($elements['#title']) . '-id';
foreach (element_children($elements['items']) as $key) {
@@ -107,6 +114,7 @@ function theme_rules_ui_variable_form($variables) {
/**
* Themes a view of multiple configuration items.
+ *
* @ingroup themeable
*/
function theme_rules_content_group($variables) {
@@ -125,6 +133,7 @@ function theme_rules_content_group($variables) {
/**
* Themes the view of a single parameter configuration.
+ *
* @ingroup themeable
*/
function theme_rules_parameter_configuration($variables) {
@@ -149,6 +158,7 @@ function theme_rules_parameter_configuration($variables) {
/**
* Themes info about variables.
+ *
* @ingroup themeable
*/
function theme_rules_variable_view($variables) {
@@ -169,6 +179,7 @@ function theme_rules_variable_view($variables) {
/**
* Themes help for using the data selector.
+ *
* @ingroup themeable
*/
function theme_rules_data_selector_help($variables) {
@@ -193,13 +204,18 @@ function theme_rules_data_selector_help($variables) {
);
foreach (RulesData::matchingDataSelector($variables_info, $param_info) as $selector => $info) {
$info += array('label' => '', 'description' => '');
- $render['table']['#rows'][] = array(check_plain($selector), check_plain(drupal_ucfirst($info['label'])), check_plain($info['description']));
+ $render['table']['#rows'][] = array(
+ check_plain($selector),
+ check_plain(drupal_ucfirst($info['label'])),
+ check_plain($info['description']),
+ );
}
return drupal_render($render);
}
/**
* Themes the rules log debug output.
+ *
* @ingroup themeable
*/
function theme_rules_log($variables) {
@@ -230,6 +246,7 @@ function theme_rules_log($variables) {
/**
* Theme rules debug log elements.
+ *
* @ingroup themeable
*/
function theme_rules_debug_element($variables) {
@@ -248,6 +265,7 @@ function theme_rules_debug_element($variables) {
/**
* Themes rules autocomplete forms.
+ *
* @ingroup themeable
*/
function theme_rules_autocomplete($variables) {
@@ -278,6 +296,7 @@ function theme_rules_autocomplete($variables) {
/**
* General theme function for displaying settings related help.
+ *
* @ingroup themeable
*/
function theme_rules_settings_help($variables) {