{"action":"created","issue":{"url":"https://api.github.com/repos/pkp/pkp-lib/issues/792","labels_url":"https://api.github.com/repos/pkp/pkp-lib/issues/792/labels{/name}","comments_url":"https://api.github.com/repos/pkp/pkp-lib/issues/792/comments","events_url":"https://api.github.com/repos/pkp/pkp-lib/issues/792/events","html_url":"https://github.com/pkp/pkp-lib/issues/792","id":109830812,"number":792,"title":"Improve escaping of PHP contents into Javascript","user":{"login":"asmecher","id":200411,"avatar_url":"https://avatars.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pkp/pkp-lib/labels/Open%20Monograph%20Press","name":"Open Monograph Press","color":"a2c6dc"}],"state":"open","locked":false,"assignee":{"login":"asmecher","id":200411,"avatar_url":"https://avatars.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/pkp/pkp-lib/milestones/4","html_url":"https://github.com/pkp/pkp-lib/milestones/OMP%201.2","labels_url":"https://api.github.com/repos/pkp/pkp-lib/milestones/4/labels","id":892323,"number":4,"title":"OMP 1.2","description":"OMP 1.2 is a major revision of OMP building on the stable OMP 1.1.1 branch but adding numerous new features and changes, including Javascript library upgrades, a move to Composer for dependency management, and more.","creator":{"login":"asmecher","id":200411,"avatar_url":"https://avatars.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":9,"state":"open","created_at":"2014-12-04T23:55:42Z","updated_at":"2015-10-05T16:49:18Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-10-05T16:01:25Z","updated_at":"2015-10-05T21:37:46Z","closed_at":null,"body":"The way we're currently escaping PHP contents into Javascript, e.g. the following in a template:\r\n\r\n    $('#contextSubmissionForm').pkpHandler('$.pkp.controllers.dashboard.form.DashboardTaskFormHandler',\r\n        {ldelim}\r\n            {if $contextCount == 1}\r\n                singleContextSubmissionUrl: '{url|escape:\"jsparam\" context=$context->getPath() page=\"submission\" op=\"wizard\" escape=false}',\r\n            {/if}\r\n            trackFormChanges: false\r\n        {rdelim}\r\n    );\r\n\r\n...does not behave nicely with path_info_disabled as `&amp;` gets encoded instead of `&`.\r\n\r\nFollowing [a SO recommendation](http://stackoverflow.com/questions/168214/pass-a-php-string-to-a-javascript-variable-and-escape-newlines), use json_encode to do it succinctly and correctly.\r\n\r\nAlso check to make sure other places that don't use `jsparam` are working correctly. It should be possible to remove jsparam once this is done, OTOH."},"comment":{"url":"https://api.github.com/repos/pkp/pkp-lib/issues/comments/145675787","html_url":"https://github.com/pkp/pkp-lib/issues/792#issuecomment-145675787","issue_url":"https://api.github.com/repos/pkp/pkp-lib/issues/792","id":145675787,"user":{"login":"asmecher","id":200411,"avatar_url":"https://avatars.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T21:37:46Z","updated_at":"2015-10-05T21:37:46Z","body":"Pulls:\r\nhttps://github.com/pkp/pkp-lib/pull/796\r\nhttps://github.com/pkp/omp/pull/140"}}