@@ -9,13 +9,13 @@ |
||
9 | 9 | * Implementation of hook_wysiwyg_plugin(). |
10 | 10 | */ |
11 | 11 | function wysiwyg_break_plugin() { |
12 | - $plugins['break'] = array( |
|
12 | + $plugins['break'] = array( |
|
13 | 13 | 'title' => t('Teaser break'), |
14 | 14 | 'vendor url' => 'http://drupal.org/project/wysiwyg', |
15 | 15 | 'icon file' => 'break.gif', |
16 | 16 | 'icon title' => t('Separate the teaser and body of this content'), |
17 | 17 | 'settings' => array(), |
18 | - ); |
|
19 | - return $plugins; |
|
18 | + ); |
|
19 | + return $plugins; |
|
20 | 20 | } |
21 | 21 |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | * Menu callback; Output a wysiwyg plugin dialog page. |
10 | 10 | */ |
11 | 11 | function wysiwyg_dialog($plugin, $instance) { |
12 | - $plugins = wysiwyg_get_all_plugins(); |
|
13 | - if (!isset($plugins[$plugin])) { |
|
12 | + $plugins = wysiwyg_get_all_plugins(); |
|
13 | + if (!isset($plugins[$plugin])) { |
|
14 | 14 | return drupal_access_denied(); |
15 | - } |
|
16 | - $callback = $plugin . '_wysiwyg_dialog'; |
|
17 | - if (!function_exists($callback)) { |
|
15 | + } |
|
16 | + $callback = $plugin . '_wysiwyg_dialog'; |
|
17 | + if (!function_exists($callback)) { |
|
18 | 18 | return drupal_not_found(); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | - // Suppress admin menu. |
|
22 | - module_invoke('admin_menu', 'suppress'); |
|
23 | - // Add editor instance id to Drupal.settings. |
|
24 | - $settings = array( |
|
21 | + // Suppress admin menu. |
|
22 | + module_invoke('admin_menu', 'suppress'); |
|
23 | + // Add editor instance id to Drupal.settings. |
|
24 | + $settings = array( |
|
25 | 25 | 'plugin' => $plugin, |
26 | 26 | 'instance' => $instance, |
27 | - ); |
|
28 | - drupal_add_js(array('wysiwyg' => $settings), 'setting'); |
|
27 | + ); |
|
28 | + drupal_add_js(array('wysiwyg' => $settings), 'setting'); |
|
29 | 29 | |
30 | - echo theme('wysiwyg_dialog_page', $callback($instance)); |
|
30 | + echo theme('wysiwyg_dialog_page', $callback($instance)); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,26 +38,26 @@ discard block |
||
38 | 38 | * @see template_preprocess() |
39 | 39 | */ |
40 | 40 | function template_preprocess_wysiwyg_dialog_page(&$variables) { |
41 | - // Construct page title |
|
42 | - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); |
|
41 | + // Construct page title |
|
42 | + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); |
|
43 | 43 | |
44 | - $variables['head_title'] = implode(' | ', $head_title); |
|
45 | - $variables['base_path'] = base_path(); |
|
46 | - $variables['front_page'] = url(); |
|
47 | - // @todo Would a breadcrumb make sense / possible at all? |
|
48 | - // $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); |
|
49 | - $variables['head'] = drupal_get_html_head(); |
|
50 | - $variables['help'] = theme('help'); |
|
51 | - $variables['language'] = $GLOBALS['language']; |
|
52 | - $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; |
|
53 | - $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; |
|
54 | - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); |
|
55 | - $variables['css'] = drupal_add_css(); |
|
56 | - $variables['styles'] = drupal_get_css(); |
|
57 | - $variables['scripts'] = drupal_get_js(); |
|
58 | - $variables['tabs'] = theme('menu_local_tasks'); |
|
59 | - $variables['title'] = drupal_get_title(); |
|
60 | - // Closure should be filled last. |
|
61 | - $variables['closure'] = theme('closure'); |
|
44 | + $variables['head_title'] = implode(' | ', $head_title); |
|
45 | + $variables['base_path'] = base_path(); |
|
46 | + $variables['front_page'] = url(); |
|
47 | + // @todo Would a breadcrumb make sense / possible at all? |
|
48 | + // $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); |
|
49 | + $variables['head'] = drupal_get_html_head(); |
|
50 | + $variables['help'] = theme('help'); |
|
51 | + $variables['language'] = $GLOBALS['language']; |
|
52 | + $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; |
|
53 | + $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; |
|
54 | + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); |
|
55 | + $variables['css'] = drupal_add_css(); |
|
56 | + $variables['styles'] = drupal_get_css(); |
|
57 | + $variables['scripts'] = drupal_get_js(); |
|
58 | + $variables['tabs'] = theme('menu_local_tasks'); |
|
59 | + $variables['title'] = drupal_get_title(); |
|
60 | + // Closure should be filled last. |
|
61 | + $variables['closure'] = theme('closure'); |
|
62 | 62 | } |
63 | 63 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if (!isset($plugins[$plugin])) { |
14 | 14 | return drupal_access_denied(); |
15 | 15 | } |
16 | - $callback = $plugin . '_wysiwyg_dialog'; |
|
16 | + $callback = $plugin.'_wysiwyg_dialog'; |
|
17 | 17 | if (!function_exists($callback)) { |
18 | 18 | return drupal_not_found(); |
19 | 19 | } |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | * plugin meta-information as values. |
37 | 37 | */ |
38 | 38 | function hook_wysiwyg_plugin($editor, $version) { |
39 | - switch ($editor) { |
|
39 | + switch ($editor) { |
|
40 | 40 | case 'tinymce': |
41 | 41 | if ($version > 3) { |
42 | 42 | return array( |
43 | - 'myplugin' => array( |
|
43 | + 'myplugin' => array( |
|
44 | 44 | // A URL to the plugin's homepage. |
45 | 45 | 'url' => 'http://drupal.org/project/img_assist', |
46 | 46 | // The full path to the native editor plugin, no trailing slash. |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | // match the corresponding JavaScript implementation. The value is |
55 | 55 | // is displayed on the editor configuration form only. |
56 | 56 | 'buttons' => array( |
57 | - 'img_assist' => t('Image Assist'), |
|
57 | + 'img_assist' => t('Image Assist'), |
|
58 | 58 | ), |
59 | 59 | // A list of editor extensions provided by this native plugin. |
60 | 60 | // Extensions are not displayed as buttons and touch the editor's |
61 | 61 | // internals, so you should know what you are doing. |
62 | 62 | 'extensions' => array( |
63 | - 'imce' => t('IMCE'), |
|
63 | + 'imce' => t('IMCE'), |
|
64 | 64 | ), |
65 | 65 | // A list of global, native editor configuration settings to |
66 | 66 | // override. To be used rarely and only when required. |
67 | 67 | 'options' => array( |
68 | - 'file_browser_callback' => 'imceImageBrowser', |
|
69 | - 'inline_styles' => TRUE, |
|
68 | + 'file_browser_callback' => 'imceImageBrowser', |
|
69 | + 'inline_styles' => TRUE, |
|
70 | 70 | ), |
71 | 71 | // Boolean whether the editor needs to load this plugin. When TRUE, |
72 | 72 | // the editor will automatically load the plugin based on the 'path' |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | 'internal' => TRUE, |
82 | 82 | // TinyMCE-specific: Additional HTML elements to allow in the markup. |
83 | 83 | 'extended_valid_elements' => array( |
84 | - 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
84 | + 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
85 | + ), |
|
85 | 86 | ), |
86 | - ), |
|
87 | 87 | ); |
88 | - } |
|
89 | - break; |
|
90 | - } |
|
88 | + } |
|
89 | + break; |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * Wysiwyg module. |
102 | 102 | */ |
103 | 103 | function hook_wysiwyg_include_directory($type) { |
104 | - switch ($type) { |
|
104 | + switch ($type) { |
|
105 | 105 | case 'plugins': |
106 | 106 | // You can just return $type, if you place your Wysiwyg plugins into a |
107 | 107 | // sub-directory named 'plugins'. |
108 | 108 | return $type; |
109 | - } |
|
109 | + } |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * Meta information about the buttons provided by this plugin. |
137 | 137 | */ |
138 | 138 | function hook_INCLUDE_plugin() { |
139 | - $plugins['awesome'] = array( |
|
139 | + $plugins['awesome'] = array( |
|
140 | 140 | // The plugin's title; defaulting to its internal name ('awesome'). |
141 | 141 | 'title' => t('Awesome plugin'), |
142 | 142 | // The (vendor) homepage of this plugin; defaults to ''. |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | ), |
166 | 166 | // TinyMCE-specific: Additional HTML elements to allow in the markup. |
167 | 167 | 'extended_valid_elements' => array( |
168 | - 'tag1[attribute1|attribute2]', |
|
169 | - 'tag2[attribute3|attribute4]', |
|
168 | + 'tag1[attribute1|attribute2]', |
|
169 | + 'tag2[attribute3|attribute4]', |
|
170 | 170 | ), |
171 | - ); |
|
172 | - return $plugins; |
|
171 | + ); |
|
172 | + return $plugins; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | * - theme: The name of the editor theme/skin. |
197 | 197 | */ |
198 | 198 | function hook_wysiwyg_editor_settings_alter(&$settings, $context) { |
199 | - // Each editor has its own collection of native settings that may be extended |
|
200 | - // or overridden. Please consult the respective official vendor documentation |
|
201 | - // for details. |
|
202 | - if ($context['profile']->editor == 'tinymce') { |
|
199 | + // Each editor has its own collection of native settings that may be extended |
|
200 | + // or overridden. Please consult the respective official vendor documentation |
|
201 | + // for details. |
|
202 | + if ($context['profile']->editor == 'tinymce') { |
|
203 | 203 | // Supported values to JSON data types. |
204 | 204 | $settings['cleanup_on_startup'] = TRUE; |
205 | - } |
|
205 | + } |
|
206 | 206 | } |
@@ -37,56 +37,56 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function hook_wysiwyg_plugin($editor, $version) { |
39 | 39 | switch ($editor) { |
40 | - case 'tinymce': |
|
41 | - if ($version > 3) { |
|
42 | - return array( |
|
43 | - 'myplugin' => array( |
|
44 | - // A URL to the plugin's homepage. |
|
45 | - 'url' => 'http://drupal.org/project/img_assist', |
|
46 | - // The full path to the native editor plugin, no trailing slash. |
|
47 | - // Ignored when 'internal' is set to TRUE below. |
|
48 | - 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', |
|
49 | - // The name of the plugin's main JavaScript file. |
|
50 | - // Ignored when 'internal' is set to TRUE below. |
|
51 | - // Default value depends on which editor the plugin is for. |
|
52 | - 'filename' => 'editor_plugin.js', |
|
53 | - // A list of buttons provided by this native plugin. The key has to |
|
54 | - // match the corresponding JavaScript implementation. The value is |
|
55 | - // is displayed on the editor configuration form only. |
|
56 | - 'buttons' => array( |
|
57 | - 'img_assist' => t('Image Assist'), |
|
58 | - ), |
|
59 | - // A list of editor extensions provided by this native plugin. |
|
60 | - // Extensions are not displayed as buttons and touch the editor's |
|
61 | - // internals, so you should know what you are doing. |
|
62 | - 'extensions' => array( |
|
63 | - 'imce' => t('IMCE'), |
|
64 | - ), |
|
65 | - // A list of global, native editor configuration settings to |
|
66 | - // override. To be used rarely and only when required. |
|
67 | - 'options' => array( |
|
68 | - 'file_browser_callback' => 'imceImageBrowser', |
|
69 | - 'inline_styles' => TRUE, |
|
70 | - ), |
|
71 | - // Boolean whether the editor needs to load this plugin. When TRUE, |
|
72 | - // the editor will automatically load the plugin based on the 'path' |
|
73 | - // variable provided. If FALSE, the plugin either does not need to |
|
74 | - // be loaded or is already loaded by something else on the page. |
|
75 | - // Most plugins should define TRUE here. |
|
76 | - 'load' => TRUE, |
|
77 | - // Boolean whether this plugin is a native plugin, i.e. shipped with |
|
78 | - // the editor. Definition must be ommitted for plugins provided by |
|
79 | - // other modules. TRUE means 'path' and 'filename' above are ignored |
|
80 | - // and the plugin is instead loaded from the editor's plugin folder. |
|
81 | - 'internal' => TRUE, |
|
82 | - // TinyMCE-specific: Additional HTML elements to allow in the markup. |
|
83 | - 'extended_valid_elements' => array( |
|
84 | - 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
85 | - ), |
|
40 | + case 'tinymce': |
|
41 | + if ($version > 3) { |
|
42 | + return array( |
|
43 | + 'myplugin' => array( |
|
44 | + // A URL to the plugin's homepage. |
|
45 | + 'url' => 'http://drupal.org/project/img_assist', |
|
46 | + // The full path to the native editor plugin, no trailing slash. |
|
47 | + // Ignored when 'internal' is set to TRUE below. |
|
48 | + 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', |
|
49 | + // The name of the plugin's main JavaScript file. |
|
50 | + // Ignored when 'internal' is set to TRUE below. |
|
51 | + // Default value depends on which editor the plugin is for. |
|
52 | + 'filename' => 'editor_plugin.js', |
|
53 | + // A list of buttons provided by this native plugin. The key has to |
|
54 | + // match the corresponding JavaScript implementation. The value is |
|
55 | + // is displayed on the editor configuration form only. |
|
56 | + 'buttons' => array( |
|
57 | + 'img_assist' => t('Image Assist'), |
|
86 | 58 | ), |
87 | - ); |
|
88 | - } |
|
89 | - break; |
|
59 | + // A list of editor extensions provided by this native plugin. |
|
60 | + // Extensions are not displayed as buttons and touch the editor's |
|
61 | + // internals, so you should know what you are doing. |
|
62 | + 'extensions' => array( |
|
63 | + 'imce' => t('IMCE'), |
|
64 | + ), |
|
65 | + // A list of global, native editor configuration settings to |
|
66 | + // override. To be used rarely and only when required. |
|
67 | + 'options' => array( |
|
68 | + 'file_browser_callback' => 'imceImageBrowser', |
|
69 | + 'inline_styles' => TRUE, |
|
70 | + ), |
|
71 | + // Boolean whether the editor needs to load this plugin. When TRUE, |
|
72 | + // the editor will automatically load the plugin based on the 'path' |
|
73 | + // variable provided. If FALSE, the plugin either does not need to |
|
74 | + // be loaded or is already loaded by something else on the page. |
|
75 | + // Most plugins should define TRUE here. |
|
76 | + 'load' => TRUE, |
|
77 | + // Boolean whether this plugin is a native plugin, i.e. shipped with |
|
78 | + // the editor. Definition must be ommitted for plugins provided by |
|
79 | + // other modules. TRUE means 'path' and 'filename' above are ignored |
|
80 | + // and the plugin is instead loaded from the editor's plugin folder. |
|
81 | + 'internal' => TRUE, |
|
82 | + // TinyMCE-specific: Additional HTML elements to allow in the markup. |
|
83 | + 'extended_valid_elements' => array( |
|
84 | + 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
|
85 | + ), |
|
86 | + ), |
|
87 | + ); |
|
88 | + } |
|
89 | + break; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function hook_wysiwyg_include_directory($type) { |
104 | 104 | switch ($type) { |
105 | - case 'plugins': |
|
106 | - // You can just return $type, if you place your Wysiwyg plugins into a |
|
107 | - // sub-directory named 'plugins'. |
|
108 | - return $type; |
|
105 | + case 'plugins': |
|
106 | + // You can just return $type, if you place your Wysiwyg plugins into a |
|
107 | + // sub-directory named 'plugins'. |
|
108 | + return $type; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | 'url' => 'http://drupal.org/project/img_assist', |
46 | 46 | // The full path to the native editor plugin, no trailing slash. |
47 | 47 | // Ignored when 'internal' is set to TRUE below. |
48 | - 'path' => drupal_get_path('module', 'img_assist') . '/drupalimage', |
|
48 | + 'path' => drupal_get_path('module', 'img_assist').'/drupalimage', |
|
49 | 49 | // The name of the plugin's main JavaScript file. |
50 | 50 | // Ignored when 'internal' is set to TRUE below. |
51 | 51 | // Default value depends on which editor the plugin is for. |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | 'icon title' => t('Do something'), |
151 | 151 | // An alternative path to the integration JavaScript; defaults to |
152 | 152 | // '[path-to-module]/[plugins-directory]/[plugin-name]'. |
153 | - 'js path' => drupal_get_path('module', 'mymodule') . '/awesomeness', |
|
153 | + 'js path' => drupal_get_path('module', 'mymodule').'/awesomeness', |
|
154 | 154 | // An alternative filename of the integration JavaScript; defaults to |
155 | 155 | // '[plugin-name].js'. |
156 | 156 | 'js file' => 'awesome.js', |
157 | 157 | // An alternative path to the integration stylesheet; defaults to |
158 | 158 | // '[path-to-module]/[plugins-directory]/[plugin-name]'. |
159 | - 'css path' => drupal_get_path('module', 'mymodule') . '/awesomeness', |
|
159 | + 'css path' => drupal_get_path('module', 'mymodule').'/awesomeness', |
|
160 | 160 | // An alternative filename of the integration stylesheet; defaults to |
161 | 161 | // '[plugin-name].css'. |
162 | 162 | 'css file' => 'awesome.css', |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | // override. To be used rarely and only when required. |
67 | 67 | 'options' => array( |
68 | 68 | 'file_browser_callback' => 'imceImageBrowser', |
69 | - 'inline_styles' => TRUE, |
|
69 | + 'inline_styles' => true, |
|
70 | 70 | ), |
71 | 71 | // Boolean whether the editor needs to load this plugin. When TRUE, |
72 | 72 | // the editor will automatically load the plugin based on the 'path' |
73 | 73 | // variable provided. If FALSE, the plugin either does not need to |
74 | 74 | // be loaded or is already loaded by something else on the page. |
75 | 75 | // Most plugins should define TRUE here. |
76 | - 'load' => TRUE, |
|
76 | + 'load' => true, |
|
77 | 77 | // Boolean whether this plugin is a native plugin, i.e. shipped with |
78 | 78 | // the editor. Definition must be ommitted for plugins provided by |
79 | 79 | // other modules. TRUE means 'path' and 'filename' above are ignored |
80 | 80 | // and the plugin is instead loaded from the editor's plugin folder. |
81 | - 'internal' => TRUE, |
|
81 | + 'internal' => true, |
|
82 | 82 | // TinyMCE-specific: Additional HTML elements to allow in the markup. |
83 | 83 | 'extended_valid_elements' => array( |
84 | 84 | 'img[class|src|border=0|alt|title|width|height|align|name|style]', |
@@ -201,6 +201,6 @@ discard block |
||
201 | 201 | // for details. |
202 | 202 | if ($context['profile']->editor == 'tinymce') { |
203 | 203 | // Supported values to JSON data types. |
204 | - $settings['cleanup_on_startup'] = TRUE; |
|
204 | + $settings['cleanup_on_startup'] = true; |
|
205 | 205 | } |
206 | 206 | } |
@@ -17,14 +17,14 @@ |
||
17 | 17 | * Implementation of hook_menu(). |
18 | 18 | */ |
19 | 19 | function forum_tweaks_menu() { |
20 | - // Note that this comes straight out of the Advanced Forum module. As such, |
|
21 | - // it should be removed should said module be added at a future point in time |
|
22 | - $items['community/forum/%/read'] = array( |
|
20 | + // Note that this comes straight out of the Advanced Forum module. As such, |
|
21 | + // it should be removed should said module be added at a future point in time |
|
22 | + $items['community/forum/%/read'] = array( |
|
23 | 23 | 'access callback' => 'forum_tweaks_markasread_access', |
24 | 24 | 'page arguments' => array(2), |
25 | 25 | 'page callback' => 'forum_tweaks_markasread', |
26 | 26 | 'type' => MENU_CALLBACK, |
27 | 27 | 'file' => 'includes/mark-read.inc', |
28 | - ); |
|
29 | - return $items; |
|
28 | + ); |
|
29 | + return $items; |
|
30 | 30 | } |
@@ -13,31 +13,31 @@ discard block |
||
13 | 13 | * Either fill a $links array or return a string version of the link to mark read. |
14 | 14 | */ |
15 | 15 | function forum_tweaks_get_mark_read_link($tid = 0, &$links = array()) { |
16 | - if (forum_tweaks_markasread_access() && !in_array($tid, variable_get('forum_containers', array()))) { |
|
16 | + if (forum_tweaks_markasread_access() && !in_array($tid, variable_get('forum_containers', array()))) { |
|
17 | 17 | if ($tid) { |
18 | - $links['mark-read']['title'] = t('Mark all topics read'); |
|
19 | - $links['mark-read']['href'] = "community/forum/{$tid}/read"; |
|
18 | + $links['mark-read']['title'] = t('Mark all topics read'); |
|
19 | + $links['mark-read']['href'] = "community/forum/{$tid}/read"; |
|
20 | 20 | |
21 | - return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
|
21 | + return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
|
22 | 22 | } |
23 | 23 | else { |
24 | - $links['mark-read']['title'] = t('Mark all forums read'); |
|
25 | - $links['mark-read']['href'] = "community/forum/0/read"; |
|
24 | + $links['mark-read']['title'] = t('Mark all forums read'); |
|
25 | + $links['mark-read']['href'] = "community/forum/0/read"; |
|
26 | 26 | |
27 | - return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE)); |
|
27 | + return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE)); |
|
28 | + } |
|
28 | 29 | } |
29 | - } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Marks all posts in forums or in a given forum as read by the current user. |
34 | 34 | */ |
35 | 35 | function forum_tweaks_markasread($current_forum_id = 0) { |
36 | - global $user; |
|
36 | + global $user; |
|
37 | 37 | |
38 | - // See if we're on a forum or on the forum overview |
|
39 | - // Path will be /forum/markasread or /forum/markasread/tid |
|
40 | - if ($current_forum_id) { |
|
38 | + // See if we're on a forum or on the forum overview |
|
39 | + // Path will be /forum/markasread or /forum/markasread/tid |
|
40 | + if ($current_forum_id) { |
|
41 | 41 | // Delete the current history entries so already visited nodes get updated. |
42 | 42 | $sql = "DELETE h |
43 | 43 | FROM {history} AS h |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | |
59 | 59 | // Readpath integration |
60 | 60 | if (module_exists('readpath')) { |
61 | - readpath_clear_readpath(); |
|
61 | + readpath_clear_readpath(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | drupal_set_message(t('All content in this forum has been marked as read')); |
65 | 65 | drupal_goto('community/forum/' . $current_forum_id); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - // We are on the forum overview, requesting all forums be marked read |
|
69 | - $forum_vocabulary_id = variable_get('forum_nav_vocabulary', ''); |
|
68 | + // We are on the forum overview, requesting all forums be marked read |
|
69 | + $forum_vocabulary_id = variable_get('forum_nav_vocabulary', ''); |
|
70 | 70 | |
71 | - // Delete the current history entries so already visited nodes get updated. |
|
72 | - $sql = "DELETE h |
|
71 | + // Delete the current history entries so already visited nodes get updated. |
|
72 | + $sql = "DELETE h |
|
73 | 73 | FROM {history} AS h |
74 | 74 | INNER JOIN {term_node} AS tn ON (h.nid = tn.nid) |
75 | 75 | INNER JOIN {term_data} AS td ON (td.tid = tn.tid) |
76 | 76 | WHERE h.uid = %d AND td.vid = %d"; |
77 | - db_query($sql, $user->uid, $forum_vocabulary_id); |
|
77 | + db_query($sql, $user->uid, $forum_vocabulary_id); |
|
78 | 78 | |
79 | - // Update the history table with all forum nodes newer than the cutoff. |
|
80 | - $sql = "INSERT INTO {history} (uid, nid, timestamp) |
|
79 | + // Update the history table with all forum nodes newer than the cutoff. |
|
80 | + $sql = "INSERT INTO {history} (uid, nid, timestamp) |
|
81 | 81 | SELECT DISTINCT %d, n.nid, %d |
82 | 82 | FROM {node} AS n |
83 | 83 | INNER JOIN {term_node} AS tn ON n.nid=tn.nid |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | INNER JOIN {term_data} AS td ON tn.tid = td.tid |
86 | 86 | WHERE (n.changed > %d OR ncs.last_comment_timestamp > %d) AND td.vid = %d"; |
87 | 87 | |
88 | - $args = array($user->uid, time(), NODE_NEW_LIMIT, NODE_NEW_LIMIT, $forum_vocabulary_id); |
|
88 | + $args = array($user->uid, time(), NODE_NEW_LIMIT, NODE_NEW_LIMIT, $forum_vocabulary_id); |
|
89 | 89 | |
90 | - db_query($sql, $args); |
|
90 | + db_query($sql, $args); |
|
91 | 91 | |
92 | - drupal_set_message(t('All forum content has been marked as read')); |
|
93 | - drupal_goto('community/forum'); |
|
92 | + drupal_set_message(t('All forum content has been marked as read')); |
|
93 | + drupal_goto('community/forum'); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -101,6 +101,6 @@ discard block |
||
101 | 101 | * cached and re-used for other users. |
102 | 102 | */ |
103 | 103 | function forum_tweaks_markasread_access() { |
104 | - global $user; |
|
105 | - return user_access('access content') && $user->uid; |
|
104 | + global $user; |
|
105 | + return user_access('access content') && $user->uid; |
|
106 | 106 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | $links['mark-read']['title'] = t('Mark all topics read'); |
19 | 19 | $links['mark-read']['href'] = "community/forum/{$tid}/read"; |
20 | 20 | |
21 | - return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
|
21 | + return l(t('Mark all topics read').'<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
|
22 | 22 | } |
23 | 23 | else { |
24 | 24 | $links['mark-read']['title'] = t('Mark all forums read'); |
25 | 25 | $links['mark-read']['href'] = "community/forum/0/read"; |
26 | 26 | |
27 | - return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE)); |
|
27 | + return l(t('Mark all forums read').'<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | drupal_set_message(t('All content in this forum has been marked as read')); |
65 | - drupal_goto('community/forum/' . $current_forum_id); |
|
65 | + drupal_goto('community/forum/'.$current_forum_id); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // We are on the forum overview, requesting all forums be marked read |
@@ -19,8 +19,7 @@ |
||
19 | 19 | $links['mark-read']['href'] = "community/forum/{$tid}/read"; |
20 | 20 | |
21 | 21 | return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
22 | - } |
|
23 | - else { |
|
22 | + } else { |
|
24 | 23 | $links['mark-read']['title'] = t('Mark all forums read'); |
25 | 24 | $links['mark-read']['href'] = "community/forum/0/read"; |
26 | 25 |
@@ -18,13 +18,13 @@ |
||
18 | 18 | $links['mark-read']['title'] = t('Mark all topics read'); |
19 | 19 | $links['mark-read']['href'] = "community/forum/{$tid}/read"; |
20 | 20 | |
21 | - return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE)); |
|
21 | + return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => true)); |
|
22 | 22 | } |
23 | 23 | else { |
24 | 24 | $links['mark-read']['title'] = t('Mark all forums read'); |
25 | 25 | $links['mark-read']['href'] = "community/forum/0/read"; |
26 | 26 | |
27 | - return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE)); |
|
27 | + return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => true)); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
@@ -2,38 +2,38 @@ discard block |
||
2 | 2 | // $Id: bbcode.module,v 1.50 2008/02/07 14:05:30 naudefj Exp $ |
3 | 3 | |
4 | 4 | function bbcode_help($section) { |
5 | - if ($section == 'admin/modules#description') |
|
5 | + if ($section == 'admin/modules#description') |
|
6 | 6 | return t('Allow the use of BBCode in your posts.'); |
7 | 7 | } |
8 | 8 | |
9 | 9 | function bbcode_filter_tips($delta, $format, $long = false) { |
10 | - if ($long) { |
|
10 | + if ($long) { |
|
11 | 11 | include_once(drupal_get_path('module', 'bbcode') .'/bbcode-help.inc'); |
12 | 12 | return _bbcode_filter_tip(); |
13 | - } |
|
14 | - else { |
|
13 | + } |
|
14 | + else { |
|
15 | 15 | # D5: $output = t('You can use !BBCode tags in the text.', array('!BBCode' => l(t('BBCode'), "filter/tips/$format", NULL, NULL, 'filter-bbcode-' . $delta))); |
16 | 16 | $output = t('You can use !BBCode (opens in new window) tags in the text.', |
17 | - array( |
|
17 | + array( |
|
18 | 18 | '!BBCode' => l(t('BBCode'), "filter/tips/$format", |
19 | 19 | array( |
20 | - 'fragment' => 'filter-bbcode-' . $delta, |
|
21 | - 'attributes' => |
|
22 | - array( |
|
23 | - 'target'=>'_blank', |
|
24 | - 'rel'=>'noopener noreferrer', |
|
25 | - ), |
|
20 | + 'fragment' => 'filter-bbcode-' . $delta, |
|
21 | + 'attributes' => |
|
22 | + array( |
|
23 | + 'target'=>'_blank', |
|
24 | + 'rel'=>'noopener noreferrer', |
|
25 | + ), |
|
26 | 26 | )) |
27 | - )); |
|
27 | + )); |
|
28 | 28 | if (variable_get("bbcode_make_links_$format", FALSE)) { |
29 | - $output .= ' '. t('URLs will automatically be converted to links.'); |
|
29 | + $output .= ' '. t('URLs will automatically be converted to links.'); |
|
30 | 30 | } |
31 | 31 | return $output; |
32 | - } |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | function bbcode_filter($op, $delta = 0, $format = -1, $text = '') { |
36 | - switch ($op) { |
|
36 | + switch ($op) { |
|
37 | 37 | case 'list': |
38 | 38 | return array(0 => t('BBCode')); |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | case 'process': |
44 | 44 | include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
45 | - if (variable_get("bbcode_debug_$format", 0)) { |
|
45 | + if (variable_get("bbcode_debug_$format", 0)) { |
|
46 | 46 | $timing_start = explode(' ', microtime()); |
47 | 47 | $ret = _bbcode_filter_process($text, $format); |
48 | 48 | $timing_stop = explode(' ', microtime()); |
@@ -50,99 +50,99 @@ discard block |
||
50 | 50 | $elapsed += $timing_stop[0] - $timing_start[0]; |
51 | 51 | $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
52 | 52 | return $ret; |
53 | - } |
|
54 | - else |
|
53 | + } |
|
54 | + else |
|
55 | 55 | return _bbcode_filter_process($text, $format); |
56 | 56 | |
57 | 57 | case 'settings': |
58 | 58 | $form = array(); |
59 | - $form['bbcode_filter'] = array( |
|
59 | + $form['bbcode_filter'] = array( |
|
60 | 60 | '#type' => 'fieldset', |
61 | 61 | '#title' => t('BBCode filter'), |
62 | 62 | '#collapsible' => TRUE, |
63 | 63 | '#collapsed' => FALSE); |
64 | - $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
64 | + $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
65 | 65 | '#type' => 'select', |
66 | 66 | '#title' => t('Convert addresses to links'), |
67 | 67 | '#default_value' => variable_get("bbcode_make_links_$format", 1), |
68 | 68 | '#options' => array(t('Disabled'), t('Enabled')), |
69 | 69 | '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.')); |
70 | - $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
70 | + $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
71 | 71 | '#type' => 'select', |
72 | 72 | '#title' => t('Spam link deterrent'), |
73 | 73 | '#default_value' => variable_get("bbcode_filter_nofollow_$format", 0), |
74 | 74 | '#options' => array(t('Disabled'), t('Enabled')), |
75 | 75 | '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.')); |
76 | - $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
76 | + $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
77 | 77 | '#type' => 'select', |
78 | 78 | '#title' => t('Email address encoding'), |
79 | 79 | '#default_value' => variable_get("bbcode_encode_mailto_$format", 1), |
80 | 80 | '#options' => array(t('Disabled'), t('Enabled')), |
81 | 81 | '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.')); |
82 | - $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
82 | + $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
83 | 83 | '#type' => 'select', |
84 | 84 | '#title' => t('Smart paragraph and line breaks'), |
85 | 85 | '#default_value' => variable_get("bbcode_paragraph_breaks_$format", 2), |
86 | 86 | '#options' => array(t('Disabled'), t('Line breaks only'), t('Line and paragraph breaks')), |
87 | 87 | '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!')); |
88 | - $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
88 | + $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
89 | 89 | '#type' => 'select', |
90 | 90 | '#title' => t('Print debugging info'), |
91 | 91 | '#default_value' => variable_get("bbcode_debug_$format", 0), |
92 | 92 | '#options' => array(t('Disabled'), t('Enabled')), |
93 | 93 | '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.')); |
94 | - return $form; |
|
94 | + return $form; |
|
95 | 95 | |
96 | 96 | default: |
97 | 97 | return $text; |
98 | - } |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /* hook_quicktags_alter |
102 | 102 | * Alter icons if the quicktags module is enabled |
103 | 103 | */ |
104 | 104 | function bbcode_quicktags_alter($items) { |
105 | - $path = base_path() . drupal_get_path('module','quicktags') .'/'; |
|
106 | - $items['ed_italic'] = array( |
|
107 | - 'name' => 'italic', |
|
108 | - 'prefix' => '[i]', |
|
109 | - 'suffix' => '[/i]', |
|
110 | - 'accesskey' => 'i', |
|
111 | - 'weight' => 10, |
|
112 | - 'icon' => $path .'ed_italic.png', |
|
105 | + $path = base_path() . drupal_get_path('module','quicktags') .'/'; |
|
106 | + $items['ed_italic'] = array( |
|
107 | + 'name' => 'italic', |
|
108 | + 'prefix' => '[i]', |
|
109 | + 'suffix' => '[/i]', |
|
110 | + 'accesskey' => 'i', |
|
111 | + 'weight' => 10, |
|
112 | + 'icon' => $path .'ed_italic.png', |
|
113 | 113 | ); |
114 | - $items['ed_bold'] = array( |
|
115 | - 'name' => 'bold', |
|
116 | - 'prefix' => '[b]', |
|
117 | - 'suffix' => '[/b]', |
|
118 | - 'accesskey' => 'b', |
|
119 | - 'weight' => 20, |
|
120 | - 'icon' => $path .'ed_bold.png', |
|
114 | + $items['ed_bold'] = array( |
|
115 | + 'name' => 'bold', |
|
116 | + 'prefix' => '[b]', |
|
117 | + 'suffix' => '[/b]', |
|
118 | + 'accesskey' => 'b', |
|
119 | + 'weight' => 20, |
|
120 | + 'icon' => $path .'ed_bold.png', |
|
121 | 121 | ); |
122 | - $items['ed_code'] = array( |
|
123 | - 'name' => 'code', |
|
124 | - 'prefix' =>'[code]', |
|
125 | - 'suffix' => '[/code]', |
|
126 | - 'accesskey' => 'c', |
|
127 | - 'weight' => 30, |
|
128 | - 'icon' => $path .'ed_code.png', |
|
122 | + $items['ed_code'] = array( |
|
123 | + 'name' => 'code', |
|
124 | + 'prefix' =>'[code]', |
|
125 | + 'suffix' => '[/code]', |
|
126 | + 'accesskey' => 'c', |
|
127 | + 'weight' => 30, |
|
128 | + 'icon' => $path .'ed_code.png', |
|
129 | 129 | ); |
130 | - $items['ed_block'] = array( |
|
131 | - 'name' => 'quote', |
|
132 | - 'prefix' =>'[quote]', |
|
133 | - 'suffix' => '[/quote]', |
|
134 | - 'accesskey' => 'q', |
|
135 | - 'weight' => 40, |
|
136 | - 'icon' => $path .'ed_block.png', |
|
130 | + $items['ed_block'] = array( |
|
131 | + 'name' => 'quote', |
|
132 | + 'prefix' =>'[quote]', |
|
133 | + 'suffix' => '[/quote]', |
|
134 | + 'accesskey' => 'q', |
|
135 | + 'weight' => 40, |
|
136 | + 'icon' => $path .'ed_block.png', |
|
137 | 137 | ); |
138 | - $items['ed_link'] = array( |
|
139 | - 'name' => 'link', |
|
140 | - 'prefix' =>'[url=http://]', |
|
141 | - 'suffix' => '[/url]', |
|
142 | - 'accesskey' => 'l', |
|
143 | - 'weight' => 50, |
|
144 | - 'icon' => $path .'ed_link.png', |
|
138 | + $items['ed_link'] = array( |
|
139 | + 'name' => 'link', |
|
140 | + 'prefix' =>'[url=http://]', |
|
141 | + 'suffix' => '[/url]', |
|
142 | + 'accesskey' => 'l', |
|
143 | + 'weight' => 50, |
|
144 | + 'icon' => $path .'ed_link.png', |
|
145 | 145 | ); |
146 | - return $items; |
|
146 | + return $items; |
|
147 | 147 | } |
148 | 148 |
@@ -34,67 +34,67 @@ |
||
34 | 34 | |
35 | 35 | function bbcode_filter($op, $delta = 0, $format = -1, $text = '') { |
36 | 36 | switch ($op) { |
37 | - case 'list': |
|
38 | - return array(0 => t('BBCode')); |
|
37 | + case 'list': |
|
38 | + return array(0 => t('BBCode')); |
|
39 | 39 | |
40 | - case 'description': |
|
41 | - return t('Converts BBCode to HTML.'); |
|
40 | + case 'description': |
|
41 | + return t('Converts BBCode to HTML.'); |
|
42 | 42 | |
43 | - case 'process': |
|
44 | - include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
|
45 | - if (variable_get("bbcode_debug_$format", 0)) { |
|
46 | - $timing_start = explode(' ', microtime()); |
|
47 | - $ret = _bbcode_filter_process($text, $format); |
|
48 | - $timing_stop = explode(' ', microtime()); |
|
49 | - $elapsed = $timing_stop[1] - $timing_start[1]; |
|
50 | - $elapsed += $timing_stop[0] - $timing_start[0]; |
|
51 | - $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
52 | - return $ret; |
|
53 | - } |
|
54 | - else |
|
55 | - return _bbcode_filter_process($text, $format); |
|
43 | + case 'process': |
|
44 | + include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
|
45 | + if (variable_get("bbcode_debug_$format", 0)) { |
|
46 | + $timing_start = explode(' ', microtime()); |
|
47 | + $ret = _bbcode_filter_process($text, $format); |
|
48 | + $timing_stop = explode(' ', microtime()); |
|
49 | + $elapsed = $timing_stop[1] - $timing_start[1]; |
|
50 | + $elapsed += $timing_stop[0] - $timing_start[0]; |
|
51 | + $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
52 | + return $ret; |
|
53 | + } |
|
54 | + else |
|
55 | + return _bbcode_filter_process($text, $format); |
|
56 | 56 | |
57 | - case 'settings': |
|
58 | - $form = array(); |
|
59 | - $form['bbcode_filter'] = array( |
|
60 | - '#type' => 'fieldset', |
|
61 | - '#title' => t('BBCode filter'), |
|
62 | - '#collapsible' => TRUE, |
|
63 | - '#collapsed' => FALSE); |
|
64 | - $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
65 | - '#type' => 'select', |
|
66 | - '#title' => t('Convert addresses to links'), |
|
67 | - '#default_value' => variable_get("bbcode_make_links_$format", 1), |
|
68 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
69 | - '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.')); |
|
70 | - $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
71 | - '#type' => 'select', |
|
72 | - '#title' => t('Spam link deterrent'), |
|
73 | - '#default_value' => variable_get("bbcode_filter_nofollow_$format", 0), |
|
74 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
75 | - '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.')); |
|
76 | - $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
77 | - '#type' => 'select', |
|
78 | - '#title' => t('Email address encoding'), |
|
79 | - '#default_value' => variable_get("bbcode_encode_mailto_$format", 1), |
|
80 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
81 | - '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.')); |
|
82 | - $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
83 | - '#type' => 'select', |
|
84 | - '#title' => t('Smart paragraph and line breaks'), |
|
85 | - '#default_value' => variable_get("bbcode_paragraph_breaks_$format", 2), |
|
86 | - '#options' => array(t('Disabled'), t('Line breaks only'), t('Line and paragraph breaks')), |
|
87 | - '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!')); |
|
88 | - $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
89 | - '#type' => 'select', |
|
90 | - '#title' => t('Print debugging info'), |
|
91 | - '#default_value' => variable_get("bbcode_debug_$format", 0), |
|
92 | - '#options' => array(t('Disabled'), t('Enabled')), |
|
93 | - '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.')); |
|
94 | - return $form; |
|
57 | + case 'settings': |
|
58 | + $form = array(); |
|
59 | + $form['bbcode_filter'] = array( |
|
60 | + '#type' => 'fieldset', |
|
61 | + '#title' => t('BBCode filter'), |
|
62 | + '#collapsible' => TRUE, |
|
63 | + '#collapsed' => FALSE); |
|
64 | + $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
|
65 | + '#type' => 'select', |
|
66 | + '#title' => t('Convert addresses to links'), |
|
67 | + '#default_value' => variable_get("bbcode_make_links_$format", 1), |
|
68 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
69 | + '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.')); |
|
70 | + $form['bbcode_filter']["bbcode_filter_nofollow_$format"] = array( |
|
71 | + '#type' => 'select', |
|
72 | + '#title' => t('Spam link deterrent'), |
|
73 | + '#default_value' => variable_get("bbcode_filter_nofollow_$format", 0), |
|
74 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
75 | + '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.')); |
|
76 | + $form['bbcode_filter']["bbcode_encode_mailto_$format"] = array( |
|
77 | + '#type' => 'select', |
|
78 | + '#title' => t('Email address encoding'), |
|
79 | + '#default_value' => variable_get("bbcode_encode_mailto_$format", 1), |
|
80 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
81 | + '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.')); |
|
82 | + $form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array( |
|
83 | + '#type' => 'select', |
|
84 | + '#title' => t('Smart paragraph and line breaks'), |
|
85 | + '#default_value' => variable_get("bbcode_paragraph_breaks_$format", 2), |
|
86 | + '#options' => array(t('Disabled'), t('Line breaks only'), t('Line and paragraph breaks')), |
|
87 | + '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!')); |
|
88 | + $form['bbcode_filter']["bbcode_debug_$format"] = array( |
|
89 | + '#type' => 'select', |
|
90 | + '#title' => t('Print debugging info'), |
|
91 | + '#default_value' => variable_get("bbcode_debug_$format", 0), |
|
92 | + '#options' => array(t('Disabled'), t('Enabled')), |
|
93 | + '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.')); |
|
94 | + return $form; |
|
95 | 95 | |
96 | - default: |
|
97 | - return $text; |
|
96 | + default: |
|
97 | + return $text; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | function bbcode_filter_tips($delta, $format, $long = false) { |
10 | 10 | if ($long) { |
11 | - include_once(drupal_get_path('module', 'bbcode') .'/bbcode-help.inc'); |
|
11 | + include_once(drupal_get_path('module', 'bbcode').'/bbcode-help.inc'); |
|
12 | 12 | return _bbcode_filter_tip(); |
13 | 13 | } |
14 | 14 | else { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | array( |
18 | 18 | '!BBCode' => l(t('BBCode'), "filter/tips/$format", |
19 | 19 | array( |
20 | - 'fragment' => 'filter-bbcode-' . $delta, |
|
20 | + 'fragment' => 'filter-bbcode-'.$delta, |
|
21 | 21 | 'attributes' => |
22 | 22 | array( |
23 | 23 | 'target'=>'_blank', |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | )) |
27 | 27 | )); |
28 | 28 | if (variable_get("bbcode_make_links_$format", FALSE)) { |
29 | - $output .= ' '. t('URLs will automatically be converted to links.'); |
|
29 | + $output .= ' '.t('URLs will automatically be converted to links.'); |
|
30 | 30 | } |
31 | 31 | return $output; |
32 | 32 | } |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | return t('Converts BBCode to HTML.'); |
42 | 42 | |
43 | 43 | case 'process': |
44 | - include_once(drupal_get_path('module', 'bbcode') .'/bbcode-filter.inc'); |
|
44 | + include_once(drupal_get_path('module', 'bbcode').'/bbcode-filter.inc'); |
|
45 | 45 | if (variable_get("bbcode_debug_$format", 0)) { |
46 | 46 | $timing_start = explode(' ', microtime()); |
47 | 47 | $ret = _bbcode_filter_process($text, $format); |
48 | 48 | $timing_stop = explode(' ', microtime()); |
49 | 49 | $elapsed = $timing_stop[1] - $timing_start[1]; |
50 | 50 | $elapsed += $timing_stop[0] - $timing_start[0]; |
51 | - $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
51 | + $ret .= '<hr />'.l('BBCode', "filter/tips/$format").' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
|
52 | 52 | return $ret; |
53 | 53 | } |
54 | 54 | else |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | * Alter icons if the quicktags module is enabled |
103 | 103 | */ |
104 | 104 | function bbcode_quicktags_alter($items) { |
105 | - $path = base_path() . drupal_get_path('module','quicktags') .'/'; |
|
105 | + $path = base_path().drupal_get_path('module', 'quicktags').'/'; |
|
106 | 106 | $items['ed_italic'] = array( |
107 | 107 | 'name' => 'italic', |
108 | 108 | 'prefix' => '[i]', |
109 | 109 | 'suffix' => '[/i]', |
110 | 110 | 'accesskey' => 'i', |
111 | 111 | 'weight' => 10, |
112 | - 'icon' => $path .'ed_italic.png', |
|
112 | + 'icon' => $path.'ed_italic.png', |
|
113 | 113 | ); |
114 | 114 | $items['ed_bold'] = array( |
115 | 115 | 'name' => 'bold', |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'suffix' => '[/b]', |
118 | 118 | 'accesskey' => 'b', |
119 | 119 | 'weight' => 20, |
120 | - 'icon' => $path .'ed_bold.png', |
|
120 | + 'icon' => $path.'ed_bold.png', |
|
121 | 121 | ); |
122 | 122 | $items['ed_code'] = array( |
123 | 123 | 'name' => 'code', |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | 'suffix' => '[/code]', |
126 | 126 | 'accesskey' => 'c', |
127 | 127 | 'weight' => 30, |
128 | - 'icon' => $path .'ed_code.png', |
|
128 | + 'icon' => $path.'ed_code.png', |
|
129 | 129 | ); |
130 | 130 | $items['ed_block'] = array( |
131 | 131 | 'name' => 'quote', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'suffix' => '[/quote]', |
134 | 134 | 'accesskey' => 'q', |
135 | 135 | 'weight' => 40, |
136 | - 'icon' => $path .'ed_block.png', |
|
136 | + 'icon' => $path.'ed_block.png', |
|
137 | 137 | ); |
138 | 138 | $items['ed_link'] = array( |
139 | 139 | 'name' => 'link', |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | 'suffix' => '[/url]', |
142 | 142 | 'accesskey' => 'l', |
143 | 143 | 'weight' => 50, |
144 | - 'icon' => $path .'ed_link.png', |
|
144 | + 'icon' => $path.'ed_link.png', |
|
145 | 145 | ); |
146 | 146 | return $items; |
147 | 147 | } |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | if ($long) { |
11 | 11 | include_once(drupal_get_path('module', 'bbcode') .'/bbcode-help.inc'); |
12 | 12 | return _bbcode_filter_tip(); |
13 | - } |
|
14 | - else { |
|
13 | + } else { |
|
15 | 14 | # D5: $output = t('You can use !BBCode tags in the text.', array('!BBCode' => l(t('BBCode'), "filter/tips/$format", NULL, NULL, 'filter-bbcode-' . $delta))); |
16 | 15 | $output = t('You can use !BBCode (opens in new window) tags in the text.', |
17 | 16 | array( |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | $elapsed += $timing_stop[0] - $timing_start[0]; |
51 | 50 | $ret .= '<hr />'. l('BBCode', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.<hr />'; |
52 | 51 | return $ret; |
53 | - } |
|
54 | - else |
|
52 | + } else |
|
55 | 53 | return _bbcode_filter_process($text, $format); |
56 | 54 | |
57 | 55 | case 'settings': |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | ), |
26 | 26 | )) |
27 | 27 | )); |
28 | - if (variable_get("bbcode_make_links_$format", FALSE)) { |
|
28 | + if (variable_get("bbcode_make_links_$format", false)) { |
|
29 | 29 | $output .= ' '. t('URLs will automatically be converted to links.'); |
30 | 30 | } |
31 | 31 | return $output; |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | $form['bbcode_filter'] = array( |
60 | 60 | '#type' => 'fieldset', |
61 | 61 | '#title' => t('BBCode filter'), |
62 | - '#collapsible' => TRUE, |
|
63 | - '#collapsed' => FALSE); |
|
62 | + '#collapsible' => true, |
|
63 | + '#collapsed' => false); |
|
64 | 64 | $form['bbcode_filter']["bbcode_make_links_$format"] = array( |
65 | 65 | '#type' => 'select', |
66 | 66 | '#title' => t('Convert addresses to links'), |
@@ -2,7 +2,7 @@ |
||
2 | 2 | // $Id: bbcode-help.inc,v 1.8 2007/01/28 21:18:45 naudefj Exp $ |
3 | 3 | |
4 | 4 | function _bbcode_filter_tip() { |
5 | - return t("<a id=\"filter-bbcode\"></a><h2>BBCode Guide</h2> |
|
5 | + return t("<a id=\"filter-bbcode\"></a><h2>BBCode Guide</h2> |
|
6 | 6 | |
7 | 7 | <p> |
8 | 8 | BBCode allows you to specify formatting rules for your text, |
@@ -9,10 +9,10 @@ |
||
9 | 9 | * Implementation of hook_wysiwyg_editor_settings_alter(). |
10 | 10 | */ |
11 | 11 | function wysiwyg_tweaks_wysiwyg_editor_settings_alter(&$settings, $context) { |
12 | - if ($context['profile']->editor == 'tinymce') { |
|
12 | + if ($context['profile']->editor == 'tinymce') { |
|
13 | 13 | $settings['browser_spellcheck'] = TRUE; |
14 | 14 | $settings['gecko_spellcheck'] = TRUE; |
15 | 15 | // Any init setting taking a string, boolean, number, or an array/object |
16 | 16 | // holding those types can be overridden/forced here. |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | */ |
11 | 11 | function wysiwyg_tweaks_wysiwyg_editor_settings_alter(&$settings, $context) { |
12 | 12 | if ($context['profile']->editor == 'tinymce') { |
13 | - $settings['browser_spellcheck'] = TRUE; |
|
14 | - $settings['gecko_spellcheck'] = TRUE; |
|
13 | + $settings['browser_spellcheck'] = true; |
|
14 | + $settings['gecko_spellcheck'] = true; |
|
15 | 15 | // Any init setting taking a string, boolean, number, or an array/object |
16 | 16 | // holding those types can be overridden/forced here. |
17 | 17 | } |
@@ -29,46 +29,46 @@ discard block |
||
29 | 29 | * Create an array of default values for a field type. |
30 | 30 | */ |
31 | 31 | function content_field_default_values($field_type) { |
32 | - $field_types = _content_field_types(); |
|
33 | - $module = $field_types[$field_type]['module']; |
|
32 | + $field_types = _content_field_types(); |
|
33 | + $module = $field_types[$field_type]['module']; |
|
34 | 34 | |
35 | - $field = array( |
|
35 | + $field = array( |
|
36 | 36 | 'module' => $module, |
37 | 37 | 'type' => $field_type, |
38 | 38 | 'active' => 0, |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - if (module_exists($module)) { |
|
41 | + if (module_exists($module)) { |
|
42 | 42 | $field['active'] = 1; |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field); |
|
46 | - // Ensure columns always default to NULL values. |
|
47 | - foreach ($field['columns'] as $column_name => $column) { |
|
45 | + $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field); |
|
46 | + // Ensure columns always default to NULL values. |
|
47 | + foreach ($field['columns'] as $column_name => $column) { |
|
48 | 48 | $field['columns'][$column_name]['not null'] = FALSE; |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - $field['required'] = 0; |
|
52 | - $field['multiple'] = 0; |
|
53 | - $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE; |
|
51 | + $field['required'] = 0; |
|
52 | + $field['multiple'] = 0; |
|
53 | + $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE; |
|
54 | 54 | |
55 | - // Make sure field settings all have an index in the array. |
|
56 | - $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field); |
|
57 | - drupal_alter('field_settings', $setting_names, 'save', $field); |
|
58 | - foreach ($setting_names as $setting) { |
|
55 | + // Make sure field settings all have an index in the array. |
|
56 | + $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field); |
|
57 | + drupal_alter('field_settings', $setting_names, 'save', $field); |
|
58 | + foreach ($setting_names as $setting) { |
|
59 | 59 | $field[$setting] = NULL; |
60 | - } |
|
61 | - return $field; |
|
60 | + } |
|
61 | + return $field; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Create an array of default values for a field instance. |
66 | 66 | */ |
67 | 67 | function content_instance_default_values($field_name, $type_name, $widget_type) { |
68 | - $widget_types = _content_widget_types(); |
|
69 | - $module = $widget_types[$widget_type]['module']; |
|
68 | + $widget_types = _content_widget_types(); |
|
69 | + $module = $widget_types[$widget_type]['module']; |
|
70 | 70 | |
71 | - $widget = array( |
|
71 | + $widget = array( |
|
72 | 72 | 'field_name' => $field_name, |
73 | 73 | 'type_name' => $type_name, |
74 | 74 | 'weight' => 0, |
@@ -78,101 +78,101 @@ discard block |
||
78 | 78 | 'widget_module' => $module, |
79 | 79 | 'display_settings' => array(), |
80 | 80 | 'widget_settings' => array(), |
81 | - ); |
|
81 | + ); |
|
82 | 82 | |
83 | - if (module_exists($module)) { |
|
83 | + if (module_exists($module)) { |
|
84 | 84 | $widget['widget_active'] = 1; |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | - $settings_names = array_merge(array('label'), array_keys(content_build_modes())); |
|
88 | - $widget['display_settings'] = array(); |
|
89 | - foreach ($settings_names as $name) { |
|
87 | + $settings_names = array_merge(array('label'), array_keys(content_build_modes())); |
|
88 | + $widget['display_settings'] = array(); |
|
89 | + foreach ($settings_names as $name) { |
|
90 | 90 | $widget['display_settings'][$name]['format'] = ($name == 'label') ? 'above' : 'default'; |
91 | 91 | $widget['display_settings'][$name]['exclude'] = 0; |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | - // Make sure widget settings all have an index in the array. |
|
95 | - $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget); |
|
96 | - drupal_alter('widget_settings', $settings_names, 'save', $widget); |
|
97 | - $widget['widget_settings'] = array(); |
|
98 | - foreach ($settings_names as $name) { |
|
94 | + // Make sure widget settings all have an index in the array. |
|
95 | + $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget); |
|
96 | + drupal_alter('widget_settings', $settings_names, 'save', $widget); |
|
97 | + $widget['widget_settings'] = array(); |
|
98 | + foreach ($settings_names as $name) { |
|
99 | 99 | $widget['widget_settings'][$name] = NULL; |
100 | - } |
|
101 | - return $widget; |
|
100 | + } |
|
101 | + return $widget; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Expand field info to create field => widget info. |
106 | 106 | */ |
107 | 107 | function content_field_instance_expand($field) { |
108 | - if (isset($field['widget'])) { |
|
108 | + if (isset($field['widget'])) { |
|
109 | 109 | return $field; |
110 | - } |
|
111 | - $field['widget'] = !empty($field['widget_settings']) ? $field['widget_settings'] : array(); |
|
112 | - $field['widget']['label'] = !empty($field['label']) ? $field['label'] : $field['field_name']; |
|
113 | - $field['widget']['weight'] = !empty($field['weight']) ? $field['weight'] : 0; |
|
114 | - $field['widget']['description'] = !empty($field['description']) ? $field['description'] : ''; |
|
110 | + } |
|
111 | + $field['widget'] = !empty($field['widget_settings']) ? $field['widget_settings'] : array(); |
|
112 | + $field['widget']['label'] = !empty($field['label']) ? $field['label'] : $field['field_name']; |
|
113 | + $field['widget']['weight'] = !empty($field['weight']) ? $field['weight'] : 0; |
|
114 | + $field['widget']['description'] = !empty($field['description']) ? $field['description'] : ''; |
|
115 | 115 | |
116 | - if (!empty($field['widget_type'])) { |
|
116 | + if (!empty($field['widget_type'])) { |
|
117 | 117 | $field['widget']['type'] = $field['widget_type']; |
118 | 118 | $widget_types = _content_widget_types(); |
119 | 119 | $field['widget']['module'] = isset($widget_types[$field['widget_type']]['module']) ? $widget_types[$field['widget_type']]['module'] : $field['widget_module']; |
120 | - } |
|
121 | - elseif (!empty($field['widget_module'])) { |
|
120 | + } |
|
121 | + elseif (!empty($field['widget_module'])) { |
|
122 | 122 | $field['widget']['module'] = $field['widget_module']; |
123 | - } |
|
124 | - |
|
125 | - unset($field['widget_type']); |
|
126 | - unset($field['weight']); |
|
127 | - unset($field['label']); |
|
128 | - unset($field['description']); |
|
129 | - unset($field['widget_module']); |
|
130 | - unset($field['widget_settings']); |
|
131 | - |
|
132 | - // If content.module is handling the default value, |
|
133 | - // initialize $widget_settings with default values, |
|
134 | - if (isset($field['default_value']) && isset($field['default_value_php']) && |
|
123 | + } |
|
124 | + |
|
125 | + unset($field['widget_type']); |
|
126 | + unset($field['weight']); |
|
127 | + unset($field['label']); |
|
128 | + unset($field['description']); |
|
129 | + unset($field['widget_module']); |
|
130 | + unset($field['widget_settings']); |
|
131 | + |
|
132 | + // If content.module is handling the default value, |
|
133 | + // initialize $widget_settings with default values, |
|
134 | + if (isset($field['default_value']) && isset($field['default_value_php']) && |
|
135 | 135 | content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) { |
136 | 136 | $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : NULL; |
137 | 137 | $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL; |
138 | 138 | unset($field['default_value']); |
139 | 139 | unset($field['default_value_php']); |
140 | - } |
|
141 | - return $field; |
|
140 | + } |
|
141 | + return $field; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Collapse field info from field => widget to flattened form values. |
146 | 146 | */ |
147 | 147 | function content_field_instance_collapse($field) { |
148 | - if (!isset($field['widget'])) { |
|
148 | + if (!isset($field['widget'])) { |
|
149 | 149 | return $field; |
150 | - } |
|
151 | - $field['widget_settings'] = !empty($field['widget']) ? $field['widget'] : array(); |
|
152 | - $field['widget_type'] = !empty($field['widget']['type']) ? $field['widget']['type'] : ''; |
|
153 | - $field['weight'] = !empty($field['widget']['weight']) ? $field['widget']['weight'] : 0; |
|
154 | - $field['label'] = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name']; |
|
155 | - $field['description'] = !empty($field['widget']['description']) ? $field['widget']['description'] : ''; |
|
156 | - $field['type_name'] = !empty($field['type_name']) ? $field['type_name'] : ''; |
|
157 | - |
|
158 | - if (!empty($field['widget']['module'])) { |
|
150 | + } |
|
151 | + $field['widget_settings'] = !empty($field['widget']) ? $field['widget'] : array(); |
|
152 | + $field['widget_type'] = !empty($field['widget']['type']) ? $field['widget']['type'] : ''; |
|
153 | + $field['weight'] = !empty($field['widget']['weight']) ? $field['widget']['weight'] : 0; |
|
154 | + $field['label'] = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name']; |
|
155 | + $field['description'] = !empty($field['widget']['description']) ? $field['widget']['description'] : ''; |
|
156 | + $field['type_name'] = !empty($field['type_name']) ? $field['type_name'] : ''; |
|
157 | + |
|
158 | + if (!empty($field['widget']['module'])) { |
|
159 | 159 | $widget_module = $field['widget']['module']; |
160 | - } |
|
161 | - elseif (!empty($field['widget']['type'])) { |
|
160 | + } |
|
161 | + elseif (!empty($field['widget']['type'])) { |
|
162 | 162 | $widget_types = _content_widget_types(); |
163 | 163 | $widget_module = $widget_types[$field['widget']['type']]['module']; |
164 | - } |
|
165 | - else { |
|
164 | + } |
|
165 | + else { |
|
166 | 166 | $widget_module = ''; |
167 | - } |
|
168 | - $field['widget_module'] = $widget_module; |
|
169 | - unset($field['widget_settings']['type']); |
|
170 | - unset($field['widget_settings']['weight']); |
|
171 | - unset($field['widget_settings']['label']); |
|
172 | - unset($field['widget_settings']['description']); |
|
173 | - unset($field['widget_settings']['module']); |
|
174 | - unset($field['widget']); |
|
175 | - return $field; |
|
167 | + } |
|
168 | + $field['widget_module'] = $widget_module; |
|
169 | + unset($field['widget_settings']['type']); |
|
170 | + unset($field['widget_settings']['weight']); |
|
171 | + unset($field['widget_settings']['label']); |
|
172 | + unset($field['widget_settings']['description']); |
|
173 | + unset($field['widget_settings']['module']); |
|
174 | + unset($field['widget']); |
|
175 | + return $field; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | * @see menu_rebuild() |
209 | 209 | */ |
210 | 210 | function content_field_instance_create($field, $rebuild = TRUE) { |
211 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
211 | + include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
212 | 212 | |
213 | - $form_values = $field; |
|
214 | - $field = content_field_instance_expand($field); |
|
213 | + $form_values = $field; |
|
214 | + $field = content_field_instance_expand($field); |
|
215 | 215 | |
216 | - // If there are prior instances, fill out missing values from the prior values, |
|
217 | - // otherwise get missing values from default values. |
|
218 | - $prior_instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
|
219 | - if (!empty($prior_instances) && is_array($prior_instances)) { |
|
216 | + // If there are prior instances, fill out missing values from the prior values, |
|
217 | + // otherwise get missing values from default values. |
|
218 | + $prior_instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
|
219 | + if (!empty($prior_instances) && is_array($prior_instances)) { |
|
220 | 220 | $prev_field = content_field_instance_expand($prior_instances[0]); |
221 | 221 | |
222 | 222 | // Weight, label, and description may have been forced into the $field |
@@ -226,72 +226,72 @@ discard block |
||
226 | 226 | $field['widget']['weight'] = isset($form_values['weight']) ? $form_values['weight'] : $prev_field['widget']['weight']; |
227 | 227 | $field['widget']['label'] = isset($form_values['label']) ? $form_values['label'] : $prev_field['widget']['label']; |
228 | 228 | $field['widget']['description'] = isset($form_values['description']) ? $form_values['description'] : $prev_field['widget']['description']; |
229 | - } |
|
230 | - else { |
|
229 | + } |
|
230 | + else { |
|
231 | 231 | $prev_field = array('widget' => array()); |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - // If we have a field type, we can build default values for this field type. |
|
235 | - $default_values = array('widget' => array()); |
|
236 | - if (isset($field['type'])) { |
|
234 | + // If we have a field type, we can build default values for this field type. |
|
235 | + $default_values = array('widget' => array()); |
|
236 | + if (isset($field['type'])) { |
|
237 | 237 | $default_values = content_field_default_values($field['type']); |
238 | 238 | $default_instance_values = content_instance_default_values($field['field_name'], $field['type_name'], $field['widget']['type']); |
239 | 239 | $default_values = content_field_instance_expand(array_merge($default_values, $default_instance_values)); |
240 | - } |
|
240 | + } |
|
241 | 241 | |
242 | - // Merge default values, previous values, and current values to create |
|
243 | - // a complete field array. |
|
244 | - $widget = array_merge($default_values['widget'], $prev_field['widget'], $field['widget']); |
|
245 | - $field = array_merge($default_values, $prev_field, $field); |
|
246 | - $field['widget'] = $widget; |
|
242 | + // Merge default values, previous values, and current values to create |
|
243 | + // a complete field array. |
|
244 | + $widget = array_merge($default_values['widget'], $prev_field['widget'], $field['widget']); |
|
245 | + $field = array_merge($default_values, $prev_field, $field); |
|
246 | + $field['widget'] = $widget; |
|
247 | 247 | |
248 | - // Make sure we know what module to invoke for field info. |
|
249 | - if (empty($field['module']) && !empty($field['type'])) { |
|
248 | + // Make sure we know what module to invoke for field info. |
|
249 | + if (empty($field['module']) && !empty($field['type'])) { |
|
250 | 250 | $field_types = _content_field_types(); |
251 | 251 | $field['module'] = $field_types[$field['type']]['module']; |
252 | - } |
|
252 | + } |
|
253 | 253 | |
254 | - // The storage type may need to be updated. |
|
255 | - $field['db_storage'] = content_storage_type($field); |
|
254 | + // The storage type may need to be updated. |
|
255 | + $field['db_storage'] = content_storage_type($field); |
|
256 | 256 | |
257 | - // Get a fresh copy of the column information whenever a field is created. |
|
258 | - $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
257 | + // Get a fresh copy of the column information whenever a field is created. |
|
258 | + $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
259 | 259 | |
260 | - if (empty($prev_field['widget']) || $prior_instances < 1) { |
|
260 | + if (empty($prev_field['widget']) || $prior_instances < 1) { |
|
261 | 261 | // If this is the first instance, create the field. |
262 | 262 | $field['db_storage'] = $field['multiple'] > 0 ? CONTENT_DB_STORAGE_PER_FIELD : CONTENT_DB_STORAGE_PER_CONTENT_TYPE; |
263 | 263 | _content_field_write($field, 'create'); |
264 | - } |
|
265 | - elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) { |
|
264 | + } |
|
265 | + elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) { |
|
266 | 266 | // If the database storage has changed, update the field and previous instances. |
267 | 267 | $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
268 | 268 | |
269 | 269 | foreach ($prior_instances as $instance) { |
270 | - $new_instance = $instance; |
|
271 | - $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
|
270 | + $new_instance = $instance; |
|
271 | + $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
|
272 | 272 | |
273 | - // Invoke hook_content_fieldapi(). |
|
274 | - module_invoke_all('content_fieldapi', 'update instance', $new_instance); |
|
273 | + // Invoke hook_content_fieldapi(). |
|
274 | + module_invoke_all('content_fieldapi', 'update instance', $new_instance); |
|
275 | 275 | |
276 | - content_alter_schema($instance, $new_instance); |
|
276 | + content_alter_schema($instance, $new_instance); |
|
277 | + } |
|
277 | 278 | } |
278 | - } |
|
279 | 279 | |
280 | - // Invoke hook_content_fieldapi(). |
|
281 | - module_invoke_all('content_fieldapi', 'create instance', $field); |
|
280 | + // Invoke hook_content_fieldapi(). |
|
281 | + module_invoke_all('content_fieldapi', 'create instance', $field); |
|
282 | 282 | |
283 | - // Update the field and the instance with the latest values. |
|
284 | - _content_field_write($field, 'update'); |
|
285 | - _content_field_instance_write($field, 'create'); |
|
283 | + // Update the field and the instance with the latest values. |
|
284 | + _content_field_write($field, 'update'); |
|
285 | + _content_field_instance_write($field, 'create'); |
|
286 | 286 | |
287 | - content_alter_schema(array(), $field); |
|
287 | + content_alter_schema(array(), $field); |
|
288 | 288 | |
289 | - if ($rebuild) { |
|
289 | + if ($rebuild) { |
|
290 | 290 | content_clear_type_cache(TRUE); |
291 | 291 | menu_rebuild(); |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | - return $field; |
|
294 | + return $field; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -319,44 +319,44 @@ discard block |
||
319 | 319 | * @see menu_rebuild() |
320 | 320 | */ |
321 | 321 | function content_field_instance_update($field, $rebuild = TRUE) { |
322 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
322 | + include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
323 | 323 | |
324 | - // Ensure the field description is in the 'expanded' form. |
|
325 | - $field = content_field_instance_expand($field); |
|
324 | + // Ensure the field description is in the 'expanded' form. |
|
325 | + $field = content_field_instance_expand($field); |
|
326 | 326 | |
327 | - // Get the previous value from the table. |
|
328 | - $previous = content_field_instance_read(array('field_name' => $field['field_name'], 'type_name' => $field['type_name'])); |
|
329 | - $prev_field = array_pop($previous); |
|
327 | + // Get the previous value from the table. |
|
328 | + $previous = content_field_instance_read(array('field_name' => $field['field_name'], 'type_name' => $field['type_name'])); |
|
329 | + $prev_field = array_pop($previous); |
|
330 | 330 | |
331 | - // Create a complete field array by merging the previous and current values, |
|
332 | - // letting the current values overwrite the previous ones. |
|
333 | - $widget = array_merge($prev_field['widget'], $field['widget']); |
|
334 | - $field = array_merge($prev_field, $field); |
|
335 | - $field['widget'] = $widget; |
|
331 | + // Create a complete field array by merging the previous and current values, |
|
332 | + // letting the current values overwrite the previous ones. |
|
333 | + $widget = array_merge($prev_field['widget'], $field['widget']); |
|
334 | + $field = array_merge($prev_field, $field); |
|
335 | + $field['widget'] = $widget; |
|
336 | 336 | |
337 | - // Make sure we know what module to invoke for field info. |
|
338 | - if (empty($field['module']) && !empty($field['type'])) { |
|
337 | + // Make sure we know what module to invoke for field info. |
|
338 | + if (empty($field['module']) && !empty($field['type'])) { |
|
339 | 339 | $field_types = _content_field_types(); |
340 | 340 | $field['module'] = $field_types[$field['type']]['module']; |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | - // The storage type may need to be updated. |
|
344 | - $field['db_storage'] = content_storage_type($field); |
|
343 | + // The storage type may need to be updated. |
|
344 | + $field['db_storage'] = content_storage_type($field); |
|
345 | 345 | |
346 | - // Changes in field values may affect columns, or column |
|
347 | - // information may have changed, get a fresh copy. |
|
348 | - $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
346 | + // Changes in field values may affect columns, or column |
|
347 | + // information may have changed, get a fresh copy. |
|
348 | + $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
349 | 349 | |
350 | - // If the database storage has changed, update the field and previous instances. |
|
351 | - $prior_instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
|
350 | + // If the database storage has changed, update the field and previous instances. |
|
351 | + $prior_instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
|
352 | 352 | |
353 | - if ($prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 1) { |
|
353 | + if ($prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 1) { |
|
354 | 354 | // Update the field's data storage. |
355 | 355 | $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
356 | 356 | |
357 | 357 | // Update the schema for prior instances to adapt to the change in db storage. |
358 | 358 | foreach ($prior_instances as $instance) { |
359 | - if ($instance['type_name'] != $field['type_name']) { |
|
359 | + if ($instance['type_name'] != $field['type_name']) { |
|
360 | 360 | $new_instance = $instance; |
361 | 361 | $new_instance['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
362 | 362 | |
@@ -364,30 +364,30 @@ discard block |
||
364 | 364 | module_invoke_all('content_fieldapi', 'update instance', $new_instance); |
365 | 365 | |
366 | 366 | content_alter_schema($instance, $new_instance); |
367 | - } |
|
367 | + } |
|
368 | + } |
|
368 | 369 | } |
369 | - } |
|
370 | 370 | |
371 | - // Invoke hook_content_fieldapi(). |
|
372 | - module_invoke_all('content_fieldapi', 'update instance', $field); |
|
371 | + // Invoke hook_content_fieldapi(). |
|
372 | + module_invoke_all('content_fieldapi', 'update instance', $field); |
|
373 | 373 | |
374 | - // Update the field and the instance with the latest values. |
|
375 | - _content_field_write($field, 'update'); |
|
376 | - _content_field_instance_write($field, 'update'); |
|
374 | + // Update the field and the instance with the latest values. |
|
375 | + _content_field_write($field, 'update'); |
|
376 | + _content_field_instance_write($field, 'update'); |
|
377 | 377 | |
378 | - content_alter_schema($prev_field, $field); |
|
378 | + content_alter_schema($prev_field, $field); |
|
379 | 379 | |
380 | - if ($rebuild) { |
|
380 | + if ($rebuild) { |
|
381 | 381 | content_clear_type_cache(TRUE); |
382 | 382 | |
383 | 383 | // The label is in the menu tree, so we need a menu rebuild |
384 | 384 | // if the label changes. |
385 | 385 | if ($prev_field['widget']['label'] != $field['widget']['label']) { |
386 | - menu_rebuild(); |
|
386 | + menu_rebuild(); |
|
387 | + } |
|
387 | 388 | } |
388 | - } |
|
389 | 389 | |
390 | - return $field; |
|
390 | + return $field; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -397,30 +397,30 @@ discard block |
||
397 | 397 | * The field array to process. |
398 | 398 | */ |
399 | 399 | function _content_field_write($field, $op = 'update') { |
400 | - // Rearrange the data to create the global_settings array. |
|
401 | - $field['global_settings'] = array(); |
|
402 | - $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field); |
|
403 | - drupal_alter('field_settings', $setting_names, 'save', $field); |
|
400 | + // Rearrange the data to create the global_settings array. |
|
401 | + $field['global_settings'] = array(); |
|
402 | + $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field); |
|
403 | + drupal_alter('field_settings', $setting_names, 'save', $field); |
|
404 | 404 | |
405 | - foreach ($setting_names as $setting) { |
|
405 | + foreach ($setting_names as $setting) { |
|
406 | 406 | // Unlike _content_field_instance_write() and 'widget_settings', 'global_settings' |
407 | 407 | // is never preexisting, so we take no particular precautions here. |
408 | 408 | $field['global_settings'][$setting] = isset($field[$setting]) ? $field[$setting] : ''; |
409 | 409 | unset($field[$setting]); |
410 | - } |
|
411 | - // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'. |
|
412 | - $field['db_columns'] = $field['columns']; |
|
410 | + } |
|
411 | + // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'. |
|
412 | + $field['db_columns'] = $field['columns']; |
|
413 | 413 | |
414 | - switch ($op) { |
|
414 | + switch ($op) { |
|
415 | 415 | case 'create': |
416 | 416 | drupal_write_record(content_field_tablename(), $field); |
417 | - break; |
|
417 | + break; |
|
418 | 418 | case 'update': |
419 | 419 | drupal_write_record(content_field_tablename(), $field, 'field_name'); |
420 | - break; |
|
421 | - } |
|
422 | - unset($field['db_columns']); |
|
423 | - return $field; |
|
420 | + break; |
|
421 | + } |
|
422 | + unset($field['db_columns']); |
|
423 | + return $field; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -430,32 +430,32 @@ discard block |
||
430 | 430 | * The field array to process. |
431 | 431 | */ |
432 | 432 | function _content_field_instance_write($field, $op = 'update') { |
433 | - // Collapse the field => widget format, so that the values to be saved by |
|
434 | - // drupal_write_record are on top-level. |
|
435 | - $field = content_field_instance_collapse($field); |
|
436 | - |
|
437 | - // Rearrange the data to create the widget_settings array. |
|
438 | - $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field); |
|
439 | - drupal_alter('widget_settings', $setting_names, 'save', $field); |
|
440 | - foreach ($setting_names as $setting) { |
|
433 | + // Collapse the field => widget format, so that the values to be saved by |
|
434 | + // drupal_write_record are on top-level. |
|
435 | + $field = content_field_instance_collapse($field); |
|
436 | + |
|
437 | + // Rearrange the data to create the widget_settings array. |
|
438 | + $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field); |
|
439 | + drupal_alter('widget_settings', $setting_names, 'save', $field); |
|
440 | + foreach ($setting_names as $setting) { |
|
441 | 441 | // In some cases (when the updated $field was originally read from |
442 | 442 | // the db, as opposed to gathered from the values of a form), the values |
443 | 443 | // are already in the right place, we take care to not wipe them. |
444 | 444 | if (isset($field[$setting])) { |
445 | - $field['widget_settings'][$setting] = $field[$setting]; |
|
446 | - unset($field[$setting]); |
|
445 | + $field['widget_settings'][$setting] = $field[$setting]; |
|
446 | + unset($field[$setting]); |
|
447 | + } |
|
447 | 448 | } |
448 | - } |
|
449 | 449 | |
450 | - switch ($op) { |
|
450 | + switch ($op) { |
|
451 | 451 | case 'create': |
452 | 452 | drupal_write_record(content_instance_tablename(), $field); |
453 | - break; |
|
453 | + break; |
|
454 | 454 | case 'update': |
455 | 455 | drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name')); |
456 | - break; |
|
457 | - } |
|
458 | - return $field; |
|
456 | + break; |
|
457 | + } |
|
458 | + return $field; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -473,30 +473,30 @@ discard block |
||
473 | 473 | * The field arrays. |
474 | 474 | */ |
475 | 475 | function content_field_instance_read($param = NULL, $include_inactive = FALSE) { |
476 | - $cond = array(); |
|
477 | - $args = array(); |
|
478 | - if (is_array($param)) { |
|
476 | + $cond = array(); |
|
477 | + $args = array(); |
|
478 | + if (is_array($param)) { |
|
479 | 479 | // Turn the conditions into a query. |
480 | 480 | foreach ($param as $key => $value) { |
481 | - $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'"; |
|
482 | - $args[] = $value; |
|
481 | + $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'"; |
|
482 | + $args[] = $value; |
|
483 | + } |
|
483 | 484 | } |
484 | - } |
|
485 | - if (!$include_inactive) { |
|
485 | + if (!$include_inactive) { |
|
486 | 486 | $cond[] = 'nf.active = 1'; |
487 | 487 | $cond[] = 'nfi.widget_active = 1'; |
488 | - } |
|
489 | - $where = $cond ? ' WHERE '. implode(' AND ', $cond) : ''; |
|
488 | + } |
|
489 | + $where = $cond ? ' WHERE '. implode(' AND ', $cond) : ''; |
|
490 | 490 | |
491 | - $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ". |
|
491 | + $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ". |
|
492 | 492 | " JOIN {". content_field_tablename() ."} nf ON nfi.field_name = nf.field_name ". |
493 | 493 | "$where ORDER BY nfi.weight ASC, nfi.label ASC", $args); |
494 | 494 | |
495 | - $fields = array(); |
|
496 | - while ($instance = db_fetch_array($db_result)) { |
|
495 | + $fields = array(); |
|
496 | + while ($instance = db_fetch_array($db_result)) { |
|
497 | 497 | // Unserialize arrays. |
498 | 498 | foreach (array('widget_settings', 'display_settings', 'global_settings', 'db_columns') as $key) { |
499 | - $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array(); |
|
499 | + $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array(); |
|
500 | 500 | } |
501 | 501 | // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'. |
502 | 502 | $instance['columns'] = $instance['db_columns']; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | // Unfold 'global_settings'. |
506 | 506 | foreach ($instance['global_settings'] as $key => $value) { |
507 | - $instance[$key] = $value; |
|
507 | + $instance[$key] = $value; |
|
508 | 508 | } |
509 | 509 | unset($instance['global_settings']); |
510 | 510 | |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | // Invoke hook_content_fieldapi(). |
516 | 516 | module_invoke_all('content_fieldapi', 'read instance', $field); |
517 | 517 | $fields[] = $field; |
518 | - } |
|
519 | - return $fields; |
|
518 | + } |
|
519 | + return $fields; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | /** |
@@ -544,26 +544,26 @@ discard block |
||
544 | 544 | * @see menu_rebuild() |
545 | 545 | */ |
546 | 546 | function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) { |
547 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
547 | + include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
548 | 548 | |
549 | - // Get the previous field value. |
|
550 | - $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name))); |
|
549 | + // Get the previous field value. |
|
550 | + $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name))); |
|
551 | 551 | |
552 | - // Invoke hook_content_fieldapi(). |
|
553 | - module_invoke_all('content_fieldapi', 'delete instance', $field); |
|
552 | + // Invoke hook_content_fieldapi(). |
|
553 | + module_invoke_all('content_fieldapi', 'delete instance', $field); |
|
554 | 554 | |
555 | - db_query("DELETE FROM {". content_instance_tablename() . |
|
555 | + db_query("DELETE FROM {". content_instance_tablename() . |
|
556 | 556 | "} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']); |
557 | 557 | |
558 | - // If no instances remain, delete the field entirely. |
|
559 | - $instances = content_field_instance_read(array('field_name' => $field_name)); |
|
560 | - if (sizeof($instances) < 1) { |
|
558 | + // If no instances remain, delete the field entirely. |
|
559 | + $instances = content_field_instance_read(array('field_name' => $field_name)); |
|
560 | + if (sizeof($instances) < 1) { |
|
561 | 561 | db_query("DELETE FROM {". content_field_tablename() ."} WHERE field_name = '%s'", $field['field_name']); |
562 | 562 | content_alter_schema($field, array()); |
563 | - } |
|
564 | - // If only one instance remains, we may need to change the database |
|
565 | - // representation for this field. |
|
566 | - elseif (sizeof($instances) == 1 && !($field['multiple'])) { |
|
563 | + } |
|
564 | + // If only one instance remains, we may need to change the database |
|
565 | + // representation for this field. |
|
566 | + elseif (sizeof($instances) == 1 && !($field['multiple'])) { |
|
567 | 567 | // Multiple-valued fields are always stored per-field-type. |
568 | 568 | $instance = $instances[0]; |
569 | 569 | $new_instance = $instance; |
@@ -571,23 +571,23 @@ discard block |
||
571 | 571 | _content_field_write($new_instance, 'update'); |
572 | 572 | |
573 | 573 | content_alter_schema($instance, $new_instance); |
574 | - } |
|
574 | + } |
|
575 | 575 | |
576 | - // If the deleted instance was the last field for the content type, |
|
577 | - // we drop the per-type table. We also consider possibly inactive fields. |
|
578 | - if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) { |
|
576 | + // If the deleted instance was the last field for the content type, |
|
577 | + // we drop the per-type table. We also consider possibly inactive fields. |
|
578 | + if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) { |
|
579 | 579 | $base_tablename = _content_tablename($field['type_name'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
580 | 580 | if (db_table_exists($base_tablename)) { |
581 | - db_drop_table($ret, $base_tablename); |
|
581 | + db_drop_table($ret, $base_tablename); |
|
582 | + } |
|
582 | 583 | } |
583 | - } |
|
584 | 584 | |
585 | - if ($rebuild) { |
|
585 | + if ($rebuild) { |
|
586 | 586 | content_clear_type_cache(TRUE); |
587 | 587 | menu_rebuild(); |
588 | - } |
|
588 | + } |
|
589 | 589 | |
590 | - return $field; |
|
590 | + return $field; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -596,18 +596,18 @@ discard block |
||
596 | 596 | * @param string $module |
597 | 597 | */ |
598 | 598 | function content_module_delete($module) { |
599 | - // Delete the field data. |
|
600 | - // If content module has been uninstalled first, all tables |
|
601 | - // have already been dropped, and running that code will raise errors. |
|
602 | - if (db_table_exists(content_instance_tablename())) { |
|
599 | + // Delete the field data. |
|
600 | + // If content module has been uninstalled first, all tables |
|
601 | + // have already been dropped, and running that code will raise errors. |
|
602 | + if (db_table_exists(content_instance_tablename())) { |
|
603 | 603 | $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module); |
604 | 604 | while ($field = db_fetch_array($results)) { |
605 | - content_field_instance_delete($field['field_name'], $field['type_name'], FALSE); |
|
605 | + content_field_instance_delete($field['field_name'], $field['type_name'], FALSE); |
|
606 | 606 | } |
607 | 607 | // Force the caches and static arrays to update to the new info. |
608 | 608 | content_clear_type_cache(TRUE); |
609 | 609 | menu_rebuild(); |
610 | - } |
|
610 | + } |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | * content_clear_type_cache() can do its job properly. |
622 | 622 | */ |
623 | 623 | function content_type_create($info) { |
624 | - node_get_types(NULL, NULL, TRUE); |
|
625 | - content_clear_type_cache(TRUE); |
|
624 | + node_get_types(NULL, NULL, TRUE); |
|
625 | + content_clear_type_cache(TRUE); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * value supplied by hook_node_type() |
633 | 633 | */ |
634 | 634 | function content_type_update($info) { |
635 | - if (!empty($info->old_type) && $info->old_type != $info->type) { |
|
635 | + if (!empty($info->old_type) && $info->old_type != $info->type) { |
|
636 | 636 | // Rename the content type in all fields that use changed content type. |
637 | 637 | db_query("UPDATE {". content_instance_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type)); |
638 | 638 | |
@@ -641,23 +641,23 @@ discard block |
||
641 | 641 | $old_name = _content_tablename($old_type['type'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
642 | 642 | $new_name = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
643 | 643 | if (db_table_exists($old_name)) { |
644 | - $ret = array(); |
|
645 | - db_rename_table($ret, $old_name, $new_name); |
|
646 | - watchdog('content', 'Content fields table %old_name has been renamed to %new_name and field instances have been updated.', array( |
|
644 | + $ret = array(); |
|
645 | + db_rename_table($ret, $old_name, $new_name); |
|
646 | + watchdog('content', 'Content fields table %old_name has been renamed to %new_name and field instances have been updated.', array( |
|
647 | 647 | '%old_name' => $old_name, '%new_name' => $new_name)); |
648 | 648 | } |
649 | 649 | |
650 | 650 | // Rename the variable storing weights for non-CCK fields. |
651 | 651 | if ($extra = variable_get('content_extra_weights_'. $info->old_type, array())) { |
652 | - variable_set('content_extra_weights_'. $info->type, $extra); |
|
653 | - variable_del('content_extra_weights_'. $info->old_type); |
|
652 | + variable_set('content_extra_weights_'. $info->type, $extra); |
|
653 | + variable_del('content_extra_weights_'. $info->old_type); |
|
654 | + } |
|
654 | 655 | } |
655 | - } |
|
656 | 656 | |
657 | - // Reset all content type info. |
|
658 | - // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
|
659 | - // node_type_form_submit() takes care of this. |
|
660 | - content_clear_type_cache(TRUE); |
|
657 | + // Reset all content type info. |
|
658 | + // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
|
659 | + // node_type_form_submit() takes care of this. |
|
660 | + content_clear_type_cache(TRUE); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -672,24 +672,24 @@ discard block |
||
672 | 672 | * |
673 | 673 | */ |
674 | 674 | function content_type_delete($info) { |
675 | - // Don't delete data for content-types defined by disabled modules. |
|
676 | - if (!empty($info->disabled)) { |
|
675 | + // Don't delete data for content-types defined by disabled modules. |
|
676 | + if (!empty($info->disabled)) { |
|
677 | 677 | return; |
678 | - } |
|
678 | + } |
|
679 | 679 | |
680 | - // TODO : What about inactive fields ? |
|
681 | - // Currently, content_field_instance_delete doesn't work on those... |
|
682 | - $fields = content_field_instance_read(array('type_name' => $info->type)); |
|
683 | - foreach ($fields as $field) { |
|
680 | + // TODO : What about inactive fields ? |
|
681 | + // Currently, content_field_instance_delete doesn't work on those... |
|
682 | + $fields = content_field_instance_read(array('type_name' => $info->type)); |
|
683 | + foreach ($fields as $field) { |
|
684 | 684 | content_field_instance_delete($field['field_name'], $info->type, FALSE); |
685 | - } |
|
686 | - $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
|
687 | - if (db_table_exists($table)) { |
|
685 | + } |
|
686 | + $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
|
687 | + if (db_table_exists($table)) { |
|
688 | 688 | $ret = array(); |
689 | 689 | db_drop_table($ret, $table); |
690 | 690 | watchdog('content', 'The content fields table %name has been deleted.', array('%name' => $table)); |
691 | - } |
|
692 | - // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
|
693 | - // node_type_form_submit() takes care of this. |
|
694 | - content_clear_type_cache(TRUE); |
|
691 | + } |
|
692 | + // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
|
693 | + // node_type_form_submit() takes care of this. |
|
694 | + content_clear_type_cache(TRUE); |
|
695 | 695 | } |
@@ -412,12 +412,12 @@ discard block |
||
412 | 412 | $field['db_columns'] = $field['columns']; |
413 | 413 | |
414 | 414 | switch ($op) { |
415 | - case 'create': |
|
416 | - drupal_write_record(content_field_tablename(), $field); |
|
417 | - break; |
|
418 | - case 'update': |
|
419 | - drupal_write_record(content_field_tablename(), $field, 'field_name'); |
|
420 | - break; |
|
415 | + case 'create': |
|
416 | + drupal_write_record(content_field_tablename(), $field); |
|
417 | + break; |
|
418 | + case 'update': |
|
419 | + drupal_write_record(content_field_tablename(), $field, 'field_name'); |
|
420 | + break; |
|
421 | 421 | } |
422 | 422 | unset($field['db_columns']); |
423 | 423 | return $field; |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | switch ($op) { |
451 | - case 'create': |
|
452 | - drupal_write_record(content_instance_tablename(), $field); |
|
453 | - break; |
|
454 | - case 'update': |
|
455 | - drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name')); |
|
456 | - break; |
|
451 | + case 'create': |
|
452 | + drupal_write_record(content_instance_tablename(), $field); |
|
453 | + break; |
|
454 | + case 'update': |
|
455 | + drupal_write_record(content_instance_tablename(), $field, array('field_name', 'type_name')); |
|
456 | + break; |
|
457 | 457 | } |
458 | 458 | return $field; |
459 | 459 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $field['active'] = 1; |
43 | 43 | } |
44 | 44 | |
45 | - $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field); |
|
45 | + $field['columns'] = (array)module_invoke($module, 'field_settings', 'database columns', $field); |
|
46 | 46 | // Ensure columns always default to NULL values. |
47 | 47 | foreach ($field['columns'] as $column_name => $column) { |
48 | 48 | $field['columns'][$column_name]['not null'] = FALSE; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $field['db_storage'] = CONTENT_DB_STORAGE_PER_CONTENT_TYPE; |
54 | 54 | |
55 | 55 | // Make sure field settings all have an index in the array. |
56 | - $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field); |
|
56 | + $setting_names = (array)module_invoke($module, 'field_settings', 'save', $field); |
|
57 | 57 | drupal_alter('field_settings', $setting_names, 'save', $field); |
58 | 58 | foreach ($setting_names as $setting) { |
59 | 59 | $field[$setting] = NULL; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | // Make sure widget settings all have an index in the array. |
95 | - $settings_names = (array) module_invoke($module, 'widget_settings', 'save', $widget); |
|
95 | + $settings_names = (array)module_invoke($module, 'widget_settings', 'save', $widget); |
|
96 | 96 | drupal_alter('widget_settings', $settings_names, 'save', $widget); |
97 | 97 | $widget['widget_settings'] = array(); |
98 | 98 | foreach ($settings_names as $name) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // initialize $widget_settings with default values, |
134 | 134 | if (isset($field['default_value']) && isset($field['default_value_php']) && |
135 | 135 | content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) { |
136 | - $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : NULL; |
|
136 | + $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : NULL; |
|
137 | 137 | $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL; |
138 | 138 | unset($field['default_value']); |
139 | 139 | unset($field['default_value_php']); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @see menu_rebuild() |
209 | 209 | */ |
210 | 210 | function content_field_instance_create($field, $rebuild = TRUE) { |
211 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
211 | + include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc'); |
|
212 | 212 | |
213 | 213 | $form_values = $field; |
214 | 214 | $field = content_field_instance_expand($field); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $field['db_storage'] = content_storage_type($field); |
256 | 256 | |
257 | 257 | // Get a fresh copy of the column information whenever a field is created. |
258 | - $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
258 | + $field['columns'] = (array)module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
259 | 259 | |
260 | 260 | if (empty($prev_field['widget']) || $prior_instances < 1) { |
261 | 261 | // If this is the first instance, create the field. |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @see menu_rebuild() |
320 | 320 | */ |
321 | 321 | function content_field_instance_update($field, $rebuild = TRUE) { |
322 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
322 | + include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc'); |
|
323 | 323 | |
324 | 324 | // Ensure the field description is in the 'expanded' form. |
325 | 325 | $field = content_field_instance_expand($field); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | // Changes in field values may affect columns, or column |
347 | 347 | // information may have changed, get a fresh copy. |
348 | - $field['columns'] = (array) module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
348 | + $field['columns'] = (array)module_invoke($field['module'], 'field_settings', 'database columns', $field); |
|
349 | 349 | |
350 | 350 | // If the database storage has changed, update the field and previous instances. |
351 | 351 | $prior_instances = content_field_instance_read(array('field_name' => $field['field_name'])); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | function _content_field_write($field, $op = 'update') { |
400 | 400 | // Rearrange the data to create the global_settings array. |
401 | 401 | $field['global_settings'] = array(); |
402 | - $setting_names = (array) module_invoke($field['module'], 'field_settings', 'save', $field); |
|
402 | + $setting_names = (array)module_invoke($field['module'], 'field_settings', 'save', $field); |
|
403 | 403 | drupal_alter('field_settings', $setting_names, 'save', $field); |
404 | 404 | |
405 | 405 | foreach ($setting_names as $setting) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $field = content_field_instance_collapse($field); |
436 | 436 | |
437 | 437 | // Rearrange the data to create the widget_settings array. |
438 | - $setting_names = (array) module_invoke($field['widget_module'], 'widget_settings', 'save', $field); |
|
438 | + $setting_names = (array)module_invoke($field['widget_module'], 'widget_settings', 'save', $field); |
|
439 | 439 | drupal_alter('widget_settings', $setting_names, 'save', $field); |
440 | 440 | foreach ($setting_names as $setting) { |
441 | 441 | // In some cases (when the updated $field was originally read from |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | if (is_array($param)) { |
479 | 479 | // Turn the conditions into a query. |
480 | 480 | foreach ($param as $key => $value) { |
481 | - $cond[] = 'nfi.'. db_escape_string($key) ." = '%s'"; |
|
481 | + $cond[] = 'nfi.'.db_escape_string($key)." = '%s'"; |
|
482 | 482 | $args[] = $value; |
483 | 483 | } |
484 | 484 | } |
@@ -486,17 +486,17 @@ discard block |
||
486 | 486 | $cond[] = 'nf.active = 1'; |
487 | 487 | $cond[] = 'nfi.widget_active = 1'; |
488 | 488 | } |
489 | - $where = $cond ? ' WHERE '. implode(' AND ', $cond) : ''; |
|
489 | + $where = $cond ? ' WHERE '.implode(' AND ', $cond) : ''; |
|
490 | 490 | |
491 | - $db_result = db_query("SELECT * FROM {". content_instance_tablename() ."} nfi ". |
|
492 | - " JOIN {". content_field_tablename() ."} nf ON nfi.field_name = nf.field_name ". |
|
491 | + $db_result = db_query("SELECT * FROM {".content_instance_tablename()."} nfi ". |
|
492 | + " JOIN {".content_field_tablename()."} nf ON nfi.field_name = nf.field_name ". |
|
493 | 493 | "$where ORDER BY nfi.weight ASC, nfi.label ASC", $args); |
494 | 494 | |
495 | 495 | $fields = array(); |
496 | 496 | while ($instance = db_fetch_array($db_result)) { |
497 | 497 | // Unserialize arrays. |
498 | 498 | foreach (array('widget_settings', 'display_settings', 'global_settings', 'db_columns') as $key) { |
499 | - $instance[$key] = (!empty($instance[$key])) ? (array) unserialize($instance[$key]) : array(); |
|
499 | + $instance[$key] = (!empty($instance[$key])) ? (array)unserialize($instance[$key]) : array(); |
|
500 | 500 | } |
501 | 501 | // 'columns' is a reserved word in MySQL4, so our column is named 'db_columns'. |
502 | 502 | $instance['columns'] = $instance['db_columns']; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * @see menu_rebuild() |
545 | 545 | */ |
546 | 546 | function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) { |
547 | - include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
|
547 | + include_once('./'.drupal_get_path('module', 'content').'/includes/content.admin.inc'); |
|
548 | 548 | |
549 | 549 | // Get the previous field value. |
550 | 550 | $field = array_pop(content_field_instance_read(array('field_name' => $field_name, 'type_name' => $type_name))); |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | // Invoke hook_content_fieldapi(). |
553 | 553 | module_invoke_all('content_fieldapi', 'delete instance', $field); |
554 | 554 | |
555 | - db_query("DELETE FROM {". content_instance_tablename() . |
|
555 | + db_query("DELETE FROM {".content_instance_tablename(). |
|
556 | 556 | "} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']); |
557 | 557 | |
558 | 558 | // If no instances remain, delete the field entirely. |
559 | 559 | $instances = content_field_instance_read(array('field_name' => $field_name)); |
560 | 560 | if (sizeof($instances) < 1) { |
561 | - db_query("DELETE FROM {". content_field_tablename() ."} WHERE field_name = '%s'", $field['field_name']); |
|
561 | + db_query("DELETE FROM {".content_field_tablename()."} WHERE field_name = '%s'", $field['field_name']); |
|
562 | 562 | content_alter_schema($field, array()); |
563 | 563 | } |
564 | 564 | // If only one instance remains, we may need to change the database |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | // If content module has been uninstalled first, all tables |
601 | 601 | // have already been dropped, and running that code will raise errors. |
602 | 602 | if (db_table_exists(content_instance_tablename())) { |
603 | - $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module); |
|
603 | + $results = db_query("SELECT field_name, type_name FROM {".content_instance_tablename()."} WHERE widget_module = '%s'", $module); |
|
604 | 604 | while ($field = db_fetch_array($results)) { |
605 | 605 | content_field_instance_delete($field['field_name'], $field['type_name'], FALSE); |
606 | 606 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | function content_type_update($info) { |
635 | 635 | if (!empty($info->old_type) && $info->old_type != $info->type) { |
636 | 636 | // Rename the content type in all fields that use changed content type. |
637 | - db_query("UPDATE {". content_instance_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type)); |
|
637 | + db_query("UPDATE {".content_instance_tablename()."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type)); |
|
638 | 638 | |
639 | 639 | // Rename the content fields table to match new content type name. |
640 | 640 | $old_type = content_types($info->old_type); |
@@ -648,9 +648,9 @@ discard block |
||
648 | 648 | } |
649 | 649 | |
650 | 650 | // Rename the variable storing weights for non-CCK fields. |
651 | - if ($extra = variable_get('content_extra_weights_'. $info->old_type, array())) { |
|
652 | - variable_set('content_extra_weights_'. $info->type, $extra); |
|
653 | - variable_del('content_extra_weights_'. $info->old_type); |
|
651 | + if ($extra = variable_get('content_extra_weights_'.$info->old_type, array())) { |
|
652 | + variable_set('content_extra_weights_'.$info->type, $extra); |
|
653 | + variable_del('content_extra_weights_'.$info->old_type); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 |
@@ -117,8 +117,7 @@ discard block |
||
117 | 117 | $field['widget']['type'] = $field['widget_type']; |
118 | 118 | $widget_types = _content_widget_types(); |
119 | 119 | $field['widget']['module'] = isset($widget_types[$field['widget_type']]['module']) ? $widget_types[$field['widget_type']]['module'] : $field['widget_module']; |
120 | - } |
|
121 | - elseif (!empty($field['widget_module'])) { |
|
120 | + } elseif (!empty($field['widget_module'])) { |
|
122 | 121 | $field['widget']['module'] = $field['widget_module']; |
123 | 122 | } |
124 | 123 | |
@@ -157,12 +156,10 @@ discard block |
||
157 | 156 | |
158 | 157 | if (!empty($field['widget']['module'])) { |
159 | 158 | $widget_module = $field['widget']['module']; |
160 | - } |
|
161 | - elseif (!empty($field['widget']['type'])) { |
|
159 | + } elseif (!empty($field['widget']['type'])) { |
|
162 | 160 | $widget_types = _content_widget_types(); |
163 | 161 | $widget_module = $widget_types[$field['widget']['type']]['module']; |
164 | - } |
|
165 | - else { |
|
162 | + } else { |
|
166 | 163 | $widget_module = ''; |
167 | 164 | } |
168 | 165 | $field['widget_module'] = $widget_module; |
@@ -226,8 +223,7 @@ discard block |
||
226 | 223 | $field['widget']['weight'] = isset($form_values['weight']) ? $form_values['weight'] : $prev_field['widget']['weight']; |
227 | 224 | $field['widget']['label'] = isset($form_values['label']) ? $form_values['label'] : $prev_field['widget']['label']; |
228 | 225 | $field['widget']['description'] = isset($form_values['description']) ? $form_values['description'] : $prev_field['widget']['description']; |
229 | - } |
|
230 | - else { |
|
226 | + } else { |
|
231 | 227 | $prev_field = array('widget' => array()); |
232 | 228 | } |
233 | 229 | |
@@ -261,8 +257,7 @@ discard block |
||
261 | 257 | // If this is the first instance, create the field. |
262 | 258 | $field['db_storage'] = $field['multiple'] > 0 ? CONTENT_DB_STORAGE_PER_FIELD : CONTENT_DB_STORAGE_PER_CONTENT_TYPE; |
263 | 259 | _content_field_write($field, 'create'); |
264 | - } |
|
265 | - elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) { |
|
260 | + } elseif (!empty($prev_field['widget']) && $prev_field['db_storage'] == CONTENT_DB_STORAGE_PER_CONTENT_TYPE && count($prior_instances) > 0) { |
|
266 | 261 | // If the database storage has changed, update the field and previous instances. |
267 | 262 | $field['db_storage'] = CONTENT_DB_STORAGE_PER_FIELD; |
268 | 263 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $field['columns'] = (array) module_invoke($module, 'field_settings', 'database columns', $field); |
46 | 46 | // Ensure columns always default to NULL values. |
47 | 47 | foreach ($field['columns'] as $column_name => $column) { |
48 | - $field['columns'][$column_name]['not null'] = FALSE; |
|
48 | + $field['columns'][$column_name]['not null'] = false; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $field['required'] = 0; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $setting_names = (array) module_invoke($module, 'field_settings', 'save', $field); |
57 | 57 | drupal_alter('field_settings', $setting_names, 'save', $field); |
58 | 58 | foreach ($setting_names as $setting) { |
59 | - $field[$setting] = NULL; |
|
59 | + $field[$setting] = null; |
|
60 | 60 | } |
61 | 61 | return $field; |
62 | 62 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | drupal_alter('widget_settings', $settings_names, 'save', $widget); |
97 | 97 | $widget['widget_settings'] = array(); |
98 | 98 | foreach ($settings_names as $name) { |
99 | - $widget['widget_settings'][$name] = NULL; |
|
99 | + $widget['widget_settings'][$name] = null; |
|
100 | 100 | } |
101 | 101 | return $widget; |
102 | 102 | } |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | // initialize $widget_settings with default values, |
134 | 134 | if (isset($field['default_value']) && isset($field['default_value_php']) && |
135 | 135 | content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) { |
136 | - $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : NULL; |
|
137 | - $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : NULL; |
|
136 | + $field['widget']['default_value'] = !empty($field['default_value']) ? $field['default_value'] : null; |
|
137 | + $field['widget']['default_value_php'] = !empty($field['default_value_php']) ? $field['default_value_php'] : null; |
|
138 | 138 | unset($field['default_value']); |
139 | 139 | unset($field['default_value_php']); |
140 | 140 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @see content_clear_type_cache() |
208 | 208 | * @see menu_rebuild() |
209 | 209 | */ |
210 | -function content_field_instance_create($field, $rebuild = TRUE) { |
|
210 | +function content_field_instance_create($field, $rebuild = true) { |
|
211 | 211 | include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
212 | 212 | |
213 | 213 | $form_values = $field; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | content_alter_schema(array(), $field); |
288 | 288 | |
289 | 289 | if ($rebuild) { |
290 | - content_clear_type_cache(TRUE); |
|
290 | + content_clear_type_cache(true); |
|
291 | 291 | menu_rebuild(); |
292 | 292 | } |
293 | 293 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @see content_clear_type_cache() |
319 | 319 | * @see menu_rebuild() |
320 | 320 | */ |
321 | -function content_field_instance_update($field, $rebuild = TRUE) { |
|
321 | +function content_field_instance_update($field, $rebuild = true) { |
|
322 | 322 | include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
323 | 323 | |
324 | 324 | // Ensure the field description is in the 'expanded' form. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | content_alter_schema($prev_field, $field); |
379 | 379 | |
380 | 380 | if ($rebuild) { |
381 | - content_clear_type_cache(TRUE); |
|
381 | + content_clear_type_cache(true); |
|
382 | 382 | |
383 | 383 | // The label is in the menu tree, so we need a menu rebuild |
384 | 384 | // if the label changes. |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @return |
473 | 473 | * The field arrays. |
474 | 474 | */ |
475 | -function content_field_instance_read($param = NULL, $include_inactive = FALSE) { |
|
475 | +function content_field_instance_read($param = null, $include_inactive = false) { |
|
476 | 476 | $cond = array(); |
477 | 477 | $args = array(); |
478 | 478 | if (is_array($param)) { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * @see content_clear_type_cache() |
544 | 544 | * @see menu_rebuild() |
545 | 545 | */ |
546 | -function content_field_instance_delete($field_name, $type_name, $rebuild = TRUE) { |
|
546 | +function content_field_instance_delete($field_name, $type_name, $rebuild = true) { |
|
547 | 547 | include_once('./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc'); |
548 | 548 | |
549 | 549 | // Get the previous field value. |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | // If the deleted instance was the last field for the content type, |
577 | 577 | // we drop the per-type table. We also consider possibly inactive fields. |
578 | - if (!content_field_instance_read(array('type_name' => $field['type_name']), TRUE)) { |
|
578 | + if (!content_field_instance_read(array('type_name' => $field['type_name']), true)) { |
|
579 | 579 | $base_tablename = _content_tablename($field['type_name'], CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
580 | 580 | if (db_table_exists($base_tablename)) { |
581 | 581 | db_drop_table($ret, $base_tablename); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | if ($rebuild) { |
586 | - content_clear_type_cache(TRUE); |
|
586 | + content_clear_type_cache(true); |
|
587 | 587 | menu_rebuild(); |
588 | 588 | } |
589 | 589 | |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | if (db_table_exists(content_instance_tablename())) { |
603 | 603 | $results = db_query("SELECT field_name, type_name FROM {". content_instance_tablename() ."} WHERE widget_module = '%s'", $module); |
604 | 604 | while ($field = db_fetch_array($results)) { |
605 | - content_field_instance_delete($field['field_name'], $field['type_name'], FALSE); |
|
605 | + content_field_instance_delete($field['field_name'], $field['type_name'], false); |
|
606 | 606 | } |
607 | 607 | // Force the caches and static arrays to update to the new info. |
608 | - content_clear_type_cache(TRUE); |
|
608 | + content_clear_type_cache(true); |
|
609 | 609 | menu_rebuild(); |
610 | 610 | } |
611 | 611 | } |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | * content_clear_type_cache() can do its job properly. |
622 | 622 | */ |
623 | 623 | function content_type_create($info) { |
624 | - node_get_types(NULL, NULL, TRUE); |
|
625 | - content_clear_type_cache(TRUE); |
|
624 | + node_get_types(null, null, true); |
|
625 | + content_clear_type_cache(true); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | // Reset all content type info. |
658 | 658 | // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
659 | 659 | // node_type_form_submit() takes care of this. |
660 | - content_clear_type_cache(TRUE); |
|
660 | + content_clear_type_cache(true); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | // Currently, content_field_instance_delete doesn't work on those... |
682 | 682 | $fields = content_field_instance_read(array('type_name' => $info->type)); |
683 | 683 | foreach ($fields as $field) { |
684 | - content_field_instance_delete($field['field_name'], $info->type, FALSE); |
|
684 | + content_field_instance_delete($field['field_name'], $info->type, false); |
|
685 | 685 | } |
686 | 686 | $table = _content_tablename($info->type, CONTENT_DB_STORAGE_PER_CONTENT_TYPE); |
687 | 687 | if (db_table_exists($table)) { |
@@ -691,5 +691,5 @@ discard block |
||
691 | 691 | } |
692 | 692 | // Menu needs to be rebuilt as well, but node types need to be rebuilt first. |
693 | 693 | // node_type_form_submit() takes care of this. |
694 | - content_clear_type_cache(TRUE); |
|
694 | + content_clear_type_cache(true); |
|
695 | 695 | } |