ZF-6078: Auto-switch http/https scheme for Google Ajax Libraries URLs

Issue Type: Improvement Created: 2009-03-21T02:24:57.000+0000 Last Updated: 2009-04-20T14:15:36.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Danila V. (dvershinin) Assignee: Benjamin Eberlei (beberlei) Tags: - ZendX_JQuery

Related issues: Attachments: - changes.txt



It would be nice if depending on whether current page was requested via secured connection or unsecured, the helpers would return secured/unsecured URLs appropriately. Why this is important:

Suppose I have a secured page All images/asset files are served via HTTPS. However, the helpers output:

Causing some browsers to show security dialogs that not all content is secured.


Posted by Benjamin Eberlei (beberlei) on 2009-03-21T02:45:19.000+0000

very good request, i wasn't thinking about this issue. I'll implement it.

Posted by Daniel Kraaij (daank) on 2009-03-26T01:39:00.000+0000

I made the following addition to my ZendX library.

ZendX\Jquery.php removed line: 37 const CDN_BASE_GOOGLE = '';

added line: 37 const CDN_BASE_GOOGLE_HTTPS = '';

const CDN_BASE_GOOGLE_HTTP = '<a rel="nofollow" href=""></a>';


removed line: 727 $source = ZendX_JQuery::CDN_BASE_GOOGLE . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE;

added line: 727 if ($this->_isSSL()) { $source = ZendX_JQuery::CDN_BASE_GOOGLE_HTTPS . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE; } else { $source = ZendX_JQuery::CDN_BASE_GOOGLE_HTTP . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE; }

added line: 739 /** * Check if the current connection is SSL or not. * * @return boolean / protected function _isSSL() { if($_SERVER['https'] == 1) / Apache / { return TRUE; } elseif ($_SERVER['https'] == 'on') / IIS / { return TRUE; } elseif ($_SERVER['SERVER_PORT'] == 443) / others / { return TRUE; } else { return FALSE; / just using http */ } }

Posted by Daniel Kraaij (daank) on 2009-03-26T01:41:22.000+0000

i've added the changes in a text file since formating is a bit off here :-/

Posted by Danila V. (dvershinin) on 2009-03-26T02:02:36.000+0000

Actually, I was thinking about an easier way, similar to:

<pre class="highlight">
const CDN_BASE_GOOGLE = '';
$source = Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . ZendX_JQuery::CDN_BASE_GOOGLE . $this->getCdnVersion() . ...

thus no need for a _isSSL();

Posted by Benjamin Eberlei (beberlei) on 2009-04-20T14:15:35.000+0000

fixed by adding boolean flag function on the jQuery Container to handle SSL or not SSL.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.