From 333d456f135e0eb05e3409b021a25120d59de05e Mon Sep 17 00:00:00 2001 From: padams Date: Mon, 5 Jul 2010 19:04:36 +0000 Subject: [PATCH] adding php5 public and static keywords to functions removing php4 constructorrs --- eventQueue.php | 34 ++- includes/template_class.php | 3 +- modules/base/classes/browscap.php | 5 - modules/base/classes/cache.php | 7 - modules/base/classes/date.php | 5 - modules/base/classes/error.php | 11 - modules/base/classes/event.php | 7 +- modules/base/classes/mailer.php | 5 - modules/base/classes/resultSetManager.php | 1 + modules/base/classes/service.php | 5 - modules/base/classes/serviceUser.php | 7 - modules/base/classes/state.php | 6 - modules/base/entities/click.php | 5 - modules/base/entities/configuration.php | 12 +- modules/base/entities/exit.php | 12 -- modules/base/entities/host.php | 14 -- modules/base/entities/impression.php | 33 --- modules/base/entities/os.php | 8 - modules/base/entities/session.php | 5 - modules/base/entities/site.php | 5 - modules/base/entities/ua.php | 7 - modules/base/handlers/clickHandlers.php | 8 - modules/base/handlers/documentHandlers.php | 12 -- modules/base/handlers/domstreamHandlers.php | 12 -- modules/base/handlers/feedRequestHandlers.php | 15 +- modules/base/handlers/hostHandlers.php | 17 -- modules/base/handlers/notifyHandlers.php | 17 -- modules/base/handlers/refererHandlers.php | 16 +- modules/base/handlers/requestHandlers.php | 13 -- modules/base/handlers/sessionHandlers.php | 14 +- modules/base/handlers/userAgentHandlers.php | 19 +- modules/base/handlers/userHandlers.php | 16 +- modules/base/handlers/visitorHandlers.php | 14 +- modules/base/helperPageTags.php | 20 -- modules/base/module.php | 2 +- modules/base/processEvent.php | 13 +- owa_base.php | 5 +- owa_controller.php | 12 +- owa_coreAPI.php | 199 +++++++----------- owa_entity.php | 4 +- owa_httpRequest.php | 5 - owa_lib.php | 86 ++++---- owa_observer.php | 6 +- owa_template.php | 2 +- owa_view.php | 30 --- wp_plugin.php | 11 +- 46 files changed, 166 insertions(+), 599 deletions(-) diff --git a/eventQueue.php b/eventQueue.php index 612eeccdf..185b1505d 100644 --- a/eventQueue.php +++ b/eventQueue.php @@ -54,15 +54,6 @@ class eventQueue { */ var $listenersByFilterType; - /** - * PHP4 Constructor - * - */ - function eventQueue() { - - return eventQueue::__construct(); - } - /** * Constructor * @@ -139,17 +130,20 @@ function notify($event) { owa_coreAPI::debug("Notifying listeners of ".$event->getEventType()); //print_r($this->listenersByEventType[$event_type] ); //print $event->getEventType(); - $list = $this->listenersByEventType[$event->getEventType()]; - //print_r($list); - if (!empty($list)) { - foreach ($this->listenersByEventType[$event->getEventType()] as $k => $observer_id) { - //print_r($list); - call_user_func_array($this->listeners[$observer_id], array($event)); - //owa_coreAPI::debug(print_r($event, true)); - owa_coreAPI::debug(sprintf("%s event handled by %s.",$event->getEventType(), get_class($this->listeners[$observer_id][0]))); + if (array_key_exists($event->getEventType(), $this->listenersByEventType)) { + $list = $this->listenersByEventType[$event->getEventType()]; + //print_r($list); + if (!empty($list)) { + foreach ($this->listenersByEventType[$event->getEventType()] as $k => $observer_id) { + //print_r($list); + call_user_func_array($this->listeners[$observer_id], array($event)); + //owa_coreAPI::debug(print_r($event, true)); + owa_coreAPI::debug(sprintf("%s event handled by %s.",$event->getEventType(), get_class($this->listeners[$observer_id][0]))); + } } - } - + } else { + owa_coreAPI::debug("no listeners registered for this event type."); + } } @@ -318,7 +312,7 @@ function makeEvent($type = '') { * @return object * @access public */ - function &get_instance() { + public static function &get_instance() { static $eq; diff --git a/includes/template_class.php b/includes/template_class.php index c4d117dba..2b7d8018d 100644 --- a/includes/template_class.php +++ b/includes/template_class.php @@ -80,7 +80,8 @@ function set_template($file = null) { function set($name, $value) { if (is_object($value)) { - if (is_a($value, 'Template')) { + $class = 'Template'; + if ($value instanceof $this) { $value = $value->fetch(); } } diff --git a/modules/base/classes/browscap.php b/modules/base/classes/browscap.php index 33b2ddb03..914bcc218 100644 --- a/modules/base/classes/browscap.php +++ b/modules/base/classes/browscap.php @@ -60,11 +60,6 @@ class owa_browscap extends owa_base { var $cache; var $cacheExpiration; - function owa_browscap($ua = '') { - - return owa_browscap::__construct($ua); - } - function __construct($ua = '') { parent::__construct(); diff --git a/modules/base/classes/cache.php b/modules/base/classes/cache.php index e70526d4b..c1eaafe7b 100644 --- a/modules/base/classes/cache.php +++ b/modules/base/classes/cache.php @@ -67,13 +67,6 @@ function __construct($cache_dir = '') { } } - function owa_cache($cache_dir = '') { - - register_shutdown_function(array(&$this, "__destruct")); - return $this->__construct($cache_dir); - - } - function setGlobalCollection($collection) { return $this->global_collections[] = $collection; diff --git a/modules/base/classes/date.php b/modules/base/classes/date.php index edfe4b9fc..fca5bb890 100644 --- a/modules/base/classes/date.php +++ b/modules/base/classes/date.php @@ -56,11 +56,6 @@ function __construct() { return; } - function owa_date() { - - return owa_date::__construct(); - } - function set($date, $format = 'yyyymmdd') { switch ($format) { diff --git a/modules/base/classes/error.php b/modules/base/classes/error.php index c93222002..354ac577c 100644 --- a/modules/base/classes/error.php +++ b/modules/base/classes/error.php @@ -54,17 +54,6 @@ class owa_error { var $c; - - /** - * PHP4 Constructor - * - */ - function owa_error() { - - return owa_error::__construct(); - } - - /** * Constructor * diff --git a/modules/base/classes/event.php b/modules/base/classes/event.php index 3473e24f8..c8c3d6caf 100644 --- a/modules/base/classes/event.php +++ b/modules/base/classes/event.php @@ -74,12 +74,7 @@ class owa_event { /** * Constructor * @access public - */ - function owa_event() { - - return owa_event::__construct(); - } - + */ function __construct() { // Set GUID for event diff --git a/modules/base/classes/mailer.php b/modules/base/classes/mailer.php index 1f18c562e..0141dc581 100644 --- a/modules/base/classes/mailer.php +++ b/modules/base/classes/mailer.php @@ -34,11 +34,6 @@ class owa_mailer extends owa_base { var $mailer; - function owa_mailer() { - - return owa_mailer::__construct(); - } - /** * Constructor * diff --git a/modules/base/classes/resultSetManager.php b/modules/base/classes/resultSetManager.php index e0f0039aa..d475c557d 100644 --- a/modules/base/classes/resultSetManager.php +++ b/modules/base/classes/resultSetManager.php @@ -97,6 +97,7 @@ class owa_resultSetManager extends owa_base { var $query_params = array(); var $baseEntity; var $metricObjectsByEntityMap = array(); + var $errors = array(); function __construct($db = '') { diff --git a/modules/base/classes/service.php b/modules/base/classes/service.php index c03cca54e..2fd84e1ca 100644 --- a/modules/base/classes/service.php +++ b/modules/base/classes/service.php @@ -47,11 +47,6 @@ class owa_service extends owa_base { var $denormalizedDimensions = array(); var $browscap; - function owa_service() { - - return owa_service::__construct(); - } - function __construct() { owa_coreAPI::profile($this, __FUNCTION__, __LINE__); diff --git a/modules/base/classes/serviceUser.php b/modules/base/classes/serviceUser.php index 08b07528c..0b724f39b 100644 --- a/modules/base/classes/serviceUser.php +++ b/modules/base/classes/serviceUser.php @@ -40,13 +40,6 @@ function __construct() { //parent::__construct(); $this->user = owa_coreApi::entityFactory('base.user'); - - return; - } - - function owa_serviceUser() { - - return owa_serviceUser::__construct(); } function load($user_id) { diff --git a/modules/base/classes/state.php b/modules/base/classes/state.php index cfb2d8318..df33acce7 100644 --- a/modules/base/classes/state.php +++ b/modules/base/classes/state.php @@ -45,13 +45,7 @@ function __destruct() { $this->persistState(); } - - function owa_state() { - register_shutdown_function(array(&$this, "__destruct")); - return owa_state::__construct(); - } - function persistState() { return false; diff --git a/modules/base/entities/click.php b/modules/base/entities/click.php index b074bab74..2dbf505cb 100644 --- a/modules/base/entities/click.php +++ b/modules/base/entities/click.php @@ -29,11 +29,6 @@ */ class owa_click extends owa_entity { - - function owa_click() { - - return owa_click::__construct(); - } function __construct() { diff --git a/modules/base/entities/configuration.php b/modules/base/entities/configuration.php index e9ac705e4..99058a4ea 100644 --- a/modules/base/entities/configuration.php +++ b/modules/base/entities/configuration.php @@ -39,17 +39,7 @@ function __construct() { $this->properties['settings'] = new owa_dbColumn; $this->properties['settings']->setDataType(OWA_DTD_TEXT); $this->setCachable(); - - return; - - } - - function owa_configuration() { - return owa_configuration::__construct(); - } - + } } - - ?> diff --git a/modules/base/entities/exit.php b/modules/base/entities/exit.php index 236e268e5..0184d2712 100644 --- a/modules/base/entities/exit.php +++ b/modules/base/entities/exit.php @@ -29,19 +29,7 @@ */ class owa_exit extends owa_entity { - - //var $id = array('data_type' => OWA_DTD_BIGINT, 'is_primary_key' => true); // BIGINT, - //var $url = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $site_name = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $site = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $exit_anchortext = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $page_title = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - - function owa_exit() { - return owa_exit::__construct(); - } - function __construct() { $this->setTableName('exit'); diff --git a/modules/base/entities/host.php b/modules/base/entities/host.php index 2967bcbc3..9de798599 100644 --- a/modules/base/entities/host.php +++ b/modules/base/entities/host.php @@ -30,20 +30,6 @@ class owa_host extends owa_entity { - //var $id = array('data_type' => OWA_DTD_BIGINT, 'is_primary_key' => true); // BIGINT, - //var $ip_address = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $host = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $full_host = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - //var $city = array('data_type' => OWA_DTD_VARCHAR255); // varchar(255), - //var $country = array('data_type' => OWA_DTD_VARCHAR255); // varchar(255), - //var $latitude = array('data_type' => OWA_DTD_VARCHAR255); // varchar(255), - //var $longitude = array('data_type' => OWA_DTD_VARCHAR255); // varchar(255), - - function owa_host() { - - return owa_host::__construct(); - } - function __construct() { $this->setTableName('host'); diff --git a/modules/base/entities/impression.php b/modules/base/entities/impression.php index c2ee4391f..008c32eac 100644 --- a/modules/base/entities/impression.php +++ b/modules/base/entities/impression.php @@ -29,39 +29,6 @@ */ class owa_impression extends owa_entity { - /* - - var $id = array('data_type' => OWA_DTD_BIGINT, 'is_primary_key' => true); // BIGINT, - var $visitor_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $session_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $tag_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $placement_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $campaign_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $ad_group_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $ad_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $site_id = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - var $last_impression_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $last_impression_timestamp = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $timestamp = array('data_type' => OWA_DTD_BIGINT); // BIGINT, - var $year = array('data_type' => OWA_DTD_INT); // INT, - var $month = array('data_type' => OWA_DTD_INT); // INT, - var $day = array('data_type' => OWA_DTD_INT); // INT, - var $dayofyear = array('data_type' => OWA_DTD_INT); // INT, - var $weekofyear = array('data_type' => OWA_DTD_INT); // INT, - var $hour = array('data_type' => OWA_DTD_TINYINT2); // tinyINT, - var $minute = array('data_type' => OWA_DTD_TINYINT2); // tinyINT, - var $msec = array('data_type' => OWA_DTD_BIGINT); // INT, - var $url = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - var $ua_id = array('data_type' => OWA_DTD_BIGINT); // BIGINT - var $ip_address = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - var $host = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - var $host_id = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - - */ - function owa_impression() { - - return owa_impression::__construct(); - } function __construct() { diff --git a/modules/base/entities/os.php b/modules/base/entities/os.php index 5838f121f..d6baeeb6a 100644 --- a/modules/base/entities/os.php +++ b/modules/base/entities/os.php @@ -30,14 +30,6 @@ class owa_os extends owa_entity { - //var $id = array('data_type' => OWA_DTD_BIGINT, 'is_primary_key' => true); // BIGINT, - //var $name = array('data_type' => OWA_DTD_VARCHAR255); // VARCHAR(255), - - function owa_os() { - - return owa_os::__construct(); - } - function __construct() { $this->setTableName('os'); diff --git a/modules/base/entities/session.php b/modules/base/entities/session.php index 499c39196..8a9b70763 100644 --- a/modules/base/entities/session.php +++ b/modules/base/entities/session.php @@ -30,11 +30,6 @@ class owa_session extends owa_entity { - function owa_session() { - - return owa_session::__construct(); - } - function __construct() { // table name diff --git a/modules/base/entities/site.php b/modules/base/entities/site.php index d0f76cb8f..9c9a50e0f 100644 --- a/modules/base/entities/site.php +++ b/modules/base/entities/site.php @@ -32,11 +32,6 @@ class owa_site extends owa_entity { - function owa_site() { - - return owa_site::__construct(); - } - function __construct() { $this->setTableName('site'); diff --git a/modules/base/entities/ua.php b/modules/base/entities/ua.php index ed93bcab8..9ceb75c48 100644 --- a/modules/base/entities/ua.php +++ b/modules/base/entities/ua.php @@ -29,12 +29,7 @@ */ class owa_ua extends owa_entity { - - function owa_ua() { - return owa_ua::__construct(); - } - function __construct() { $this->setTableName('ua'); @@ -53,6 +48,4 @@ function __construct() { } } - - ?> \ No newline at end of file diff --git a/modules/base/handlers/clickHandlers.php b/modules/base/handlers/clickHandlers.php index f2712375d..c97ec9138 100644 --- a/modules/base/handlers/clickHandlers.php +++ b/modules/base/handlers/clickHandlers.php @@ -29,14 +29,6 @@ */ class owa_clickHandlers extends owa_observer { - /** - * Constructor - * - */ - function __construct() { - - return parent::__construct(); - } /** * Notify Handler * diff --git a/modules/base/handlers/documentHandlers.php b/modules/base/handlers/documentHandlers.php index bc3a433ef..a6f162a2d 100644 --- a/modules/base/handlers/documentHandlers.php +++ b/modules/base/handlers/documentHandlers.php @@ -33,19 +33,7 @@ */ class owa_documentHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function __construct() { - return parent::__construct(); - } - /** * Notify Event Handler * diff --git a/modules/base/handlers/domstreamHandlers.php b/modules/base/handlers/domstreamHandlers.php index f5d830e50..9be6d50d8 100644 --- a/modules/base/handlers/domstreamHandlers.php +++ b/modules/base/handlers/domstreamHandlers.php @@ -33,19 +33,7 @@ */ class owa_domstreamHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function __construct() { - return parent::__construct(); - } - /** * Notify method * diff --git a/modules/base/handlers/feedRequestHandlers.php b/modules/base/handlers/feedRequestHandlers.php index d65285284..cebd2dadf 100644 --- a/modules/base/handlers/feedRequestHandlers.php +++ b/modules/base/handlers/feedRequestHandlers.php @@ -33,20 +33,7 @@ */ class owa_feedRequestHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function __construct() { - - // Call the base class constructor. - return parent::__construct(); - } - + /** * Notify Event Handler * diff --git a/modules/base/handlers/hostHandlers.php b/modules/base/handlers/hostHandlers.php index 92a70b31f..3e87e1a70 100644 --- a/modules/base/handlers/hostHandlers.php +++ b/modules/base/handlers/hostHandlers.php @@ -34,24 +34,7 @@ */ class owa_hostHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function owa_hostHandlers() { - - return owa_hostHandlers::__construct(); - } - - function __construct() { - return parent::__construct(); - } - /** * Notify Event Handler * diff --git a/modules/base/handlers/notifyHandlers.php b/modules/base/handlers/notifyHandlers.php index c743355e5..2b97b4a50 100644 --- a/modules/base/handlers/notifyHandlers.php +++ b/modules/base/handlers/notifyHandlers.php @@ -33,23 +33,6 @@ */ class owa_notifyHandlers extends owa_observer { - /** - * Constructor - * - * @param string $priority - * @param array $conf - * @access public - * @return Log_observer_request_logger - */ - function owa_notifyHandlers() { - - // Call the base class constructor. - - $this->owa_observer(); - - return; - } - /** * Notify Handler * diff --git a/modules/base/handlers/refererHandlers.php b/modules/base/handlers/refererHandlers.php index 62b1855fc..0986be675 100644 --- a/modules/base/handlers/refererHandlers.php +++ b/modules/base/handlers/refererHandlers.php @@ -39,21 +39,7 @@ */ class owa_refererHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function owa_refererHandlers() { - - // Call the base class constructor. - $this->owa_observer(); - return; - } - + /** * Notify Event Handler * diff --git a/modules/base/handlers/requestHandlers.php b/modules/base/handlers/requestHandlers.php index e4b9b3c22..b1e0ed1d1 100644 --- a/modules/base/handlers/requestHandlers.php +++ b/modules/base/handlers/requestHandlers.php @@ -34,19 +34,6 @@ */ class owa_requestHandlers extends owa_observer { - /** - * Constructor - * - * @param string $priority - * @param array $conf - * @access public - * @return Log_observer_request_logger - */ - function __construct() { - - return parent::__construct(); - } - /** * Notify Handler * diff --git a/modules/base/handlers/sessionHandlers.php b/modules/base/handlers/sessionHandlers.php index 7457b36e5..4226d6610 100644 --- a/modules/base/handlers/sessionHandlers.php +++ b/modules/base/handlers/sessionHandlers.php @@ -33,19 +33,7 @@ */ class owa_sessionHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function __construct() { - - return parent::__construct(); - } - + /** * Notify Event Handler * diff --git a/modules/base/handlers/userAgentHandlers.php b/modules/base/handlers/userAgentHandlers.php index b4ad4d652..6696c5e0c 100644 --- a/modules/base/handlers/userAgentHandlers.php +++ b/modules/base/handlers/userAgentHandlers.php @@ -33,24 +33,7 @@ */ class owa_userAgentHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function owa_userAgentHandlers() { - - return owa_userAgentHandlers::__construct(); - } - - function __construct() { - - return parent::__construct(); - } - + /** * Notify Event Handler * diff --git a/modules/base/handlers/userHandlers.php b/modules/base/handlers/userHandlers.php index 9d3d95425..7d61c9d46 100644 --- a/modules/base/handlers/userHandlers.php +++ b/modules/base/handlers/userHandlers.php @@ -33,21 +33,7 @@ */ class owa_userHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function owa_userHandlers() { - - // Call the base class constructor. - $this->owa_observer(); - return; - } - + /** * Notify Event Handler * diff --git a/modules/base/handlers/visitorHandlers.php b/modules/base/handlers/visitorHandlers.php index 9e2ebc454..03aa2e650 100644 --- a/modules/base/handlers/visitorHandlers.php +++ b/modules/base/handlers/visitorHandlers.php @@ -34,19 +34,7 @@ */ class owa_visitorHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * - */ - function __construct() { - - return parent::__construct(); - } - + /** * Notify Event Handler * diff --git a/modules/base/helperPageTags.php b/modules/base/helperPageTags.php index b63419a4c..35a0c1bd9 100644 --- a/modules/base/helperPageTags.php +++ b/modules/base/helperPageTags.php @@ -34,16 +34,6 @@ class owa_helperPageTagsController extends owa_controller { - function owa_helperPageTagsController($params) { - - return owa_helperPageTagsController::__construct($params); - } - - function __construct($params) { - - return parent::__construct($params); - } - function action() { // Control logic @@ -101,16 +91,6 @@ function action() { class owa_helperPageTagsView extends owa_view { - function owa_helperPageTagsView() { - - return owa_helperPageTagsView::__construct(); - } - - function __construct() { - - return parent::__construct(); - } - function render($data) { $this->body->set('site_id', $this->get('site_id')); diff --git a/modules/base/module.php b/modules/base/module.php index 6d17ed8da..4a2ba3b8c 100644 --- a/modules/base/module.php +++ b/modules/base/module.php @@ -525,7 +525,7 @@ function makeUrlCanonical($url) { } // check and remove trailing slash - if (substr($url, -1, -1) === '/') { + if (substr($url, -1) === '/') { $url = substr($url, 0, -1); } diff --git a/modules/base/processEvent.php b/modules/base/processEvent.php index 491c7094e..8d65a3877 100644 --- a/modules/base/processEvent.php +++ b/modules/base/processEvent.php @@ -38,11 +38,6 @@ class owa_processEventController extends owa_controller { var $event; var $eq; - function owa_processEventController($params) { - - return owa_processEventController::__construct($params); - } - function __construct($params) { $event = $params['event']; @@ -169,7 +164,13 @@ function pre() { } if (!$this->event->get('page_uri')) { - $this->event->set('page_uri', $this->eq->filter('page_uri', sprintf('%s?%s', $page_parse['path'], $page_parse['query']))); + + if (array_key_exists('query', $page_parse) || !empty($page_parse['query'])) { + $this->event->set('page_uri', $this->eq->filter('page_uri', sprintf('%s?%s', $page_parse['path'], $page_parse['query']))); + } else { + $this->event->set('page_uri', $this->eq->filter('page_uri', $page_parse['path'])); + } + } // set internal referer diff --git a/owa_base.php b/owa_base.php index 66ab962c9..44a57256a 100644 --- a/owa_base.php +++ b/owa_base.php @@ -82,10 +82,7 @@ function __construct() { owa_coreAPI::profile($this, __FUNCTION__, __LINE__); $this->e = &owa_coreAPI::errorSingleton(); $this->c = &owa_coreAPI::configSingleton(); - $this->config = &$this->c->fetch('base'); - - return; - + $this->config = $this->c->fetch('base'); } /** diff --git a/owa_controller.php b/owa_controller.php index 94724cdae..73191da49 100644 --- a/owa_controller.php +++ b/owa_controller.php @@ -108,17 +108,7 @@ class owa_controller extends owa_base { var $authenticate_user; var $state; - - /** - * PHP4 Constructor - * - * @param array $params - */ - function owa_controller($params) { - - return owa_controller::__construct($params); - } - + /** * Constructor * diff --git a/owa_coreAPI.php b/owa_coreAPI.php index 5e13a0bfc..68550f67a 100644 --- a/owa_coreAPI.php +++ b/owa_coreAPI.php @@ -31,22 +31,8 @@ */ class owa_coreAPI { - - /** - * Container for request params - * - * @var array - */ - var $params; - - /** - * Container for caller config overrides. - * - * @var array - */ - var $caller_config_overrides; - - function &singleton($params = array()) { + + public static function &singleton($params = array()) { static $api; @@ -61,7 +47,7 @@ function &singleton($params = array()) { return $api; } - function setupStorageEngine($type) { + public static function setupStorageEngine($type) { if (!class_exists('owa_db')) { require_once(OWA_BASE_CLASSES_DIR.'owa_db.php'); @@ -82,7 +68,7 @@ function setupStorageEngine($type) { } - function &dbSingleton() { + public static function &dbSingleton() { static $db; @@ -109,32 +95,8 @@ function &dbSingleton() { return $db; } - - - /* -function authSingleton() { - - static $auth_modules; - $auth_mdules = array(); - - if (empty($auth_modules['plugin'])): - - $c = &owa_coreAPI::configSingleton(); - $plugin = $c->get('base', 'authentication'); - - endif; - // this needs to not be a singleton - $auth_modules[$plugin] = &owa_lib::singleton(OWA_PLUGIN_DIR.'auth'.DIRECTORY_SEPARATOR, 'owa_auth_', $plugin); - - return $auth_modules[$plugin]; - - - return; - } -*/ - - function &configSingleton($params = array()) { + public static function &configSingleton($params = array()) { static $config; @@ -151,7 +113,7 @@ function &configSingleton($params = array()) { return $config; } - function &errorSingleton() { + public static function &errorSingleton() { static $e; @@ -168,13 +130,13 @@ function &errorSingleton() { return $e; } - function &getSetting($module, $name) { + public static function getSetting($module, $name) { $s = &owa_coreAPI::configSingleton(); return $s->get($module, $name); } - function setSetting($module, $name, $value, $persist = false) { + public static function setSetting($module, $name, $value, $persist = false) { $s = &owa_coreAPI::configSingleton(); @@ -187,13 +149,13 @@ function setSetting($module, $name, $value, $persist = false) { } - function getAllRoles() { + public static function getAllRoles() { $caps = owa_coreAPI::getSetting('base', 'capabilities'); return array_keys($caps); } - function &getCurrentUser() { + public static function &getCurrentUser() { $s = &owa_coreAPI::serviceSingleton(); return $s->getCurrentUser(); @@ -203,7 +165,7 @@ function &getCurrentUser() { * check to see if the current user has a capability * always returns a bool */ - function isCurrentUserCapable($capability) { + public static function isCurrentUserCapable($capability) { $cu = &owa_coreAPI::getCurrentUser(); owa_coreAPI::debug("Current User Role: ".$cu->getRole()); @@ -213,13 +175,13 @@ function isCurrentUserCapable($capability) { return $ret; } - function isCurrentUserAuthenticated() { + public static function isCurrentUserAuthenticated() { $cu = &owa_coreAPI::getCurrentUser(); return $cu->isAuthenticated(); } - function &serviceSingleton() { + public static function &serviceSingleton() { static $s; @@ -236,7 +198,7 @@ function &serviceSingleton() { return $s; } - function &cacheSingleton($params = array()) { + public static function &cacheSingleton($params = array()) { static $cache; @@ -254,7 +216,7 @@ function &cacheSingleton($params = array()) { return $cache; } - function requestContainerSingleton() { + public static function requestContainerSingleton() { static $request; @@ -272,7 +234,7 @@ function requestContainerSingleton() { } - function moduleRequireOnce($module, $class_dir, $file) { + public static function moduleRequireOnce($module, $class_dir, $file) { if (!empty($class_dir)) { @@ -290,7 +252,7 @@ function moduleRequireOnce($module, $class_dir, $file) { } } - function moduleFactory($modulefile, $class_suffix = null, $params = '', $class_ns = 'owa_') { + public static function moduleFactory($modulefile, $class_suffix = null, $params = '', $class_ns = 'owa_') { list($module, $file) = split("\.", $modulefile); $class = $class_ns.$file.$class_suffix; @@ -309,7 +271,7 @@ function moduleFactory($modulefile, $class_suffix = null, $params = '', $class_n return $obj; } - function moduleGenericFactory($module, $sub_directory, $file, $class_suffix = null, $params = '', $class_ns = 'owa_') { + public static function moduleGenericFactory($module, $sub_directory, $file, $class_suffix = null, $params = '', $class_ns = 'owa_') { $class = $class_ns.$file.$class_suffix; @@ -328,7 +290,7 @@ function moduleGenericFactory($module, $sub_directory, $file, $class_suffix = nu * * @return Object module class object */ - function moduleClassFactory($module) { + public static function moduleClassFactory($module) { if (!class_exists('owa_module')): require_once(OWA_BASE_CLASSES_DIR.'owa_module.php'); @@ -341,7 +303,7 @@ function moduleClassFactory($module) { } - function updateFactory($module, $filename, $class_ns = 'owa_') { + public static function updateFactory($module, $filename, $class_ns = 'owa_') { require_once(OWA_BASE_CLASS_DIR.'update.php'); @@ -362,7 +324,7 @@ function updateFactory($module, $filename, $class_ns = 'owa_') { return $obj; } - function subViewFactory($subview, $params = array()) { + public static function subViewFactory($subview, $params = array()) { list($module, $class) = split("\.", $subview); //print_r($module.' ' . $class); @@ -374,7 +336,7 @@ function subViewFactory($subview, $params = array()) { return $subview; } - function &supportClassFactory($module, $class, $params = array(),$class_ns = 'owa_') { + public static function &supportClassFactory($module, $class, $params = array(),$class_ns = 'owa_') { $obj = &owa_lib::factory(OWA_BASE_DIR.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR, $class_ns, $class, $params); $obj->module = $module; @@ -390,7 +352,7 @@ function &supportClassFactory($module, $class, $params = array(),$class_ns = 'ow * @param unknown_type $entity_name * @return unknown */ - function entityFactory($entity_name) { + public static function entityFactory($entity_name) { /* SETUP STORAGE ENGINE */ @@ -424,24 +386,13 @@ function entityFactory($entity_name) { * @param unknown_type $entity_name * @return unknown * @depricated + * @todo REMOVE */ - function rawEntityFactory($entity_name) { + public static function rawEntityFactory($entity_name) { return owa_coreAPI::entityFactory($entity_name); } - - /** - * Factory for generating graphs - * - * @param unknown_type $entity_name - * @return unknown - */ - function graphFactory($graph_name, $params = array()) { - - return owa_coreAPI::moduleSpecificFactory($graph_name, 'graphs', '', $params, false); - - } /** * Factory for generating module specific classes @@ -452,7 +403,7 @@ function graphFactory($graph_name, $params = array()) { * @param array $params * @return unknown */ - function moduleSpecificFactory($modulefile, $class_dir, $class_suffix = null, $params = '', $add_module_name = true, $class_ns = 'owa_') { + public static function moduleSpecificFactory($modulefile, $class_dir, $class_suffix = null, $params = '', $add_module_name = true, $class_ns = 'owa_') { list($module, $file) = split("\.", $modulefile); $class = $class_ns.$file.$class_suffix; @@ -473,7 +424,7 @@ function moduleSpecificFactory($modulefile, $class_dir, $class_suffix = null, $p } - function executeApiCommand($map) { + public static function executeApiCommand($map) { if (!array_key_exists('do', $map)) { echo ("API Command missing from request."); @@ -522,7 +473,7 @@ function executeApiCommand($map) { * @param unknown_type $entity_name * @return unknown */ - function metricFactory($metric_name) { + public static function metricFactory($metric_name) { if (!strpos($metric_name, '.')) { $s = owa_coreAPI::serviceSingleton(); @@ -541,7 +492,7 @@ function metricFactory($metric_name) { * * @return array */ - function getAdminPanels() { + public static function getAdminPanels() { $panels = array(); @@ -569,7 +520,7 @@ function getAdminPanels() { * @param string sortby the array value to sort the navigation array by * @return array */ - function getNavigation($view, $nav_name, $sortby ='order') { + public static function getNavigation($view, $nav_name, $sortby ='order') { $links = array(); @@ -611,7 +562,7 @@ function getNavigation($view, $nav_name, $sortby ='order') { } - function getGroupNavigation($group, $sortby ='order') { + public static function getGroupNavigation($group, $sortby ='order') { $links = array(); @@ -662,7 +613,8 @@ function getGroupNavigation($group, $sortby ='order') { return $links[$group]; //print_r($links[$view][$nav_name]); - if (!empty($links[$group])): + /* +if (!empty($links[$group])): // anonymous sorting function, takes sort by variable. $code = "return strnatcmp(\$a['$sortby'], \$b['$sortby']);"; @@ -673,18 +625,22 @@ function getGroupNavigation($group, $sortby ='order') { else: return false; endif; +*/ } - function getNavSort($a, $b) { + /** + * @Todo REMOVE + */ + public static function getNavSort($a, $b) { return strnatcmp($a['order'], $b['order']); } - function getActiveModules() { + public static function getActiveModules() { $c = owa_coreAPI::configSingleton(); $config = $c->config->get('settings'); @@ -703,7 +659,7 @@ function getActiveModules() { } - function getModulesNeedingUpdates() { + public static function getModulesNeedingUpdates() { $service = owa_coreAPI::serviceSingleton(); @@ -716,7 +672,7 @@ function getModulesNeedingUpdates() { * @param $action string * */ - function performAction($action, $params = array()) { + public static function performAction($action, $params = array()) { // Load $controller = owa_coreAPI::moduleFactory($action, 'Controller', $params); @@ -755,9 +711,6 @@ function performAction($action, $params = array()) { return; endif; - - - } /** @@ -769,7 +722,7 @@ function performAction($action, $params = array()) { * @param object $message * @return boolean */ - function logEvent($event_type, $message = '') { + public static function logEvent($event_type, $message = '') { if (owa_coreAPI::getStateParam('overlay')) { return false; @@ -800,7 +753,7 @@ function logEvent($event_type, $message = '') { // do not log if the request is robotic $service = &owa_coreAPI::serviceSingleton(); $bcap = $service->getBrowscap(); - owa_coreAPI::profile($this, __FUNCTION__, __LINE__); + owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__); if (!owa_coreAPI::getSetting('base', 'log_robots')) { if ($bcap->robotCheck()) { @@ -808,14 +761,14 @@ function logEvent($event_type, $message = '') { owa_coreAPI::setRequestParam('is_robot', true); return; } - owa_coreAPI::profile($this, __FUNCTION__, __LINE__); + owa_coreAPI::profile(__CLASS__, __FUNCTION__, __LINE__); } $service->setBrowscap($bcap); // form event if one was not passed - - if (!is_a($message, 'owa_event')) { + $class= 'owa_event'; + if (!($message instanceof $class)) { $event = owa_coreAPI::supportClassFactory('base', 'event'); $event->setProperties($message); $event->setEventType($event_type); @@ -839,7 +792,7 @@ function logEvent($event_type, $message = '') { } - function displayImage($data) { + public static function displayImage($data) { header('Content-type: image/gif'); header('P3P: CP="'.owa_coreAPI::getSetting('base', 'p3p_policy').'"'); @@ -849,10 +802,7 @@ function displayImage($data) { header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); - print owa_coreAPI::displayView($data); - - return; - + echo owa_coreAPI::displayView($data); } @@ -864,7 +814,7 @@ function displayImage($data) { * @return string * */ - function displayView($data, $viewfile = '') { + public static function displayView($data, $viewfile = '') { if (empty($viewfile)): $viewfile = $data['view']; @@ -876,7 +826,7 @@ function displayView($data, $viewfile = '') { } - function displaySubView($data, $viewfile = '') { + public static function displaySubView($data, $viewfile = '') { if (empty($viewfile)): $viewfile = $data['view']; @@ -890,8 +840,9 @@ function displaySubView($data, $viewfile = '') { /** * Strip a URL of certain GET params - * + * @depricated * @return string + * @todo REMOVE */ function stripDocumentUrl($url) { @@ -906,7 +857,7 @@ function stripDocumentUrl($url) { // OWA specific params to filter array_push($filters, owa_coreAPI::getSetting('base', 'source_param')); - array_push($filters, owa_coreAPI::getSetting('base', 'ns').owa_coreAPI::getSetting('base', 'feed_subscription_id')); + array_push($filters, owa_coreAPI::getSetting('base', 'ns').owa_coreAPI::getSetting('base', 'feed_subscription_param')); //print_r($filters); @@ -933,26 +884,26 @@ function stripDocumentUrl($url) { } - function getRequestParam($name) { + public static function getRequestParam($name) { $service = &owa_coreAPI::serviceSingleton(); return $service->request->getParam($name); } - function getRequest() { + public static function getRequest() { $service = &owa_coreAPI::serviceSingleton(); return $service->request; } - function setRequestParam($name, $value) { + public static function setRequestParam($name, $value) { $service = &owa_coreAPI::serviceSingleton(); return $service->request->setParam($name, $value); } - function makeTimePeriod($time_period, $params = array()) { + public static function makeTimePeriod($time_period, $params = array()) { $period = owa_coreAPI::supportClassFactory('base', 'timePeriod'); $map = array(); @@ -983,7 +934,7 @@ function makeTimePeriod($time_period, $params = array()) { * * @return Object */ - function validationFactory($class_file) { + public static function validationFactory($class_file) { if (!class_exists('owa_validation')): require_once(OWA_BASE_CLASS_DIR.'validation.php'); @@ -993,28 +944,28 @@ function validationFactory($class_file) { } - function debug($msg) { + public static function debug($msg) { $e = owa_coreAPI::errorSingleton(); $e->debug($msg); return; } - function error($msg) { + public static function error($msg) { $e = owa_coreAPI::errorSingleton(); $e->err($msg); return; } - function notice($msg) { + public static function notice($msg) { $e = owa_coreAPI::errorSingleton(); $e->notice($msg); return; } - function createCookie($cookie_name, $cookie_value, $expires = 0, $path = '/', $domain = '') { + public static function createCookie($cookie_name, $cookie_value, $expires = 0, $path = '/', $domain = '') { if (empty($domain)) { $domain = owa_coreAPI::getSetting('base', 'cookie_domain'); @@ -1037,37 +988,37 @@ function createCookie($cookie_name, $cookie_value, $expires = 0, $path = '/', $d return; } - function deleteCookie($cookie_name, $path = '/', $domain = '') { + public static function deleteCookie($cookie_name, $path = '/', $domain = '') { return owa_coreAPI::createCookie($cookie_name, '', time()-3600*24*365*10, $path, $domain); } - function setState($store, $name = '', $value, $store_type = '', $is_perminent = '') { + public static function setState($store, $name = '', $value, $store_type = '', $is_perminent = '') { $service = &owa_coreAPI::serviceSingleton(); return $service->request->state->set($store, $name, $value, $store_type, $is_perminent); } - function getStateParam($store, $name = '') { + public static function getStateParam($store, $name = '') { $service = &owa_coreAPI::serviceSingleton(); return $service->request->state->get($store, $name); } - function getServerParam($name = '') { + public static function getServerParam($name = '') { $service = &owa_coreAPI::serviceSingleton(); return $service->request->getServerParam($name); } - function clearState($store) { + public static function clearState($store) { $service = &owa_coreAPI::serviceSingleton(); $service->request->state->clear($store); } - function getEventProcessor($event_type) { + public static function getEventProcessor($event_type) { $service = &owa_coreAPI::serviceSingleton(); $processor = $service->getMapValue('event_processors', $event_type); @@ -1085,7 +1036,7 @@ function getEventProcessor($event_type) { * * @return unknown */ - function handleRequest($caller_params = null, $action = '') { + public static function handleRequest($caller_params = null, $action = '') { static $init; @@ -1124,13 +1075,13 @@ function handleRequest($caller_params = null, $action = '') { } - function isUpdateRequired() { + public static function isUpdateRequired() { $service = &owa_coreAPI::serviceSingleton(); return $service->isUpdateRequired(); } - function getSitesList() { + public static function getSitesList() { //$s = owa_coreAPI::entityFactory('base.site'); $db = owa_coreAPI::dbSingleton(); @@ -1140,7 +1091,7 @@ function getSitesList() { } - function profile($that = '', $function = '', $line = '', $msg = '') { + public static function profile($that = '', $function = '', $line = '', $msg = '') { if (defined('OWA_PROFILER')) { if (OWA_PROFILER === true) { @@ -1164,7 +1115,7 @@ function profile($that = '', $function = '', $line = '', $msg = '') { } } - function profileDisplay() { + public static function profileDisplay() { $p = owa_coreAPI::profile(); if ($p) { $p->display(); @@ -1172,7 +1123,7 @@ function profileDisplay() { } - function getEventDispatch() { + public static function getEventDispatch() { if (!class_exists('eventQueue')) { require_once(OWA_DIR.'/eventQueue.php'); @@ -1182,7 +1133,7 @@ function getEventDispatch() { return $eq; } - function getCliCommandClass($command) { + public static function getCliCommandClass($command) { $s = owa_coreAPI::serviceSingleton(); return $s->getCliCommandClass($command); diff --git a/owa_entity.php b/owa_entity.php index 61247dcc7..23d65be91 100644 --- a/owa_entity.php +++ b/owa_entity.php @@ -420,7 +420,9 @@ function setCachable($seconds = '') { function isCachable() { if (owa_coreAPI::getSetting('base', 'cache_objects')) { - return $this->_tableProperties['cacheable']; + if (array_key_exists('cacheable', $this->_tableProperties)) { + return $this->_tableProperties['cacheable']; + } } else { return false; } diff --git a/owa_httpRequest.php b/owa_httpRequest.php index 5c7497684..e596dd567 100644 --- a/owa_httpRequest.php +++ b/owa_httpRequest.php @@ -83,12 +83,7 @@ class owa_http { var $response_code; var $request_headers; - - function owa_http() { - return owa_http::__construct(); - } - function __construct() { $c = &owa_coreAPI::configSingleton(); diff --git a/owa_lib.php b/owa_lib.php index 4b9ea8c5f..55534b55e 100644 --- a/owa_lib.php +++ b/owa_lib.php @@ -41,7 +41,7 @@ class owa_lib { * @param array $array * @return string */ - function implode_assoc($inner_glue, $outer_glue, $array) { + public static function implode_assoc($inner_glue, $outer_glue, $array) { $output = array(); foreach( $array as $key => $item ) { $output[] = $key . $inner_glue . $item; @@ -60,7 +60,7 @@ function implode_assoc($inner_glue, $outer_glue, $array) { * @return array $data_arrays * @access public */ - function deconstruct_assoc($a_array) { + public static function deconstruct_assoc($a_array) { if (!empty($a_array)): $data_arrays = array(); @@ -87,7 +87,7 @@ function deconstruct_assoc($a_array) { } - function decon_assoc($a_array) { + public static function decon_assoc($a_array) { $data_arrays = array(); @@ -102,7 +102,7 @@ function decon_assoc($a_array) { } // php 4 compatible function - function array_intersect_key() { + public static function array_intersect_key() { $arrs = func_get_args(); $result = array_shift($arrs); @@ -117,7 +117,7 @@ function array_intersect_key() { } // php4 compatible function - function array_walk_recursive(&$input, $funcname, $userdata = "") + public static function array_walk_recursive(&$input, $funcname, $userdata = "") { if (!is_callable($funcname)) { @@ -168,7 +168,7 @@ function array_walk_recursive(&$input, $funcname, $userdata = "") * @return array * @access public */ - function time_now() { + public static function time_now() { $timestamp = time(); @@ -208,7 +208,7 @@ function errorHandler($msg) { * * @return array */ - function months() { + public static function months() { return array( @@ -228,13 +228,13 @@ function months() { } - function days() { + public static function days() { return array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); } - function years() { + public static function years() { static $years; @@ -265,7 +265,7 @@ function years() { * @param int $month * @return string */ - function get_month_label($month) { + public static function get_month_label($month) { static $months; @@ -286,7 +286,7 @@ function get_month_label($month) { * @param string $day * @return string */ - function setDaySuffix($day) { + public static function setDaySuffix($day) { switch ($day) { @@ -313,7 +313,7 @@ function setDaySuffix($day) { * @param array $params * @return string */ - function getDatelabel($params) { + public static function getDatelabel($params) { switch ($params['period']) { @@ -361,7 +361,7 @@ function getDatelabel($params) { * @depricated * @return array */ - function reporting_periods() { + public static function reporting_periods() { return array( @@ -391,7 +391,7 @@ function reporting_periods() { * @depricated * @return array */ - function date_reporting_periods() { + public static function date_reporting_periods() { return array( @@ -409,7 +409,7 @@ function date_reporting_periods() { * @param unknown_type $period * @return unknown */ - function get_period_label($period) { + public static function get_period_label($period) { $periods = owa_lib::reporting_periods(); @@ -421,7 +421,7 @@ function get_period_label($period) { * * @return string */ - function get_current_url() { + public static function get_current_url() { $url = 'http'; @@ -440,7 +440,7 @@ function get_current_url() { return $url; } - function inputFilter($array) { + public static function inputFilter($array) { static $f; @@ -453,7 +453,7 @@ function inputFilter($array) { } - function fileInclusionFilter($str) { + public static function fileInclusionFilter($str) { $str = str_replace("http://", "", $str); $str = str_replace("/", "", $str); @@ -483,7 +483,7 @@ function fileInclusionFilter($str) { * @param array $conf * @return object */ - function &factory($class_dir, $class_prefix, $class_name, $conf = array(), $class_suffix = '') { + public static function &factory($class_dir, $class_prefix, $class_name, $conf = array(), $class_suffix = '') { //$class_dir = strtolower($class_dir).DIRECTORY_SEPARATOR; $class_dir = $class_dir.DIRECTORY_SEPARATOR; @@ -522,7 +522,7 @@ function &factory($class_dir, $class_prefix, $class_name, $conf = array(), $clas * @param array $conf * @return object */ - function &singleton($class_dir, $class_prefix, $class_name, $conf = array()) { + public static function &singleton($class_dir, $class_prefix, $class_name, $conf = array()) { static $instance; @@ -539,7 +539,7 @@ function &singleton($class_dir, $class_prefix, $class_name, $conf = array()) { * * @param string $url */ - function redirectBrowser($url) { + public static function redirectBrowser($url) { //ob_clean(); // 302 redirect to URL @@ -548,7 +548,7 @@ function redirectBrowser($url) { return; } - function makeLinkQueryString($query_params) { + public static function makeLinkQueryString($query_params) { $new_query_params = array(); @@ -583,7 +583,7 @@ function makeLinkQueryString($query_params) { } - function getRequestParams() { + public static function getRequestParams() { $params = array(); @@ -601,7 +601,7 @@ function getRequestParams() { return $params; } - function rekeyArray($array, $new_keys) { + public static function rekeyArray($array, $new_keys) { $new_keys = $new_keys; $new_array = array(); @@ -618,7 +618,7 @@ function rekeyArray($array, $new_keys) { } - function stripParams($params, $ns = '') { + public static function stripParams($params, $ns = '') { $striped_params = array(); @@ -656,7 +656,7 @@ function stripParams($params, $ns = '') { * @return unknown * @deprecated */ - function moduleRequireOnce($module, $file) { + public static function moduleRequireOnce($module, $file) { return require_once(OWA_BASE_DIR.'/modules/'.$module.'/'.$file.'.php'); } @@ -670,7 +670,7 @@ function moduleRequireOnce($module, $file) { * @return unknown * @deprecated */ - function moduleFactory($modulefile, $class_suffix = null, $params = '') { + public static function moduleFactory($modulefile, $class_suffix = null, $params = '') { list($module, $file) = split("\.", $modulefile); $class = 'owa_'.$file.$class_suffix; @@ -691,7 +691,7 @@ function moduleFactory($modulefile, $class_suffix = null, $params = '') { * * @param unknown_type $data */ - function redirectToView($data) { + public static function redirectToView($data) { //print_r($data); $c = &owa_coreAPI::configSingleton(); $config = $c->fetch('base'); @@ -722,7 +722,7 @@ function redirectToView($data) { * @param array $data * @deprecated */ - function displayView($data, $params = array()) { + public static function displayView($data, $params = array()) { $view = owa_lib::moduleFactory($data['view'], 'View', $params); @@ -730,7 +730,7 @@ function displayView($data, $params = array()) { } - function &coreAPISingleton() { + public static function &coreAPISingleton() { static $api; @@ -749,7 +749,7 @@ function &coreAPISingleton() { * @return integer * @access private */ - function setStringGuid($string) { + public static function setStringGuid($string) { if (!empty($string)): return crc32(strtolower($string)); else: @@ -763,6 +763,8 @@ function setStringGuid($string) { * @param array $constraints * @return string $where * @access public + * @depricated + * @todo remove */ function addConstraints($constraints) { @@ -824,7 +826,7 @@ function addConstraints($constraints) { } - function assocFromString($string_state, $inner = '=>', $outer = '|||') { + public static function assocFromString($string_state, $inner = '=>', $outer = '|||') { if (!empty($string_state)): @@ -858,7 +860,7 @@ function assocFromString($string_state, $inner = '=>', $outer = '|||') { * Simple function to replicate PHP 5 behaviour */ - function microtime_float() { + public static function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } @@ -867,7 +869,7 @@ function microtime_float() { * Lists all files in a Directory * */ - function listDir($start_dir='.', $recursive = true) { + public static function listDir($start_dir='.', $recursive = true) { $files = array(); @@ -902,7 +904,7 @@ function listDir($start_dir='.', $recursive = true) { } - function makeDateArray($result, $format) { + public static function makeDateArray($result, $format) { if (!empty($result)) { @@ -922,7 +924,7 @@ function makeDateArray($result, $format) { } - function makeDates($timestamps, $format) { + public static function makeDates($timestamps, $format) { sort($timestamps); @@ -938,7 +940,7 @@ function makeDates($timestamps, $format) { } - function html2txt($document){ + public static function html2txt($document){ $search = array('@]*?>.*?@si', // Strip out javascript '@]*?>.*?@siU', // Strip style tags properly '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags @@ -948,7 +950,7 @@ function html2txt($document){ return $text; } - function escapeNonAsciiChars($string) { + public static function escapeNonAsciiChars($string) { return preg_replace('/[^(\x20-\x7F)]*/','', $string); } @@ -961,7 +963,7 @@ function escapeNonAsciiChars($string) { * @param string $trailing * @return string */ - function truncate ($str, $length=10, $trailing='...') { + public static function truncate ($str, $length=10, $trailing='...') { // take off chars for the trailing $length-=strlen($trailing); @@ -982,12 +984,12 @@ function truncate ($str, $length=10, $trailing='...') { * @param string $password * @return string */ - function encryptPassword($password) { + public static function encryptPassword($password) { return md5(strtolower($password).strlen($password)); } - function timestampToYyyymmdd($timestamp = '') { + public static function timestampToYyyymmdd($timestamp = '') { if(empty($timestamp)) { $timestamp = time(); @@ -998,7 +1000,7 @@ function timestampToYyyymmdd($timestamp = '') { return $yyyymmdd; } - function setContentTypeHeader($type = 'html') { + public static function setContentTypeHeader($type = 'html') { if (!$type) { $type = 'html'; diff --git a/owa_observer.php b/owa_observer.php index 06d227a71..f263669bc 100644 --- a/owa_observer.php +++ b/owa_observer.php @@ -54,11 +54,7 @@ class owa_observer extends owa_base { * log event notifications. * * @access public - */ - function owa_observer() { - return owa_observer::__construct(); - } - + */ function __construct() { $this->id = md5(microtime()); } diff --git a/owa_template.php b/owa_template.php index eed3a9bf0..382dd40e2 100644 --- a/owa_template.php +++ b/owa_template.php @@ -130,7 +130,7 @@ function getTemplatePath($module, $file) { * @depricated * @param string $file */ - function set_template($file) { + function set_template($file = null) { if (!$file): owa_coreAPI::error('No template file was specified.'); diff --git a/owa_view.php b/owa_view.php index 91782d484..788e9bbb5 100644 --- a/owa_view.php +++ b/owa_view.php @@ -552,11 +552,6 @@ function __construct() { } - function owa_genericTableView() { - - return owa_genericTableView::__construct(); - } - function render($data) { $this->t->set_template('wrapper_blank.tpl'); @@ -635,11 +630,6 @@ function render($data) { class owa_sparklineJsView extends owa_view { - function owa_sparklineJsView() { - - return owa_sparklinejSView::__construct(); - } - function __construct() { return parent::__construct(); @@ -666,11 +656,6 @@ function render($data) { } class owa_chartView extends owa_view { - - function owa_chartView() { - - return owa_chartView::__construct(); - } function __construct() { @@ -705,11 +690,6 @@ class owa_mailView extends owa_view { var $po; var $postProcessView = true; - function owa_mailView() { - - return owa_mailView::__construct(); - } - function __construct() { // make this a service @@ -750,11 +730,6 @@ class owa_adminView extends owa_view { var $postProcessView = true; - function owa_adminView() { - - return owa_adminView::__construct(); - } - function __construct() { return parent::__construct(); @@ -771,11 +746,6 @@ function post() { class owa_jsonView extends owa_view { - function owa_jsonView() { - - return owa_jsonView::__construct(); - } - function __construct() { if (!class_exists('Services_JSON')) { diff --git a/wp_plugin.php b/wp_plugin.php index 629edf971..680d6a294 100644 --- a/wp_plugin.php +++ b/wp_plugin.php @@ -221,14 +221,14 @@ function &owa_getInstance($params = array()) { // Access WP current user object to check permissions $current_user = owa_getCurrentWpUser(); - + //print_r($current_user); // Set OWA's current user info and mark as authenticated so that // downstream controllers don't have to authenticate $cu =&owa_coreAPI::getCurrentUser(); $cu->setUserData('user_id', $current_user->user_login); owa_coreAPI::debug("Wordpress User_id: ".$current_user->user_login); $cu->setUserData('email_address', $current_user->user_email); - $cu->setUserData('real_name', $current_user->user_identity); + $cu->setUserData('real_name', $current_user->first_name.' '.$current_user->last_name); $cu->setRole(owa_translate_role($current_user->roles)); owa_coreAPI::debug("Wordpress User Role: ".print_r($current_user->roles, true)); owa_coreAPI::debug("Wordpress Translated OWA User Role: ".$cu->getRole()); @@ -325,7 +325,7 @@ function owa_main() { $event = $owa->makeEvent(); // Don't log if the page request is a preview - Wordpress 2.x or greater - if (function_exists(is_preview)) { + if (function_exists('is_preview')) { if (is_preview()) { $event->set('do_not_log',true); } @@ -341,7 +341,10 @@ function owa_main() { $event->set('feed_format', $_GET['feed']); } - $event->set($owa->getSetting('base', 'source_param'), $_GET[$owa->getSetting('base', 'ns').$owa->getSetting('base', 'source_param')]); + //eliminate use of _GET by using OWA's request param method. + if (array_key_exists($owa->getSetting('base', 'ns').$owa->getSetting('base', 'source_param'), $_GET)) { + $event->set($owa->getSetting('base', 'source_param'), $_GET[$owa->getSetting('base', 'ns').$owa->getSetting('base', 'source_param')]); + } $cu = &owa_coreAPI::getCurrentUser();