summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorrit Schippers2009-08-05 20:04:10 (GMT)
committer Jorrit Schippers2009-08-05 20:04:10 (GMT)
commit21aad53a7f8bfa4085cbbe714c33f3ab57750a84 (patch)
tree232e014dff65646927a23420aa286647b32975f9
parentf7ad9b6348fb7ad1123b572dc0e9eaaf59a26513 (diff)
Drupal code guidelines conformance
-rw-r--r--fckeditor.install8
-rw-r--r--fckeditor.module39
2 files changed, 24 insertions, 23 deletions
diff --git a/fckeditor.install b/fckeditor.install
index 6bbe5fc..0abd587 100644
--- a/fckeditor.install
+++ b/fckeditor.install
@@ -22,7 +22,7 @@
* == END LICENSE ==
*
* @file
- * Implementation of hook_install()
+ * Implementation of hook_install().
*
* This will automatically install the database tables for the FCKeditor module for both the MySQL and PostgreSQL databases.
*
@@ -151,8 +151,8 @@ function fckeditor_install() {
}
/**
-* Implementation of hook_schema().
-*/
+ * Implementation of hook_schema().
+ */
function fckeditor_schema() {
$schema['fckeditor_settings'] = array(
'description' => 'Stores FCKeditor profile settings',
@@ -302,7 +302,7 @@ function fckeditor_update_6130() {
}
/**
- * Implementation of hook_uninstall()
+ * Implementation of hook_uninstall().
*/
function fckeditor_uninstall() {
drupal_uninstall_schema('fckeditor');
diff --git a/fckeditor.module b/fckeditor.module
index c5036fc..f903b2a 100644
--- a/fckeditor.module
+++ b/fckeditor.module
@@ -43,7 +43,7 @@ $_fckeditor_configuration = array();
$_fckeditor_js_ids = array();
/**
- * Implementation of hook_help
+ * Implementation of hook_help()
*/
function fckeditor_help($path, $arg) {
switch ($path) {
@@ -55,11 +55,11 @@ function fckeditor_help($path, $arg) {
$output = t("<p>The Global Profile allows you to define settings that are common for all profiles. Values defined in other profiles will be appended to the global configuration. This way you can avoid repeating some of the settings that are usually the same in each profile.</p>");
break;
}
- else if (!empty($arg[3]) && in_array($arg[3], array("add", "edit"))) {
+ elseif (!empty($arg[3]) && in_array($arg[3], array("add", "edit"))) {
$output = t("<p>Note: FCKeditor is highly configurable. The most commonly used features are listed below. If you want to take a look at all available settings, open <code>!fckconfig</code> and then customize <code>!fckeditor_config</code> to your needs. This is also the only way to define new toolbar sets. It is advised to not edit <code>fckconfig.js</code> because you may overwrite it accidentally when you update the editor.</p>", array('!fckconfig' => drupal_get_path('module', 'fckeditor') ."/fckeditor/fckconfig.js", '!fckeditor_config' => drupal_get_path('module', 'fckeditor') ."/fckeditor.config.js"));
break;
}
- else if (!empty($arg[3]) && in_array($arg[3], array("delete", "deleteg"))) {
+ elseif (!empty($arg[3]) && in_array($arg[3], array("delete", "deleteg"))) {
break;
}
$output = t("<p>The FCKeditor module allows Drupal to replace textarea fields with a rich text or <acronym title=\"What You See Is What You Get\">WYSIWYG</acronym> editor. This editor brings many of the powerful functionalities of known desktop editors like Word to the web. It's relatively lightweight and doesn't require any kind of installation on the client computer.</p><p>More information about the editor is located at the !fckeditorlink. A small user guide is located at !userguidelink.</p>",
@@ -137,7 +137,7 @@ function fckeditor_help($path, $arg) {
}
/**
- * Implementation of hook_perm
+ * Implementation of hook_perm().
* Administer -> User management -> Permissions
*/
function fckeditor_perm() {
@@ -399,10 +399,10 @@ function fckeditor_profile_validate($edit) {
if ($edit['css_mode'] != 'self') {
$errors['css_path'] = t('CSS path is not empty. Please set the "Editor CSS" option to "define css" mode.');
}
- else if (false !== strpos($edit['css_path'], '"')) {
+ elseif (false !== strpos($edit['css_path'], '"')) {
$errors['css_path'] = t('Double quotes are not allowed in CSS path.');
}
- else if (substr($edit['css_path'], 0, 1) == "'" && substr($edit['css_path'], -1) == "'") {
+ elseif (substr($edit['css_path'], 0, 1) == "'" && substr($edit['css_path'], -1) == "'") {
$errors['css_path'] = t('Enter valid path, do not surround it with quotes.');
}
}
@@ -411,10 +411,10 @@ function fckeditor_profile_validate($edit) {
if ($edit['css_style'] != 'self') {
$errors['styles_path'] = t('Path to predefined styles is not empty. Please set the "Predefined styles" option to "define path to fckstyles.xml" mode.');
}
- else if (false !== strpos($edit['styles_path'], '"')) {
+ elseif (false !== strpos($edit['styles_path'], '"')) {
$errors['styles_path'] = t('Double quotes are not allowed in path.');
}
- else if (substr($edit['styles_path'], 0, 1) == "'" && substr($edit['styles_path'], -1) == "'") {
+ elseif (substr($edit['styles_path'], 0, 1) == "'" && substr($edit['styles_path'], -1) == "'") {
$errors['styles_path'] = t('Enter valid path, do not surround it with quotes.');
}
}
@@ -919,7 +919,7 @@ function fckeditor_process_textarea($element) {
$content .= $element['#post']['teaser_js'] ."<!--break-->";
}
$content .= $element['#value'];
- $wysiwyg_link = '<div id="fck_'. $js_id .'"><textarea id="'. $js_id .'" cols="'.$element['#cols'].'" rows="'. $element['#rows'] .'">'. htmlspecialchars($content) .'</textarea></div>'."\n";
+ $wysiwyg_link = '<div id="fck_'. $js_id .'"><textarea id="'. $js_id .'" cols="'. $element['#cols'] .'" rows="'. $element['#rows'] .'">'. htmlspecialchars($content) .'</textarea></div>'."\n";
$wysiwyg_link .= "<a href=\"javascript:Toggle('{$js_id}','{$element['#id']}','". str_replace("'", "\\'", t("Switch to plain text editor")) ."','". str_replace("'", "\\'", t("Switch to rich text editor")) ."',". $xss_check .");\" id=\"switch_{$js_id}\" ". ($fckeditor_on?"style=\"display:none\"":"") .">";
$wysiwyg_link .= $fckeditor_on ? t("Switch to plain text editor") : t("Switch to rich text editor");
$wysiwyg_link .= "</a>";
@@ -1139,7 +1139,7 @@ function fckeditor_process_textarea($element) {
$js .= $js_id .".Config['StylesXmlPath'] = \"". $styles_xml_path ."\";\n";
}
}
- else if (!empty($conf['css_style']) && $conf['css_style'] == 'self') {
+ elseif (!empty($conf['css_style']) && $conf['css_style'] == 'self') {
$conf['styles_path'] = str_replace("%h%t", "%t", $conf['styles_path']);
$js .= $js_id .".Config['StylesXmlPath'] = \"". str_replace(array('%h', '%t', '%m'), array($host, $host . $themepath, $module_drupal_path), $conf['styles_path']) ."\";\n";
}
@@ -1168,7 +1168,7 @@ function fckeditor_process_textarea($element) {
if (file_exists($path)) {
$css_files[$name] = $host . $path;
}
- else if (!empty($css_files[$name])) {
+ elseif (!empty($css_files[$name])) {
unset($css_files[$name]);
}
}
@@ -1185,20 +1185,20 @@ function fckeditor_process_textarea($element) {
$editorcss .= $host . $color_paths[1] .",";
}
}
- else if (!empty($color_paths[0])) {
+ elseif (!empty($color_paths[0])) {
$editorcss .= $host . $color_paths[0] .",";
}
$editorcss .= $module_full_path ."/fckeditor.css\";\n";
$js .= $js_id .".Config['EditorAreaCSS'] = ". $editorcss;
}
- else if (file_exists($style_css)) {
+ elseif (file_exists($style_css)) {
$js .= $js_id .".Config['EditorAreaCSS'] = \"". $host . $style_css .",". $module_full_path ."/fckeditor.css\";";
}
else {
$js .= $js_id .".Config['EditorAreaCSS'] = \"". $module_full_path ."/fckeditor.css\";";
}
}
- else if ($conf['css_mode'] == 'self') {
+ elseif ($conf['css_mode'] == 'self') {
$conf['css_path'] = str_replace("%h%t", "%t", $conf['css_path']);
$js .= $js_id .".Config['EditorAreaCSS'] = \"". str_replace(array('%h', '%t'), array($host, $host . $themepath), $conf['css_path']) .",". $module_full_path ."/fckeditor.css\";";
}
@@ -1214,7 +1214,8 @@ function fckeditor_process_textarea($element) {
if ($element['#id'] == 'edit-body') {
$teasersuffix = '&amp;teaser=edit-teaser-js';
- } else {
+ }
+ else {
$teasersuffix = '';
}
@@ -2252,7 +2253,7 @@ function fckeditor_is_compatible_client() {
if (function_exists('FCKeditor_IsCompatibleBrowser')) {
return FCKeditor_IsCompatibleBrowser();
}
- else if (class_exists('FCKeditor')) {
+ elseif (class_exists('FCKeditor')) {
//FCKeditor 2.6 with definition of FCKeditor_IsCompatibleBrowser() in fckeditor.php
if (filesize($fckeditor_main_file) > 1500) {
include_once $fckeditor_main_file;
@@ -2291,9 +2292,9 @@ function fckeditor_user_get_setting($user, $profile, $setting) {
}
function fckeditor_user_get_profile($user, $clear = FALSE) {
- static $profile_name;
+ static $profile_name = NULL;
- if ($clear === TRUE || $profile_name == null) {
+ if ($clear === TRUE || $profile_name == NULL) {
$profile_name = array();
}
@@ -2310,7 +2311,7 @@ function fckeditor_user_get_profile($user, $clear = FALSE) {
if (isset($rid) && isset($user->roles[$rid])) {
$profile_name[$user->uid] = db_result(db_query("SELECT s.name FROM {fckeditor_settings} s INNER JOIN {fckeditor_role} r ON r.name = s.name WHERE r.rid='%s'", $rid));
}
- else if ($user->uid == "1") {
+ elseif ($user->uid == "1") {
$profile_name[$user->uid] = db_result(db_query_range("SELECT s.name FROM {fckeditor_settings} s INNER JOIN {fckeditor_role} r ON r.name = s.name ORDER BY r.rid DESC", 1));
}
}