{"action":"created","comment":{"url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/comments/24867032","id":24867032,"diff_hunk":"@@ -0,0 +1,147 @@\n+<?php\n+/**\n+ * Copyright 2010 Cyrille Mahieux\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and limitations\n+ * under the License.\n+ *\n+ * ><)))°> ><)))°> ><)))°> ><)))°> ><)))°> ><)))°> ><)))°> ><)))°> ><)))°>\n+ *\n+ * Manipulation of HTML\n+ *\n+ * @author c.mahieux@of2m.fr\n+ * @since 05/04/2010\n+ */\n+class Library_HTML_Components\n+{\n+    /**\n+     * Dump server list in an HTML select\n+     *\n+     * @return String\n+     */\n+    public static function serverSelect($name, $selected = '', $class = '', $events = '')\n+    {\n+        # Loading ini file\n+        $_ini = Library_Configuration_Loader::singleton();\n+\n+        # Select Name\n+        $serverList = '<select id=\"' . $name . '\" ';\n+\n+        # CSS Class\n+        $serverList .= ($class != '') ? 'class=\"' . $class . '\"' : '';\n+\n+        # Javascript Events\n+        $serverList .= ' ' . $events .'>';\n+\n+        foreach($_ini->get('servers') as $cluster => $servers)\n+        {\n+            # Cluster\n+            $serverList .= '<option value=\"' . $cluster . '\" ';\n+            $serverList .= ($selected == $cluster) ? 'selected=\"selected\"' : '';\n+            $serverList .= '>' . $cluster . ' cluster</option>';\n+\n+            # Cluster server\n+            foreach($servers as $name => $servers)\n+            {\n+                $serverList .= '<option value=\"' . $name . '\" ';\n+                $serverList .= ($selected == $name) ? 'selected=\"selected\"' : '';\n+                $serverList .= '>&nbsp;&nbsp;-&nbsp;' . ((strlen($name) > 38) ? substr($name, 0, 38) . ' [...]' : $name) . '</option>';\n+            }\n+        }\n+        return $serverList . '</select>';\n+    }\n+\n+    /**\n+     * Dump cluster list in an HTML select\n+     *\n+     * @return String\n+     */\n+    public static function clusterSelect($name, $selected = '', $class = '', $events = '')\n+    {\n+        # Loading ini file\n+        $_ini = Library_Configuration_Loader::singleton();\n+\n+        # Select Name\n+        $clusterList = '<select id=\"' . $name . '\" ';\n+\n+        # CSS Class\n+        $clusterList .= ($class != '') ? 'class=\"' . $class . '\"' : '';\n+\n+        # Javascript Events\n+        $clusterList .= ' ' . $events .'>';\n+\n+        foreach($_ini->get('servers') as $cluster => $servers)\n+        {\n+            # Option value and selected case\n+            $clusterList .= '<option value=\"' . $cluster . '\" ';\n+            $clusterList .= ($selected == $cluster) ? 'selected=\"selected\"' : '';\n+            $clusterList .= '>' . $cluster . ' cluster</option>';\n+        }\n+        return $clusterList . '</select>';\n+    }\n+\n+    /**\n+     * Dump server response in proper formatting\n+     *\n+     * @param String $hostname Hostname\n+     * @param String $port Port\n+     * @param Mixed $data Data (reponse)\n+     *\n+     * @return String\n+     */\n+    public static function serverResponse($hostname, $port, $data)\n+    {\n+        $header = '<span class=\"red\">Server ' . $hostname . ':' . $port . \"</span>\\r\\n\";\n+        $return = '';\n+        if(is_array($data))\n+        {\n+            foreach($data as $string)\n+            {\n+                $return .= $string . \"\\r\\n\";\n+            }\n+            return $header . htmlentities($return, ENT_NOQUOTES | 0, \"UTF-8\") . \"\\r\\n\";\n+        }\n+        return $header . $return . $data . \"\\r\\n\";","path":"Library/HTML/Components.php","position":112,"original_position":112,"commit_id":"e9e771fff8a0e8dfde20485e4d23785e285e3f5a","original_commit_id":"e9e771fff8a0e8dfde20485e4d23785e285e3f5a","user":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"body":"Ahhhhh, won't escape if `data`'s not an array!","created_at":"2015-02-17T23:48:11Z","updated_at":"2015-02-17T23:48:11Z","html_url":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1#discussion_r24867032","pull_request_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/comments/24867032"},"html":{"href":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1#discussion_r24867032"},"pull_request":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1","id":29488703,"html_url":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1","diff_url":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1.diff","patch_url":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1.patch","issue_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/1","number":1,"state":"open","locked":false,"title":"Import phpmemcacheadmin 1.2.2","user":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"body":"for notes","created_at":"2015-02-17T23:37:52Z","updated_at":"2015-02-17T23:48:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b55f2b0f661dedf695be32bf19b682a8225dc169","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1/commits","review_comments_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1/comments","review_comment_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/1/comments","statuses_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/statuses/e9e771fff8a0e8dfde20485e4d23785e285e3f5a","head":{"label":"JordanMilne:notes","ref":"notes","sha":"e9e771fff8a0e8dfde20485e4d23785e285e3f5a","user":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"repo":{"id":30942960,"name":"phpmemcacheadmin","full_name":"JordanMilne/phpmemcacheadmin","owner":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JordanMilne/phpmemcacheadmin","description":"Just so I can reference stuff","fork":false,"url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin","forks_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/forks","keys_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/teams","hooks_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/hooks","issue_events_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/events{/number}","events_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/events","assignees_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/assignees{/user}","branches_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/branches{/branch}","tags_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/tags","blobs_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/languages","stargazers_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/stargazers","contributors_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/contributors","subscribers_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/subscribers","subscription_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/subscription","commits_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/comments/{number}","contents_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/contents/{+path}","compare_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/merges","archive_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/downloads","issues_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues{/number}","pulls_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/labels{/name}","releases_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/releases{/id}","created_at":"2015-02-17T23:14:01Z","updated_at":"2015-02-17T23:36:21Z","pushed_at":"2015-02-17T23:36:31Z","git_url":"git://github.com/JordanMilne/phpmemcacheadmin.git","ssh_url":"git@github.com:JordanMilne/phpmemcacheadmin.git","clone_url":"https://github.com/JordanMilne/phpmemcacheadmin.git","svn_url":"https://github.com/JordanMilne/phpmemcacheadmin","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"notes"}},"base":{"label":"JordanMilne:master","ref":"master","sha":"d54134ecdd31bc00017d614f5e10ce2ef73dbc8e","user":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"repo":{"id":30942960,"name":"phpmemcacheadmin","full_name":"JordanMilne/phpmemcacheadmin","owner":{"login":"JordanMilne","id":278982,"avatar_url":"https://avatars.githubusercontent.com/u/278982?v=3","gravatar_id":"","url":"https://api.github.com/users/JordanMilne","html_url":"https://github.com/JordanMilne","followers_url":"https://api.github.com/users/JordanMilne/followers","following_url":"https://api.github.com/users/JordanMilne/following{/other_user}","gists_url":"https://api.github.com/users/JordanMilne/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMilne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMilne/subscriptions","organizations_url":"https://api.github.com/users/JordanMilne/orgs","repos_url":"https://api.github.com/users/JordanMilne/repos","events_url":"https://api.github.com/users/JordanMilne/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMilne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JordanMilne/phpmemcacheadmin","description":"Just so I can reference stuff","fork":false,"url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin","forks_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/forks","keys_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/teams","hooks_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/hooks","issue_events_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/events{/number}","events_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/events","assignees_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/assignees{/user}","branches_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/branches{/branch}","tags_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/tags","blobs_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/languages","stargazers_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/stargazers","contributors_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/contributors","subscribers_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/subscribers","subscription_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/subscription","commits_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/comments/{number}","contents_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/contents/{+path}","compare_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/merges","archive_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/downloads","issues_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues{/number}","pulls_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/labels{/name}","releases_url":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/releases{/id}","created_at":"2015-02-17T23:14:01Z","updated_at":"2015-02-17T23:36:21Z","pushed_at":"2015-02-17T23:36:31Z","git_url":"git://github.com/JordanMilne/phpmemcacheadmin.git","ssh_url":"git@github.com:JordanMilne/phpmemcacheadmin.git","clone_url":"https://github.com/JordanMilne/phpmemcacheadmin.git","svn_url":"https://github.com/JordanMilne/phpmemcacheadmin","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"notes"}},"_links":{"self":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1"},"html":{"href":"https://github.com/JordanMilne/phpmemcacheadmin/pull/1"},"issue":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/1"},"comments":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/JordanMilne/phpmemcacheadmin/statuses/e9e771fff8a0e8dfde20485e4d23785e285e3f5a"}}}}