Merge branch 'dev' into docu
This commit is contained in:
@@ -162,6 +162,18 @@ function localize_item(&$item){
|
||||
elseif(activity_match($item['verb'],ACTIVITY_DISLIKE)) {
|
||||
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
|
||||
}
|
||||
|
||||
// short version, in notification strings the author will be displayed separately
|
||||
|
||||
if(activity_match($item['verb'],ACTIVITY_LIKE)) {
|
||||
$shortbodyverb = t('likes %1$s\'s %2$s');
|
||||
}
|
||||
elseif(activity_match($item['verb'],ACTIVITY_DISLIKE)) {
|
||||
$shortbodyverb = t('doesn\'t like %1$s\'s %2$s');
|
||||
}
|
||||
|
||||
$item['shortlocalize'] = sprintf($bodyverb, $objauthor, $plink);
|
||||
|
||||
$item['body'] = $item['localize'] = sprintf($bodyverb, $author, $objauthor, $plink);
|
||||
if($Bphoto != "")
|
||||
$item['body'] .= "\n\n\n" . '[zrl=' . chanlink_url($author_link) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
|
||||
|
||||
@@ -1699,7 +1699,7 @@ function handle_feed($uid, $abook_id, $url) {
|
||||
* @param int $w image width
|
||||
* @param string $type profile photo mime type
|
||||
* @param string $photo Fully qualified URL to a profile/avator photo
|
||||
* @return string
|
||||
* @return string XML tag
|
||||
*/
|
||||
function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) {
|
||||
$o = '';
|
||||
@@ -1736,22 +1736,22 @@ function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) {
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* @brief Return an atom tag with author information from an xchan.
|
||||
*
|
||||
* @param string $tag
|
||||
* @param array $xchan
|
||||
* @return string An xml tag
|
||||
* @return string
|
||||
*/
|
||||
function atom_render_author($tag, $xchan) {
|
||||
|
||||
$nick = xmlify(substr($xchan['xchan_addr'],0,strpos($xchan['xchan_addr'],'@')));
|
||||
$nick = xmlify(substr($xchan['xchan_addr'], 0, strpos($xchan['xchan_addr'], '@')));
|
||||
$id = xmlify($xchan['xchan_url']);
|
||||
$name = xmlify($xchan['xchan_name']);
|
||||
$photo = xmlify($xchan['xchan_photo_l']);
|
||||
$type = xmlify($xchan['xchan_photo_mimetype']);
|
||||
$w = $h = 300;
|
||||
|
||||
$o .= "<$tag>\r\n";
|
||||
$o = "<$tag>\r\n";
|
||||
$o .= " <as:object-type>http://activitystrea.ms/schema/1.0/person</as:object-type>\r\n";
|
||||
$o .= " <id>$id</id>\r\n";
|
||||
$o .= " <name>$nick</name>\r\n";
|
||||
@@ -1764,7 +1764,8 @@ function atom_render_author($tag, $xchan) {
|
||||
|
||||
/**
|
||||
* @hooks atom_render_author
|
||||
* * \e string - The created XML tag as a string without closing tag
|
||||
* Possibility to add further tags to returned XML string.
|
||||
* * \e string The created XML tag as a string without closing tag
|
||||
*/
|
||||
call_hooks('atom_render_author', $o);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ function get_help_content($tocpath = false) {
|
||||
}
|
||||
|
||||
if($path) {
|
||||
|
||||
|
||||
$title = basename($path);
|
||||
if(! $tocpath)
|
||||
\App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
|
||||
@@ -38,10 +38,10 @@ function get_help_content($tocpath = false) {
|
||||
// available and so default back to the English TOC at /doc/toc.{html,bb,md}
|
||||
// TODO: This is incompatible with the hierarchical TOC construction
|
||||
// defined in /Zotlabs/Widget/Helpindex.php.
|
||||
if($tocpath !== false &&
|
||||
load_doc_file('doc/' . $path . '.md') === '' &&
|
||||
load_doc_file('doc/' . $path . '.bb') === '' &&
|
||||
load_doc_file('doc/' . $path . '.html') === ''
|
||||
if($tocpath !== false &&
|
||||
load_doc_file('doc/' . $path . '.md') === '' &&
|
||||
load_doc_file('doc/' . $path . '.bb') === '' &&
|
||||
load_doc_file('doc/' . $path . '.html') === ''
|
||||
) {
|
||||
$path = $title;
|
||||
}
|
||||
@@ -120,22 +120,28 @@ function preg_callback_help_include($matches) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return boolean|array
|
||||
*/
|
||||
function determine_help_language() {
|
||||
require_once('Text/LanguageDetect.php');
|
||||
$lang_detect = new Text_LanguageDetect();
|
||||
// Set this mode to recognize language by the short code like "en", "ru", etc.
|
||||
$lang_detect->setNameMode(2);
|
||||
// If the language was specified in the URL, override the language preference
|
||||
// If the language was specified in the URL, override the language preference
|
||||
// of the browser. Default to English if both of these are absent.
|
||||
if($lang_detect->languageExists(argv(1))) {
|
||||
$lang = argv(1);
|
||||
$from_url = true;
|
||||
} else {
|
||||
$lang = \App::$language;
|
||||
if(! isset($lang))
|
||||
if(! isset($lang))
|
||||
$lang = 'en';
|
||||
|
||||
$from_url = false;
|
||||
}
|
||||
|
||||
return array('language' => $lang, 'from_url' => $from_url);
|
||||
}
|
||||
|
||||
@@ -145,14 +151,14 @@ function load_doc_file($s) {
|
||||
$x = determine_help_language();
|
||||
$lang = $x['language'];
|
||||
$url_idx = ($x['from_url'] ? 1 : 0);
|
||||
// The English translation is at the root of /doc/. Other languages are in
|
||||
// The English translation is at the root of /doc/. Other languages are in
|
||||
// subfolders named by the language code such as "de", "es", etc.
|
||||
if($lang !== 'en') {
|
||||
$path .= '/' . $lang;
|
||||
$path .= '/' . $lang;
|
||||
}
|
||||
|
||||
$b = basename($s);
|
||||
|
||||
|
||||
for($i=1+$url_idx; $i<argc()-1; $i++) {
|
||||
$path .= '/' . argv($i);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* language related tasks.
|
||||
*/
|
||||
|
||||
use CommerceGuys\Intl\Language\LanguageRepository;
|
||||
|
||||
/**
|
||||
* @brief Get the browser's submitted preferred languages.
|
||||
@@ -17,7 +18,7 @@
|
||||
*
|
||||
* Get the language setting directly from system variables, bypassing get_config()
|
||||
* as database may not yet be configured.
|
||||
*
|
||||
*
|
||||
* If possible, we use the value from the browser.
|
||||
*
|
||||
* @return array with ordered list of preferred languages from browser
|
||||
@@ -28,7 +29,7 @@ function get_browser_language() {
|
||||
|
||||
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
|
||||
// break up string into pieces (languages and q factors)
|
||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
|
||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
||||
|
||||
if (count($lang_parse[1])) {
|
||||
@@ -40,7 +41,7 @@ function get_browser_language() {
|
||||
if ($val === '') $langs[$lang] = 1;
|
||||
}
|
||||
|
||||
// sort list based on value
|
||||
// sort list based on value
|
||||
arsort($langs, SORT_NUMERIC);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +53,7 @@ function get_browser_language() {
|
||||
* @brief Returns the best language for which also a translation exists.
|
||||
*
|
||||
* This function takes the results from get_browser_language() and compares it
|
||||
* with the available translations and returns the best fitting language for
|
||||
* with the available translations and returns the best fitting language for
|
||||
* which there exists a translation.
|
||||
*
|
||||
* If there is no match fall back to config['system']['language']
|
||||
@@ -243,11 +244,9 @@ function string_plural_select_default($n) {
|
||||
*
|
||||
* @see http://pear.php.net/package/Text_LanguageDetect
|
||||
* @param string $s A string to examine
|
||||
* @return Language code in 2-letter ISO 639-1 (en, de, fr) format
|
||||
* @return string Language code in 2-letter ISO 639-1 (en, de, fr) format
|
||||
*/
|
||||
function detect_language($s) {
|
||||
require_once('Text/LanguageDetect.php');
|
||||
|
||||
$min_length = get_config('system', 'language_detect_min_length');
|
||||
if ($min_length === false)
|
||||
$min_length = LANGUAGE_DETECT_MIN_LENGTH;
|
||||
@@ -257,7 +256,7 @@ function detect_language($s) {
|
||||
$min_confidence = LANGUAGE_DETECT_MIN_CONFIDENCE;
|
||||
|
||||
// embedded apps have long base64 strings which will trip up the detector.
|
||||
$naked_body = preg_replace('/\[app\](.*?)\[\/app\]/','',$s);
|
||||
$naked_body = preg_replace('/\[app\](.*?)\[\/app\]/', '', $s);
|
||||
// strip off bbcode
|
||||
$naked_body = preg_replace('/\[(.+?)\]/', '', $naked_body);
|
||||
if (mb_strlen($naked_body) < intval($min_length)) {
|
||||
@@ -300,11 +299,7 @@ function detect_language($s) {
|
||||
* @param string $s Language code to look up
|
||||
* @param string $l (optional) In which language to return the name
|
||||
* @return string with the language name, or $s if unrecognized
|
||||
*
|
||||
* @todo include CommerceGuys\Intl through composer like SabreDAV.
|
||||
*/
|
||||
require_once(__DIR__ . '/../library/intl/vendor/autoload.php');
|
||||
use CommerceGuys\Intl\Language\LanguageRepository;
|
||||
function get_language_name($s, $l = null) {
|
||||
// get() expects the second part to be in upper case
|
||||
if (strpos($s, '-') !== false) $s = substr($s, 0, 2) . strtoupper(substr($s, 2));
|
||||
@@ -322,6 +317,8 @@ function get_language_name($s, $l = null) {
|
||||
$language = $languageRepository->get($s, $l);
|
||||
} catch (CommerceGuys\Intl\Exception\UnknownLanguageException $e) {
|
||||
return $s; // Give up
|
||||
} catch (CommerceGuys\Intl\Exception\UnknownLocaleException $e) {
|
||||
return $s; // Give up
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,7 +376,7 @@ function lang_selector() {
|
||||
$o = replace_macros($tpl, array(
|
||||
'$title' => t('Select an alternate language'),
|
||||
'$langs' => array($lang_options, $selected),
|
||||
|
||||
|
||||
));
|
||||
|
||||
return $o;
|
||||
|
||||
@@ -74,6 +74,9 @@ function photo_upload($channel, $observer, $args) {
|
||||
$imagedata = @file_get_contents($tmp_name);
|
||||
@unlink($tmp_name);
|
||||
}
|
||||
else {
|
||||
$imagedata = @file_get_contents($args['os_syspath']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$imagedata = @file_get_contents($args['os_syspath']);
|
||||
|
||||
@@ -95,10 +95,35 @@ function strip_zids($s) {
|
||||
return preg_replace('/[\?&]zid=(.*?)(&|$)/ism','$2',$s);
|
||||
}
|
||||
|
||||
function strip_owt($s) {
|
||||
return preg_replace('/[\?&]owt=(.*?)(&|$)/ism','$2',$s);
|
||||
}
|
||||
|
||||
function strip_zats($s) {
|
||||
return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s);
|
||||
}
|
||||
|
||||
function strip_auth_query_params() {
|
||||
|
||||
$_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
|
||||
$_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
|
||||
$_SERVER['QUERY_STRING'] = strip_owt($_SERVER['QUERY_STRING']);
|
||||
|
||||
$_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
|
||||
$_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
|
||||
$_SERVER['REQUEST_URI'] = strip_owt($_SERVER['REQUEST_URI']);
|
||||
|
||||
|
||||
$_ENV['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['QUERY_STRING']);
|
||||
$_ENV['QUERY_STRING'] = strip_zids($_ENV['QUERY_STRING']);
|
||||
$_ENV['QUERY_STRING'] = strip_owt($_ENV['QUERY_STRING']);
|
||||
|
||||
$_ENV['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['REQUEST_URI']);
|
||||
$_ENV['REQUEST_URI'] = strip_zids($_ENV['REQUEST_URI']);
|
||||
$_ENV['REQUEST_URI'] = strip_owt($_ENV['REQUEST_URI']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links
|
||||
|
||||
Reference in New Issue
Block a user