Skip to content

Commit

Permalink
Initial work on fixing PHP Strict Standards warnings
Browse files Browse the repository at this point in the history
This mainly corrects using static function and bad inheritance in method
signatures of NamespacedElements
  • Loading branch information
kabel committed Oct 10, 2014
1 parent ccf7eaa commit 8798183
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 57 deletions.
10 changes: 5 additions & 5 deletions lib/php/UNL/Services/Peoplefinder.php
Expand Up @@ -13,7 +13,7 @@
*
* @package UNL_Services_Peoplefinder
*/
class UNL_Services_Peoplefinder
abstract class UNL_Services_Peoplefinder
{

/**
Expand All @@ -22,7 +22,7 @@ class UNL_Services_Peoplefinder
* @param string $uid
* @return string|false
*/
function getFullName($uid)
public static function getFullName($uid)
{
if ($vcard = UNL_Services_Peoplefinder::getVCard($uid)) {
$matches = array();
Expand All @@ -43,7 +43,7 @@ function getFullName($uid)
* @param string $uid
* @return string|false
*/
function getEmail($uid)
public static function getEmail($uid)
{
if ($hcard = UNL_Services_Peoplefinder::getHCard($uid)) {
$matches = array();
Expand All @@ -64,7 +64,7 @@ function getEmail($uid)
* @param string $uid
* @return string|false
*/
function getHCard($uid)
public static function getHCard($uid)
{
if ($hcard = file_get_contents('http://peoplefinder.unl.edu/hcards/'.$uid)) {
return $hcard;
Expand All @@ -79,7 +79,7 @@ function getHCard($uid)
* @param string $uid
* @return string|false
*/
function getVCard($uid)
public static function getVCard($uid)
{
if ($vcard = file_get_contents('http://peoplefinder.unl.edu/vcards/'.$uid)) {
return $vcard;
Expand Down
4 changes: 2 additions & 2 deletions src/UNL/MediaHub/Controller.php
Expand Up @@ -410,7 +410,7 @@ function postRun($me)
*
* @return void
*/
function setReplacementData($field, $data)
public function setReplacementData($field, $data)
{
self::$replacements[$field] = $data;
}
Expand Down Expand Up @@ -439,7 +439,7 @@ public static function getReplacementData($field)
*
* @return string
*/
function getURL($mixed = null, $additional_params = array())
public static function getURL($mixed = null, $additional_params = array())
{
$params = array();

Expand Down
4 changes: 2 additions & 2 deletions src/UNL/MediaHub/Feed/Media/NamespacedElements.php
Expand Up @@ -4,15 +4,15 @@ abstract class UNL_MediaHub_Feed_Media_NamespacedElements extends UNL_MediaHub_M
{
abstract function getItemElements();

public static function mediaHasElement($media_id, $element, $xmlns)
protected static function mediaHasElementNS($media_id, $element, $xmlns)
{
$query = new Doctrine_Query();
$query->from('UNL_MediaHub_Feed_Media_NamespacedElements_'.$xmlns);
$query->where('xmlns = ? AND media_id = ? AND element = ?', array($xmlns, $media_id, $element));
return $query->fetchOne();
}

public static function mediaSetElement($media_id, $element, $xmlns, $value)
protected static function mediaSetElementNS($media_id, $element, $xmlns, $value)
{
$class = 'UNL_MediaHub_Feed_Media_NamespacedElements_' . $xmlns;
if (call_user_func($class . '::mediaHasElement', $media_id, $element)){
Expand Down
2 changes: 1 addition & 1 deletion src/UNL/MediaHub/Feed/Media/NamespacedElements/geo.php
Expand Up @@ -15,7 +15,7 @@ function getItemElements()
);
}

public static function mediaHasElement($media_id, $element)
public static function mediaHasElement($media_id, $element, $xmlns)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaHasElement($media_id, $element, 'geo');
}
Expand Down
4 changes: 2 additions & 2 deletions src/UNL/MediaHub/Feed/Media/NamespacedElements/itunes.php
Expand Up @@ -21,11 +21,11 @@ function getItemElements()

public static function mediaHasElement($media_id, $element)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaHasElement($media_id, $element, 'itunes');
return parent::mediaHasElementNS($media_id, $element, self::$xmlns);
}

public static function mediaSetElement($media_id, $element, $value)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaSetElement($media_id, $element, 'itunes', $value);
return parent::mediaSetElementNS($media_id, $element, self::$xmlns, $value);
}
}
2 changes: 1 addition & 1 deletion src/UNL/MediaHub/Feed/Media/NamespacedElements/itunesu.php
Expand Up @@ -16,7 +16,7 @@ function getItemElements()

public static function mediaHasElement($media_id, $element)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaHasElement($media_id, $element, 'itunesu');
return parent::mediaHasElementNS($media_id, $element, self::$xmlns);
}

function preInsert($event)
Expand Down
2 changes: 1 addition & 1 deletion src/UNL/MediaHub/Feed/Media/NamespacedElements/media.php
Expand Up @@ -31,6 +31,6 @@ function getItemElements()

public static function mediaHasElement($media_id, $element)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaHasElement($media_id, $element, 'media');
return parent::mediaHasElementNS($media_id, $element, self::$xmlns);
}
}
Expand Up @@ -45,6 +45,6 @@ public static function setCustomElements($elements)

public static function mediaHasElement($media_id, $element)
{
return UNL_MediaHub_Feed_Media_NamespacedElements::mediaHasElement($media_id, $element, 'mediahub');
return parent::mediaHasElementNS($media_id, $element, self::$xmlns);
}
}
18 changes: 0 additions & 18 deletions src/UNL/MediaHub/List.php
Expand Up @@ -78,8 +78,6 @@ function run()
$this->last = $pager->getLastIndice();

$this->pager = $pager;

$this->getURL();
}

abstract function setOrderBy(Doctrine_Query &$query);
Expand All @@ -103,21 +101,5 @@ function count()
{
return $this->total;
}

/**
* Returns a url to describe this specific list.
*
* @return string
*/
function getURL()
{
$this->url = self::$url;

$this->url .= '&orderby=' . $this->options['orderby'];

$this->url .= '&order=' . $this->options['order'];

return $this->url;
}
}
?>
4 changes: 2 additions & 2 deletions src/UNL/MediaHub/Manager.php
Expand Up @@ -50,7 +50,7 @@ class UNL_MediaHub_Manager implements UNL_MediaHub_CacheableInterface, UNL_Media

function __construct($options = array(), $dsn)
{
$this->mediahub = new UNL_MediaHub($dsn);
self::$mediahub = new UNL_MediaHub($dsn);

$this->auth = UNL_Auth::factory('SimpleCAS');
$this->auth->login();
Expand Down Expand Up @@ -262,7 +262,7 @@ function showFeed()
function handlePost()
{
$handler = new UNL_MediaHub_Manager_PostHandler($this->options, $_POST, $_FILES);
$handler->setMediaHub($this->mediahub);
$handler->setMediaHub(self::$mediahub);
return $handler->handle();
}

Expand Down
6 changes: 3 additions & 3 deletions src/UNL/MediaHub/Media.php
Expand Up @@ -70,7 +70,7 @@ public function postInsert($event)
$this->setMRSSContent();
}

public function postSave()
public function postSave($event)
{
// var_dump('postsave');
// $this->setMRSSThumbnail();
Expand Down Expand Up @@ -191,7 +191,7 @@ function getFeeds()
return new UNL_MediaHub_FeedList(array('limit'=>null, 'filter'=>new UNL_MediaHub_FeedList_Filter_WithMediaId($this->id)));
}

function delete()
function delete(Doctrine_Connection $conn = null)
{
$feeds = $this->getFeeds();
$feeds->run();
Expand All @@ -214,7 +214,7 @@ function delete()
} catch (Exception $e) {
// Error, just skip this for now.
}
return parent::delete();
return parent::delete($conn);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/UNL/MediaHub/MediaList.php
Expand Up @@ -74,7 +74,7 @@ function getURL()
{
$params = array();

$this->url = UNL_MediaHub_Controller::getURL();
self::$url = UNL_MediaHub_Controller::getURL();
if (!empty($this->options['filter'])) {
switch ($this->options['filter']->getType()) {
case 'tag':
Expand All @@ -93,9 +93,9 @@ function getURL()
$params['orderby'] = $this->options['orderby'];
$params['order'] = $this->options['order'];

$this->url = UNL_MediaHub_Controller::addURLParams($this->url, $params);
self::$url = UNL_MediaHub_Controller::addURLParams(self::$url, $params);

return $this->url;
return self::$url;
}
}

Expand Down
2 changes: 1 addition & 1 deletion www/manager/templates/Feed/Media/Form.tpl.php
Expand Up @@ -20,7 +20,7 @@
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
';

UNL_MediaHub_Manager::setReplacementData('head', $js);
$controller->setReplacementData('head', $js);
?>
<div class="headline_main" id="headline_main">
<?php
Expand Down
4 changes: 2 additions & 2 deletions www/manager/templates/FeedList.tpl.php
@@ -1,6 +1,6 @@
<?php
UNL_MediaHub_Controller::setReplacementData('title', 'UNL | MediaHub | Your Media');
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>Your Media</li></ul>');
$controller->setReplacementData('title', 'UNL | MediaHub | Your Media');
$controller->setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>Your Media</li></ul>');
?>
<div id="feedlist" class="grid6 first">
<h1 class="sec_header">Your Channels</h1>
Expand Down
4 changes: 2 additions & 2 deletions www/templates/html/Feed/LiveStream.tpl.php
Expand Up @@ -6,8 +6,8 @@
}

$feed_url = htmlentities(UNL_MediaHub_Controller::getURL($context->feed), ENT_QUOTES);
UNL_MediaHub_Controller::setReplacementData('title', 'UNL | MediaHub | '.htmlspecialchars($context->feed->title). ' | Live');
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '
$controller->setReplacementData('title', 'UNL | MediaHub | '.htmlspecialchars($context->feed->title). ' | Live');
$controller->setReplacementData('breadcrumbs', '
<ul>
<li><a href="http://www.unl.edu/">UNL</a></li>
<li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li>
Expand Down
6 changes: 3 additions & 3 deletions www/templates/html/FeedAndMedia.tpl.php
@@ -1,7 +1,7 @@
<?php
UNL_MediaHub_Controller::setReplacementData('head', '<link rel="alternate" type="application/rss+xml" title="'.htmlentities($context->feed->title, ENT_QUOTES).'" href="?format=xml" />');
UNL_MediaHub_Controller::setReplacementData('title', 'UNL | MediaHub | '.htmlspecialchars($context->feed->title));
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.htmlspecialchars($context->feed->title).'</li></ul>');
$controller->setReplacementData('head', '<link rel="alternate" type="application/rss+xml" title="'.htmlentities($context->feed->title, ENT_QUOTES).'" href="?format=xml" />');
$controller->setReplacementData('title', 'UNL | MediaHub | '.htmlspecialchars($context->feed->title));
$controller->setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.htmlspecialchars($context->feed->title).'</li></ul>');
$feed_url = htmlentities(UNL_MediaHub_Controller::getURL($context->feed), ENT_QUOTES);
?>
<div id="channelIntro" class="clear">
Expand Down
4 changes: 2 additions & 2 deletions www/templates/html/FeedList.tpl.php
@@ -1,8 +1,8 @@
<?php
$label = 'Available Channels';
if (isset($context->label) && !empty($context->label)) {
UNL_MediaHub_Controller::setReplacementData('title', 'UNL | MediaHub | '.$context->label);
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.$context->label.'</li></ul>');
$controller->setReplacementData('title', 'UNL | MediaHub | '.$context->label);
$controller->setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.$context->label.'</li></ul>');
$label = $context->label;
}
?>
Expand Down
8 changes: 4 additions & 4 deletions www/templates/html/Media.tpl.php
Expand Up @@ -12,8 +12,8 @@
}

