{"action":"created","comment":{"url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/comments/92232402","pull_request_review_id":12742191,"id":92232402,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\r\n+/**\r\n+ * Handles adding script data to the page in cases where localizing a\r\n+ * specific script is not suitable.\r\n+ *\r\n+ * Should generally be accessed via tribe( 'tribe.asset.script-data' )\r\n+ * rather than via direct instantiation.\r\n+ */\r\n+class Tribe__Asset__Script_Data {\r\n+\t/**\r\n+\t * Container for any JS data objects that should be added to the page.\r\n+\t *\r\n+\t * @var array\r\n+\t */\r\n+\tprotected $objects = array();\r\n+\r\n+\t/**\r\n+\t * Hooks up the method used to actually render the JSON data.\r\n+\t */\r\n+\tpublic function hook() {\r\n+\t\tif ( is_admin() ) {\r\n+\t\t\tadd_action( 'admin_footer', array( $this, 'render_json' ) );\r\n+\t\t} else {\r\n+\t\t\tadd_action( 'wp_footer', array( $this, 'render_json' ) );\r\n+\t\t}\r\n+\t}\r\n+\r\n+\t/**\r\n+\t * Adds the provided data to the list of objects that should be available\r\n+\t * to other scripts.\r\n+\t *\r\n+\t * @param string $object_name\r\n+\t * @param array  $data\r\n+\t */\r\n+\tpublic function add( $object_name, array $data ) {\r\n+\t\t$this->objects[ $object_name ] = $data;\r\n+\t}\r\n+\r\n+\t/**\r\n+\t * Outputs the\r\n+\t * @internal\r\n+\t */\r\n+\tpublic function render_json() {\r\n+\t\tif ( empty( $this->objects ) ) {\r\n+\t\t\treturn;\r\n+\t\t}\r\n+\r\n+\t\techo '<script type=\\'text/javascript\\'> /* <![CDATA[ */';\r","path":"src/Tribe/Asset/Script_Data.php","position":48,"original_position":48,"commit_id":"00cadce611ffe00932c22867dab5cf2919956532","original_commit_id":"00cadce611ffe00932c22867dab5cf2919956532","user":{"login":"bordoni","id":236579,"avatar_url":"https://avatars.githubusercontent.com/u/236579?v=3","gravatar_id":"","url":"https://api.github.com/users/bordoni","html_url":"https://github.com/bordoni","followers_url":"https://api.github.com/users/bordoni/followers","following_url":"https://api.github.com/users/bordoni/following{/other_user}","gists_url":"https://api.github.com/users/bordoni/gists{/gist_id}","starred_url":"https://api.github.com/users/bordoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bordoni/subscriptions","organizations_url":"https://api.github.com/users/bordoni/orgs","repos_url":"https://api.github.com/users/bordoni/repos","events_url":"https://api.github.com/users/bordoni/events{/privacy}","received_events_url":"https://api.github.com/users/bordoni/received_events","type":"User","site_admin":false},"body":"Can we render each variable in a Single JS script, and add an ID Attribute like `id=\"tribe-asset-data-$object_name\"`","created_at":"2016-12-13T18:21:31Z","updated_at":"2016-12-13T18:21:50Z","html_url":"https://github.com/moderntribe/tribe-common/pull/302#discussion_r92232402","pull_request_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302","_links":{"self":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/comments/92232402"},"html":{"href":"https://github.com/moderntribe/tribe-common/pull/302#discussion_r92232402"},"pull_request":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302"}}},"pull_request":{"url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302","id":97804740,"html_url":"https://github.com/moderntribe/tribe-common/pull/302","diff_url":"https://github.com/moderntribe/tribe-common/pull/302.diff","patch_url":"https://github.com/moderntribe/tribe-common/pull/302.patch","issue_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/302","number":302,"state":"open","locked":false,"title":"Fix/70623 common script data","user":{"login":"barryhughes","id":3594411,"avatar_url":"https://avatars.githubusercontent.com/u/3594411?v=3","gravatar_id":"","url":"https://api.github.com/users/barryhughes","html_url":"https://github.com/barryhughes","followers_url":"https://api.github.com/users/barryhughes/followers","following_url":"https://api.github.com/users/barryhughes/following{/other_user}","gists_url":"https://api.github.com/users/barryhughes/gists{/gist_id}","starred_url":"https://api.github.com/users/barryhughes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barryhughes/subscriptions","organizations_url":"https://api.github.com/users/barryhughes/orgs","repos_url":"https://api.github.com/users/barryhughes/repos","events_url":"https://api.github.com/users/barryhughes/events{/privacy}","received_events_url":"https://api.github.com/users/barryhughes/received_events","type":"User","site_admin":false},"body":"* Makes the `tribe_l10n_datatables` object available independently of whether `tribe-common.js` or any other single asset is enqueued\r\n* Adds a helper class to achieve that (ie, add data to the page without localizing individual scripts)\r\n\r\nhttps://central.tri.be/issues/70682","created_at":"2016-12-13T18:08:18Z","updated_at":"2016-12-13T18:21:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6595303bbd51783963ceab08ebc0b9be29e8c34f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302/commits","review_comments_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302/comments","review_comment_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/302/comments","statuses_url":"https://api.github.com/repos/moderntribe/tribe-common/statuses/00cadce611ffe00932c22867dab5cf2919956532","head":{"label":"moderntribe:fix/70623-common-script-data","ref":"fix/70623-common-script-data","sha":"00cadce611ffe00932c22867dab5cf2919956532","user":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars.githubusercontent.com/u/2279551?v=3","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"repo":{"id":41689794,"name":"tribe-common","full_name":"moderntribe/tribe-common","owner":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars.githubusercontent.com/u/2279551?v=3","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moderntribe/tribe-common","description":"Common classes and functions used in our plugins","fork":false,"url":"https://api.github.com/repos/moderntribe/tribe-common","forks_url":"https://api.github.com/repos/moderntribe/tribe-common/forks","keys_url":"https://api.github.com/repos/moderntribe/tribe-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moderntribe/tribe-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moderntribe/tribe-common/teams","hooks_url":"https://api.github.com/repos/moderntribe/tribe-common/hooks","issue_events_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/events{/number}","events_url":"https://api.github.com/repos/moderntribe/tribe-common/events","assignees_url":"https://api.github.com/repos/moderntribe/tribe-common/assignees{/user}","branches_url":"https://api.github.com/repos/moderntribe/tribe-common/branches{/branch}","tags_url":"https://api.github.com/repos/moderntribe/tribe-common/tags","blobs_url":"https://api.github.com/repos/moderntribe/tribe-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moderntribe/tribe-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moderntribe/tribe-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/moderntribe/tribe-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moderntribe/tribe-common/statuses/{sha}","languages_url":"https://api.github.com/repos/moderntribe/tribe-common/languages","stargazers_url":"https://api.github.com/repos/moderntribe/tribe-common/stargazers","contributors_url":"https://api.github.com/repos/moderntribe/tribe-common/contributors","subscribers_url":"https://api.github.com/repos/moderntribe/tribe-common/subscribers","subscription_url":"https://api.github.com/repos/moderntribe/tribe-common/subscription","commits_url":"https://api.github.com/repos/moderntribe/tribe-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/moderntribe/tribe-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/moderntribe/tribe-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/moderntribe/tribe-common/contents/{+path}","compare_url":"https://api.github.com/repos/moderntribe/tribe-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moderntribe/tribe-common/merges","archive_url":"https://api.github.com/repos/moderntribe/tribe-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moderntribe/tribe-common/downloads","issues_url":"https://api.github.com/repos/moderntribe/tribe-common/issues{/number}","pulls_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls{/number}","milestones_url":"https://api.github.com/repos/moderntribe/tribe-common/milestones{/number}","notifications_url":"https://api.github.com/repos/moderntribe/tribe-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moderntribe/tribe-common/labels{/name}","releases_url":"https://api.github.com/repos/moderntribe/tribe-common/releases{/id}","deployments_url":"https://api.github.com/repos/moderntribe/tribe-common/deployments","created_at":"2015-08-31T17:22:40Z","updated_at":"2016-12-09T20:35:37Z","pushed_at":"2016-12-13T18:08:19Z","git_url":"git://github.com/moderntribe/tribe-common.git","ssh_url":"git@github.com:moderntribe/tribe-common.git","clone_url":"https://github.com/moderntribe/tribe-common.git","svn_url":"https://github.com/moderntribe/tribe-common","homepage":null,"size":18969,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":5,"default_branch":"develop"}},"base":{"label":"moderntribe:develop","ref":"develop","sha":"b1a18d718550c545a88a4251689256f2614db034","user":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars.githubusercontent.com/u/2279551?v=3","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"repo":{"id":41689794,"name":"tribe-common","full_name":"moderntribe/tribe-common","owner":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars.githubusercontent.com/u/2279551?v=3","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moderntribe/tribe-common","description":"Common classes and functions used in our plugins","fork":false,"url":"https://api.github.com/repos/moderntribe/tribe-common","forks_url":"https://api.github.com/repos/moderntribe/tribe-common/forks","keys_url":"https://api.github.com/repos/moderntribe/tribe-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moderntribe/tribe-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moderntribe/tribe-common/teams","hooks_url":"https://api.github.com/repos/moderntribe/tribe-common/hooks","issue_events_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/events{/number}","events_url":"https://api.github.com/repos/moderntribe/tribe-common/events","assignees_url":"https://api.github.com/repos/moderntribe/tribe-common/assignees{/user}","branches_url":"https://api.github.com/repos/moderntribe/tribe-common/branches{/branch}","tags_url":"https://api.github.com/repos/moderntribe/tribe-common/tags","blobs_url":"https://api.github.com/repos/moderntribe/tribe-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moderntribe/tribe-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moderntribe/tribe-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/moderntribe/tribe-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moderntribe/tribe-common/statuses/{sha}","languages_url":"https://api.github.com/repos/moderntribe/tribe-common/languages","stargazers_url":"https://api.github.com/repos/moderntribe/tribe-common/stargazers","contributors_url":"https://api.github.com/repos/moderntribe/tribe-common/contributors","subscribers_url":"https://api.github.com/repos/moderntribe/tribe-common/subscribers","subscription_url":"https://api.github.com/repos/moderntribe/tribe-common/subscription","commits_url":"https://api.github.com/repos/moderntribe/tribe-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/moderntribe/tribe-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/moderntribe/tribe-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/moderntribe/tribe-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/moderntribe/tribe-common/contents/{+path}","compare_url":"https://api.github.com/repos/moderntribe/tribe-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moderntribe/tribe-common/merges","archive_url":"https://api.github.com/repos/moderntribe/tribe-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moderntribe/tribe-common/downloads","issues_url":"https://api.github.com/repos/moderntribe/tribe-common/issues{/number}","pulls_url":"https://api.github.com/repos/moderntribe/tribe-common/pulls{/number}","milestones_url":"https://api.github.com/repos/moderntribe/tribe-common/milestones{/number}","notifications_url":"https://api.github.com/repos/moderntribe/tribe-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moderntribe/tribe-common/labels{/name}","releases_url":"https://api.github.com/repos/moderntribe/tribe-common/releases{/id}","deployments_url":"https://api.github.com/repos/moderntribe/tribe-common/deployments","created_at":"2015-08-31T17:22:40Z","updated_at":"2016-12-09T20:35:37Z","pushed_at":"2016-12-13T18:08:19Z","git_url":"git://github.com/moderntribe/tribe-common.git","ssh_url":"git@github.com:moderntribe/tribe-common.git","clone_url":"https://github.com/moderntribe/tribe-common.git","svn_url":"https://github.com/moderntribe/tribe-common","homepage":null,"size":18969,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302"},"html":{"href":"https://github.com/moderntribe/tribe-common/pull/302"},"issue":{"href":"https://api.github.com/repos/moderntribe/tribe-common/issues/302"},"comments":{"href":"https://api.github.com/repos/moderntribe/tribe-common/issues/302/comments"},"review_comments":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302/comments"},"review_comment":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moderntribe/tribe-common/pulls/302/commits"},"statuses":{"href":"https://api.github.com/repos/moderntribe/tribe-common/statuses/00cadce611ffe00932c22867dab5cf2919956532"}}}}
{"actor":{"display_login":"bordoni"}}