-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ura soul
committed
Jan 12, 2014
0 parents
commit ece147e
Showing
41 changed files
with
1,288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
/** | ||
* Url Sniffer by Steve Clay (ufcoe) | ||
* @link https://gist.github.com/mrclay/5016415 | ||
*/ | ||
namespace UFCOE\Elgg; | ||
|
||
class Url { | ||
|
||
protected $host; | ||
protected $path; | ||
protected $scheme; | ||
|
||
/** | ||
* @param string $siteUrl if not given, will retrieve from elgg_get_site_url() | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function __construct($siteUrl = null) { | ||
if (!$siteUrl && is_callable('elgg_get_site_url')) { | ||
$siteUrl = elgg_get_site_url(); | ||
} | ||
if (!preg_match('~^(https?)\\://([^/]+)(/.*)~', $siteUrl, $m)) { | ||
throw new \InvalidArgumentException('$siteUrl must be full URL'); | ||
} | ||
$this->scheme = $m[1]; | ||
$this->host = $m[2]; | ||
$this->path = $m[3]; | ||
} | ||
|
||
/** | ||
* @param string $url | ||
* @return int 0 if no GUID found | ||
*/ | ||
public function getGuid($url) { | ||
$url = $this->analyze($url); | ||
return ($url && $url['guid']) ? $url['guid'] : 0; | ||
} | ||
|
||
/** | ||
* @param string $url | ||
* @return array|bool | ||
*/ | ||
public function analyze($url) { | ||
$url = trim($url); | ||
if (!preg_match('~^(https?)\\://([^/]+)(/[^\\?]*)~', $url, $m)) { | ||
return false; | ||
} | ||
list (, $scheme, $host, $path) = $m; | ||
$ret = array( | ||
'scheme_matches' => ($scheme === $this->scheme), | ||
'host_matches' => ($host === $this->host), | ||
'guid' => null, | ||
'action' => null, | ||
'handler' => null, | ||
'handler_segments' => array(), | ||
); | ||
$ret['in_site'] = ($ret['host_matches'] && (0 === strpos($path, $this->path))); | ||
if ($ret['in_site']) { | ||
$sitePath = substr($path, strlen($this->path)); | ||
if (preg_match('~^action/(.*)~', $sitePath, $m)) { | ||
if (preg_match('~^[^/]~', $m[1])) { | ||
$ret['action'] = $m[1]; | ||
} | ||
} else { | ||
$segments = explode('/', $sitePath); | ||
if (!empty($segments[0])) { | ||
$ret['handler'] = $segments[0]; | ||
$ret['handler_segments'] = array_slice($segments, 1); | ||
if ($segments[0] !== 'profile') { | ||
if ((count($segments) >= 3) | ||
&& in_array($segments[1], array('view', 'read')) | ||
&& preg_match('~^[1-9]\\d*$~', $segments[2])) { | ||
$ret['guid'] = (int) $segments[2]; | ||
|
||
// less-reliable guessing | ||
} elseif (preg_match('~^(?:[^/]+/)+([1-9]\\d*)(?:$|/)~', $sitePath, $m)) { | ||
$ret['guid'] = (int) $m[1]; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return $ret; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
$sitename = $CONFIG->sitename; | ||
$english = array( | ||
'interconnected:share' => 'Share this page using', | ||
'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: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', | ||
'interconnected:facebook' => 'facebook', | ||
'interconnected:googleplus' => 'Google+', | ||
'interconnected:linkedin' => 'Linked in', | ||
'interconnected:linkedin-button' => 'Linked', | ||
'interconnected:pinterest' => 'Pinterest', | ||
'interconnected:stumbleupon' => 'StumbleUpon', | ||
'interconnected:youtube' => 'Youtube', | ||
'interconnected:email' => 'Email', | ||
'interconnected:source' => 'Source: ', | ||
'interconnected:hjcategory' => 'Category from ' . $sitename . ':', | ||
'interconnected:videolist_item' => 'A video shared by', | ||
'interconnected:file' => 'A file shared by', | ||
'interconnected:image' => 'An image shared by', | ||
'interconnected:album' => 'An image album shared by', | ||
'interconnected:blog' => 'A blog shared by', | ||
'interconnected:bookmarks' => 'A bookmark shared by', | ||
'interconnected:page_top' => 'A page shared by', | ||
'interconnected:page' => 'A page shared by', | ||
'interconnected:pinboards' => 'A pinboard shared by', | ||
'interconnected:market' => 'An item for sale, shared by', | ||
'interconnected:event' => 'An event shared by', | ||
'interconnected:thewire' => 'A status update from', | ||
'interconnected:title:profile' => "%s's profile at " . $sitename . ':', | ||
'interconnected:profile' => "Profile", | ||
'interconnected:friends' => "Friends", | ||
'interconnected:category' => 'Category', | ||
'interconnected:categories' => 'Categories', | ||
'interconnected:title:privacy' => 'Privacy policy', | ||
'interconnected:title:terms' => 'Terms of use', | ||
'interconnected:title:about' => 'About', | ||
'interconnected:groups' => 'Groups', | ||
'interconnected:members' => 'Members', | ||
'interconnected:rootpage:title:activity' => 'Activity at ' . $sitename, | ||
'interconnected:rootpage:title:members' => 'Members at ' . $sitename, | ||
'interconnected:rootpage:title:groups' => 'Groups at ' . $sitename, | ||
'interconnected:rootpage:title:file' => 'Files at ' . $sitename, | ||
'interconnected:rootpage:title:blog' => 'Blogs at ' . $sitename, | ||
'interconnected:rootpage:title:photos' => 'Images at ' . $sitename, | ||
'interconnected:rootpage:title:albums' => 'Image albums at ' . $sitename, | ||
'interconnected:rootpage:title:events' => 'Events listed at ' . $sitename, | ||
'interconnected:rootpage:title:videolist' => 'Videos at ' . $sitename, | ||
'interconnected:rootpage:title:bookmarks' => 'Bookmarks at ' . $sitename, | ||
'interconnected:rootpage:title:pages' => 'Pages at ' . $sitename, | ||
'interconnected:rootpage:title:thewire' => 'Status updates at ' . $sitename, | ||
'interconnected:rootpage:title:pinboards' => 'Pinboards at ' . $sitename, | ||
'interconnected:rootpage:title:market' => 'Items being traded at ' . $sitename, | ||
'interconnected:title:friends' => "%s's friends at " . $sitename, | ||
'interconnected:rootpage:title:categories' => 'Categorised items from ' . $sitename, | ||
'interconnected:rootpage:title:privacy' => 'The privacy policy at ' . $sitename, | ||
'interconnected:rootpage:title:terms' => 'The terms of use agreement at ' . $sitename, | ||
'interconnected:rootpage:title:search' => 'Search results information from ' . $sitename, | ||
'interconnected:rootpage:title:tags' => 'The top tags in the community at ' . $sitename, | ||
'interconnected:rootpage:title:donation' => 'Donations to support ' . $sitename, | ||
'interconnected:rootpage:description:donation' => 'Here you can use a variety of online methods to make donations to support the operations of the community at ' . $sitename, | ||
'interconnected:rootpage:title:liked_content' => 'The most liked items at ' . $sitename, | ||
'interconnected:rootpage:description:liked_content' => 'This list shows which items are the most popular with members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:tags' => 'These are the most commonly used tags for items that have been added to the community at ' . $sitename, | ||
'interconnected:rootpage:description:activity' => 'The full list of the activity in the community at ' . $sitename, | ||
'interconnected:rootpage:description:members' => 'The full list of the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:groups' => 'The full list of groups that have been created by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:file' => 'The full list of files that have been uploaded and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:blog' => 'The full list of blogs that have been created and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:photos' => 'The full list of images that have been created and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:albums' => 'The full list of Image albums that have been created and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:events' => 'The full list of events that have been listed by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:videolist' => 'The full list of videos that have been found and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:bookmarks' => 'The full list of bookmarks that have been found and shared by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:pages' => 'The full list of pages that have been created by the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:thewire' => 'The full list of publicly shared status updates from the members of the community at ' . $sitename, | ||
'interconnected:rootpage:description:pinboards' => 'The pinboards at ' . $sitename . ' allow you to build and share collections of images, videos and whatever else you wish to share.', | ||
'interconnected:rootpage:description:market' => 'The market pages at ' . $sitename . ' are full of features for buying and selling.', | ||
'interconnected:description:friends' => "The full list of %s's friends at " . $sitename, | ||
'interconnected:rootpage:description:privacy' => 'This privacy policy expresses the intentions of the site operators as they pertain to maintaining the privacy of the users of this website.', | ||
'interconnected:rootpage:description:terms' => 'This page contains the full terms of use agreement that all users of this website are required to read and agree to, prior to joining here and creating a user profile.', | ||
'interconnected:rootpage:description:categories' => 'The full list of categories available at ' . $sitename . '. Each category contains different types of item from the community.', | ||
'interconnected:rootpage:description:search' => 'Search for information from the community at ' . $sitename, | ||
'interconnected:emailbody' => "Greetings! I found this at " . $sitename . "... %s %s %s", | ||
'interconnected:title:file-type' => 'A selection of files from the community at ' . $sitename, | ||
'interconnected:description:file-type' => 'A selection from one category of files; from the community at ' . $sitename, | ||
'interconnected:widget:buttons' => 'Share this with', | ||
'interconnected:widget:buttons_descr' => 'Adds a collection of sharing buttons for popular social networks.', | ||
'interconnected:admin:title:social' => 'Social sharing options.', | ||
'interconnected:admin:title:seo' => 'Search engine optimisation options.', | ||
'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: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)", | ||
); | ||
add_translation("en", $english); | ||
?> |
Oops, something went wrong.