Modified Files:
functions.php
Log Message:
added first implementation of social functions
Index: functions.php
===================================================================
RCS file: /cvsroot/flatnuke/flatnuke/functions.php,v
retrieving revision 1.352
retrieving revision 1.353
diff -C2 -d -r1.352 -r1.353
*** functions.php 26 Feb 2012 10:41:15 -0000 1.352
--- functions.php 27 Feb 2012 15:16:05 -0000 1.353
***************
*** 163,166 ****
--- 163,175 ----
}
+ //creo i link per i siti sociali (se non siamo in una sezione di notizie)
+ if (!file_exists(_FN_SECTIONS_DIR."/"._FN_MOD."/news")){
+ echo "<div class='social-links' style='float:right;margin-left:10px;margin-bottom:10px;/*border:1px;
+ border-left-style: solid; border-bottom-style: solid;border-color: #d5d6d7;*/'>";
+ // echo "<div class='social-links'>";
+ create_social_links($_SERVER["SERVER_NAME"].$_SERVER['PHP_SELF'],_FN_TITLE);
+ echo "</div>";
+ }
+
// Include code for section's header
load_php_code("include/section/header");
***************
*** 4537,4539 ****
--- 4546,4590 ----
}
+ /**
+ * Crea i link con le icone per segnalre la risorsa specificata nei siti sociali
+ * @param string $link il link da segnalare
+ * @param string $title il titolo (non viene utilizzato da tutti i siti)
+ * @author Aldo Boccacci
+ * @since 3.0.1
+ */
+ function create_social_links($link,$title){
+ $link = getparam($link,PAR_NULL,SAN_NULL);
+ $title = getparam($title,PAR_NULL,SAN_NULL);
+ $link = urlencode(strip_tags(stripslashes($link)));
+ $title = urlencode(strip_tags(stripslashes($title)));
+
+ $social = "";
+ if (file_exists("images/social/facebook.png"))
+ $social = "<a href=\"http://www.facebook.com/share.php?u=$link&t='$title'\" title=\"facebook\"><img src=\"images/social/facebook.png\" alt=\"facebook\"></a>";
+ if (file_exists("images/social/twitter.png"))
+ $social .= "<a href=\"http://twitter.com/home?status=$link\" title=\"twitter\"><img src=\"images/social/twitter.png\" alt=\"twitter\"></a>";
+ if (file_exists("images/social/linkedin.png"))
+ $social .= "<a href=\"http://www.linkedin.com/shareArticle?mini=true&url=$link&title=$title\" title=\"linkedin\"><img src=\"images/social/linkedin.png\" alt=\"linkedin\"></a>";
+ if (file_exists("images/social/google.png"))
+ $social .= "<script type=\"text/javascript\">document.write(' <g:plusone annotation=\"none\"><\/g:plusone>');</script>";
+ echo $social;
+
+ //if file google.png doesn't exist we don't need Google script
+ if (file_exists("images/social/google.png")){
+ ?>
+
+ <!-- Code from Google for adding +1 button -->
+ <script type="text/javascript">
+ window.___gcfg = {lang: 'it'};
+
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+ </script>
+ <?php
+ }//fine controllo esistenza file google.png
+
+ }//fine funzione create_social_links
?>
\ No newline at end of file