@@ -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 = ''; |
@@ -76,8 +76,7 @@ |
||
76 | 76 | watchdog('demo framework', 'Enabled module: ' . $module); |
77 | 77 | drupal_set_message(t('@module enabled.', array('@module' => $module)), 'status'); |
78 | 78 | return TRUE; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | drupal_set_message(t('@module does not exist or dependencies are missing.', array('@module' => $module)), 'error'); |
82 | 81 | return FALSE; |
83 | 82 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Page callback; enable a scenario. |
10 | 10 | */ |
11 | 11 | function df_admin_page_enable($module) { |
12 | - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT . '/df/enable/' . $module)) { |
|
12 | + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], DRUPAL_ROOT.'/df/enable/'.$module)) { |
|
13 | 13 | return drupal_access_denied(); |
14 | 14 | } |
15 | 15 | return df_admin_enable_scenario($module); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Load info file to grab dependencies. |
37 | - if (!$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info')) { |
|
37 | + if (!$info = drupal_parse_info_file(drupal_get_path('module', $module).'/'.$module.'.info')) { |
|
38 | 38 | drupal_set_message(t('Unable to load Scenario .info file'), 'error'); |
39 | 39 | return FALSE; |
40 | 40 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | // Not all DFS require a batch content import, but some need this. |
59 | 59 | // Resolves to the DF admin page if no reset callback present. |
60 | 60 | if (!drupal_is_cli()) { |
61 | - $path = 'admin/df/reset/' . $module; |
|
62 | - $token = drupal_get_token(DRUPAL_ROOT . '/df/reset/' . $module); |
|
61 | + $path = 'admin/df/reset/'.$module; |
|
62 | + $token = drupal_get_token(DRUPAL_ROOT.'/df/reset/'.$module); |
|
63 | 63 | drupal_goto($path, array('query' => array('token' => $token))); |
64 | 64 | } |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Enable a disabled Features module. |
74 | 74 | if (!module_exists($module)) { |
75 | 75 | if (module_enable(array($module))) { |
76 | - watchdog('demo framework', 'Enabled module: ' . $module); |
|
76 | + watchdog('demo framework', 'Enabled module: '.$module); |
|
77 | 77 | drupal_set_message(t('@module enabled.', array('@module' => $module)), 'status'); |
78 | 78 | return TRUE; |
79 | 79 | } |
@@ -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 | } |
@@ -34,8 +34,7 @@ |
||
34 | 34 | // Create a MigrateSource object. |
35 | 35 | if (isset($arguments['path'])) { |
36 | 36 | $import_path = $arguments['path']; |
37 | - } |
|
38 | - else { |
|
37 | + } else { |
|
39 | 38 | $import_path = drupal_get_path('module', 'df_tools_hero') . '/import/df_tools_hero.fpp.hero.csv'; |
40 | 39 | } |
41 | 40 | $this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1)); |
@@ -36,14 +36,14 @@ |
||
36 | 36 | $import_path = $arguments['path']; |
37 | 37 | } |
38 | 38 | else { |
39 | - $import_path = drupal_get_path('module', 'df_tools_hero') . '/import/df_tools_hero.fpp.hero.csv'; |
|
39 | + $import_path = drupal_get_path('module', 'df_tools_hero').'/import/df_tools_hero.fpp.hero.csv'; |
|
40 | 40 | } |
41 | 41 | $this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1)); |
42 | 42 | $this->destination = new MigrateDestinationFieldablePanelsPanes('hero', array('text_format' => 'full_html')); |
43 | 43 | |
44 | 44 | $this->addFieldMapping('field_hero_image', 'Image'); |
45 | 45 | $this->addFieldMapping('field_hero_image:file_replace')->defaultValue(FILE_EXISTS_REPLACE); |
46 | - $this->addFieldMapping('field_hero_image:source_dir')->defaultValue(dirname($import_path) . '/images'); |
|
46 | + $this->addFieldMapping('field_hero_image:source_dir')->defaultValue(dirname($import_path).'/images'); |
|
47 | 47 | $this->addFieldMapping('field_hero_image:destination_file', 'filename'); |
48 | 48 | |
49 | 49 | $this->addFieldMapping('field_hero_headline_1', 'Headline 1'); |
@@ -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 |
@@ -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() { |