$context->loadReference('UNL_MediaHub_Media_Comment');
UNL_MediaHub_Controller::setReplacementData('title', htmlspecialchars($context->title) . ' | MediaHub | University of Nebraska-Lincoln');
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.htmlspecialchars($context->title).'</li></ul>');
$controller->setReplacementData('title', htmlspecialchars($context->title) . ' | MediaHub | University of Nebraska-Lincoln');
$controller->setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.htmlspecialchars($context->title).'</li></ul>');
$meta = '
<meta name="title" content="'.htmlentities($context->title, ENT_QUOTES).'" />
<meta name="description" content="'.htmlentities(strip_tags($context->description), ENT_QUOTES).'" />
Expand Down Expand Up @@ -49,8 +49,8 @@
<meta property="og:audio:type" content="'.$context->type.'" />
';
}
UNL_MediaHub_Controller::setReplacementData('head', $meta);
UNL_MediaHub_Controller::setReplacementData('pagetitle', '<h1>'.$context->title.'</h1>');
$controller->setReplacementData('head', $meta);
$controller->setReplacementData('pagetitle', '<h1>'.$context->title.'</h1>');

// Store the mediaplayer code in a variable, so we can re-use it for the embed
$mediaplayer = $savvy->render($context, 'MediaPlayer.tpl.php');
Expand Down
4 changes: 2 additions & 2 deletions www/templates/html/MediaList.tpl.php
@@ -1,7 +1,7 @@
<?php
if (isset($context->label) && !empty($context->label)) {
UNL_MediaHub_Controller::setReplacementData('title', 'UNL | Media | '.$context->label);
UNL_MediaHub_Controller::setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.$context->label.'</li></ul>');
$controller->setReplacementData('title', 'UNL | Media | '.$context->label);
$controller->setReplacementData('breadcrumbs', '<ul> <li><a href="http://www.unl.edu/">UNL</a></li> <li><a href="'.UNL_MediaHub_Controller::getURL().'">MediaHub</a></li> <li>'.$context->label.'</li></ul>');
echo '<h3>'.$context->label.'</h3>';
}

Expand Down

0 comments on commit 8798183

Please sign in to comment.