@@ -104,8 +104,8 @@ |
||
104 | 104 | $products = entity_load('commerce_product'); |
105 | 105 | $products_key = array_keys($products); |
106 | 106 | $products_number = count($products_key); |
107 | - $count = $products_number < $items_number ? $products_number: $items_number; |
|
108 | - for($i = 0; $i < $count; $i++) { |
|
107 | + $count = $products_number < $items_number ? $products_number : $items_number; |
|
108 | + for ($i = 0; $i < $count; $i++) { |
|
109 | 109 | $product = $products[$products_key[rand(0, $products_number - 1)]]; |
110 | 110 | $line_item = commerce_product_line_item_new($product, 1, $order->order_id); |
111 | 111 | commerce_line_item_save($line_item); |
@@ -89,6 +89,9 @@ discard block |
||
89 | 89 | * @param $items_number |
90 | 90 | * @param $order_state |
91 | 91 | */ |
92 | +/** |
|
93 | + * @param integer $items_number |
|
94 | + */ |
|
92 | 95 | function _df_commerce_create_order($uid, $items_number, $is_cart = FALSE) { |
93 | 96 | // Create order as a cart. |
94 | 97 | $order = commerce_order_new($uid, 'cart'); |
@@ -171,7 +174,7 @@ discard block |
||
171 | 174 | * Helper function to update the order status and set the message. |
172 | 175 | * |
173 | 176 | * @param $order |
174 | - * @param $status |
|
177 | + * @param string $status |
|
175 | 178 | */ |
176 | 179 | function _df_commerce_update_order_status($order, $status) { |
177 | 180 | // We need to harcode the previous state, as the entity will not |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | if (!$scenario = variable_get('df_admin_installed_scenario', FALSE)) { |
23 | 23 | drupal_set_message(t('No Demo Framework Scenario is currently installed.')); |
24 | 24 | return FALSE; |
25 | - } |
|
26 | - else{ |
|
25 | + } else{ |
|
27 | 26 | drupal_set_message(t('Uninstalling Demo Framework Scenario @scenario', array('@scenario' => $scenario))); |
28 | 27 | } |
29 | 28 | |
@@ -111,13 +110,11 @@ discard block |
||
111 | 110 | if ($enable_module) { |
112 | 111 | $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT . '/df/enable/' . $enable_module))); |
113 | 112 | $path = array('admin/df/enable/' . $enable_module, $options); |
114 | - } |
|
115 | - else { |
|
113 | + } else { |
|
116 | 114 | $path = ''; |
117 | 115 | } |
118 | 116 | batch_process($path); |
119 | - } |
|
120 | - else { |
|
117 | + } else { |
|
121 | 118 | drush_backend_batch_process(); |
122 | 119 | } |
123 | 120 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * Page callback; uninstall a scenario. |
9 | 9 | */ |
10 | 10 | function df_admin_page_uninstall() { |
11 | - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT . '/df/uninstall')) { |
|
11 | + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT.'/df/uninstall')) { |
|
12 | 12 | return drupal_access_denied(); |
13 | 13 | } |
14 | 14 | return df_admin_uninstall_scenario(); |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | drupal_set_message(t('No Demo Framework Scenario is currently installed.')); |
24 | 24 | return FALSE; |
25 | 25 | } |
26 | - else{ |
|
26 | + else { |
|
27 | 27 | drupal_set_message(t('Uninstalling Demo Framework Scenario @scenario', array('@scenario' => $scenario))); |
28 | 28 | } |
29 | 29 | |
30 | 30 | // Load info file to grab dependencies. |
31 | - if (!$info = drupal_parse_info_file(drupal_get_path('module', $scenario) . '/' . $scenario . '.info')) { |
|
31 | + if (!$info = drupal_parse_info_file(drupal_get_path('module', $scenario).'/'.$scenario.'.info')) { |
|
32 | 32 | drupal_set_message(t('Unable to load Scenario .info file'), 'error'); |
33 | 33 | return FALSE; |
34 | 34 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'operations' => $operations, |
100 | 100 | 'title' => t('Uninstall processing'), |
101 | 101 | 'init_message' => t('Starting uninstall process'), |
102 | - 'file' => drupal_get_path('module', 'migrate_ui') . '/migrate_ui.pages.inc', |
|
102 | + 'file' => drupal_get_path('module', 'migrate_ui').'/migrate_ui.pages.inc', |
|
103 | 103 | 'progress_message' => t('Uninstalling Demo Framework Scenario...'), |
104 | 104 | 'error_message' => t('An error occurred. Some or all of the uninstall processing has failed.'), |
105 | 105 | 'finished' => 'df_admin_batch_finish', |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | // If we're being called from the enable function, redirect to enable after |
110 | 110 | // the current module is uninstalled. |
111 | 111 | if ($enable_module) { |
112 | - $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT . '/df/enable/' . $enable_module))); |
|
113 | - $path = array('admin/df/enable/' . $enable_module, $options); |
|
112 | + $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT.'/df/enable/'.$enable_module))); |
|
113 | + $path = array('admin/df/enable/'.$enable_module, $options); |
|
114 | 114 | } |
115 | 115 | else { |
116 | 116 | $path = ''; |
@@ -137,7 +137,7 @@ |
||
137 | 137 | * The machine name of the scenario feature. |
138 | 138 | * @param string $rollback |
139 | 139 | * Boolean: rollback existing demo content. |
140 | - */ |
|
140 | + */ |
|
141 | 141 | function drush_df_admin_reset_scenario($scenario) { |
142 | 142 | $rollback = drush_get_option('rollback', TRUE); |
143 | 143 | $seed = drush_get_option('seed', TRUE); |
@@ -135,8 +135,6 @@ |
||
135 | 135 | * |
136 | 136 | * @param string $scenario |
137 | 137 | * The machine name of the scenario feature. |
138 | - * @param string $rollback |
|
139 | - * Boolean: rollback existing demo content. |
|
140 | 138 | */ |
141 | 139 | function drush_df_admin_reset_scenario($scenario) { |
142 | 140 | $rollback = drush_get_option('rollback', TRUE); |
@@ -108,8 +108,7 @@ discard block |
||
108 | 108 | foreach ($messages as $message) { |
109 | 109 | $operations[] = array('drupal_get_messages', array($message, TRUE)); |
110 | 110 | } |
111 | - } |
|
112 | - else { |
|
111 | + } else { |
|
113 | 112 | // Determine the current alias |
114 | 113 | $alias_context = drush_get_context('alias'); |
115 | 114 | $alias = !empty($alias_context) ? $alias_context : '@self'; |
@@ -139,8 +138,7 @@ discard block |
||
139 | 138 | $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT . '/df/imagestyles'))); |
140 | 139 | // The ability to send an array for $redirect is undocumented on Drupal.org, yay! |
141 | 140 | batch_process(array('admin/df/imagestyles', $options)); |
142 | - } |
|
143 | - else { |
|
141 | + } else { |
|
144 | 142 | drush_backend_batch_process(); |
145 | 143 | } |
146 | 144 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Page callback; reset a scenario. |
10 | 10 | */ |
11 | 11 | function df_admin_page_reset($module) { |
12 | - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT . '/df/reset/' . $module)) { |
|
12 | + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT.'/df/reset/'.$module)) { |
|
13 | 13 | return drupal_access_denied(); |
14 | 14 | } |
15 | 15 | return df_admin_reset_scenario($module, TRUE, TRUE); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // Confirm if there was an attempt to run scenario migrations. |
80 | 80 | $migrations_count = count($migrations[$scenario]); |
81 | 81 | if ($migrations_count > 0 && drupal_is_cli()) { |
82 | - $message = $migrations_count . ' demo migrations attempted.'; |
|
82 | + $message = $migrations_count.' demo migrations attempted.'; |
|
83 | 83 | $operations[] = array('drush_print', array($message, 0, NULL, TRUE)); |
84 | 84 | } |
85 | 85 | |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | 'operations' => $operations, |
130 | 130 | 'title' => t('Import processing'), |
131 | 131 | 'init_message' => t('Starting import process'), |
132 | - 'file' => drupal_get_path('module', 'migrate_ui') . '/migrate_ui.pages.inc', |
|
132 | + 'file' => drupal_get_path('module', 'migrate_ui').'/migrate_ui.pages.inc', |
|
133 | 133 | 'progress_message' => t('Importing Demo Framework Scenario...'), |
134 | 134 | 'error_message' => t('An error occurred. Some or all of the import processing has failed.'), |
135 | 135 | 'finished' => 'df_admin_batch_finish', |
136 | 136 | ); |
137 | 137 | batch_set($batch); |
138 | 138 | if (!drupal_is_cli()) { |
139 | - $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT . '/df/imagestyles'))); |
|
139 | + $options = array('query' => array('token' => drupal_get_token(DRUPAL_ROOT.'/df/imagestyles'))); |
|
140 | 140 | // The ability to send an array for $redirect is undocumented on Drupal.org, yay! |
141 | 141 | batch_process(array('admin/df/imagestyles', $options)); |
142 | 142 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | $vars['content'][$field_name][0]['file']['#muted'] = TRUE; |
52 | 52 | $vars['content'][$field_name][0]['file']['#autoplay'] = 'auto'; |
53 | 53 | } |
54 | - } |
|
55 | - else if ($field_name != 'title') { |
|
54 | + } else if ($field_name != 'title') { |
|
56 | 55 | $container[$field_name] = $field_value; |
57 | 56 | unset($vars['content'][$field_name]); |
58 | 57 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | * Implements hook_lightning_fpp_types(). |
24 | 24 | */ |
25 | 25 | function df_tools_hero_lightning_fpp_types_alter(&$types) { |
26 | - $icon_path = drupal_get_path('module', 'df_tools_hero') . '/images/'; |
|
26 | + $icon_path = drupal_get_path('module', 'df_tools_hero').'/images/'; |
|
27 | 27 | $types['hero'] = array( |
28 | 28 | 'title' => 'hero', |
29 | - 'icon' => $icon_path . 'icon_hero.png', |
|
29 | + 'icon' => $icon_path.'icon_hero.png', |
|
30 | 30 | 'path' => 'hero', |
31 | 31 | ); |
32 | 32 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | // have control over that file via build scripts. |
18 | 18 | // If RestWS had a real way to deal with CORS/preflight, we would use that. |
19 | 19 | if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { |
20 | - echo "";die; |
|
20 | + echo ""; die; |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 |
@@ -55,8 +55,7 @@ |
||
55 | 55 | |
56 | 56 | drupal_set_message(t('Successfully exported Panelizer display for Node @nid to @panels_file', ['@nid' => $node->id(), '@panels_file' => $panels_file])); |
57 | 57 | return TRUE; |
58 | - } |
|
59 | - else { |
|
58 | + } else { |
|
60 | 59 | drupal_set_message(t('The given Node is not Panelized.'), 'error'); |
61 | 60 | return FALSE; |
62 | 61 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * Page callback to reset image styles. |
21 | 21 | */ |
22 | 22 | function df_tools_image_page() { |
23 | - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT . '/df/imagestyles')) { |
|
23 | + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT.'/df/imagestyles')) { |
|
24 | 24 | return drupal_access_denied(); |
25 | 25 | } |
26 | 26 | return df_tools_image_seed_derivatives(); |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | $file_pattern = "[^\/]*"; // Finds anything that does not contain "/", should be fine. |
78 | 78 | } |
79 | 79 | else { |
80 | - $file_pattern = $dir ? $dir . ".+" : ".+"; |
|
80 | + $file_pattern = $dir ? $dir.".+" : ".+"; |
|
81 | 81 | } |
82 | 82 | |
83 | - $regex = "^public:\/\/(" . $file_pattern . ")\.(" . implode($extensions, '|') . ")$"; |
|
83 | + $regex = "^public:\/\/(".$file_pattern.")\.(".implode($extensions, '|').")$"; |
|
84 | 84 | |
85 | 85 | // Query the database for files that match this pattern. |
86 | 86 | $query = db_select('file_managed', 'f') |
87 | - ->condition('filemime', $mimetypes , 'IN') |
|
87 | + ->condition('filemime', $mimetypes, 'IN') |
|
88 | 88 | ->condition('uri', $regex, 'REGEXP'); |
89 | 89 | $total_count = $query->countQuery()->execute()->fetchField(); |
90 | 90 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | foreach (image_styles() as $name => $style) { |
102 | 102 | if (!empty($excludes) && in_array($style['name'], $excludes)) { |
103 | - $operations[] = array('drush_log', array('Excluding ' . $name, 'success')); |
|
103 | + $operations[] = array('drush_log', array('Excluding '.$name, 'success')); |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | if (empty($includes[0]) || in_array($style['name'], $includes)) { |
107 | - $operations[] = array('drush_log', array('Processing ' . $name, 'success')); |
|
107 | + $operations[] = array('drush_log', array('Processing '.$name, 'success')); |
|
108 | 108 | $count = 1; |
109 | 109 | $last_progress = 0; |
110 | 110 | foreach ($files as $file) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if (($progress % 25 === 0 || $progress % 7 === 0) && $progress != $last_progress) { |
119 | 119 | // If we're in the command line, print the percentage, otherwise hide it |
120 | 120 | if (drupal_is_cli()) { |
121 | - $operations[] = array('drush_print', array('...' . $progress . '%', 0, NULL, ($progress == 100))); |
|
121 | + $operations[] = array('drush_print', array('...'.$progress.'%', 0, NULL, ($progress == 100))); |
|
122 | 122 | } |
123 | 123 | $last_progress = $progress; |
124 | 124 | } |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | // Create a MigrateSource object. |
13 | 13 | if (isset($arguments['path'])) { |
14 | 14 | $import_path = $arguments['path']; |
15 | - } |
|
16 | - else { |
|
15 | + } else { |
|
17 | 16 | $import_path = drupal_get_path('module', 'df_tools_user') . '/import/df_tools_user.users.csv'; |
18 | 17 | } |
19 | 18 | $this->source = new MigrateSourceCSV($import_path, $this->csvcolumns(), array('header_rows' => 1)); |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | parent::__construct($arguments); |
69 | 68 | if (isset($arguments['path'])) { |
70 | 69 | $import_path = $arguments['path']; |
71 | - } |
|
72 | - else { |
|
70 | + } else { |
|
73 | 71 | $import_path = drupal_get_path('module', 'df_tools_user') . '/import/df_tools_user.users.csv'; |
74 | 72 | } |
75 | 73 | $this->source = new MigrateSourceCSV($import_path, $this->csvcolumns(), array('header_rows' => 1)); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $import_path = $arguments['path']; |
15 | 15 | } |
16 | 16 | else { |
17 | - $import_path = drupal_get_path('module', 'df_tools_user') . '/import/df_tools_user.users.csv'; |
|
17 | + $import_path = drupal_get_path('module', 'df_tools_user').'/import/df_tools_user.users.csv'; |
|
18 | 18 | } |
19 | 19 | $this->source = new MigrateSourceCSV($import_path, $this->csvcolumns(), array('header_rows' => 1)); |
20 | 20 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $import_path = $arguments['path']; |
71 | 71 | } |
72 | 72 | else { |
73 | - $import_path = drupal_get_path('module', 'df_tools_user') . '/import/df_tools_user.users.csv'; |
|
73 | + $import_path = drupal_get_path('module', 'df_tools_user').'/import/df_tools_user.users.csv'; |
|
74 | 74 | } |
75 | 75 | $this->source = new MigrateSourceCSV($import_path, $this->csvcolumns(), array('header_rows' => 1)); |
76 | 76 | |
77 | 77 | // Get the base path, which is where we assume /images is located |
78 | 78 | $base_path = dirname($import_path); |
79 | - $this->addFieldMapping('source_dir')->defaultValue($base_path . '/images'); |
|
79 | + $this->addFieldMapping('source_dir')->defaultValue($base_path.'/images'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | function csvcolumns() { |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | 'category' => 'Add HTML', |
22 | 22 | 'reusable' => false, |
23 | 23 | 'uuid' => $uuid, |
24 | - 'field_raw_html' => array ( |
|
25 | - 'und' => array ( |
|
26 | - 0 => array ( |
|
24 | + 'field_raw_html' => array( |
|
25 | + 'und' => array( |
|
26 | + 0 => array( |
|
27 | 27 | 'value' => $html, |
28 | 28 | 'format' => 'raw_html', |
29 | 29 | ), |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | 'category' => 'Add Map', |
51 | 51 | 'reusable' => false, |
52 | 52 | 'uuid' => $uuid, |
53 | - 'field_map_address' => array ( |
|
54 | - 'und' => array ( |
|
55 | - 0 => array ( |
|
53 | + 'field_map_address' => array( |
|
54 | + 'und' => array( |
|
55 | + 0 => array( |
|
56 | 56 | 'value' => $address, |
57 | 57 | ), |
58 | 58 | ), |
59 | 59 | ), |
60 | - 'field_map_information' => array ( |
|
61 | - 'und' => array ( |
|
62 | - 0 => array ( |
|
60 | + 'field_map_information' => array( |
|
61 | + 'und' => array( |
|
62 | + 0 => array( |
|
63 | 63 | 'value' => $info, |
64 | 64 | 'format' => 'full_html', |
65 | 65 | ), |