| @@ 10-165 (lines=156) @@ | ||
| 7 | * Class Map_Model |
|
| 8 | * @package Clubdeuce\WPLib\Components\GoogleMaps |
|
| 9 | */ |
|
| 10 | class Map_Model extends Model_Base { |
|
| 11 | ||
| 12 | /** |
|
| 13 | * @var Map |
|
| 14 | */ |
|
| 15 | protected $_map; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @param string $method_name |
|
| 19 | * @return mixed |
|
| 20 | */ |
|
| 21 | function __call( $method_name, $args ) { |
|
| 22 | $value = null; |
|
| 23 | ||
| 24 | do { |
|
| 25 | ||
| 26 | if ( property_exists( $this, "_{$method_name}" ) ) { |
|
| 27 | $property = "_{$method_name}"; |
|
| 28 | $value = $this->{$property}; |
|
| 29 | break; |
|
| 30 | } |
|
| 31 | ||
| 32 | if ( ! isset( $this->_map ) ) { |
|
| 33 | break; |
|
| 34 | } |
|
| 35 | ||
| 36 | $value = call_user_func_array( array( $this->_map, $method_name ), $args ); |
|
| 37 | ||
| 38 | } while ( false ); |
|
| 39 | ||
| 40 | return $value; |
|
| 41 | } |
|
| 42 | ||
| 43 | // /** |
|
| 44 | // * @var array |
|
| 45 | // */ |
|
| 46 | // protected $_center; |
|
| 47 | // |
|
| 48 | // /** |
|
| 49 | // * The Map element height (default: 400px). |
|
| 50 | // * @var string |
|
| 51 | // */ |
|
| 52 | // protected $_height = '400px'; |
|
| 53 | // |
|
| 54 | // /** |
|
| 55 | // * The string to use for the map HTML element id property |
|
| 56 | // * |
|
| 57 | // * @var string |
|
| 58 | // */ |
|
| 59 | // protected $_html_id; |
|
| 60 | // |
|
| 61 | // /** |
|
| 62 | // * @var Marker[] |
|
| 63 | // */ |
|
| 64 | // protected $_markers = array(); |
|
| 65 | // |
|
| 66 | // /** |
|
| 67 | // * The Map element width (default: 100%). |
|
| 68 | // * @var string |
|
| 69 | // */ |
|
| 70 | // protected $_width = '100%'; |
|
| 71 | // |
|
| 72 | // /** |
|
| 73 | // * @var int |
|
| 74 | // */ |
|
| 75 | // protected $_zoom = 5; |
|
| 76 | // |
|
| 77 | // /** |
|
| 78 | // * @param Marker $marker |
|
| 79 | // */ |
|
| 80 | // function add_marker( $marker ) { |
|
| 81 | // |
|
| 82 | // $this->_markers[] = $marker; |
|
| 83 | // |
|
| 84 | // } |
|
| 85 | // |
|
| 86 | // /** |
|
| 87 | // * @param Marker[] $markers |
|
| 88 | // */ |
|
| 89 | // function add_markers( $markers ) { |
|
| 90 | // |
|
| 91 | // $this->_markers = array_merge( $this->_markers, $markers ); |
|
| 92 | // |
|
| 93 | // } |
|
| 94 | // |
|
| 95 | // /** |
|
| 96 | // * @return array |
|
| 97 | // */ |
|
| 98 | // function center() { |
|
| 99 | // |
|
| 100 | // return $this->_center; |
|
| 101 | // |
|
| 102 | // } |
|
| 103 | // |
|
| 104 | // /** |
|
| 105 | // * @return string |
|
| 106 | // */ |
|
| 107 | // function height() { |
|
| 108 | // |
|
| 109 | // return $this->_height; |
|
| 110 | // |
|
| 111 | // } |
|
| 112 | // |
|
| 113 | // /** |
|
| 114 | // * @return string |
|
| 115 | // */ |
|
| 116 | // function html_id() { |
|
| 117 | // |
|
| 118 | // if ( ! isset( $this->_html_id ) ) { |
|
| 119 | // $this->_html_id = sprintf( 'map-%1$s', md5( serialize( array( $this->center(), $this->markers() ) ) ) ); |
|
| 120 | // } |
|
| 121 | // |
|
| 122 | // return $this->_html_id; |
|
| 123 | // |
|
| 124 | // } |
|
| 125 | // |
|
| 126 | // /** |
|
| 127 | // * @return Marker[] |
|
| 128 | // */ |
|
| 129 | // function markers() { |
|
| 130 | // |
|
| 131 | // return $this->_markers; |
|
| 132 | // |
|
| 133 | // } |
|
| 134 | // |
|
| 135 | // /** |
|
| 136 | // * @return string |
|
| 137 | // */ |
|
| 138 | // function width() { |
|
| 139 | // |
|
| 140 | // return $this->_width; |
|
| 141 | // |
|
| 142 | // } |
|
| 143 | // |
|
| 144 | // /** |
|
| 145 | // * @return int |
|
| 146 | // */ |
|
| 147 | // function zoom() { |
|
| 148 | // |
|
| 149 | // return $this->_zoom; |
|
| 150 | // |
|
| 151 | // } |
|
| 152 | // |
|
| 153 | // /** |
|
| 154 | // * @return array |
|
| 155 | // */ |
|
| 156 | // function make_args() { |
|
| 157 | // |
|
| 158 | // return array( |
|
| 159 | // 'center' => $this->center(), |
|
| 160 | // 'zoom' => (int)$this->zoom() |
|
| 161 | // ); |
|
| 162 | // |
|
| 163 | // } |
|
| 164 | ||
| 165 | } |
|
| 166 | ||
| @@ 9-51 (lines=43) @@ | ||
| 6 | * Class Marker_Label_Model |
|
| 7 | * @package Clubdeuce\WPLib\Components\GoogleMaps |
|
| 8 | */ |
|
| 9 | class Marker_Label_Model extends Model_Base { |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @var \Clubdeuce\WPGoogleMaps\Marker_Label |
|
| 13 | */ |
|
| 14 | protected $_label; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @return bool |
|
| 18 | */ |
|
| 19 | function has_label() { |
|
| 20 | ||
| 21 | return $this->_has( '_label' ); |
|
| 22 | ||
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param string $method_name |
|
| 27 | * @return mixed |
|
| 28 | */ |
|
| 29 | function __call( $method_name, $args ) { |
|
| 30 | $value = null; |
|
| 31 | ||
| 32 | do { |
|
| 33 | ||
| 34 | if ( property_exists( $this, "_{$method_name}" ) ) { |
|
| 35 | $property = "_{$method_name}"; |
|
| 36 | $value = $this->{$property}; |
|
| 37 | break; |
|
| 38 | } |
|
| 39 | ||
| 40 | if ( ! isset( $this->_label ) ) { |
|
| 41 | break; |
|
| 42 | } |
|
| 43 | ||
| 44 | $value = call_user_func_array( array( $this->_label, $method_name ), $args ); |
|
| 45 | ||
| 46 | } while ( false ); |
|
| 47 | ||
| 48 | return $value; |
|
| 49 | } |
|
| 50 | ||
| 51 | } |
|
| 52 | ||