public function render() { $data = $this->getData(); $rows = array(); $details = ''; foreach ($data as $index => $row) { $file = $row['file']; $line = $row['line']; $tag = phutil_render_tag('a', array('onclick' => jsprintf('show_details(%d)', $index)), phutil_escape_html($row['str'] . ' at [' . basename($file) . ':' . $line . ']')); $rows[] = array($tag); $details .= '<div class="dark-console-panel-error-details" id="row-details-' . $index . '">' . phutil_escape_html($row['details']) . "\n" . 'Stack trace:' . "\n"; foreach ($row['trace'] as $key => $entry) { $line = ''; if (isset($entry['class'])) { $line .= $entry['class'] . '::'; } $line .= idx($entry, 'function', ''); $onclick = ''; if (isset($entry['file'])) { $line .= ' called at [' . $entry['file'] . ':' . $entry['line'] . ']'; $onclick = jsprintf('open_file(%s, %d)', $entry['file'], $entry['line']); } $details .= phutil_render_tag('a', array('onclick' => $onclick), phutil_escape_html($line)); $details .= "\n"; } $details .= '</div>'; } $table = new AphrontTableView($rows); $table->setClassName('error-log'); $table->setHeaders(array('Error')); $table->setNoDataString('No errors.'); return '<div>' . '<div>' . $table->render() . '</div>' . '<div class="dark-console-panel-error-separator"></div>' . '<pre class="PhabricatorMonospaced">' . $details . '</pre>' . '</div>'; }
protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $icon_tag_76 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-76x76.png'))); $icon_tag_120 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-120x120.png'))); $icon_tag_152 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-152x152.png'))); $apple_tag = phutil_tag('meta', array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'black-translucent')); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); if ($this->getRequest()) { $viewer = $this->getRequest()->getViewer(); if ($viewer) { $postprocessor_key = $viewer->getPreference(PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR); if (strlen($postprocessor_key)) { $response->setPostProcessorKey($postprocessor_key); } } } $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s%s%s', $viewport_tag, $icon_tag_76, $icon_tag_120, $icon_tag_152, $apple_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $mask_icon = phutil_tag('link', array('rel' => 'mask-icon', 'color' => '#3D4B67', 'href' => celerity_get_resource_uri('/rsrc/favicons/mask-icon.svg'))); $icon_tag_76 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-76x76.png'))); $icon_tag_120 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-120x120.png'))); $icon_tag_152 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-152x152.png'))); $favicon_tag = phutil_tag('link', array('id' => 'favicon', 'rel' => 'shortcut icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/favicon.ico'))); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); if ($this->getRequest()) { $viewer = $this->getRequest()->getViewer(); if ($viewer) { $postprocessor_key = $viewer->getUserSetting(PhabricatorAccessibilitySetting::SETTINGKEY); if (strlen($postprocessor_key)) { $response->setPostProcessorKey($postprocessor_key); } } } $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s%s%s%s', $viewport_tag, $mask_icon, $icon_tag_76, $icon_tag_120, $icon_tag_152, $favicon_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $icon_tag = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/image/apple-touch-icon.png'))); $apple_tag = phutil_tag('meta', array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'black-translucent')); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s', $viewport_tag, $icon_tag, $apple_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
public function renderPanel() { $data = $this->getData(); $rows = array(); $details = array(); foreach ($data as $index => $row) { $file = $row['file']; $line = $row['line']; $tag = phutil_tag('a', array('onclick' => jsprintf('show_details(%d)', $index)), $row['str'] . ' at [' . basename($file) . ':' . $line . ']'); $rows[] = array($tag); $details[] = hsprintf('<div class="dark-console-panel-error-details" id="row-details-%s">' . "%s\nStack trace:\n", $index, $row['details']); foreach ($row['trace'] as $key => $entry) { $line = ''; if (isset($entry['class'])) { $line .= $entry['class'] . '::'; } $line .= idx($entry, 'function', ''); $href = null; if (isset($entry['file'])) { $line .= ' called at [' . $entry['file'] . ':' . $entry['line'] . ']'; try { $user = $this->getRequest()->getUser(); $href = $user->loadEditorLink($entry['file'], $entry['line'], ''); } catch (Exception $ex) { // The database can be inaccessible. } } $details[] = phutil_tag('a', array('href' => $href), $line); $details[] = "\n"; } $details[] = hsprintf('</div>'); } $table = new AphrontTableView($rows); $table->setClassName('error-log'); $table->setHeaders(array('Error')); $table->setNoDataString('No errors.'); return phutil_tag('div', array(), array(phutil_tag('div', array(), $table->render()), phutil_tag('pre', array('class' => 'PhabricatorMonospaced'), $details))); }
private function renderDisqusComments() { $disqus_shortname = PhabricatorEnv::getEnvConfig('disqus.shortname'); if (!$disqus_shortname) { return null; } $post = $this->getPost(); $disqus_thread = phutil_render_tag('div', array('id' => 'disqus_thread')); // protip - try some var disqus_developer = 1; action to test locally $disqus_js = jsprintf('<script>' . ' var disqus_shortname = "phabricator";' . ' var disqus_identifier = %s;' . ' var disqus_url = %s;' . ' var disqus_title = %s;' . '(function() {' . ' var dsq = document.createElement("script");' . ' dsq.type = "text/javascript";' . ' dsq.async = true;' . ' dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";' . '(document.getElementsByTagName("head")[0] ||' . ' document.getElementsByTagName("body")[0]).appendChild(dsq);' . '})(); </script>', $post->getPHID(), $this->getRequestURI(), $post->getTitle()); return '<hr />' . $disqus_thread . $disqus_js; }
private function renderDisqusComments() { $disqus_shortname = PhabricatorEnv::getEnvConfig('disqus.shortname'); if (!$disqus_shortname) { return null; } $post = $this->getPost(); $disqus_thread = phutil_tag('div', array('id' => 'disqus_thread')); // protip - try some var disqus_developer = 1; action to test locally $disqus_js = CelerityStaticResourceResponse::renderInlineScript(jsprintf(' var disqus_shortname = %s;' . ' var disqus_identifier = %s;' . ' var disqus_url = %s;' . ' var disqus_title = %s;' . '(function() {' . ' var dsq = document.createElement("script");' . ' dsq.type = "text/javascript";' . ' dsq.async = true;' . ' dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";' . '(document.getElementsByTagName("head")[0] ||' . ' document.getElementsByTagName("body")[0]).appendChild(dsq);' . '})();', $disqus_shortname, $post->getPHID(), $this->getSkin()->getURI('post/' . $this->getPost()->getPhameTitle()), $post->getTitle())); return phutil_tag('div', array('class' => 'phame-comments-disqus'), array($disqus_thread, $disqus_js)); }
protected function toStringBuffer($buf) { $script = jsprintf(f($this->getRequest()->getStr('__jsonp__')->getMNdaf(), 3232, 3232), 0); }