{"action":"created","comment":{"url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/comments/85846382","pull_request_review_id":6537574,"id":85846382,"diff_hunk":"@@ -0,0 +1,116 @@\n+<?php\n+\n+function snagshout_register_catalogs() {\n+  register_post_type(\n+    'ss_catalog',\n+    [\n+      'labels' => [\n+        'name' => __('Catalogs', 'textdomain'),\n+        'singular_name' => __('Catalog', 'textdomain'),\n+        'add_new' => __('Add New', 'textdomain'),\n+        'add_new_item' => __('Add New Catalog', 'textdomain'),\n+        'new_item' => __('New Catalog', 'textdomain'),\n+        'edit_item' => __('Edit Catalog', 'textdomain'),\n+        'view_item' => __('View Catalog', 'textdomain'),\n+        'all_items' => __('All Catalogs', 'textdomain'),\n+        'search_items' => __('Search Catalogs', 'textdomain'),\n+        'not_found' => __('No catalogs found.', 'textdomain'),\n+        'not_found_in_trash' => __('No catalogs found in Trash.', 'textdomain'),\n+      ],\n+      'description' => 'Displays Snagshout deals',\n+      'public' => true,\n+      'hierarchical' => false,\n+      'exclude_from_search' => true,\n+      'menu_icon' => 'dashicons-cart',\n+      'register_meta_box_cb' => 'snagshout_register_catalog_metabox',\n+      'supports' => ['title'],\n+      // ...\n+    ]\n+  );\n+}\n+\n+function snagshout_register_catalog_metabox() {\n+  add_meta_box(\n+    'ss-catalog-options',\n+    __('Catalog Options', 'textdomain'),\n+    'snagshout_render_catalog_metabox',\n+    'ss_catalog',\n+    'side',\n+    'high'\n+  );\n+}\n+\n+function snagshout_render_catalog_metabox($post) {\n+  $categories = ['all' => 'All categories'];\n+  $categoriesResponse = json_decode(snagshout_fetch_categories());\n+\n+  if ($categoriesResponse && $categoriesResponse->data) {\n+    foreach ($categoriesResponse->data as $category) {\n+      $categories[$category->id] = $category->name;\n+    }\n+  }\n+\n+  $instance = [];\n+\n+  echo snagshout_render_view('catalog-options', [\n+    // General data.\n+    'categories' => $categories,\n+    'layouts' => [\n+      '2-columns' => 'Two columns',\n+      '1-column' => 'One column',\n+      '3-columns' => 'Three columns',\n+      '4-columns' => 'Four columns',\n+    ],\n+    'feeds' => [\n+      'popular' => 'Popular deals first',\n+      'newest' => 'Newest deals first',\n+    ],\n+\n+    // Loaded options.\n+    'layout' => get_post_meta($post->ID, 'ss_layout', true),\n+    'category' => get_post_meta($post->ID, 'ss_category', true),\n+    'feed' => get_post_meta($post->ID, 'ss_feed', true),\n+    'limit' => (int) get_post_meta($post->ID, 'ss_limit', true),\n+    'randomize' => get_post_meta($post->ID, 'ss_randomize', true) === 'on',\n+  ]);\n+}\n+\n+function snagshout_store_catalog($post_id, $post, $update) {\n+  if ($post->post_type != 'ss_catalog') {\n+    return;\n+  }\n+\n+  update_post_meta(\n+    $post_id,\n+    'ss_layout',\n+    snagshout_get($_POST, 'ss_layout', '3-columns')\n+  );\n+  update_post_meta(\n+    $post_id,\n+    'ss_category',\n+    snagshout_get($_POST, 'ss_category', '')\n+  );\n+  update_post_meta(\n+    $post_id,\n+    'ss_feed',\n+    snagshout_get($_POST, 'ss_feed', 'popular')\n+  );\n+  update_post_meta(\n+    $post_id,\n+    'ss_limit',\n+    snagshout_get($_POST, 'ss_limit', '25')\n+  );\n+  update_post_meta(\n+    $post_id,\n+    'ss_randomize',\n+    snagshout_get($_POST, 'ss_randomize', 'false')\n+  );","path":"src/catalog/init.php","position":107,"original_position":107,"commit_id":"89611429999e8a2b782d7b98995409006c9efd9d","original_commit_id":"89611429999e8a2b782d7b98995409006c9efd9d","user":{"login":"etcinit","id":1160305,"avatar_url":"https://avatars.githubusercontent.com/u/1160305?v=3","gravatar_id":"","url":"https://api.github.com/users/etcinit","html_url":"https://github.com/etcinit","followers_url":"https://api.github.com/users/etcinit/followers","following_url":"https://api.github.com/users/etcinit/following{/other_user}","gists_url":"https://api.github.com/users/etcinit/gists{/gist_id}","starred_url":"https://api.github.com/users/etcinit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etcinit/subscriptions","organizations_url":"https://api.github.com/users/etcinit/orgs","repos_url":"https://api.github.com/users/etcinit/repos","events_url":"https://api.github.com/users/etcinit/events{/privacy}","received_events_url":"https://api.github.com/users/etcinit/received_events","type":"User","site_admin":false},"body":"todo: Refactor this into a for each loop.","created_at":"2016-10-31T22:27:32Z","updated_at":"2016-10-31T22:28:49Z","html_url":"https://github.com/sellerlabs/snagshout-wordpress/pull/1#discussion_r85846382","pull_request_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/comments/85846382"},"html":{"href":"https://github.com/sellerlabs/snagshout-wordpress/pull/1#discussion_r85846382"},"pull_request":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1","id":91702332,"html_url":"https://github.com/sellerlabs/snagshout-wordpress/pull/1","diff_url":"https://github.com/sellerlabs/snagshout-wordpress/pull/1.diff","patch_url":"https://github.com/sellerlabs/snagshout-wordpress/pull/1.patch","issue_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/1","number":1,"state":"open","locked":false,"title":"Add catalogs, a custom post type","user":{"login":"etcinit","id":1160305,"avatar_url":"https://avatars.githubusercontent.com/u/1160305?v=3","gravatar_id":"","url":"https://api.github.com/users/etcinit","html_url":"https://github.com/etcinit","followers_url":"https://api.github.com/users/etcinit/followers","following_url":"https://api.github.com/users/etcinit/following{/other_user}","gists_url":"https://api.github.com/users/etcinit/gists{/gist_id}","starred_url":"https://api.github.com/users/etcinit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etcinit/subscriptions","organizations_url":"https://api.github.com/users/etcinit/orgs","repos_url":"https://api.github.com/users/etcinit/repos","events_url":"https://api.github.com/users/etcinit/events{/privacy}","received_events_url":"https://api.github.com/users/etcinit/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-31T22:25:01Z","updated_at":"2016-10-31T22:28:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"089cc7ea8eb40b29b010266129af35ec443c9236","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1/commits","review_comments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1/comments","review_comment_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/1/comments","statuses_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/statuses/89611429999e8a2b782d7b98995409006c9efd9d","head":{"label":"sellerlabs:etcinit/catalogs","ref":"etcinit/catalogs","sha":"89611429999e8a2b782d7b98995409006c9efd9d","user":{"login":"sellerlabs","id":11278378,"avatar_url":"https://avatars.githubusercontent.com/u/11278378?v=3","gravatar_id":"","url":"https://api.github.com/users/sellerlabs","html_url":"https://github.com/sellerlabs","followers_url":"https://api.github.com/users/sellerlabs/followers","following_url":"https://api.github.com/users/sellerlabs/following{/other_user}","gists_url":"https://api.github.com/users/sellerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/sellerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellerlabs/subscriptions","organizations_url":"https://api.github.com/users/sellerlabs/orgs","repos_url":"https://api.github.com/users/sellerlabs/repos","events_url":"https://api.github.com/users/sellerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/sellerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":71191460,"name":"snagshout-wordpress","full_name":"sellerlabs/snagshout-wordpress","owner":{"login":"sellerlabs","id":11278378,"avatar_url":"https://avatars.githubusercontent.com/u/11278378?v=3","gravatar_id":"","url":"https://api.github.com/users/sellerlabs","html_url":"https://github.com/sellerlabs","followers_url":"https://api.github.com/users/sellerlabs/followers","following_url":"https://api.github.com/users/sellerlabs/following{/other_user}","gists_url":"https://api.github.com/users/sellerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/sellerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellerlabs/subscriptions","organizations_url":"https://api.github.com/users/sellerlabs/orgs","repos_url":"https://api.github.com/users/sellerlabs/repos","events_url":"https://api.github.com/users/sellerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/sellerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sellerlabs/snagshout-wordpress","description":"Wordpress plugin for Snagshout partners","fork":false,"url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress","forks_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/forks","keys_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/teams","hooks_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/hooks","issue_events_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/events{/number}","events_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/events","assignees_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/assignees{/user}","branches_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/branches{/branch}","tags_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/tags","blobs_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/refs{/sha}","trees_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/statuses/{sha}","languages_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/languages","stargazers_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/stargazers","contributors_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/contributors","subscribers_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/subscribers","subscription_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/subscription","commits_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/commits{/sha}","git_commits_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/commits{/sha}","comments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/comments{/number}","issue_comment_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/comments{/number}","contents_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/contents/{+path}","compare_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/merges","archive_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/downloads","issues_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues{/number}","pulls_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls{/number}","milestones_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/milestones{/number}","notifications_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/labels{/name}","releases_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/releases{/id}","deployments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/deployments","created_at":"2016-10-18T00:01:26Z","updated_at":"2016-10-26T00:34:01Z","pushed_at":"2016-10-31T22:25:01Z","git_url":"git://github.com/sellerlabs/snagshout-wordpress.git","ssh_url":"git@github.com:sellerlabs/snagshout-wordpress.git","clone_url":"https://github.com/sellerlabs/snagshout-wordpress.git","svn_url":"https://github.com/sellerlabs/snagshout-wordpress","homepage":"https://wordpress.org/plugins/snagshout/","size":1461,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"sellerlabs:master","ref":"master","sha":"d954fcd494d52b2c813e2096314fffa4d7547d44","user":{"login":"sellerlabs","id":11278378,"avatar_url":"https://avatars.githubusercontent.com/u/11278378?v=3","gravatar_id":"","url":"https://api.github.com/users/sellerlabs","html_url":"https://github.com/sellerlabs","followers_url":"https://api.github.com/users/sellerlabs/followers","following_url":"https://api.github.com/users/sellerlabs/following{/other_user}","gists_url":"https://api.github.com/users/sellerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/sellerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellerlabs/subscriptions","organizations_url":"https://api.github.com/users/sellerlabs/orgs","repos_url":"https://api.github.com/users/sellerlabs/repos","events_url":"https://api.github.com/users/sellerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/sellerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":71191460,"name":"snagshout-wordpress","full_name":"sellerlabs/snagshout-wordpress","owner":{"login":"sellerlabs","id":11278378,"avatar_url":"https://avatars.githubusercontent.com/u/11278378?v=3","gravatar_id":"","url":"https://api.github.com/users/sellerlabs","html_url":"https://github.com/sellerlabs","followers_url":"https://api.github.com/users/sellerlabs/followers","following_url":"https://api.github.com/users/sellerlabs/following{/other_user}","gists_url":"https://api.github.com/users/sellerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/sellerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sellerlabs/subscriptions","organizations_url":"https://api.github.com/users/sellerlabs/orgs","repos_url":"https://api.github.com/users/sellerlabs/repos","events_url":"https://api.github.com/users/sellerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/sellerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sellerlabs/snagshout-wordpress","description":"Wordpress plugin for Snagshout partners","fork":false,"url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress","forks_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/forks","keys_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/teams","hooks_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/hooks","issue_events_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/events{/number}","events_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/events","assignees_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/assignees{/user}","branches_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/branches{/branch}","tags_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/tags","blobs_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/refs{/sha}","trees_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/statuses/{sha}","languages_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/languages","stargazers_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/stargazers","contributors_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/contributors","subscribers_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/subscribers","subscription_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/subscription","commits_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/commits{/sha}","git_commits_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/git/commits{/sha}","comments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/comments{/number}","issue_comment_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/comments{/number}","contents_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/contents/{+path}","compare_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/merges","archive_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/downloads","issues_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues{/number}","pulls_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls{/number}","milestones_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/milestones{/number}","notifications_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/labels{/name}","releases_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/releases{/id}","deployments_url":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/deployments","created_at":"2016-10-18T00:01:26Z","updated_at":"2016-10-26T00:34:01Z","pushed_at":"2016-10-31T22:25:01Z","git_url":"git://github.com/sellerlabs/snagshout-wordpress.git","ssh_url":"git@github.com:sellerlabs/snagshout-wordpress.git","clone_url":"https://github.com/sellerlabs/snagshout-wordpress.git","svn_url":"https://github.com/sellerlabs/snagshout-wordpress","homepage":"https://wordpress.org/plugins/snagshout/","size":1461,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1"},"html":{"href":"https://github.com/sellerlabs/snagshout-wordpress/pull/1"},"issue":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/1"},"comments":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/sellerlabs/snagshout-wordpress/statuses/89611429999e8a2b782d7b98995409006c9efd9d"}}}}
{"actor":{"display_login":"etcinit"}}