{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments/30930370","id":30930370,"diff_hunk":"@@ -0,0 +1,81 @@\n+<?php\n+/**\n+ * @file\n+ * dosomething_helpers.share.inc\n+ */\n+\n+/**\n+ * Returns an empty page with javascript that closes the current window.\n+ * Used as the redirect page for facebook shares that require a redirect uri.\n+ * Allows us to close the share popup window when the user has finished sharing.\n+ */\n+function dosomething_helpers_share_redirect() {\n+  return \"<script>(function(){ window.close(); })();</script>\";\n+}\n+\n+/**\n+ * Returns a facebook share url.\n+ *\n+ * @param  string $link The url to share.\n+ * @param  string $type\n+ *  The type of facebook share intent link to use.\n+ *    - 'feed_dialog': Allows for customized stories, outside of what is set in the metatags.\n+ * @param Array $custom_options\n+ *    An array of customized options for the type of share being used.\n+ *\n+ * @return string   The facebook intent url.\n+ */\n+function dosomething_helpers_facebook_intent($link, $type = NULL, $custom_options = NULL) {\n+  switch ($type) {\n+    // Used to create a facebook share link that uses a custom image,\n+    // different from what is set in the metatags.\n+    case 'feed_dialog':\n+      // Build the redirect url.\n+      $base_path = url(base_path(), array('absolute' => TRUE));\n+      $redirect_path = url(base_path(), array('absolute' => TRUE)) . 'ds-share-complete';\n+\n+      // Pass in all the feed dialog parameters\n+      $facebook_app_id = variable_get('dosomething_settings_facebook_app_id');\n+      $standard_options = array(\n+          'app_id' => $facebook_app_id,\n+          'display' => 'popup',\n+          'link'   => $link,\n+          'redirect_uri' => $redirect_path,\n+        );\n+\n+      if ($custom_options) {\n+        $standard_options = array_merge($standard_options, $custom_options);\n+      }\n+\n+      $fb_share_url = url('https://www.facebook.com/dialog/feed', array('query' => $standard_options));\n+      break;\n+    // Standard facebook share, just sharing a link and all other data is scraped from the page.\n+    default:\n+      $fb_share_url = \"https://www.facebook.com/sharer/sharer.php?u=\" . urlencode($link);\n+  }\n+\n+  return $fb_share_url;\n+}\n+\n+/**\n+ * Returns a twitter share url.\n+ *\n+ * @param  string $tweet The text that should prepopulate the tweet (can include the url of the page to share).\n+ * @return string        The twitter intent url.\n+ */\n+function dosomething_helpers_twitter_intent($tweet) {\n+  return \"https://twitter.com/intent/tweet?text=\" . urlencode($tweet);\n+}\n+\n+/**\n+ * Returns a tumblr share url.\n+ *\n+ * @param  array $options An array including:\n+ *                            - source: url of the image to share.\n+ *                            - caption: share language.\n+ *                            - clickthru: url to share\n+ * @return string        The tumblr intent url to share a photo.\n+ */\n+function dosomething_helpers_tumblr_intent($options) {\n+  return url('https://www.tumblr.com/widgets/share/tool', array('query' => $options));\n+}","path":"lib/modules/dosomething/dosomething_helpers/dosomething_helpers.share.inc","position":81,"original_position":81,"commit_id":"1adbd9caec5cb7f44a5968548b5e4506277904d8","original_commit_id":"1adbd9caec5cb7f44a5968548b5e4506277904d8","user":{"login":"aaronschachter","id":1236811,"avatar_url":"https://avatars.githubusercontent.com/u/1236811?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronschachter","html_url":"https://github.com/aaronschachter","followers_url":"https://api.github.com/users/aaronschachter/followers","following_url":"https://api.github.com/users/aaronschachter/following{/other_user}","gists_url":"https://api.github.com/users/aaronschachter/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronschachter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronschachter/subscriptions","organizations_url":"https://api.github.com/users/aaronschachter/orgs","repos_url":"https://api.github.com/users/aaronschachter/repos","events_url":"https://api.github.com/users/aaronschachter/events{/privacy}","received_events_url":"https://api.github.com/users/aaronschachter/received_events","type":"User","site_admin":false},"body":"This is Github complaining because files should have an empty line at the end of file.","created_at":"2015-05-22T21:03:00Z","updated_at":"2015-05-22T21:03:00Z","html_url":"https://github.com/DoSomething/dosomething/pull/4532#discussion_r30930370","pull_request_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments/30930370"},"html":{"href":"https://github.com/DoSomething/dosomething/pull/4532#discussion_r30930370"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532","id":36068059,"html_url":"https://github.com/DoSomething/dosomething/pull/4532","diff_url":"https://github.com/DoSomething/dosomething/pull/4532.diff","patch_url":"https://github.com/DoSomething/dosomething/pull/4532.patch","issue_url":"https://api.github.com/repos/DoSomething/dosomething/issues/4532","number":4532,"state":"open","locked":false,"title":"Share functionality updates","user":{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false},"body":"## Fixes #4527 \r\n\r\n* Move the functions that create the share intent links to the `dosomething_helpers` module \r\n* Create a page at `/ds-share-complete` that only returns some inline js that closes the current page. This allows us to close the share popup when facebook requires us to redirect to another page. \r\n\r\ncc @angaither @DFurnes ","created_at":"2015-05-22T20:54:21Z","updated_at":"2015-05-22T21:03:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"216b610d4ac7163152351d5dea87029af94eea96","assignee":{"login":"aaronschachter","id":1236811,"avatar_url":"https://avatars.githubusercontent.com/u/1236811?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronschachter","html_url":"https://github.com/aaronschachter","followers_url":"https://api.github.com/users/aaronschachter/followers","following_url":"https://api.github.com/users/aaronschachter/following{/other_user}","gists_url":"https://api.github.com/users/aaronschachter/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronschachter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronschachter/subscriptions","organizations_url":"https://api.github.com/users/aaronschachter/orgs","repos_url":"https://api.github.com/users/aaronschachter/repos","events_url":"https://api.github.com/users/aaronschachter/events{/privacy}","received_events_url":"https://api.github.com/users/aaronschachter/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532/commits","review_comments_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532/comments","review_comment_url":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/dosomething/issues/4532/comments","statuses_url":"https://api.github.com/repos/DoSomething/dosomething/statuses/1adbd9caec5cb7f44a5968548b5e4506277904d8","head":{"label":"sbsmith86:facebook-redirect","ref":"facebook-redirect","sha":"1adbd9caec5cb7f44a5968548b5e4506277904d8","user":{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false},"repo":{"id":25887312,"name":"dosomething","full_name":"sbsmith86/dosomething","owner":{"login":"sbsmith86","id":1700409,"avatar_url":"https://avatars.githubusercontent.com/u/1700409?v=3","gravatar_id":"","url":"https://api.github.com/users/sbsmith86","html_url":"https://github.com/sbsmith86","followers_url":"https://api.github.com/users/sbsmith86/followers","following_url":"https://api.github.com/users/sbsmith86/following{/other_user}","gists_url":"https://api.github.com/users/sbsmith86/gists{/gist_id}","starred_url":"https://api.github.com/users/sbsmith86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbsmith86/subscriptions","organizations_url":"https://api.github.com/users/sbsmith86/orgs","repos_url":"https://api.github.com/users/sbsmith86/repos","events_url":"https://api.github.com/users/sbsmith86/events{/privacy}","received_events_url":"https://api.github.com/users/sbsmith86/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbsmith86/dosomething","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":true,"url":"https://api.github.com/repos/sbsmith86/dosomething","forks_url":"https://api.github.com/repos/sbsmith86/dosomething/forks","keys_url":"https://api.github.com/repos/sbsmith86/dosomething/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbsmith86/dosomething/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbsmith86/dosomething/teams","hooks_url":"https://api.github.com/repos/sbsmith86/dosomething/hooks","issue_events_url":"https://api.github.com/repos/sbsmith86/dosomething/issues/events{/number}","events_url":"https://api.github.com/repos/sbsmith86/dosomething/events","assignees_url":"https://api.github.com/repos/sbsmith86/dosomething/assignees{/user}","branches_url":"https://api.github.com/repos/sbsmith86/dosomething/branches{/branch}","tags_url":"https://api.github.com/repos/sbsmith86/dosomething/tags","blobs_url":"https://api.github.com/repos/sbsmith86/dosomething/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbsmith86/dosomething/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbsmith86/dosomething/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbsmith86/dosomething/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbsmith86/dosomething/statuses/{sha}","languages_url":"https://api.github.com/repos/sbsmith86/dosomething/languages","stargazers_url":"https://api.github.com/repos/sbsmith86/dosomething/stargazers","contributors_url":"https://api.github.com/repos/sbsmith86/dosomething/contributors","subscribers_url":"https://api.github.com/repos/sbsmith86/dosomething/subscribers","subscription_url":"https://api.github.com/repos/sbsmith86/dosomething/subscription","commits_url":"https://api.github.com/repos/sbsmith86/dosomething/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbsmith86/dosomething/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbsmith86/dosomething/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbsmith86/dosomething/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbsmith86/dosomething/contents/{+path}","compare_url":"https://api.github.com/repos/sbsmith86/dosomething/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbsmith86/dosomething/merges","archive_url":"https://api.github.com/repos/sbsmith86/dosomething/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbsmith86/dosomething/downloads","issues_url":"https://api.github.com/repos/sbsmith86/dosomething/issues{/number}","pulls_url":"https://api.github.com/repos/sbsmith86/dosomething/pulls{/number}","milestones_url":"https://api.github.com/repos/sbsmith86/dosomething/milestones{/number}","notifications_url":"https://api.github.com/repos/sbsmith86/dosomething/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbsmith86/dosomething/labels{/name}","releases_url":"https://api.github.com/repos/sbsmith86/dosomething/releases{/id}","created_at":"2014-10-28T19:53:11Z","updated_at":"2015-05-08T15:07:25Z","pushed_at":"2015-05-22T20:49:23Z","git_url":"git://github.com/sbsmith86/dosomething.git","ssh_url":"git@github.com:sbsmith86/dosomething.git","clone_url":"https://github.com/sbsmith86/dosomething.git","svn_url":"https://github.com/sbsmith86/dosomething","homepage":"http://www.dosomething.org/","size":14628,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"DoSomething:dev","ref":"dev","sha":"9faef40a3e99d901bce7d36bb7ab7b9c154d2afb","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":13592927,"name":"dosomething","full_name":"DoSomething/dosomething","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/dosomething","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":false,"url":"https://api.github.com/repos/DoSomething/dosomething","forks_url":"https://api.github.com/repos/DoSomething/dosomething/forks","keys_url":"https://api.github.com/repos/DoSomething/dosomething/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/dosomething/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/dosomething/teams","hooks_url":"https://api.github.com/repos/DoSomething/dosomething/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/dosomething/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/dosomething/events","assignees_url":"https://api.github.com/repos/DoSomething/dosomething/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/dosomething/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/dosomething/tags","blobs_url":"https://api.github.com/repos/DoSomething/dosomething/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/dosomething/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/dosomething/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/dosomething/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/dosomething/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/dosomething/languages","stargazers_url":"https://api.github.com/repos/DoSomething/dosomething/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/dosomething/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/dosomething/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/dosomething/subscription","commits_url":"https://api.github.com/repos/DoSomething/dosomething/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/dosomething/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/dosomething/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/dosomething/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/dosomething/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/dosomething/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/dosomething/merges","archive_url":"https://api.github.com/repos/DoSomething/dosomething/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/dosomething/downloads","issues_url":"https://api.github.com/repos/DoSomething/dosomething/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/dosomething/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/dosomething/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/dosomething/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/dosomething/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/dosomething/releases{/id}","created_at":"2013-10-15T14:50:48Z","updated_at":"2015-05-08T18:00:09Z","pushed_at":"2015-05-22T20:54:21Z","git_url":"git://github.com/DoSomething/dosomething.git","ssh_url":"git@github.com:DoSomething/dosomething.git","clone_url":"https://github.com/DoSomething/dosomething.git","svn_url":"https://github.com/DoSomething/dosomething","homepage":"http://www.dosomething.org/","size":28132,"stargazers_count":23,"watchers_count":23,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":219,"forks":17,"open_issues":219,"watchers":23,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532"},"html":{"href":"https://github.com/DoSomething/dosomething/pull/4532"},"issue":{"href":"https://api.github.com/repos/DoSomething/dosomething/issues/4532"},"comments":{"href":"https://api.github.com/repos/DoSomething/dosomething/issues/4532/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/dosomething/pulls/4532/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/dosomething/statuses/1adbd9caec5cb7f44a5968548b5e4506277904d8"}}}}