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

Commit

Permalink
Bug #89, small & whitespace fixes to PHP [iet:9499314]
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Jul 17, 2017
1 parent 94a69c7 commit f04e217
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
12 changes: 6 additions & 6 deletions application/controllers/oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function index()
}

$req->format = $this->input->get('format') ? $this->input->get('format') : 'json';
if ('json'!=$req->format && 'xml'!=$req->format) {
if ('json' !== $req->format && 'xml' !== $req->format) {
$this->_error("the output format '$req->format' is not recognised.", "400.5");
}

Expand All @@ -92,16 +92,16 @@ public function index()
if (preg_match('@^urn:(\w{2,}):.*@', $req->url, $matches)) {
$p[ 'host' ] = $matches[ 1 ];
$this->_debug([ "'url' parameter of type 'URN' found.", $p ]);
} else if (!isset($p['host'])) {
} else if (! isset($p[ 'host' ])) {
$this->_error("the parameter 'url' is invalid - missing host.", 400);
}
$host = $req->host = str_replace('www.', '', strtolower($p['host']));
$host = $req->host = str_replace('www.', '', strtolower($p[ 'host' ]));

if (!isset($providers[$host])) {
if (! isset($providers[ $host ])) {
$this->_error("unsupported provider 'http://$req->host'.", 400);
}

$provider = $providers[$host];
$provider = $providers[ $host ];
if (is_string($provider)) {
# New (#1356)
$name = $provider;
Expand All @@ -120,7 +120,7 @@ public function index()

if (! preg_match("@{$regex}$@", $req->url, $matches)) {
$regex_display = $this->provider->regex;
$this->_debug(array( 'regex_real' => $regex ));
$this->_debug([ 'regex_real' => $regex ]);
$this->_error("the format of the URL for provider '$host' is incorrect. Expecting '$regex_display'.", 400);
}

Expand Down
7 changes: 7 additions & 0 deletions application/core/MY_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public function __construct()
$this->CI =& get_instance();

if ($this->CI->use_composer()) {
if (! file_exists(__DIR__ . '/../../vendor/autoload.php')) {
@header('HTTP/1.1 500');
?><title>500 Internal Server Error</title> <p>Error. Missing 'vendor' directory.
<?php
exit(1);
// OR: $this->CI->_error("Missing 'vendor' directory.", 500);
}
require_once __DIR__ .'/../../vendor/autoload.php';
}

Expand Down
4 changes: 2 additions & 2 deletions application/errors/error_php.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php $_debug = isset($_GET[ 'debug' ]) ?>
<?php $_debug = filter_input(INPUT_GET, 'debug') ?>
<div class="error-php" data-msg=<?php echo json_encode("PHP $severity: $message")?> style=
"border:1px solid #990000;padding-left:20px;margin:0 0 5px 0;<?php echo $_debug ? '':'display:none'?>">

Expand All @@ -9,5 +9,5 @@
<div>Filename: <?php echo $filepath; ?></div>
<div>Line Number: <?php echo $line; ?></div>

<script>window.console && console.log(<?php echo json_encode("ERROR - PHP $severity: '$message' .. (ouplayer)")?>)</script>
<script>window.console && console.error(<?php echo json_encode("ERROR - PHP $severity: '$message' .. (ouplayer)")?>)</script>
</div>
2 changes: 1 addition & 1 deletion application/views/site_layout/layout_ouice_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<meta name="description" content=
"<?php echo site_name() ?> is an online audio and video player, developed at The Open University, and used in student and public facing services. The Open University; open to people, places, methods and ideas." />
<meta name="keywords" content="ouplayer, oembed, open university, distance, learning, study, employee development, research, course, qualification, uni" />
<meta name="copyright" content="© 2011-2015 The Open University" />
<meta name="copyright" content="©2011-<?php echo date('Y')?> The Open University" />
<link rel="publisher" href="https://plus.google.com/u/0/b/116885993308590908200/" title="The Open University" />

<link rel="alternate" type="application/rss+xml" href="<?php echo OUP_BLOG_RSS_URL ?>" title="<?php echo site_name() ?> feed" />
Expand Down

0 comments on commit f04e217

Please sign in to comment.