diff --git a/graphics/social-sprites-2.png b/graphics/social-sprites-2.png new file mode 100644 index 0000000..5c1163c Binary files /dev/null and b/graphics/social-sprites-2.png differ diff --git a/graphics/social-sprites.xcf b/graphics/social-sprites.xcf index c453b05..902083a 100644 Binary files a/graphics/social-sprites.xcf and b/graphics/social-sprites.xcf differ diff --git a/languages/en.php b/languages/en.php index 0409ea0..2343590 100644 --- a/languages/en.php +++ b/languages/en.php @@ -5,6 +5,7 @@ 'interconnected:profile:share' => "Share this profile using", 'interconnected:no-share' => "This item cannot be shared yet", 'interconnected:profile-on' => "%s's profile on %s", + 'interconnected:share_count' => "total shares of this page on %s: %s", 'interconnected:my-profiles' => "My profiles", 'interconnected:access-denied' => "Only items with an access/privacy level of public and blogs that are published are accessible outside of the community.", 'interconnected:twitter' => 'Twitter', @@ -40,6 +41,8 @@ 'interconnected:title:about' => 'About', 'interconnected:groups' => 'Groups', 'interconnected:members' => 'Members', + 'interconnected:followus-on' => 'Follow us on %s', + 'interconnected:title:followus' => 'Follow us on ', 'interconnected:rootpage:title:activity' => 'Activity at ' . $sitename, 'interconnected:rootpage:title:members' => 'Members at ' . $sitename, 'interconnected:rootpage:title:groups' => 'Groups at ' . $sitename, @@ -94,12 +97,20 @@ 'interconnected:admin:site-logo' => 'a complete (absolute) url for your site logo (version: small image)', 'interconnected:admin:full-site-logo' => 'a complete (absolute) url for your site logo (version: full size image - recommended 600px wide)', 'interconnected:admin:twitter-handle' => '(optional) a twitter handle/id that you use for your site (when pages shared using twitter, the tweet will end with - via @your-twitter-handle)', + 'interconnected:admin:facebook-handle' => '(optional) a facebook page url that you use for your site.', + 'interconnected:admin:googleplus-handle' => '(optional) a google+ profile url that you use for your site.', + 'interconnected:admin:youtube-handle' => '(optional) a youtube profile url that you use for your site.', + 'interconnected:admin:followus-footer' => 'show social media \'follow us\' links in site footer?', 'interconnected:admin:about-me' => "the name of the field the contains the user's about me profile information on your site (default is description)", 'interconnected:admin:group-description' => "the name of the field the contains the description field for your site's groups (default is briefdescription)", 'interconnected:admin:default-title' => "an opengraph (og:title) title to be used when sharing pages that do not have a specific title - generally this will only be for your homepage and does not effect the main html title for the page.", 'interconnected:admin:default-meta-keywords' => "a comma seperated list of keywords to use as default in the metatag section of the page head when no better options are available. e.g. social network,community,sharing", 'interconnected:admin:max-meta-keywords' => "the maximum amount of keywords to display on any page (enter an integer that is greater than or equal to 0)", 'interconnected:admin:max-meta-description' => "the maximum amount of characters to be used in the metatag description for each page (enter an integer that is greater than or equal to 0 - 160 is recommended)", + 'interconnected:admin:button_size' => "the size of the sharing buttons to be displayed.", + 'interconnected:admin:option:small' => "small - icons only", + 'interconnected:admin:option:large' => "large - icons + text", + ); add_translation("en", $english); ?> \ No newline at end of file diff --git a/lib/interconnected.php b/lib/interconnected.php index 256125a..c1e32e6 100644 --- a/lib/interconnected.php +++ b/lib/interconnected.php @@ -7,6 +7,38 @@ * @website infiniteeureka.com */ +function interconnected_get_counts($url){ + + if ($url) + { + $app_id = 'appID=' . 'v7JUl2UxgA2mC4YjHl0j06z8' . '&'; // set this in admin panel + $url = 'http://api.aljtmedia.com/social/?' . $app_id . 'url=' . $url; + + +http://api.aljtmedia.com/social/?appID=v7JUl2UxgA2mC4YjHl0j06z8&url=https://www.infiniteeureka.com/ + # Setup cURL + $curl = curl_init(); + + # URL to call + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json')); + + # Get the response + $response = curl_exec($curl); + + # Close connection + curl_close($curl); + + # Return JSON + return json_decode($response, true); + } + else { + return false; + } + +} + function interconnected_analyze_url($url) { if (!class_exists('UFCOE\\Elgg\\Url')) { @@ -75,6 +107,12 @@ function get_sharing_data_for_current_page() $group_description = elgg_get_plugin_setting('group_description', 'interconnected'); + $button_size = elgg_get_plugin_setting('button_size', 'interconnected'); + if ($button_size) + $content['button_size'] = $button_size; + else + $content['button_size'] = $button_size='large'; + $context = elgg_get_context(); $url = current_page_url(); $url_array = interconnected_analyze_url($url); @@ -127,14 +165,7 @@ function get_sharing_data_for_current_page() else { $item_title = $entity->title; - $access_id = $entity->access_id; - $access_id_string = get_readable_access_level($access_id); - - if (($access_id_string != 'Public')&&($access_id_string != 'public')) - { - $content['access_denied'] = TRUE; - } - + switch ($subtype) { case 'blog': @@ -177,6 +208,8 @@ function get_sharing_data_for_current_page() { $icon_url = $entity->getIconURL($size); $full_icon_url = $entity->getIconURL($full_size); + $album_entity = get_entity($entity->container_guid); + $access_id = $album_entity->access_id; } $description = $entity->description; $subtext = elgg_echo('interconnected:' . $subtype) .' ' . $author . '... '; @@ -202,7 +235,16 @@ function get_sharing_data_for_current_page() $type = 'article'; break; } - } + } + if (!$access_id) + $access_id = $entity->access_id; + $access_id_string = get_readable_access_level($access_id); + + if (($access_id_string != 'Public')&&($access_id_string != 'public')) + { + $content['access_denied'] = TRUE; + } + } } diff --git a/manifest.xml b/manifest.xml index 58c9300..bb43a94 100644 --- a/manifest.xml +++ b/manifest.xml @@ -2,7 +2,7 @@ interconnected ura soul - 0.1.10 + 1.2 for social sharing and seo without bloatage https://www.infiniteeureka.com GNU Public License version 2 diff --git a/readme.txt b/readme.txt index f1011b0..807ea4b 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ * interconnected - elgg plugin * @license GNU Public License version 2 * @author ura soul - * @website https://www.infiniteeureka.com - donations may increase capacity for creating freely shared code and are gladly received - * @functionality - connects elgg sites to other social sites and improves seo - includes simple sharing buttons for common social networks and opengraph metatags + * @website https://www.infiniteeureka.com - donations gladly received + * @functionality - connects elgg sites to other social sites and improves seo - includes simple sharing buttons for common social networks */ @@ -15,40 +15,28 @@ This plugin uses various methods to allow users to share elgg items/pages on var features: -* adds sharing buttons to appropriate locations in elgg - currently adds a sidebar module to appropriate elgg pages and buttons to the bottom of profile info boxes (you can edit start.php to change this). -* passes appropriate images/thumbnails and text to target sites for sharing. -* adds opengraph and standard metatags to each page header to ensure sites that use metatag fields (e.g. tag: xmlns:og="http://ogp.me/ns#" so the full html tag will look like this: @@ -57,16 +45,7 @@ todo: * could add a settings page for each user to allow them to write their default greeting or signature for messages sent to external sharing services. * setting option to choose whether to share internal urls for videos/bookmarks or to share source urls. e.g. share youtube videos directly or share elgg page. -* add more target sites (tumblr coming soon) +* add more target sites * integrate wire functionality to allow wire posts to be auto-shared to multiple target sites. * integrate multi-access functionality to upgrade thewire to allow posts to be made to multiple subsets of users, rather than only to public. * auto-share option for new items (requires extension/over-riding of 'add' forms - and/or a hook). -* fix: linked-in does not pick up images when pages are shared. -* better support for groups - (requires re-structuring of functions) - -notes: - -* og:author is not included because facebook uses that to point to a facebook profile and if we add data to that field that contains spaces, the facebook validator will error. -* og:image for groups - there are not master icons available for groups in elgg... which results in fb complaining that some group images are too small. -* facebook's sharer page and opengraph code is sometimes glitchy - even when image paths are passed directly to facebook they sometimes do not render - regardless of whether the facebook opengraph debugger throws an error or not. - diff --git a/start.php b/start.php index 728e1a5..818e3e7 100644 --- a/start.php +++ b/start.php @@ -11,17 +11,15 @@ function interconnected_init() { - $context = elgg_get_context(); - // elgg_dump($context); $lib = elgg_get_plugins_path() . 'interconnected/lib/interconnected.php'; elgg_register_library('interconnected', $lib); elgg_load_library('interconnected'); elgg_extend_view('css/admin', 'interconnected/admin', 1); elgg_extend_view('page/elements/head', 'interconnected/metatags', 500); - if (($context != 'admin')&&($context != 'members')&&($context != 'messages')&&($context != 'co-creators')&&($context != 'reportedcontent')&&($context != 'settings')&&($context != 'suggested_friends')&&($context != 'suggested_friends_extended')) + elgg_extend_view('css/elgg', 'interconnected/css'); + if ((!elgg_in_context('admin'))&&(!elgg_in_context('members'))&&(!elgg_in_context('messages'))&&(!elgg_in_context('co-creators'))&&(!elgg_in_context('reportedcontent'))&&(!elgg_in_context('settings'))&&(!elgg_in_context('suggested_friends'))&&(!elgg_in_context('suggested_friends_extended'))) { - elgg_extend_view('css/elgg', 'interconnected/css'); elgg_extend_view('page/elements/sidebar','sidebar/interconnected',700); elgg_extend_view('profile/details','interconnected/profile',500); elgg_extend_view('widgets/set_description/content', 'interconnected/simple', 500); diff --git a/views/default/interconnected/css.php b/views/default/interconnected/css.php index 5aa40b3..346c013 100644 --- a/views/default/interconnected/css.php +++ b/views/default/interconnected/css.php @@ -13,6 +13,11 @@ padding-right:6px; } + .elgg-sharing-wrapper-simple > label { + position:relative; + top:6px; + } + .elgg-sharing-wrapper { display:inline-block; @@ -26,7 +31,7 @@ margin-right: 8px; margin-top: 5px; } -.elgg-button-share{ +.elgg-button-share-small,.elgg-button-share-large{ background-size: contain!important; color: #000; font-size: 15px!important; @@ -34,15 +39,16 @@ line-height:22px; } -.elgg-button-share:hover { +.elgg-button-share-small:hover,.elgg-button-share-large:hover { transition: 0s ease-in-out; } -.elgg-sharing-logo{ +.elgg-sharing-logo-small,.elgg-sharing-logo-large{ width:22px; height:22px; display:inline-block; background-size:cover!important; + background: url('')no-repeat; } .elgg-my-profiles{ @@ -57,24 +63,44 @@ margin: 10px 0 0 0!important; } +.elgg-share-count{ + background:white; + border:1px solid black; + border-radius:4px; + color:black; + padding: 0 3px; + font-size: 0.9em; + display:inline-block; + float:right; + margin-left: -4px; +} + +.elgg-share-count-arrow{ + color:white; + font-size: 0.8em; + margin-left: -3px; + float:right; + display:inline-block; +} + .elgg-social-shortcut{ margin:3px; display: inline-block; } -.elgg-sharing-logo{ - background: url('')no-repeat; -} - -.elgg-button-twitter, .elgg-button-email,.elgg-button-pinterest, -.elgg-button-stumbleupon,.elgg-button-googleplus { +.elgg-button-share-large.elgg-button-twitter, .elgg-button-share-large.elgg-button-email,.elgg-button-share-large.elgg-button-pinterest, +.elgg-button-share-large.elgg-button-stumbleupon,.elgg-button-share-large.elgg-button-googleplus,.elgg-button-share-large.elgg-button-facebook { padding: 0 4px 0px 0px!important; } - .elgg-button-linkedin{ + .elgg-button-share-large.elgg-button-linkedin{ padding: 0 0px 0px 4px!important; } +.elgg-button-share-small{ + padding:0px!important; +} + .elgg-button-twitter, .elgg-button-linkedin, .elgg-button-email,.elgg-button-pinterest, .elgg-button-stumbleupon{ background: rgb(255,255,255); /* Old browsers */ @@ -100,31 +126,43 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#c0c0c0',GradientType=0 ); /* IE6-9 */ } -.elgg-button-twitter .elgg-sharing-logo, .elgg-button-facebook .elgg-sharing-logo, .elgg-button-email .elgg-sharing-logo, .elgg-button-googleplus .elgg-sharing-logo,.elgg-button-stumbleupon .elgg-sharing-logo,.elgg-button-pinterest .elgg-sharing-logo { - float:left; +.elgg-button-twitter .elgg-sharing-logo-large, .elgg-button-facebook .elgg-sharing-logo-large, .elgg-button-email .elgg-sharing-logo-large, .elgg-button-googleplus .elgg-sharing-logo-large,.elgg-button-stumbleupon .elgg-sharing-logo-large,.elgg-button-pinterest .elgg-sharing-logo-large { margin-right:3px; } -.elgg-button-linkedin .elgg-sharing-logo{ - float:right; +.elgg-button-twitter .elgg-sharing-logo-large, .elgg-button-facebook .elgg-sharing-logo-large, .elgg-button-email .elgg-sharing-logo-large, .elgg-button-googleplus .elgg-sharing-logo-large,.elgg-button-stumbleupon .elgg-sharing-logo-large,.elgg-button-pinterest .elgg-sharing-logo-large,.elgg-button-twitter .elgg-sharing-logo-small, .elgg-button-facebook .elgg-sharing-logo-small, .elgg-button-email .elgg-sharing-logo-small, .elgg-button-googleplus .elgg-sharing-logo-small,.elgg-button-stumbleupon .elgg-sharing-logo-small,.elgg-button-pinterest .elgg-sharing-logo-small +{ + float:left; +} + +.elgg-button-email .elgg-sharing-logo-small,.elgg-button-email .elgg-sharing-logo-large{ + background-position: -2px!important; +} + +.elgg-button-linkedin .elgg-sharing-logo-large{ margin-left:3px; - background-position: -132px!important; } -.elgg-button-twitter .elgg-sharing-logo{ - background-position: -66px!important; +.elgg-button-linkedin .elgg-sharing-logo-large,.elgg-button-linkedin .elgg-sharing-logo-small +{ + float:right; + background-position: -154px!important; +} + +.elgg-button-twitter .elgg-sharing-logo-small,.elgg-button-twitter .elgg-sharing-logo-large{ + background-position: -78px!important; } -.elgg-button-googleplus .elgg-sharing-logo{ - background-position: -44px!important; +.elgg-button-googleplus .elgg-sharing-logo-small,.elgg-button-googleplus .elgg-sharing-logo-large{ + background-position: -52px!important; } -.elgg-button-pinterest .elgg-sharing-logo{ - background-position: -87px!important; +.elgg-button-pinterest .elgg-sharing-logo-small,.elgg-button-pinterest .elgg-sharing-logo-large{ + background-position: -104px!important; } -.elgg-button-stumbleupon .elgg-sharing-logo{ - background-position: -109px!important; +.elgg-button-stumbleupon .elgg-sharing-logo-small,.elgg-button-stumbleupon .elgg-sharing-logo-large{ + background-position: -127px!important; } .elgg-button-facebook{ @@ -138,11 +176,10 @@ background: linear-gradient(to bottom, rgba(119,122,163,1) 0%,rgba(42,96,198,1) 4%,rgba(48,80,141,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#777aa3', endColorstr='#30508d',GradientType=0 ); /* IE6-9 */ border: 1px solid rgb(61, 94, 158); - padding: 0 4px 0px 0px!important; } -.elgg-button-facebook .elgg-sharing-logo{ - background-position: -22px!important; +.elgg-button-facebook .elgg-sharing-logo-small,.elgg-button-facebook .elgg-sharing-logo-large { + background-position: -26px!important; } .elgg-button-facebook:hover{ border: 1px solid rgb(78, 117, 192); diff --git a/views/default/interconnected/followus.php b/views/default/interconnected/followus.php new file mode 100644 index 0000000..2f8bf05 --- /dev/null +++ b/views/default/interconnected/followus.php @@ -0,0 +1,32 @@ +$href, + 'text'=>elgg_view('output/img', array('src'=> elgg_get_site_url(). 'mod/interconnected/graphics/' . $site . '.png', + 'alt'=> elgg_echo('interconnected:followus-on', array($site)), + 'title' => elgg_echo('interconnected:followus-on', array($site)))))); + $to_output = TRUE; + } + $count++; + if ($count < count($target_sites)) + $output .= ' '; +} +if ($to_output == TRUE) + echo '
' . ' ' . $output . '
'; +?> \ No newline at end of file diff --git a/views/default/interconnected/interconnected.php b/views/default/interconnected/interconnected.php index b73fc6e..c219347 100644 --- a/views/default/interconnected/interconnected.php +++ b/views/default/interconnected/interconnected.php @@ -19,13 +19,14 @@ - $item_title = $INTERCONNECTED_PAGE_DATA['item_title']; - $subtext = $INTERCONNECTED_PAGE_DATA['subtext']; - $description = $INTERCONNECTED_PAGE_DATA['description']; + $item_title = elgg_get_excerpt($INTERCONNECTED_PAGE_DATA['item_title'],250); + $subtext = elgg_get_excerpt($INTERCONNECTED_PAGE_DATA['subtext'],250); + $description = elgg_get_excerpt($INTERCONNECTED_PAGE_DATA['description'],250); $icon_url = $INTERCONNECTED_PAGE_DATA['icon_url']; $full_icon_url = $INTERCONNECTED_PAGE_DATA['full_icon_url']; $url = $INTERCONNECTED_PAGE_DATA['url']; $twitter_handle = $INTERCONNECTED_PAGE_DATA['twitter_handle']; + $button_size = $INTERCONNECTED_PAGE_DATA['button_size']; // clean fields ready for html output @@ -58,11 +59,15 @@ 'twitter_handle' => $twitter_handle, 'item_title' => $item_title, 'subtext' => $subtext, - 'description' => $description); + 'description' => $description, + 'button_size' => $button_size, + //'counts' => interconnected_get_counts(current_page_url()), + ); $body = '