{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/25742198","id":25742198,"diff_hunk":"@@ -127,68 +127,72 @@ public function getLangTag()\n \t */\n \tpublic function &getToc()\n \t{\n-\t\tif (is_null($this->toc))\n+\t\tif (!is_null($this->toc))\n \t\t{\n-\t\t\t// Get vars\n-\t\t\t$lang_tag = $this->getLangTag();\n-\t\t\t$help_search = $this->getHelpSearch();\n+\t\t\treturn $this->toc;\n+\t\t}\n \n-\t\t\t// New style - Check for a TOC JSON file\n-\t\t\tif (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'))\n-\t\t\t{\n-\t\t\t\t$data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'));\n+\t\t// Get vars\n+\t\t$lang_tag = $this->getLangTag();\n+\t\t$help_search = $this->getHelpSearch();\n \n-\t\t\t\t// Loop through the data array\n-\t\t\t\tforeach ($data as $key => $value)\n-\t\t\t\t{\n-\t\t\t\t\t$this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value);\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\telse\n+\t\t// New style - Check for a TOC JSON file\n+\t\tif (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'))\n+\t\t{\n+\t\t\t$data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'));\n+\n+\t\t\t// Loop through the data array\n+\t\t\tforeach ($data as $key => $value)\n \t\t\t{\n-\t\t\t\t// Get Help files\n-\t\t\t\tjimport('joomla.filesystem.folder');\n-\t\t\t\t$files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\\.xml$|\\.html$');\n-\t\t\t\t$this->toc = array();\n-\n-\t\t\t\tforeach ($files as $file)\n-\t\t\t\t{\n-\t\t\t\t\t$buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file);\n-\n-\t\t\t\t\tif (preg_match('#<title>(.*?)</title>#', $buffer, $m))\n-\t\t\t\t\t{\n-\t\t\t\t\t\t$title = trim($m[1]);\n-\n-\t\t\t\t\t\tif ($title)\n-\t\t\t\t\t\t{\n-\t\t\t\t\t\t\t// Translate the page title\n-\t\t\t\t\t\t\t$title = JText::_($title);\n-\n-\t\t\t\t\t\t\t// Strip the extension\n-\t\t\t\t\t\t\t$file = preg_replace('#\\.xml$|\\.html$#', '', $file);\n-\n-\t\t\t\t\t\t\tif ($help_search)\n-\t\t\t\t\t\t\t{\n-\t\t\t\t\t\t\t\tif (JString::strpos(JString::strtolower(strip_tags($buffer)), JString::strtolower($help_search)) !== false)\n-\t\t\t\t\t\t\t\t{\n-\t\t\t\t\t\t\t\t\t// Add an item in the Table of Contents\n-\t\t\t\t\t\t\t\t\t$this->toc[$file] = $title;\n-\t\t\t\t\t\t\t\t}\n-\t\t\t\t\t\t\t}\n-\t\t\t\t\t\t\telse\n-\t\t\t\t\t\t\t{\n-\t\t\t\t\t\t\t\t// Add an item in the Table of Contents\n-\t\t\t\t\t\t\t\t$this->toc[$file] = $title;\n-\t\t\t\t\t\t\t}\n-\t\t\t\t\t\t}\n-\t\t\t\t\t}\n-\t\t\t\t}\n+\t\t\t\t$this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value);\n \t\t\t}\n \n \t\t\t// Sort the Table of Contents\n \t\t\tasort($this->toc);\n+\n+\t\t\treturn $this->toc;\n+\t\t}\n+\n+\t\t// Get Help files\n+\t\tjimport('joomla.filesystem.folder');\n+\t\t$files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\\.xml$|\\.html$');\n+\t\t$this->toc = array();\n+\n+\t\tforeach ($files as $file)\n+\t\t{\n+\t\t\t$buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file);\n+\n+\t\t\tif (!preg_match('#<title>(.*?)</title>#', $buffer, $m))\n+\t\t\t{\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\t$title = trim($m[1]);\n+\n+\t\t\tif (!$title)\n+\t\t\t{\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\t// Translate the page title\n+\t\t\t$title = JText::_($title);\n+\n+\t\t\t// Strip the extension\n+\t\t\t$file = preg_replace('#\\.xml$|\\.html$#', '', $file);\n+\n+\t\t\tif ($help_search","path":"administrator/components/com_admin/models/help.php","position":109,"original_position":109,"commit_id":"70996c0a5ef8ce286504ca0baacde75dd01674cc","original_commit_id":"aaee0a721e21c32d16fa202ebe99664b7bfd4027","user":{"login":"nonumber","id":744259,"avatar_url":"https://avatars.githubusercontent.com/u/744259?v=3","gravatar_id":"","url":"https://api.github.com/users/nonumber","html_url":"https://github.com/nonumber","followers_url":"https://api.github.com/users/nonumber/followers","following_url":"https://api.github.com/users/nonumber/following{/other_user}","gists_url":"https://api.github.com/users/nonumber/gists{/gist_id}","starred_url":"https://api.github.com/users/nonumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonumber/subscriptions","organizations_url":"https://api.github.com/users/nonumber/orgs","repos_url":"https://api.github.com/users/nonumber/repos","events_url":"https://api.github.com/users/nonumber/events{/privacy}","received_events_url":"https://api.github.com/users/nonumber/received_events","type":"User","site_admin":false},"body":"3 states:\r\n$helpsearch && strpos !== false: set toc\r\n$helpsearch (&& strpos === false): do nothing\r\n!$helpsearch: set toc\r\n\r\nSo that is the same as:\r\n$helpsearch && strpos === false: do nothing\r\nelse: set toc\r\n","created_at":"2015-03-04T00:24:40Z","updated_at":"2015-03-04T00:24:40Z","html_url":"https://github.com/joomla/joomla-cms/pull/6286#discussion_r25742198","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/25742198"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6286#discussion_r25742198"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286","id":30401885,"html_url":"https://github.com/joomla/joomla-cms/pull/6286","diff_url":"https://github.com/joomla/joomla-cms/pull/6286.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/6286.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6286","number":6286,"state":"open","locked":false,"title":"Improved syntax: elses after returns/continues [com_admin]","user":{"login":"nonumber","id":744259,"avatar_url":"https://avatars.githubusercontent.com/u/744259?v=3","gravatar_id":"","url":"https://api.github.com/users/nonumber","html_url":"https://github.com/nonumber","followers_url":"https://api.github.com/users/nonumber/followers","following_url":"https://api.github.com/users/nonumber/following{/other_user}","gists_url":"https://api.github.com/users/nonumber/gists{/gist_id}","starred_url":"https://api.github.com/users/nonumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonumber/subscriptions","organizations_url":"https://api.github.com/users/nonumber/orgs","repos_url":"https://api.github.com/users/nonumber/repos","events_url":"https://api.github.com/users/nonumber/events{/privacy}","received_events_url":"https://api.github.com/users/nonumber/received_events","type":"User","site_admin":false},"body":"See: https://github.com/joomla/joomla-cms/pull/6282","created_at":"2015-03-03T18:59:26Z","updated_at":"2015-03-04T00:24:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1952c1537c5eefbbae2ab237adf75f4f21bcb45","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/6286/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/70996c0a5ef8ce286504ca0baacde75dd01674cc","head":{"label":"nonumber:cleanup.com_admin","ref":"cleanup.com_admin","sha":"70996c0a5ef8ce286504ca0baacde75dd01674cc","user":{"login":"nonumber","id":744259,"avatar_url":"https://avatars.githubusercontent.com/u/744259?v=3","gravatar_id":"","url":"https://api.github.com/users/nonumber","html_url":"https://github.com/nonumber","followers_url":"https://api.github.com/users/nonumber/followers","following_url":"https://api.github.com/users/nonumber/following{/other_user}","gists_url":"https://api.github.com/users/nonumber/gists{/gist_id}","starred_url":"https://api.github.com/users/nonumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonumber/subscriptions","organizations_url":"https://api.github.com/users/nonumber/orgs","repos_url":"https://api.github.com/users/nonumber/repos","events_url":"https://api.github.com/users/nonumber/events{/privacy}","received_events_url":"https://api.github.com/users/nonumber/received_events","type":"User","site_admin":false},"repo":{"id":29645988,"name":"joomla-cms","full_name":"nonumber/joomla-cms","owner":{"login":"nonumber","id":744259,"avatar_url":"https://avatars.githubusercontent.com/u/744259?v=3","gravatar_id":"","url":"https://api.github.com/users/nonumber","html_url":"https://github.com/nonumber","followers_url":"https://api.github.com/users/nonumber/followers","following_url":"https://api.github.com/users/nonumber/following{/other_user}","gists_url":"https://api.github.com/users/nonumber/gists{/gist_id}","starred_url":"https://api.github.com/users/nonumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nonumber/subscriptions","organizations_url":"https://api.github.com/users/nonumber/orgs","repos_url":"https://api.github.com/users/nonumber/repos","events_url":"https://api.github.com/users/nonumber/events{/privacy}","received_events_url":"https://api.github.com/users/nonumber/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nonumber/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/nonumber/joomla-cms","forks_url":"https://api.github.com/repos/nonumber/joomla-cms/forks","keys_url":"https://api.github.com/repos/nonumber/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nonumber/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nonumber/joomla-cms/teams","hooks_url":"https://api.github.com/repos/nonumber/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/nonumber/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/nonumber/joomla-cms/events","assignees_url":"https://api.github.com/repos/nonumber/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/nonumber/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/nonumber/joomla-cms/tags","blobs_url":"https://api.github.com/repos/nonumber/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nonumber/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nonumber/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/nonumber/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nonumber/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/nonumber/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/nonumber/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/nonumber/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/nonumber/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/nonumber/joomla-cms/subscription","commits_url":"https://api.github.com/repos/nonumber/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/nonumber/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/nonumber/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/nonumber/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/nonumber/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/nonumber/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nonumber/joomla-cms/merges","archive_url":"https://api.github.com/repos/nonumber/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nonumber/joomla-cms/downloads","issues_url":"https://api.github.com/repos/nonumber/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/nonumber/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/nonumber/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/nonumber/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nonumber/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/nonumber/joomla-cms/releases{/id}","created_at":"2015-01-22T02:43:30Z","updated_at":"2015-01-22T02:43:43Z","pushed_at":"2015-03-04T00:08:39Z","git_url":"git://github.com/nonumber/joomla-cms.git","ssh_url":"git@github.com:nonumber/joomla-cms.git","clone_url":"https://github.com/nonumber/joomla-cms.git","svn_url":"https://github.com/nonumber/joomla-cms","homepage":"http://joomla.org","size":124131,"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":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"eeabe8eb41410ce088fd7cb2a2072856e183b6a0","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","created_at":"2011-09-27T02:07:38Z","updated_at":"2015-03-03T20:24:43Z","pushed_at":"2015-03-03T17:50:30Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"http://joomla.org","size":307556,"stargazers_count":1460,"watchers_count":1460,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1621,"mirror_url":null,"open_issues_count":577,"forks":1621,"open_issues":577,"watchers":1460,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/6286"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6286"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/6286/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/6286/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/70996c0a5ef8ce286504ca0baacde75dd01674cc"}}}}