Skip to content

Commit

Permalink
v 1.2 - added button size option, plus various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ura soul committed May 6, 2014
1 parent 14b5e9c commit 3173fc8
Show file tree
Hide file tree
Showing 20 changed files with 300 additions and 93 deletions.
Binary file added graphics/social-sprites-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/social-sprites.xcf
Binary file not shown.
11 changes: 11 additions & 0 deletions languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>public</i> and blogs that are <i>published</i> are accessible outside of the community.",
'interconnected:twitter' => 'Twitter',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 <i>about me</i> profile information on your site (default is <i>description</i>)",
'interconnected:admin:group-description' => "the name of the field the contains the <i>description</i> field for your site's groups (default is <i>briefdescription</i>)",
'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);
?>
60 changes: 51 additions & 9 deletions lib/interconnected.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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 . '... ';
Expand All @@ -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;
}

}

}
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
<name>interconnected</name>
<author>ura soul</author>
<version>0.1.10</version>
<version>1.2</version>
<description>for social sharing and seo without bloatage</description>
<website>https://www.infiniteeureka.com</website>
<license>GNU Public License version 2</license>
Expand Down
37 changes: 8 additions & 29 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/


Expand All @@ -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. <meta property="og:image") for sharing are accessing the correct information (this also improves SEO).
* adds descriptive text and titles to common pages in elgg which otherwise would be non-unique.
* adds profile buttons for social site profiles belonging to profile owner (using profile_manager fields).
* adds sharing buttons to appropriate locations in elgg - currently adds a sidebar module to many 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.
* adds metatags to each page header to ensure sites that use metatag fields (e.g. <meta property="og:image") for sharing are accessing the correct information (this also improves SEO).
* supports common elgg objects such as videolist, tidypics, blogs, pages, bookmarks, files and pinboards etc. (sharing items from pages created by other 3rd party plugins may function correctly or may not - these plugins are not all tested).
* supports site-wide categories and the hypecategories plugin.
* allows twitter tweets to be linked automatically to a twitter handle that is specific for your site (requires admin setting to be configured).
* code is lightweight and does not use external server connections until sharing occurs.
* can be extended to include more target sites - will be made easier in future releases.
* can be easily extended to include more target sites.
* includes a widget for homepage_cms (could be used for other areas of elgg if desired).
* all text is multi-language compatible.
* supports profile manager's custom field features to allow profile/group data, such as 'about me' for profiles, to be shared (requires field names being configured in the admin settings for this plugin).
* supports profile manager's custom field capabality to allow profile data to be auto-shared (requires admin setting to be configured).
* allows different sized images to be used when sharing the homepage or other areas of the site which do not have images (large or small version images).
* intelligently chooses images to be used if no icons are available - may use group icon, item container, item owner or site default images.
* supports profile_url plugin.
* uses url sniffing to be view independent - so you can 'theoretically' use the views in this plugin anywhere on an elgg site.
* does not allow non-public items (and unpublished blogs) to be shared since they cannot be seen by recipient sites.
* supports the pagehandler_hijack plugin feature of changing the url path of different parts of the site.
* supports the donation modules.
* if entities are shared from an edit page or non 'view' mode page, the resulting url will point to the 'view' version of the page.

install:

1. deactivate and remove any previous version of the plugin from the mod folder
2. extract the zip file for this plugin and move the extracted files into the mod folder
3. activate the plugin.
4. optional: create profile fields in profile_manager for social profiles. they should be of type 'url'. currently the supported sites are as follows:

* youtube (name the profile field as: youtube)
* google+ (name the profile field as: googleplus)
* twitter (name the profile field as: twitter)
* facebook (name the profile field as: facebook)
* linked in (name the profile field as: linkedin)

n.b. you will need to edit the views/default/page/default.php file to include the opengraph namespace before your pages will fully comply with the opengraph standard. this plugin does not include the change since this file is such a fundamental file of an elgg installation. to make the change yourself you only need to add the following tag inside the <html> tag: xmlns:og="http://ogp.me/ns#"
so the full html tag will look like this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xml:lang="<?php echo $lang; ?>" lang="<?php echo $lang; ?>">
Expand All @@ -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.

6 changes: 2 additions & 4 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 3173fc8

Please sign in to comment.