Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Bug #6/ #14, whitespace PSR-2 fixes to controllers [iet:3791672]
Browse files Browse the repository at this point in the history
* Plus, README & composer fixes [iet:3785103]
  • Loading branch information
nfreear committed Jul 22, 2015
1 parent 9f18e87 commit 088852b
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 68 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Open Media Player

A unified, accessible online audio and video player solution from The Open University.
A unified, accessible online audio and video player solution from [The Open University][ou].

* <https://mediaplayer.open.ac.uk>

Built on [MediaElement.js][], Flowplayer, CodeIgniter and oEmbed ([all included][credit]).
Built on [MediaElement.js][], CodeIgniter and [oEmbed][].


## Requirements

* Linux, Mac OS X or Windows (tested on Redhat 6 & Windows 7)
* PHP 5.3.3+ (cURL, `json_encode`)
* [Composer][]
* Apache 2.2+
* mod_rewrite and `.htaccess` (`.sams`) (or access to `httpd.conf`)
* Linux, Mac OS X or Windows
* PHP 5.3.3+ (cURL, SimpleXML)
* [Composer][]
* Apache 2.2+ (mod_rewrite)


## Releases
Expand All @@ -25,6 +24,8 @@ Built on [MediaElement.js][], Flowplayer, CodeIgniter and oEmbed ([all included]
* GitHub: [IET-OU/open-media-player-core][]
* GitHub: [IET-OU/open-oembed-providers][]

--

* <http://embed.open.ac.uk>
* <https://mediaplayer.open.ac.uk>

Expand All @@ -35,21 +36,27 @@ Built on [MediaElement.js][], Flowplayer, CodeIgniter and oEmbed ([all included]

## Credits

Open Media Player: Copyright © 2010-2015 The Open University.
Open Media Player: Copyright © 2015 The Open University.

* Not licensed as open-source (yet!)
* Author: Nick Freear <n.d.freear+@+open.ac.uk> / [Institute of Educational Technology][iet], and many others.
* Author: Nick Freear / [Institute of Educational Technology][iet], & many others.

For full credits and licenses see [docs/CREDITS.txt](docs/CREDITS.txt)

---
License: `to be confirmed.`

© 2011-2015 [The Open University][ou] and contributors. ([Institute of Educational Technology][iet])


[code]: https://github.com/IET-OU/open-media-player
[IET-OU/open-media-player-core]: /IET-OU/open-media-player-core
[IET-OU/open-oembed-providers]: /IET-OU/open-oembed-providers
[install]: /IET-OU/open-media-player-core/wiki/Install
[IET-OU/open-media-player-core]: https://github.com/IET-OU/open-media-player-core
[IET-OU/open-oembed-providers]: https://github.com/IET-OU/open-oembed-providers
[install]: https://github.com/IET-OU/open-media-player-core/wiki/Install
[credit]: http://iet-embed-acct.open.ac.uk/docs/CREDITS.txt "Credits and licenses"
[Composer]: https://getcomposer.org/
[MediaElement.js]: http://mediaelementjs.com/
[oEmbed]: http://oembed.com/
[iet]: http://iet.open.ac.uk/
[ou]: http://www.open.ac.uk/

[End]: http://example
71 changes: 38 additions & 33 deletions application/bin/xgettext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
/*
http://translate.google.com/#en|fr|Player+controls.+Play.+Pause.+Rewind.+Fast+forward.+Current+time.+Loading.+Loaded.+Seek+bar.+Total+time.+Mute.+Un-mute.+Volume.+Quieter.+Louder.+New+window.+Captions.
*/
if('cli'!=php_sapi_name()) die(basename(__FILE__).": Must run as cli."); #Security.

if ('cli'!=php_sapi_name()) {
die(basename(__FILE__).": Must run as cli."); #Security.
}
$xgettext = array(
'mac' => "/Applications/Poedit.app/Contents/MacOS/xgettext",
'win' => "C:/apps/GnuWin32/bin/xgettext.exe",
'win' => "C:/apps/GnuWin32/bin/xgettext.exe",
'win' => "C:/Program Files/Poedit/bin/xgettext.exe",
);
$OS = NULL;
$OS = null;
foreach ($xgettext as $label => $path) {
if (file_exists($path)) {
echo "OK, $label it is!".PHP_EOL;
Expand All @@ -29,7 +30,7 @@
break;
}
}
$files_from = win_dir(str_replace('.php','', __FILE__).".txt", $quote=FALSE);
$files_from = win_dir(str_replace('.php', '', __FILE__).".txt", $quote = false);
$sys_dir = dirname(dirname(dirname(__FILE__)));
$out_dir = win_dir("$sys_dir/application/language/"); #_templates_/");

Expand All @@ -39,15 +40,15 @@
$domains = array('application/');

foreach ($domains as $path) {
$domain = basename($path);
$directory = win_dir("$sys_dir/$path");
$domain = basename($path);
$directory = win_dir("$sys_dir/$path");

$exclude = ".|..|.svn|.po|.DS_Store|cli|about|config|Zend|phpmailer|index.html|- Copy.";
$files = file_array($directory, $directory, $exclude);
$bytes = file_put_contents($files_from, $files); #implode(PHP_EOL, $files));
$exclude = ".|..|.svn|.po|.DS_Store|cli|about|config|Zend|phpmailer|index.html|- Copy.";
$files = file_array($directory, $directory, $exclude);
$bytes = file_put_contents($files_from, $files); #implode(PHP_EOL, $files));

/*@todo --keyword=plural' doesn't work :( --keyword=t:1, plural:1,2 --flag=plural:1:pass-c-format */
$command = <<<EOF
$command = <<<EOF
"$xgettext"
--default-domain=$domain
--directory=$directory
Expand All @@ -65,54 +66,58 @@
--debug
EOF;

if ('win' != $OS) {
# The Windows builds don't have these options :(
$command .= <<<EOF
if ('win' != $OS) {
# The Windows builds don't have these options :(
$command .= <<<EOF
--copyright-holder="2011 The Open University. All rights reserved."
--package-name=ouplayer-$domain
--package-version="1.0"
--msgid-bugs-address="[email protected]"
EOF;
}
}

$command = str_replace(array("\r","\n"), '', $command);
$command = str_replace(array("\r","\n"), '', $command);

# A return of '0' is good.
$st = system($command, $return);
$count = count(explode(PHP_EOL, $files));
echo "Domain: $domain | Files parsed: $count | Status: $return".PHP_EOL;
$st = system($command, $return);
$count = count(explode(PHP_EOL, $files));
echo "Domain: $domain | Files parsed: $count | Status: $return".PHP_EOL;
}
# Security: truncate file.
#$r = file_put_contents($files_from, '');


function win_dir($input, $quotes=TRUE) {
global $OS;
if ('win'==$OS) {
$quotes = /*($quotes) ? '"' :*/ '';
return ltrim(str_replace(array('Documents and Settings', "/"), array('DOCUME~1', "\\"), $input), "\\");
}
return $input;
function win_dir($input, $quotes = true)
{
global $OS;
if ('win'==$OS) {
$quotes = /*($quotes) ? '"' :*/ '';
return ltrim(str_replace(array('Documents and Settings', "/"), array('DOCUME~1', "\\"), $input), "\\");
}
return $input;
}

// Open a known directory, and proceed to read its contents
function file_array($path, $rel, $exclude = ".|..|.svn|.DS_Store", $recursive = true) {
function file_array($path, $rel, $exclude = ".|..|.svn|.DS_Store", $recursive = true)
{
$path = rtrim($path, "/") . "/";
$folder_handle = opendir($path);
$exclude_array = explode("|", strtolower($exclude));
$result = ''; #array();
while(false !== ($filename = readdir($folder_handle))) {
if(!in_array(strtolower($filename), $exclude_array)) {
if(is_dir($path . $filename . "/")) {
while (false !== ($filename = readdir($folder_handle))) {
if (!in_array(strtolower($filename), $exclude_array)) {
if (is_dir($path . $filename . "/")) {
// Need to include full "path" or it's an infinite loop
if($recursive) $result .= file_array($path . $filename . "/", $rel, $exclude, true); #[].
if ($recursive) {
$result .= file_array($path . $filename . "/", $rel, $exclude, true); #[].
}
} else {
$result .= win_dir(str_replace($rel,'', $path).$filename.PHP_EOL); #[], $path.
$result .= win_dir(str_replace($rel, '', $path).$filename.PHP_EOL); #[], $path.
}
}
}
closedir($folder_handle);
return $result;
}

#End.
#End.
1 change: 0 additions & 1 deletion application/controllers/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Build extends \IET_OU\Open_Media_Player\MY_Controller
public function revision($echo = false)
{
if ($this->input->is_cli_request()) {

$git = new \IET_OU\Open_Media_Player\Gitlib();

$result = $git->put_revision($echo);
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public function openlearn()
return $this->_player('Openlearn_player', $options);
}

public function _is_popup() {
public function _is_popup()
{
return 'Popup' == get_class($this);
}

Expand Down
3 changes: 1 addition & 2 deletions application/controllers/oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ public function index()

if (file_exists($oembed_view . '.php')) {
$html = $this->load->view($oembed_view, $view_data);
}
// LEGACY.
} // LEGACY.
elseif (file_exists(APPPATH . "views/$oembed_view.php")) {
$html = $this->load->view($oembed_view, $view_data);

Expand Down
1 change: 0 additions & 1 deletion application/controllers/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function index($return = false)
$services[ $name ] = $this->provider->getProperties();

if ('\\IET_OU\\Open_Media_Player\\Oupodcast_Provider' == $provider) {

$player = new \IET_OU\Open_Media_Player\Podcast_Player();
$services[$name]->_sizes = $player->get_sizes();
}
Expand Down
2 changes: 0 additions & 2 deletions composer-shared/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@

"extra": {
"//": [
"http://mediaplayer.open.ac.uk/demo/info#php - 5.4.36",
"http://embed.open.ac.uk/demo/info#php - 5.3.3",
"https://github.com/IET-OU/ouplayer ../system/core/CodeIgniter.php#L36 - CI 2.1.3",
"http://iet-embed-acct.open.ac.uk/docs/CREDITS.txt",
"https://gist.github.com/nfreear/57262e040d49b2f212ec",
Expand Down
25 changes: 10 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"minimum-stability": "dev",
"authors": [
{ "name": "Nick Freear (@nfreear)", "role": "developer" },
{ "name": "Peter Devine (@peterdevinegmd", "role": "designer", "homepage": "http://devine.co.uk/peter/" }
{ "name": "Peter Devine (@peterdevinegmd)", "role": "designer", "homepage": "http://devine.co.uk/peter/" },
{ "name": "& many others", "homepage": "https://github.com/IET-OU/open-media-player/blob/2.x/docs/CREDITS.txt" }
],
"support": {
"email": "[email protected]",
"forum": "https://groups.google.com/forum/#!forum/ou-media-player",
"issues": "https://github.com/IET-OU/ouplayer/issues",
"source": "https://github.com/IET-OU/ouplayer"
"forum": "https://groups.google.com/forum/#!forum/open-media-player",
"issues": "https://github.com/IET-OU/open-media-player/issues",
"source": "https://github.com/IET-OU/open-media-player"
},
"require": {
"php": ">=5.3.3",
Expand Down Expand Up @@ -50,9 +51,6 @@
"mkdir _data",
"php application/bin/cpn application/config/.env-generic .env"
],
"X--pre-install-cmd": [
"php application/bin/boot-comp-merge"
],
"post-install-cmd": [
"php application/bin/cpn application/config embed_config.dist.php embed_config.php",
"php application/bin/cpn application/config oup_site.dist.php oup_site.php",
Expand All @@ -63,26 +61,23 @@
],
"env-suggest": "Nfreear\\Composer\\Suggest::dotEnvTemplate",
"test": [
"php index.php build/revision",
"composer validate --no-interaction",
"composer validate --no-interaction --working-dir composer-shared",
"#parallel-lint application/*",
"phpcs --standard=./phpcs.xml -n --encoding=utf-8 --extensions=php application/core/*"
],
"test-cs": [
"phpcs --standard=./phpcs.xml -n --encoding=utf-8 --extensions=php application/*"
],
"test-v": [
"phpcs --standard=./phpcs.xml -n --encoding=utf-8 --extensions=php application/views/vle_d*"
"phpcs --standard=./phpcs.xml -n --encoding=utf-8 --extensions=php application/views/*"
],
"fix-oump": [
"phpcbf --standard=./phpcs.xml -n -l --encoding=utf-8 --extensions=php application/help*"
]
},
"config": {
"preferred-install": "source"
},
"extra": {
"X--merge-plugin": {
"include": [
"./composer-shared/composer.json"
]
}
}
}

0 comments on commit 088852b

Please sign in to comment.