aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php50
1 files changed, 37 insertions, 13 deletions
diff --git a/include/text.php b/include/text.php
index 4777e7a61..6f7297bb0 100644
--- a/include/text.php
+++ b/include/text.php
@@ -536,9 +536,10 @@ function attribute_contains($attr, $s) {
*
* @param string $msg Message to log
* @param int $level A log level.
+ * @param int $priority - compatible with syslog
*/
-function logger($msg, $level = 0) {
+function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
// turn off logger in install mode
global $a;
global $db;
@@ -559,8 +560,8 @@ function logger($msg, $level = 0) {
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
}
- $s = datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL;
- $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'logged' => false);
+ $s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
+ $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false);
call_hooks('logger',$pluginfo);
@@ -568,6 +569,23 @@ function logger($msg, $level = 0) {
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
}
+function log_priority_str($priority) {
+ $parr = array(
+ LOG_EMERG => 'LOG_EMERG',
+ LOG_ALERT => 'LOG_ALERT',
+ LOG_CRIT => 'LOG_CRIT',
+ LOG_ERR => 'LOG_ERR',
+ LOG_WARNING => 'LOG_WARNING',
+ LOG_NOTICE => 'LOG_NOTICE',
+ LOG_INFO => 'LOG_INFO',
+ LOG_DEBUG => 'LOG_DEBUG'
+ );
+
+ if($parr[$priority])
+ return $parr[$priority];
+ return 'LOG_UNDEFINED';
+}
+
/**
* @brief This is a special logging facility for developers.
*
@@ -972,7 +990,7 @@ function get_mood_verbs() {
'tired' => t('tired'),
'perky' => t('perky'),
'angry' => t('angry'),
- 'stupefied' => t('stupified'),
+ 'stupefied' => t('stupefied'),
'puzzled' => t('puzzled'),
'interested' => t('interested'),
'bitter' => t('bitter'),
@@ -1416,20 +1434,14 @@ function format_event($jobject) {
function prepare_body(&$item,$attach = false) {
require_once('include/identity.php');
-// if($item['html']) {
-// $s = bb_observer($item['html']);
-// }
-// else {
- call_hooks('prepare_body_init', $item);
-// unobscure($item);
- $s = prepare_text($item['body'],$item['mimetype'], false);
-// }
+ call_hooks('prepare_body_init', $item);
$photo = '';
- $is_photo = (($item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
+ $is_photo = ((($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) ? true : false);
if($is_photo) {
+
$object = json_decode($item['object'],true);
// if original photo width is <= 640px prepend it to item body
@@ -1444,6 +1456,8 @@ function prepare_body(&$item,$attach = false) {
}
}
+ $s = prepare_text($item['body'],$item['mimetype'], false);
+
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event($item['object']) : false);
$prep_arr = array(
@@ -1602,6 +1616,16 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
}
+function create_export_photo_body(&$item) {
+ if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) {
+ $j = json_decode($item['object'],true);
+ if($j) {
+ $item['body'] .= "\n\n" . (($j['body']) ? $j['body'] : $j['bbcode']);
+ $item['sig'] = '';
+ }
+ }
+}
+
/**
* zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links
* These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode()