From: friendica Date: Tue, 17 Apr 2012 05:57:34 +0000 (-0700) Subject: small fix to mathjax. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=54d98689fab14505149d4dab770ba034990a0920;p=friendica-addons.git small fix to mathjax. --- diff --git a/convpath.tgz b/convpath.tgz new file mode 100644 index 00000000..2c43d3d3 Binary files /dev/null and b/convpath.tgz differ diff --git a/facebook.tgz b/facebook.tgz index 2b643e70..6660aa8d 100644 Binary files a/facebook.tgz and b/facebook.tgz differ diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php deleted file mode 100755 index 09b6c605..00000000 --- a/fromgplus/fromgplus.php +++ /dev/null @@ -1,181 +0,0 @@ - - * - */ - -function fromgplus_install() { - register_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); - register_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); -} - -function fromgplus_uninstall() { - unregister_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); - unregister_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); -} - -function fromgplus_addon_settings(&$a,&$s) { - - if(! local_user()) - return; - - $enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : ''); - $account = get_pconfig(local_user(),'fromgplus','account'); - - $s .= '
'; - $s .= '

' . t('Google+ Import Settings').'

'; - $s .= '
'; - - $s .= ''; - $s .= ''; - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - - $s .= '
'; - $s .= '
'; - - return; -} - -function fromgplus_addon_settings_post(&$a,&$b) { - - if(! local_user()) - return; - - if($_POST['fromgplus-submit']) { - set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account'])); - $enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0); - set_pconfig(local_user(),'fromgplus','enable', $enable); - info( t('Google+ Import Settings saved.') . EOL); - } -} -/* -function html2bbcode($html) { - - $bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8'); - - $bbcode = str_replace(array("\n"), array(""), $bbcode); - $bbcode = str_replace(array("", ""), array("[b]", "[/b]"), $bbcode); - $bbcode = str_replace(array("", ""), array("[i]", "[/i]"), $bbcode); - $bbcode = str_replace(array("", ""), array("[s]", "[/s]"), $bbcode); - $bbcode = str_replace(array("
"), array("\n"), $bbcode); - - $bbcode = trim(strip_tags($bbcode)); - return($bbcode); -} - -function friendicapost($post) { - global $friendica; - - $api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]); - $ret = $api->updateStatus($post); - $api->endSession(); -} - -function handleattachments($item) { - $post = ""; - - foreach ($item->object->attachments as $attachment) { - switch($attachment->objectType) { - case "video": - //$post .= "\n\n[url=".$attachment->url."]". - // "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - $post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n"; - - //if (strpos($attachment->embed->url, "youtube.com")) - // $post .= "[youtube]".$attachment->url."[/youtube]\n"; - //else - /// $post .= "[url=".$attachment->url."][img]".$attachment->image->url."[/img][/url]\n"; - - ///$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]"; - break; - - case "article": - //$post .= "\n\n[url=".$attachment->url."]". - // "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - $post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n"; - $post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]"; - break; - - case "photo": - //$post .= "\n\n[url=".$attachment->fullImage->url."]". - // "[img]".$attachment->fullImage->url."[/img][/url]\n"; - $post .= "\n\n[img]".$attachment->fullImage->url."[/img]\n"; - if ($attachment->displayName != "") - $post .= html2bbcode($attachment->displayName)."\n"; - break; - - case "photo-album": - $post .= "\n\n[url=".$attachment->url."]". - "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - break; - - default: - print_r($attachment); - die(); - break; - } - } - return($post); -} - -$result = file_get_contents("https://www.googleapis.com/plus/v1/people/".$google["id"]."/activities/public?alt=json&pp=1&key=".$google["key"]."&maxResults=".$google["maxfetch"]); -$activities = json_decode($result); - -$state = array("lastid"=>''); -if (file_exists($statefile)) - $state = unserialize(file_get_contents($statefile)); - -$lastid = ""; - -foreach($activities->items as $item) { - if ($item->id == $state["lastid"]) - break; - - if ($lastid == "") - $lastid = $item->id; - - switch($item->object->objectType) { - case "note": - $post = html2bbcode($item->object->content); - - if (is_array($item->object->attachments)) - $post .= handleattachments($item); - friendicapost($post); - break; - - case "activity": - $post = html2bbcode($item->annotation)."\n"; - //$post .= html2bbcode("♲ "); - $post .= html2bbcode("♻ "); - $post .= "[url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url]"; - $post .= " \n"; - //$post .= "[quote]"; - - $post .= html2bbcode($item->object->content); - - if (is_array($item->object->attachments)) - $post .= "\n".trim(handleattachments($item)); - - //$post .= "[/quote]"; - - friendicapost($post); - break; - - default: - print_r($item); - die(); - break; - } -} - -if ($lastid != "") { - $state['lastid'] = $lastid; - file_put_contents($statefile, serialize($state)); -} -*/ diff --git a/fromgplus/tofriendica.php b/fromgplus/tofriendica.php deleted file mode 100644 index b185ecc1..00000000 --- a/fromgplus/tofriendica.php +++ /dev/null @@ -1,128 +0,0 @@ -", ""), array("[b]", "[/b]"), $bbcode); - $bbcode = str_replace(array("", ""), array("[i]", "[/i]"), $bbcode); - $bbcode = str_replace(array("", ""), array("[s]", "[/s]"), $bbcode); - $bbcode = str_replace(array("
"), array("\n"), $bbcode); - - $bbcode = trim(strip_tags($bbcode)); - return($bbcode); -} - -function friendicapost($post) { - global $friendica; - - $api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]); - $ret = $api->updateStatus($post); - $api->endSession(); -} - -function handleattachments($item) { - $post = ""; - - foreach ($item->object->attachments as $attachment) { - switch($attachment->objectType) { - case "video": - //$post .= "\n\n[url=".$attachment->url."]". - // "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - $post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n"; - - //if (strpos($attachment->embed->url, "youtube.com")) - // $post .= "[youtube]".$attachment->url."[/youtube]\n"; - //else - /// $post .= "[url=".$attachment->url."][img]".$attachment->image->url."[/img][/url]\n"; - - ///$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]"; - break; - - case "article": - //$post .= "\n\n[url=".$attachment->url."]". - // "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - $post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n"; - $post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]"; - break; - - case "photo": - //$post .= "\n\n[url=".$attachment->fullImage->url."]". - // "[img]".$attachment->fullImage->url."[/img][/url]\n"; - $post .= "\n\n[img]".$attachment->fullImage->url."[/img]\n"; - if ($attachment->displayName != "") - $post .= html2bbcode($attachment->displayName)."\n"; - break; - - case "photo-album": - $post .= "\n\n[url=".$attachment->url."]". - "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n"; - break; - - default: - print_r($attachment); - die(); - break; - } - } - return($post); -} - -$result = file_get_contents("https://www.googleapis.com/plus/v1/people/".$google["id"]."/activities/public?alt=json&pp=1&key=".$google["key"]."&maxResults=".$google["maxfetch"]); -$activities = json_decode($result); - -$state = array("lastid"=>''); -if (file_exists($statefile)) - $state = unserialize(file_get_contents($statefile)); - -$lastid = ""; - -foreach($activities->items as $item) { - if ($item->id == $state["lastid"]) - break; - - if ($lastid == "") - $lastid = $item->id; - - switch($item->object->objectType) { - case "note": - $post = html2bbcode($item->object->content); - - if (is_array($item->object->attachments)) - $post .= handleattachments($item); - friendicapost($post); - break; - - case "activity": - $post = html2bbcode($item->annotation)."\n"; - //$post .= html2bbcode("♲ "); - $post .= html2bbcode("♻ "); - $post .= "[url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url]"; - $post .= " \n"; - //$post .= "[quote]"; - - $post .= html2bbcode($item->object->content); - - if (is_array($item->object->attachments)) - $post .= "\n".trim(handleattachments($item)); - - //$post .= "[/quote]"; - - friendicapost($post); - break; - - default: - print_r($item); - die(); - break; - } -} - -if ($lastid != "") { - $state['lastid'] = $lastid; - file_put_contents($statefile, serialize($state)); -} -?> diff --git a/mathjax.tgz b/mathjax.tgz new file mode 100644 index 00000000..bb591e1d Binary files /dev/null and b/mathjax.tgz differ diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 69df4225..7105772b 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -48,7 +48,9 @@ function mathjax_settings (&$a, &$s) { function mathjax_page_header($a, &$b) { // if the visitor of the page is not a local_user, use MathJax // otherwise check the users settings. - $url = get_config ('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); + $url = get_config ('mathjax','baseurl'); + if(! $url) + $url = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; if (! local_user()) { $b .= ''; } else {