root/trunk/owa_location.php

Revision 241, 2.3 kB (checked in by padams, 2 years ago)

- adding form validation framework
- refactored settings/config into real object
- added modules roster and stub for activate/deactivate

Line 
1<?php
2
3//
4// Open Web Analytics - An Open Source Web Analytics Framework
5//
6// Copyright 2006 Peter Adams. All rights reserved.
7//
8// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// $Id$
17//
18
19/**
20 * Geo-location abstract class
21 *
22 * Looks up the geographic location of a request based on IP address lookups in a variety of
23 * databses or web services.
24 *
25 * @author      Peter Adams <peter@openwebanalytics.com>
26 * @copyright   Copyright &copy; 2006 Peter Adams <peter@openwebanalytics.com>
27 * @license     http://www.gnu.org/copyleft/gpl.html GPL v2.0
28 * @category    owa
29 * @package     owa
30 * @version             $Revision$           
31 * @since               owa 1.0.0
32 */
33class owa_location extends owa_base {
34       
35        /**
36         * City
37         *
38         * @var string
39         */
40        var $city;
41       
42        /**
43         * Country
44         *
45         * @var string
46         */
47        var $country;
48       
49        /**
50         * Latitude coordinates
51         *
52         * @var string
53         */
54        var $latitude;
55       
56        /**
57         * Longitude coordinates
58         *
59         * @var string
60         */
61        var $longitude;
62       
63        /**
64         * Location of concrete class plugins
65         *
66         * @var unknown_type
67         */
68        var $plugin_dir;
69       
70        /**
71         * Constructor
72         *
73         * @return owa_location
74         */
75        function owa_location() {
76               
77                $this->owa_base();
78               
79                return;
80        }
81       
82        function &factory($class_path, $plugin, $name = '', $ident = '', $conf = array()) {
83               
84        $classfile = $class_path . $plugin . '.php';
85
86        $class = 'owa_'.$plugin;
87       
88        /*
89         * Attempt to include our version of the named class, but don't treat
90         * a failure as fatal.  The caller may have already included their own
91         * version of the named class.
92         */
93        if (!class_exists($class)) {
94            include_once $classfile;
95        }
96
97        /* If the class exists, return a new instance of it. */
98        if (class_exists($class)) {
99            $obj = new $class;
100            return $obj;
101        }
102
103        return null;
104    }
105       
106}
107
108?>
Note: See TracBrowser for help on using the browser.