more cleanup
This commit is contained in:
		@@ -1275,13 +1275,6 @@ class Human {
 | 
				
			|||||||
            Turkish (<a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>),
 | 
					            Turkish (<a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>),
 | 
				
			||||||
            Ukrainian (<a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)';
 | 
					            Ukrainian (<a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $links = '
 | 
					 | 
				
			||||||
	 			<a id="docs-icon" class="small-icon" title="Documentation" href="' . $CRAYON_WEBSITE . '" target="_blank"></a>
 | 
					 | 
				
			||||||
				<a id="git-icon" class="small-icon" title="GitHub" href="' . $CRAYON_GIT . '" target="_blank"></a>
 | 
					 | 
				
			||||||
				<a id="wp-icon" class="small-icon" title="Plugin Page" href="' . $CRAYON_PLUGIN_WP . '" target="_blank"></a>
 | 
					 | 
				
			||||||
	 			<a id="twitter-icon" class="small-icon" title="Twitter" href="' . $CRAYON_TWITTER . '" target="_blank"></a>
 | 
					 | 
				
			||||||
				<a id="gmail-icon" class="small-icon" title="Email" href="mailto:' . $CRAYON_EMAIL . '" target="_blank"></a>';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        echo '
 | 
					        echo '
 | 
				
			||||||
				<table id="crayon-info" border="0">
 | 
									<table id="crayon-info" border="0">
 | 
				
			||||||
		  <tr>
 | 
							  <tr>
 | 
				
			||||||
@@ -1292,9 +1285,6 @@ class Human {
 | 
				
			|||||||
		  </tr>
 | 
							  </tr>
 | 
				
			||||||
		  <tr>
 | 
							  <tr>
 | 
				
			||||||
				<td>' . $translators . '</td>
 | 
									<td>' . $translators . '</td>
 | 
				
			||||||
		  </tr>
 | 
					 | 
				
			||||||
		  <tr>
 | 
					 | 
				
			||||||
				<td colspan="2">' . $links . '</td>
 | 
					 | 
				
			||||||
		  </tr>
 | 
							  </tr>
 | 
				
			||||||
				</table>';
 | 
									</table>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,11 +95,9 @@ const CRAYON_STYLE_ADMIN = CRAYON_CSS_SRC_DIR . 'admin_style.css';
 | 
				
			|||||||
const CRAYON_STYLE_GLOBAL = CRAYON_CSS_SRC_DIR . 'global_style.css';
 | 
					const CRAYON_STYLE_GLOBAL = CRAYON_CSS_SRC_DIR . 'global_style.css';
 | 
				
			||||||
const CRAYON_STYLE_MIN = CRAYON_CSS_MIN_DIR . 'crayon.min.css';
 | 
					const CRAYON_STYLE_MIN = CRAYON_CSS_MIN_DIR . 'crayon.min.css';
 | 
				
			||||||
const CRAYON_LOGO = CRAYON_CSS_DIR . 'images/crayon_logo.png';
 | 
					const CRAYON_LOGO = CRAYON_CSS_DIR . 'images/crayon_logo.png';
 | 
				
			||||||
const CRAYON_DONATE_BUTTON = CRAYON_CSS_DIR . 'images/donate.png';
 | 
					 | 
				
			||||||
const CRAYON_THEME_EDITOR_PHP = CRAYON_THEME_EDITOR_PATH . 'theme_editor.php';
 | 
					const CRAYON_THEME_EDITOR_PHP = CRAYON_THEME_EDITOR_PATH . 'theme_editor.php';
 | 
				
			||||||
const CRAYON_THEME_EDITOR_JS = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.js';
 | 
					const CRAYON_THEME_EDITOR_JS = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.js';
 | 
				
			||||||
const CRAYON_THEME_EDITOR_STYLE = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.css';
 | 
					const CRAYON_THEME_EDITOR_STYLE = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.css';
 | 
				
			||||||
const CRAYON_THEME_EDITOR_BUTTON = CRAYON_CSS_DIR . 'images/theme_editor.png';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PHP Files
 | 
					// PHP Files
 | 
				
			||||||
const CRAYON_FORMATTER_PHP = CRAYON_ROOT_PATH . 'crayon_formatter.class.php';
 | 
					const CRAYON_FORMATTER_PHP = CRAYON_ROOT_PATH . 'crayon_formatter.class.php';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,4 @@
 | 
				
			|||||||
=== Crayon Syntax Highlighter ===
 | 
					=== Crayon Syntax Highlighter ===
 | 
				
			||||||
Contributors: akarmenia
 | 
					 | 
				
			||||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=AW99EMEPQ4CFE&lc=AU&item_name=Crayon%20Syntax%20Highlighter%20Donation&item_number=crayon%2ddonate¤cy_code=AUD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
 | 
					 | 
				
			||||||
License: GPLv2 or later
 | 
					 | 
				
			||||||
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter, bbpress
 | 
					 | 
				
			||||||
Requires at least: 3.0
 | 
					 | 
				
			||||||
Tested up to: 4.2.0
 | 
					 | 
				
			||||||
Stable tag: trunk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, or post text.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
== Description ==
 | 
					== Description ==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,94 +1,103 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require_once (CRAYON_ROOT_PATH . 'crayon_settings.class.php');
 | 
					require_once(CRAYON_ROOT_PATH . 'crayon_settings.class.php');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Manages logging variable values to the log file. */
 | 
					/* Manages logging variable values to the log file. */
 | 
				
			||||||
class CrayonLog {
 | 
					 | 
				
			||||||
	private static $file = NULL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Logs a variable value to a log file
 | 
					class CrayonLog
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static $file = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static function log($var = NULL, $title = '', $trim_url = TRUE) {
 | 
					    // Logs a variable value to a log file
 | 
				
			||||||
		if ($var === NULL) {
 | 
					 | 
				
			||||||
			// Return log
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (($log = CrayonUtil::file(CRAYON_LOG_FILE)) !== FALSE) {
 | 
					    public static function log($var = NULL, $title = '', $trim_url = TRUE)
 | 
				
			||||||
				return $log;
 | 
					    {
 | 
				
			||||||
			} else {
 | 
					        if ($var === NULL) {
 | 
				
			||||||
				return '';
 | 
					            // Return log
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			try {
 | 
					 | 
				
			||||||
				if (self::$file == NULL) {
 | 
					 | 
				
			||||||
					self::$file = @fopen(CRAYON_LOG_FILE, 'a+');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (self::$file) {
 | 
					            if (($log = CrayonUtil::file(CRAYON_LOG_FILE)) !== FALSE) {
 | 
				
			||||||
						$header = /*CRAYON_DASH .*/ CRAYON_NL . '[Crayon Syntax Highlighter Log Entry - ' . date('g:i:s A - d M Y') . ']' . CRAYON_NL .
 | 
					                return $log;
 | 
				
			||||||
							/*CRAYON_DASH .*/ CRAYON_NL;
 | 
					            } else {
 | 
				
			||||||
						fwrite(self::$file, $header);
 | 
					                return '';
 | 
				
			||||||
					} else {
 | 
					            }
 | 
				
			||||||
						return;
 | 
					        } else {
 | 
				
			||||||
					}
 | 
					            try {
 | 
				
			||||||
				}
 | 
					                if (self::$file == NULL) {
 | 
				
			||||||
				// Capture variable dump
 | 
					                    self::$file = @fopen(CRAYON_LOG_FILE, 'a+');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (self::$file) {
 | 
				
			||||||
 | 
					                        $header = /*CRAYON_DASH .*/
 | 
				
			||||||
 | 
					                            CRAYON_NL . '[Crayon Syntax Highlighter Log Entry - ' . date('g:i:s A - d M Y') . ']' . CRAYON_NL .
 | 
				
			||||||
 | 
					                            /*CRAYON_DASH .*/
 | 
				
			||||||
 | 
					                            CRAYON_NL;
 | 
				
			||||||
 | 
					                        fwrite(self::$file, $header);
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                // Capture variable dump
 | 
				
			||||||
                $buffer = trim(strip_tags(var_export($var, true)));
 | 
					                $buffer = trim(strip_tags(var_export($var, true)));
 | 
				
			||||||
				$title = (!empty($title) ? " [$title]" : '');
 | 
					                $title = (!empty($title) ? " [$title]" : '');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Remove absolute path to plugin directory from buffer
 | 
					                // Remove absolute path to plugin directory from buffer
 | 
				
			||||||
				if ($trim_url) {
 | 
					                if ($trim_url) {
 | 
				
			||||||
					$buffer = CrayonUtil::path_rel($buffer);
 | 
					                    $buffer = CrayonUtil::path_rel($buffer);
 | 
				
			||||||
				}
 | 
					                }
 | 
				
			||||||
				$write = $title . ' ' . $buffer . CRAYON_NL /* . CRAYON_LINE . CRAYON_NL*/;
 | 
					                $write = $title . ' ' . $buffer . CRAYON_NL /* . CRAYON_LINE . CRAYON_NL*/
 | 
				
			||||||
 | 
					                ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// If we exceed max file size, truncate file first
 | 
					                // If we exceed max file size, truncate file first
 | 
				
			||||||
				if (filesize(CRAYON_LOG_FILE) + strlen($write) > CRAYON_LOG_MAX_SIZE) {
 | 
					                if (filesize(CRAYON_LOG_FILE) + strlen($write) > CRAYON_LOG_MAX_SIZE) {
 | 
				
			||||||
					ftruncate(self::$file, 0);
 | 
					                    ftruncate(self::$file, 0);
 | 
				
			||||||
					fwrite(self::$file, 'The log has been truncated since it exceeded ' . CRAYON_LOG_MAX_SIZE .
 | 
					                    fwrite(self::$file, 'The log has been truncated since it exceeded ' . CRAYON_LOG_MAX_SIZE .
 | 
				
			||||||
						' bytes.' . CRAYON_NL . /*CRAYON_LINE .*/ CRAYON_NL);
 | 
					                        ' bytes.' . CRAYON_NL . /*CRAYON_LINE .*/ CRAYON_NL);
 | 
				
			||||||
				}
 | 
					                }
 | 
				
			||||||
				clearstatcache();
 | 
					                clearstatcache();
 | 
				
			||||||
				fwrite(self::$file, $write, CRAYON_LOG_MAX_SIZE);
 | 
					                fwrite(self::$file, $write, CRAYON_LOG_MAX_SIZE);
 | 
				
			||||||
			} catch (Exception $e) {
 | 
					            } catch (Exception $e) {
 | 
				
			||||||
				// Ignore fatal errors during logging
 | 
					                // Ignore fatal errors during logging
 | 
				
			||||||
			}
 | 
					            }
 | 
				
			||||||
		}
 | 
					        }
 | 
				
			||||||
	}
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Logs system-wide only if global settings permit
 | 
					    // Logs system-wide only if global settings permit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static function syslog($var = NULL, $title = '', $trim_url = TRUE) {
 | 
					    public static function syslog($var = NULL, $title = '', $trim_url = TRUE)
 | 
				
			||||||
		if (CrayonGlobalSettings::val(CrayonSettings::ERROR_LOG_SYS)) {
 | 
					    {
 | 
				
			||||||
			$title = (empty($title)) ? 'SYSTEM LOG' : $title;
 | 
					        if (CrayonGlobalSettings::val(CrayonSettings::ERROR_LOG_SYS)) {
 | 
				
			||||||
			self::log($var, $title, $trim_url);
 | 
					            $title = (empty($title)) ? 'SYSTEM LOG' : $title;
 | 
				
			||||||
		}
 | 
					            self::log($var, $title, $trim_url);
 | 
				
			||||||
	}
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static function debug($var = NULL, $title = '', $trim_url = TRUE) {
 | 
					    public static function debug($var = NULL, $title = '', $trim_url = TRUE)
 | 
				
			||||||
		if (CRAYON_DEBUG) {
 | 
					    {
 | 
				
			||||||
			$title = (empty($title)) ? 'DEBUG' : $title;
 | 
					        if (CRAYON_DEBUG) {
 | 
				
			||||||
			self::log($var, $title, $trim_url);
 | 
					            $title = (empty($title)) ? 'DEBUG' : $title;
 | 
				
			||||||
		}
 | 
					            self::log($var, $title, $trim_url);
 | 
				
			||||||
	}
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static function clear() {
 | 
					    public static function clear()
 | 
				
			||||||
		if (!@unlink(CRAYON_LOG_FILE)) {
 | 
					    {
 | 
				
			||||||
			// Will result in nothing if we can't log
 | 
					        if (!@unlink(CRAYON_LOG_FILE)) {
 | 
				
			||||||
 | 
					            // Will result in nothing if we can't log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			self::log('The log could not be cleared', 'Log Clear');
 | 
					            self::log('The log could not be cleared', 'Log Clear');
 | 
				
			||||||
		}
 | 
					        }
 | 
				
			||||||
		self::$file = NULL; // Remove file handle
 | 
					        self::$file = NULL; // Remove file handle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static function email($to, $from = NULL) {
 | 
					    public static function email($to, $from = NULL)
 | 
				
			||||||
		if (($log_contents = CrayonUtil::file(CRAYON_LOG_FILE)) !== FALSE) {
 | 
					    {
 | 
				
			||||||
			$headers = $from ? 'From: ' . $from : '';
 | 
					        if (($log_contents = CrayonUtil::file(CRAYON_LOG_FILE)) !== FALSE) {
 | 
				
			||||||
			$result = @mail($to, 'Crayon Syntax Highlighter Log', $log_contents, $headers);
 | 
					            $headers = $from ? 'From: ' . $from : '';
 | 
				
			||||||
			self::log('The log was emailed to the admin.', 'Log Email');
 | 
					            $result = @mail($to, 'Crayon Syntax Highlighter Log', $log_contents, $headers);
 | 
				
			||||||
		} else {
 | 
					            self::log('The log was emailed to the admin.', 'Log Email');
 | 
				
			||||||
			// Will result in nothing if we can't email
 | 
					        } else {
 | 
				
			||||||
 | 
					            // Will result in nothing if we can't email
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			self::log("The log could not be emailed to $to.", 'Log Email');
 | 
					            self::log("The log could not be emailed to $to.", 'Log Email');
 | 
				
			||||||
		}
 | 
					        }
 | 
				
			||||||
	}
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
@@ -21,4 +21,3 @@ class CrayonTimer {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
@@ -53,5 +53,3 @@ function crayon_resources() {
 | 
				
			|||||||
	crayon_print_script('crayon-js', $plugin_url.CRAYON_JS, $CRAYON_VERSION);
 | 
						crayon_print_script('crayon-js', $plugin_url.CRAYON_JS, $CRAYON_VERSION);
 | 
				
			||||||
	crayon_print_script('crayon-jquery-popup', $plugin_url.CRAYON_JQUERY_POPUP, $CRAYON_VERSION);
 | 
						crayon_print_script('crayon-jquery-popup', $plugin_url.CRAYON_JQUERY_POPUP, $CRAYON_VERSION);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user