{"action":"created","comment":{"url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/comments/47895886","id":47895886,"diff_hunk":"@@ -48,12 +48,37 @@ function jcf_post_load_custom_fields( $post_type = '' ){\n \t\t\tadd_action('admin_print_styles', 'jcf_edit_post_styles');\r\n \t\t\tadd_action('admin_print_scripts', 'jcf_edit_post_scripts');\r\n \r\n+\t\t\t?>\r\n+\t\t\t<script>\r\n+\t\t\t\tvar visibility_rules = {};\r\n+\t\t\t</script>\r\n+\t\t\t<?php\r\n+\t\t\t$visibility_rules = array();\r\n \t\t\tforeach($fieldsets as $f_id => $fieldset){\r\n+\t\t\t\tif(!empty($fieldset['visibility_rules'])){\r\n+\t\t\t\t\t$visibility_rules[$f_id] = $fieldset['visibility_rules'];\r\n+\r\n+\t\t\t\t\tforeach($visibility_rules[$f_id] as $key => $rule) {\r\n+\t\t\t\t\t\tif($rule['based_on'] == 'taxonomy'){\r\n+\t\t\t\t\t\t\t$taxonomy_terms = array();\r\n+\t\t\t\t\t\t\tforeach($rule['rule_taxonomy_terms'] as $term_id){\r\n+\t\t\t\t\t\t\t\t$taxonomy_terms[] = get_term_by('id', $term_id, $rule['rule_taxonomy']);\r\n+\t\t\t\t\t\t\t}\r\n+\t\t\t\t\t\t\t$visibility_rules[$f_id][$key]['rule_taxonomy_terms'] = $taxonomy_terms;\r\n+\t\t\t\t\t\t}\r\n+\t\t\t\t\t}\r\n+\t\t\t\t}\r\n+\r\n \t\t\t\tadd_meta_box('jcf_fieldset-'.$f_id, $fieldset['title'], 'jcf_post_show_custom_fields', $post_type, 'advanced', 'default', array($fieldset) );\r\n \t\t\t}\r\n+\t\t\t?>\r\n+\t\t\t<script>\r\n+\t\t\t\tfieldsets_visibility_rules = '<?php echo json_encode($visibility_rules);?>';\r\n+\t\t\t</script>\r","path":"inc/functions.post.php","position":30,"original_position":30,"commit_id":"144f6e6116883ad6b7f2c59f765397ce9c3a2621","original_commit_id":"144f6e6116883ad6b7f2c59f765397ce9c3a2621","user":{"login":"aprokopenko","id":1842666,"avatar_url":"https://avatars.githubusercontent.com/u/1842666?v=3","gravatar_id":"","url":"https://api.github.com/users/aprokopenko","html_url":"https://github.com/aprokopenko","followers_url":"https://api.github.com/users/aprokopenko/followers","following_url":"https://api.github.com/users/aprokopenko/following{/other_user}","gists_url":"https://api.github.com/users/aprokopenko/gists{/gist_id}","starred_url":"https://api.github.com/users/aprokopenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aprokopenko/subscriptions","organizations_url":"https://api.github.com/users/aprokopenko/orgs","repos_url":"https://api.github.com/users/aprokopenko/repos","events_url":"https://api.github.com/users/aprokopenko/events{/privacy}","received_events_url":"https://api.github.com/users/aprokopenko/received_events","type":"User","site_admin":false},"body":"2 раза пишешь тег скрипт. (до и после foreach) можно все написать в одном.\r\nне совсем понятно зачем ты json_encode запорачиваешь в кавычки - ты таким образом получаешь не объект а строку. потом ее еще и парсить в js","created_at":"2015-12-17T11:34:26Z","updated_at":"2015-12-17T11:34:26Z","html_url":"https://github.com/aprokopenko/justcustomfields/pull/56#discussion_r47895886","pull_request_url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/comments/47895886"},"html":{"href":"https://github.com/aprokopenko/justcustomfields/pull/56#discussion_r47895886"},"pull_request":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56","id":53722568,"html_url":"https://github.com/aprokopenko/justcustomfields/pull/56","diff_url":"https://github.com/aprokopenko/justcustomfields/pull/56.diff","patch_url":"https://github.com/aprokopenko/justcustomfields/pull/56.patch","issue_url":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/56","number":56,"state":"open","locked":false,"title":"4488550 fielset visibility settings","user":{"login":"jcssamoylov","id":13030559,"avatar_url":"https://avatars.githubusercontent.com/u/13030559?v=3","gravatar_id":"","url":"https://api.github.com/users/jcssamoylov","html_url":"https://github.com/jcssamoylov","followers_url":"https://api.github.com/users/jcssamoylov/followers","following_url":"https://api.github.com/users/jcssamoylov/following{/other_user}","gists_url":"https://api.github.com/users/jcssamoylov/gists{/gist_id}","starred_url":"https://api.github.com/users/jcssamoylov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcssamoylov/subscriptions","organizations_url":"https://api.github.com/users/jcssamoylov/orgs","repos_url":"https://api.github.com/users/jcssamoylov/repos","events_url":"https://api.github.com/users/jcssamoylov/events{/privacy}","received_events_url":"https://api.github.com/users/jcssamoylov/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-15T16:00:50Z","updated_at":"2015-12-17T11:34:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56/commits","review_comments_url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56/comments","review_comment_url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/56/comments","statuses_url":"https://api.github.com/repos/aprokopenko/justcustomfields/statuses/144f6e6116883ad6b7f2c59f765397ce9c3a2621","head":{"label":"jcssamoylov:4488550_fielset_visibility_settings","ref":"4488550_fielset_visibility_settings","sha":"144f6e6116883ad6b7f2c59f765397ce9c3a2621","user":{"login":"jcssamoylov","id":13030559,"avatar_url":"https://avatars.githubusercontent.com/u/13030559?v=3","gravatar_id":"","url":"https://api.github.com/users/jcssamoylov","html_url":"https://github.com/jcssamoylov","followers_url":"https://api.github.com/users/jcssamoylov/followers","following_url":"https://api.github.com/users/jcssamoylov/following{/other_user}","gists_url":"https://api.github.com/users/jcssamoylov/gists{/gist_id}","starred_url":"https://api.github.com/users/jcssamoylov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcssamoylov/subscriptions","organizations_url":"https://api.github.com/users/jcssamoylov/orgs","repos_url":"https://api.github.com/users/jcssamoylov/repos","events_url":"https://api.github.com/users/jcssamoylov/events{/privacy}","received_events_url":"https://api.github.com/users/jcssamoylov/received_events","type":"User","site_admin":false},"repo":{"id":37974571,"name":"justcustomfields","full_name":"jcssamoylov/justcustomfields","owner":{"login":"jcssamoylov","id":13030559,"avatar_url":"https://avatars.githubusercontent.com/u/13030559?v=3","gravatar_id":"","url":"https://api.github.com/users/jcssamoylov","html_url":"https://github.com/jcssamoylov","followers_url":"https://api.github.com/users/jcssamoylov/followers","following_url":"https://api.github.com/users/jcssamoylov/following{/other_user}","gists_url":"https://api.github.com/users/jcssamoylov/gists{/gist_id}","starred_url":"https://api.github.com/users/jcssamoylov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcssamoylov/subscriptions","organizations_url":"https://api.github.com/users/jcssamoylov/orgs","repos_url":"https://api.github.com/users/jcssamoylov/repos","events_url":"https://api.github.com/users/jcssamoylov/events{/privacy}","received_events_url":"https://api.github.com/users/jcssamoylov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jcssamoylov/justcustomfields","description":"wordpress just custom fields dev version","fork":true,"url":"https://api.github.com/repos/jcssamoylov/justcustomfields","forks_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/forks","keys_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/teams","hooks_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/hooks","issue_events_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/issues/events{/number}","events_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/events","assignees_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/assignees{/user}","branches_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/branches{/branch}","tags_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/tags","blobs_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/git/refs{/sha}","trees_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/statuses/{sha}","languages_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/languages","stargazers_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/stargazers","contributors_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/contributors","subscribers_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/subscribers","subscription_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/subscription","commits_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/commits{/sha}","git_commits_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/git/commits{/sha}","comments_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/comments{/number}","issue_comment_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/issues/comments{/number}","contents_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/contents/{+path}","compare_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/merges","archive_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/downloads","issues_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/issues{/number}","pulls_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/pulls{/number}","milestones_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/milestones{/number}","notifications_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/labels{/name}","releases_url":"https://api.github.com/repos/jcssamoylov/justcustomfields/releases{/id}","created_at":"2015-06-24T09:14:56Z","updated_at":"2015-06-24T09:14:56Z","pushed_at":"2015-12-15T15:57:06Z","git_url":"git://github.com/jcssamoylov/justcustomfields.git","ssh_url":"git@github.com:jcssamoylov/justcustomfields.git","clone_url":"https://github.com/jcssamoylov/justcustomfields.git","svn_url":"https://github.com/jcssamoylov/justcustomfields","homepage":null,"size":527,"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":"master"}},"base":{"label":"aprokopenko:develop","ref":"develop","sha":"cb84c039e4d60fbd2b08e65cbb1b521275afb521","user":{"login":"aprokopenko","id":1842666,"avatar_url":"https://avatars.githubusercontent.com/u/1842666?v=3","gravatar_id":"","url":"https://api.github.com/users/aprokopenko","html_url":"https://github.com/aprokopenko","followers_url":"https://api.github.com/users/aprokopenko/followers","following_url":"https://api.github.com/users/aprokopenko/following{/other_user}","gists_url":"https://api.github.com/users/aprokopenko/gists{/gist_id}","starred_url":"https://api.github.com/users/aprokopenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aprokopenko/subscriptions","organizations_url":"https://api.github.com/users/aprokopenko/orgs","repos_url":"https://api.github.com/users/aprokopenko/repos","events_url":"https://api.github.com/users/aprokopenko/events{/privacy}","received_events_url":"https://api.github.com/users/aprokopenko/received_events","type":"User","site_admin":false},"repo":{"id":4638077,"name":"justcustomfields","full_name":"aprokopenko/justcustomfields","owner":{"login":"aprokopenko","id":1842666,"avatar_url":"https://avatars.githubusercontent.com/u/1842666?v=3","gravatar_id":"","url":"https://api.github.com/users/aprokopenko","html_url":"https://github.com/aprokopenko","followers_url":"https://api.github.com/users/aprokopenko/followers","following_url":"https://api.github.com/users/aprokopenko/following{/other_user}","gists_url":"https://api.github.com/users/aprokopenko/gists{/gist_id}","starred_url":"https://api.github.com/users/aprokopenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aprokopenko/subscriptions","organizations_url":"https://api.github.com/users/aprokopenko/orgs","repos_url":"https://api.github.com/users/aprokopenko/repos","events_url":"https://api.github.com/users/aprokopenko/events{/privacy}","received_events_url":"https://api.github.com/users/aprokopenko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aprokopenko/justcustomfields","description":"wordpress just custom fields dev version","fork":false,"url":"https://api.github.com/repos/aprokopenko/justcustomfields","forks_url":"https://api.github.com/repos/aprokopenko/justcustomfields/forks","keys_url":"https://api.github.com/repos/aprokopenko/justcustomfields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aprokopenko/justcustomfields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aprokopenko/justcustomfields/teams","hooks_url":"https://api.github.com/repos/aprokopenko/justcustomfields/hooks","issue_events_url":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/events{/number}","events_url":"https://api.github.com/repos/aprokopenko/justcustomfields/events","assignees_url":"https://api.github.com/repos/aprokopenko/justcustomfields/assignees{/user}","branches_url":"https://api.github.com/repos/aprokopenko/justcustomfields/branches{/branch}","tags_url":"https://api.github.com/repos/aprokopenko/justcustomfields/tags","blobs_url":"https://api.github.com/repos/aprokopenko/justcustomfields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aprokopenko/justcustomfields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aprokopenko/justcustomfields/git/refs{/sha}","trees_url":"https://api.github.com/repos/aprokopenko/justcustomfields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aprokopenko/justcustomfields/statuses/{sha}","languages_url":"https://api.github.com/repos/aprokopenko/justcustomfields/languages","stargazers_url":"https://api.github.com/repos/aprokopenko/justcustomfields/stargazers","contributors_url":"https://api.github.com/repos/aprokopenko/justcustomfields/contributors","subscribers_url":"https://api.github.com/repos/aprokopenko/justcustomfields/subscribers","subscription_url":"https://api.github.com/repos/aprokopenko/justcustomfields/subscription","commits_url":"https://api.github.com/repos/aprokopenko/justcustomfields/commits{/sha}","git_commits_url":"https://api.github.com/repos/aprokopenko/justcustomfields/git/commits{/sha}","comments_url":"https://api.github.com/repos/aprokopenko/justcustomfields/comments{/number}","issue_comment_url":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/comments{/number}","contents_url":"https://api.github.com/repos/aprokopenko/justcustomfields/contents/{+path}","compare_url":"https://api.github.com/repos/aprokopenko/justcustomfields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aprokopenko/justcustomfields/merges","archive_url":"https://api.github.com/repos/aprokopenko/justcustomfields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aprokopenko/justcustomfields/downloads","issues_url":"https://api.github.com/repos/aprokopenko/justcustomfields/issues{/number}","pulls_url":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls{/number}","milestones_url":"https://api.github.com/repos/aprokopenko/justcustomfields/milestones{/number}","notifications_url":"https://api.github.com/repos/aprokopenko/justcustomfields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aprokopenko/justcustomfields/labels{/name}","releases_url":"https://api.github.com/repos/aprokopenko/justcustomfields/releases{/id}","created_at":"2012-06-12T14:04:27Z","updated_at":"2015-01-24T21:53:52Z","pushed_at":"2015-12-17T11:24:11Z","git_url":"git://github.com/aprokopenko/justcustomfields.git","ssh_url":"git@github.com:aprokopenko/justcustomfields.git","clone_url":"https://github.com/aprokopenko/justcustomfields.git","svn_url":"https://github.com/aprokopenko/justcustomfields","homepage":null,"size":542,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56"},"html":{"href":"https://github.com/aprokopenko/justcustomfields/pull/56"},"issue":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/56"},"comments":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/aprokopenko/justcustomfields/statuses/144f6e6116883ad6b7f2c59f765397ce9c3a2621"}}}}