Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper PHP class and concentrate dependencies.
- Loading branch information
Showing
3 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
/* vim: set noexpandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ | ||
|
||
require_once 'Swat/SwatHtmlHeadEntrySet.php'; | ||
require_once 'Swat/SwatJavaScriptHtmlHeadEntry.php'; | ||
|
||
/** | ||
* Gets a HTML head entry set for using jQuery | ||
* | ||
* @package JQuery | ||
* @copyright 2015 silverorange | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
*/ | ||
class JQuery | ||
{ | ||
// {{{ class constants | ||
|
||
/** | ||
* The current jQuery version. Update this when updating the bundled | ||
* version. | ||
*/ | ||
const VERSION = '1.11.2'; | ||
|
||
// }}} | ||
// {{{ protected properties | ||
|
||
/** | ||
* Static collection of head entries | ||
* | ||
* @var SwatHtmlHeadEntrySet | ||
*/ | ||
protected static $html_head_entries = null; | ||
|
||
// }}} | ||
// {{{ public function getHtmlHeadEntrySet() | ||
|
||
/** | ||
* Gets the HTML head entries needed for jQuery | ||
* | ||
* @return SwatHtmlHeadEntrySet the HTML head entries needed for jQuery. | ||
*/ | ||
public function getHtmlHeadEntrySet() | ||
{ | ||
if (!self::$html_head_entries instanceof SwatHtmlHeadEntrySet) { | ||
$filename = printf('jquery-%s.js', self::VERSION); | ||
self::$html_head_entries = new SwatHtmlHeadEntrySet(); | ||
self::$html_head_entries->add( | ||
new SwatJavaScriptHtmlHeadEntry( | ||
'packages/jquery/javascript/'.$filename | ||
) | ||
); | ||
return self::$html_head_entries; | ||
} | ||
} | ||
|
||
// }}} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## | ||
## Static Web-resource dependencies for the jQuery package | ||
## | ||
## Copyright (c) 2015 silverorange | ||
## | ||
## Permission is hereby granted, free of charge, to any person obtaining | ||
## a copy of this software and associated documentation files (the | ||
## "Software"), to deal in the Software without restriction, including | ||
## without limitation the rights to use, copy, modify, merge, publish, | ||
## distribute, sublicense, and/or sell copies of the Software, and to | ||
## permit persons to whom the Software is furnished to do so, subject to | ||
## the following conditions: | ||
## | ||
## The above copyright notice and this permission notice shall be | ||
## included in all copies or substantial portions of the Software. | ||
## | ||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
## LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
## OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
## | ||
## vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2: | ||
## | ||
JQuery: | ||
Provides: | ||
# JavaScript resources | ||
packages/jquery/javascript/jquery-1.11.2.js: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters