my-simon 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.document +5 -0
  2. data/.gitignore.orig +55 -0
  3. data/DOC/Launch Check List.docx +0 -0
  4. data/DOC/Launch Check List.pdf +0 -0
  5. data/Gemfile +14 -0
  6. data/Gemfile.lock +44 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +21 -0
  9. data/README.rdoc +19 -0
  10. data/Rakefile +46 -0
  11. data/VERSION +1 -0
  12. data/build/rakefile.rb +12 -0
  13. data/config.rb +24 -0
  14. data/lib/simon.rb +0 -5
  15. data/my-simon.gemspec +141 -0
  16. data/scaffolding/simon/controller.tpl +9 -0
  17. data/scaffolding/simon/model.tpl +10 -0
  18. data/scaffolding/simon/view.tpl +5 -0
  19. data/scaffolding/standards/html_template.html +44 -0
  20. data/scaffolding/standards/html_template.php +44 -0
  21. data/scaffolding/standards/jquery_plugin_template.js +45 -0
  22. data/scaffolding/standards/js_template.js +43 -0
  23. data/simon +282 -0
  24. data/test/helper.rb +18 -0
  25. data/test/test_simon.rb +7 -0
  26. data/www/.htaccess +488 -0
  27. data/www/404.html +32 -0
  28. data/www/crossdomain.xml +25 -0
  29. data/www/favicon.ico +0 -0
  30. data/www/index.php +17 -0
  31. data/www/lib/js/homePage.js +43 -0
  32. data/www/lib/js/jquery/JQbook.js +809 -0
  33. data/www/lib/js/jquery/jquery-1.8.0.min.js +27 -0
  34. data/www/lib/js/jquery/jquery.alphanumeric.js +82 -0
  35. data/www/lib/js/jquery/jquery.cookie.js +96 -0
  36. data/www/lib/js/jquery/jquery.easing.1.3.js +207 -0
  37. data/www/lib/js/main.js +117 -0
  38. data/www/lib/js/master.js +6 -0
  39. data/www/lib/js/plugins/handlebars-1.0.rc.1.js +1920 -0
  40. data/www/lib/js/plugins/modernizr-1.7.min.js +2 -0
  41. data/www/lib/js/plugins/swfobject.js +777 -0
  42. data/www/lib/js/plugins_mod/README.txt +3 -0
  43. data/www/lib/php/app.php +53 -0
  44. data/www/lib/php/controller/index.php +10 -0
  45. data/www/lib/php/controller/regex.php +23 -0
  46. data/www/lib/php/model/Book.php +8 -0
  47. data/www/lib/php/model/Model.php +8 -0
  48. data/www/lib/php/plugins/php-activerecord/ActiveRecord.php +44 -0
  49. data/www/lib/php/plugins/php-activerecord/lib/CallBack.php +226 -0
  50. data/www/lib/php/plugins/php-activerecord/lib/Column.php +155 -0
  51. data/www/lib/php/plugins/php-activerecord/lib/Config.php +288 -0
  52. data/www/lib/php/plugins/php-activerecord/lib/Connection.php +456 -0
  53. data/www/lib/php/plugins/php-activerecord/lib/ConnectionManager.php +38 -0
  54. data/www/lib/php/plugins/php-activerecord/lib/DateTime.php +45 -0
  55. data/www/lib/php/plugins/php-activerecord/lib/Exceptions.php +137 -0
  56. data/www/lib/php/plugins/php-activerecord/lib/Expressions.php +183 -0
  57. data/www/lib/php/plugins/php-activerecord/lib/Inflector.php +115 -0
  58. data/www/lib/php/plugins/php-activerecord/lib/Model.php +1673 -0
  59. data/www/lib/php/plugins/php-activerecord/lib/Reflections.php +86 -0
  60. data/www/lib/php/plugins/php-activerecord/lib/Relationship.php +637 -0
  61. data/www/lib/php/plugins/php-activerecord/lib/SQLBuilder.php +396 -0
  62. data/www/lib/php/plugins/php-activerecord/lib/Serialization.php +302 -0
  63. data/www/lib/php/plugins/php-activerecord/lib/Singleton.php +57 -0
  64. data/www/lib/php/plugins/php-activerecord/lib/Table.php +547 -0
  65. data/www/lib/php/plugins/php-activerecord/lib/Utils.php +351 -0
  66. data/www/lib/php/plugins/php-activerecord/lib/Validations.php +833 -0
  67. data/www/lib/php/plugins/php-activerecord/lib/adapters/MysqlAdapter.php +73 -0
  68. data/www/lib/php/plugins/php-activerecord/lib/adapters/OciAdapter.php +121 -0
  69. data/www/lib/php/plugins/php-activerecord/lib/adapters/PgsqlAdapter.php +104 -0
  70. data/www/lib/php/plugins/php-activerecord/lib/adapters/SqliteAdapter.php +81 -0
  71. data/www/lib/php/system/Config.php +174 -0
  72. data/www/lib/php/system/config.routes.php +29 -0
  73. data/www/lib/php/system/router.php +220 -0
  74. data/www/lib/php/template/footer.php +59 -0
  75. data/www/lib/php/template/header.php +74 -0
  76. data/www/lib/php/view/index.php +5 -0
  77. data/www/media/images/facebook_share.jpg +0 -0
  78. data/www/robots.txt +5 -0
  79. data/www/sandbox/readme.txt +3 -0
  80. data/www/sass/javascript.scss +1 -0
  81. data/www/sass/layout.scss +128 -0
  82. data/www/sass/master.scss +4 -0
  83. data/www/sass/reset.scss +47 -0
  84. data/www/sass/typography.scss +24 -0
  85. data/www/styles/javascript.css +1 -0
  86. data/www/styles/layout.css +186 -0
  87. data/www/styles/master.css +4 -0
  88. data/www/styles/reset.css +60 -0
  89. data/www/styles/typography.css +24 -0
  90. metadata +179 -7
@@ -0,0 +1,57 @@
1
+ <?php
2
+ /**
3
+ * @package ActiveRecord
4
+ */
5
+ namespace ActiveRecord;
6
+
7
+ /**
8
+ * This implementation of the singleton pattern does not conform to the strong definition
9
+ * given by the "Gang of Four." The __construct() method has not be privatized so that
10
+ * a singleton pattern is capable of being achieved; however, multiple instantiations are also
11
+ * possible. This allows the user more freedom with this pattern.
12
+ *
13
+ * @package ActiveRecord
14
+ */
15
+ abstract class Singleton
16
+ {
17
+ /**
18
+ * Array of cached singleton objects.
19
+ *
20
+ * @var array
21
+ */
22
+ private static $instances = array();
23
+
24
+ /**
25
+ * Static method for instantiating a singleton object.
26
+ *
27
+ * @return object
28
+ */
29
+ final public static function instance()
30
+ {
31
+ $class_name = get_called_class();
32
+
33
+ if (!isset(self::$instances[$class_name]))
34
+ self::$instances[$class_name] = new $class_name;
35
+
36
+ return self::$instances[$class_name];
37
+ }
38
+
39
+ /**
40
+ * Singleton objects should not be cloned.
41
+ *
42
+ * @return void
43
+ */
44
+ final private function __clone() {}
45
+
46
+ /**
47
+ * Similar to a get_called_class() for a child class to invoke.
48
+ *
49
+ * @return string
50
+ */
51
+ final protected function get_called_class()
52
+ {
53
+ $backtrace = debug_backtrace();
54
+ return get_class($backtrace[2]['object']);
55
+ }
56
+ }
57
+ ?>
@@ -0,0 +1,547 @@
1
+ <?php
2
+ /**
3
+ * @package ActiveRecord
4
+ */
5
+ namespace ActiveRecord;
6
+
7
+ /**
8
+ * Manages reading and writing to a database table.
9
+ *
10
+ * This class manages a database table and is used by the Model class for
11
+ * reading and writing to its database table. There is one instance of Table
12
+ * for every table you have a model for.
13
+ *
14
+ * @package ActiveRecord
15
+ */
16
+ class Table
17
+ {
18
+ private static $cache = array();
19
+
20
+ public $class;
21
+ public $conn;
22
+ public $pk;
23
+ public $last_sql;
24
+
25
+ // Name/value pairs of columns in this table
26
+ public $columns = array();
27
+
28
+ /**
29
+ * Name of the table.
30
+ */
31
+ public $table;
32
+
33
+ /**
34
+ * Name of the database (optional)
35
+ */
36
+ public $db_name;
37
+
38
+ /**
39
+ * Name of the sequence for this table (optional). Defaults to {$table}_seq
40
+ */
41
+ public $sequence;
42
+
43
+ /**
44
+ * A instance of CallBack for this model/table
45
+ * @static
46
+ * @var object ActiveRecord\CallBack
47
+ */
48
+ public $callback;
49
+
50
+ /**
51
+ * List of relationships for this table.
52
+ */
53
+ private $relationships = array();
54
+
55
+ public static function load($model_class_name)
56
+ {
57
+ if (!isset(self::$cache[$model_class_name]))
58
+ {
59
+ /* do not place set_assoc in constructor..it will lead to infinite loop due to
60
+ relationships requesting the model's table, but the cache hasn't been set yet */
61
+ self::$cache[$model_class_name] = new Table($model_class_name);
62
+ self::$cache[$model_class_name]->set_associations();
63
+ }
64
+
65
+ return self::$cache[$model_class_name];
66
+ }
67
+
68
+ public static function clear_cache($model_class_name=null)
69
+ {
70
+ if ($model_class_name && array_key_exists($model_class_name,self::$cache))
71
+ unset(self::$cache[$model_class_name]);
72
+ else
73
+ self::$cache = array();
74
+ }
75
+
76
+ public function __construct($class_name)
77
+ {
78
+ $this->class = Reflections::instance()->add($class_name)->get($class_name);
79
+
80
+ // if connection name property is null the connection manager will use the default connection
81
+ $connection = $this->class->getStaticPropertyValue('connection',null);
82
+
83
+ $this->conn = ConnectionManager::get_connection($connection);
84
+ $this->set_table_name();
85
+ $this->get_meta_data();
86
+ $this->set_primary_key();
87
+ $this->set_sequence_name();
88
+ $this->set_delegates();
89
+ $this->set_setters_and_getters();
90
+
91
+ $this->callback = new CallBack($class_name);
92
+ $this->callback->register('before_save', function(Model $model) { $model->set_timestamps(); }, array('prepend' => true));
93
+ $this->callback->register('after_save', function(Model $model) { $model->reset_dirty(); }, array('prepend' => true));
94
+ }
95
+
96
+ public function create_joins($joins)
97
+ {
98
+ if (!is_array($joins))
99
+ return $joins;
100
+
101
+ $self = $this->table;
102
+ $ret = $space = '';
103
+
104
+ $existing_tables = array();
105
+ foreach ($joins as $value)
106
+ {
107
+ $ret .= $space;
108
+
109
+ if (stripos($value,'JOIN ') === false)
110
+ {
111
+ if (array_key_exists($value, $this->relationships))
112
+ {
113
+ $rel = $this->get_relationship($value);
114
+
115
+ // if there is more than 1 join for a given table we need to alias the table names
116
+ if (array_key_exists($rel->class_name, $existing_tables))
117
+ {
118
+ $alias = $value;
119
+ $existing_tables[$rel->class_name]++;
120
+ }
121
+ else
122
+ {
123
+ $existing_tables[$rel->class_name] = true;
124
+ $alias = null;
125
+ }
126
+
127
+ $ret .= $rel->construct_inner_join_sql($this, false, $alias);
128
+ }
129
+ else
130
+ throw new RelationshipException("Relationship named $value has not been declared for class: {$this->class->getName()}");
131
+ }
132
+ else
133
+ $ret .= $value;
134
+
135
+ $space = ' ';
136
+ }
137
+ return $ret;
138
+ }
139
+
140
+ public function options_to_sql($options)
141
+ {
142
+ $table = array_key_exists('from', $options) ? $options['from'] : $this->get_fully_qualified_table_name();
143
+ $sql = new SQLBuilder($this->conn, $table);
144
+
145
+ if (array_key_exists('joins',$options))
146
+ {
147
+ $sql->joins($this->create_joins($options['joins']));
148
+
149
+ // by default, an inner join will not fetch the fields from the joined table
150
+ if (!array_key_exists('select', $options))
151
+ $options['select'] = $this->get_fully_qualified_table_name() . '.*';
152
+ }
153
+
154
+ if (array_key_exists('select',$options))
155
+ $sql->select($options['select']);
156
+
157
+ if (array_key_exists('conditions',$options))
158
+ {
159
+ if (!is_hash($options['conditions']))
160
+ {
161
+ if (is_string($options['conditions']))
162
+ $options['conditions'] = array($options['conditions']);
163
+
164
+ call_user_func_array(array($sql,'where'),$options['conditions']);
165
+ }
166
+ else
167
+ {
168
+ if (!empty($options['mapped_names']))
169
+ $options['conditions'] = $this->map_names($options['conditions'],$options['mapped_names']);
170
+
171
+ $sql->where($options['conditions']);
172
+ }
173
+ }
174
+
175
+ if (array_key_exists('order',$options))
176
+ $sql->order($options['order']);
177
+
178
+ if (array_key_exists('limit',$options))
179
+ $sql->limit($options['limit']);
180
+
181
+ if (array_key_exists('offset',$options))
182
+ $sql->offset($options['offset']);
183
+
184
+ if (array_key_exists('group',$options))
185
+ $sql->group($options['group']);
186
+
187
+ if (array_key_exists('having',$options))
188
+ $sql->having($options['having']);
189
+
190
+ return $sql;
191
+ }
192
+
193
+ public function find($options)
194
+ {
195
+ $sql = $this->options_to_sql($options);
196
+ $readonly = (array_key_exists('readonly',$options) && $options['readonly']) ? true : false;
197
+ $eager_load = array_key_exists('include',$options) ? $options['include'] : null;
198
+
199
+ return $this->find_by_sql($sql->to_s(),$sql->get_where_values(), $readonly, $eager_load);
200
+ }
201
+
202
+ public function find_by_sql($sql, $values=null, $readonly=false, $includes=null)
203
+ {
204
+ $this->last_sql = $sql;
205
+
206
+ $collect_attrs_for_includes = is_null($includes) ? false : true;
207
+ $list = $attrs = array();
208
+ $sth = $this->conn->query($sql,$this->process_data($values));
209
+
210
+ while (($row = $sth->fetch()))
211
+ {
212
+ $model = new $this->class->name($row,false,true,false);
213
+
214
+ if ($readonly)
215
+ $model->readonly();
216
+
217
+ if ($collect_attrs_for_includes)
218
+ $attrs[] = $model->attributes();
219
+
220
+ $list[] = $model;
221
+ }
222
+
223
+ if ($collect_attrs_for_includes && !empty($list))
224
+ $this->execute_eager_load($list, $attrs, $includes);
225
+
226
+ return $list;
227
+ }
228
+
229
+ /**
230
+ * Executes an eager load of a given named relationship for this table.
231
+ *
232
+ * @param $models array found modesl for this table
233
+ * @param $attrs array of attrs from $models
234
+ * @param $includes array eager load directives
235
+ * @return void
236
+ */
237
+ private function execute_eager_load($models=array(), $attrs=array(), $includes=array())
238
+ {
239
+ if (!is_array($includes))
240
+ $includes = array($includes);
241
+
242
+ foreach ($includes as $index => $name)
243
+ {
244
+ // nested include
245
+ if (is_array($name))
246
+ {
247
+ $nested_includes = count($name) > 1 ? $name : $name[0];
248
+ $name = $index;
249
+ }
250
+ else
251
+ $nested_includes = array();
252
+
253
+ $rel = $this->get_relationship($name, true);
254
+ $rel->load_eagerly($models, $attrs, $nested_includes, $this);
255
+ }
256
+ }
257
+
258
+ public function get_column_by_inflected_name($inflected_name)
259
+ {
260
+ foreach ($this->columns as $raw_name => $column)
261
+ {
262
+ if ($column->inflected_name == $inflected_name)
263
+ return $column;
264
+ }
265
+ return null;
266
+ }
267
+
268
+ public function get_fully_qualified_table_name($quote_name=true)
269
+ {
270
+ $table = $quote_name ? $this->conn->quote_name($this->table) : $this->table;
271
+
272
+ if ($this->db_name)
273
+ $table = $this->conn->quote_name($this->db_name) . ".$table";
274
+
275
+ return $table;
276
+ }
277
+
278
+ /**
279
+ * Retrieve a relationship object for this table. Strict as true will throw an error
280
+ * if the relationship name does not exist.
281
+ *
282
+ * @param $name string name of Relationship
283
+ * @param $strict bool
284
+ * @throws RelationshipException
285
+ * @return Relationship or null
286
+ */
287
+ public function get_relationship($name, $strict=false)
288
+ {
289
+ if ($this->has_relationship($name))
290
+ return $this->relationships[$name];
291
+
292
+ if ($strict)
293
+ throw new RelationshipException("Relationship named $name has not been declared for class: {$this->class->getName()}");
294
+
295
+ return null;
296
+ }
297
+
298
+ /**
299
+ * Does a given relationship exist?
300
+ *
301
+ * @param $name string name of Relationship
302
+ * @return bool
303
+ */
304
+ public function has_relationship($name)
305
+ {
306
+ return array_key_exists($name, $this->relationships);
307
+ }
308
+
309
+ public function insert(&$data, $pk=null, $sequence_name=null)
310
+ {
311
+ $data = $this->process_data($data);
312
+
313
+ $sql = new SQLBuilder($this->conn,$this->get_fully_qualified_table_name());
314
+ $sql->insert($data,$pk,$sequence_name);
315
+
316
+ $values = array_values($data);
317
+ return $this->conn->query(($this->last_sql = $sql->to_s()),$values);
318
+ }
319
+
320
+ public function update(&$data, $where)
321
+ {
322
+ $data = $this->process_data($data);
323
+
324
+ $sql = new SQLBuilder($this->conn,$this->get_fully_qualified_table_name());
325
+ $sql->update($data)->where($where);
326
+
327
+ $values = $sql->bind_values();
328
+ return $this->conn->query(($this->last_sql = $sql->to_s()),$values);
329
+ }
330
+
331
+ public function delete($data)
332
+ {
333
+ $data = $this->process_data($data);
334
+
335
+ $sql = new SQLBuilder($this->conn,$this->get_fully_qualified_table_name());
336
+ $sql->delete($data);
337
+
338
+ $values = $sql->bind_values();
339
+ return $this->conn->query(($this->last_sql = $sql->to_s()),$values);
340
+ }
341
+
342
+ /**
343
+ * Add a relationship.
344
+ *
345
+ * @param Relationship $relationship a Relationship object
346
+ */
347
+ private function add_relationship($relationship)
348
+ {
349
+ $this->relationships[$relationship->attribute_name] = $relationship;
350
+ }
351
+
352
+ private function get_meta_data()
353
+ {
354
+ // as more adapters are added probably want to do this a better way
355
+ // than using instanceof but gud enuff for now
356
+ $quote_name = !($this->conn instanceof PgsqlAdapter);
357
+
358
+ $this->columns = $this->conn->columns($this->get_fully_qualified_table_name($quote_name));
359
+ }
360
+
361
+ /**
362
+ * Replaces any aliases used in a hash based condition.
363
+ *
364
+ * @param $hash array A hash
365
+ * @param $map array Hash of used_name => real_name
366
+ * @return array Array with any aliases replaced with their read field name
367
+ */
368
+ private function map_names(&$hash, &$map)
369
+ {
370
+ $ret = array();
371
+
372
+ foreach ($hash as $name => &$value)
373
+ {
374
+ if (array_key_exists($name,$map))
375
+ $name = $map[$name];
376
+
377
+ $ret[$name] = $value;
378
+ }
379
+ return $ret;
380
+ }
381
+
382
+ private function &process_data($hash)
383
+ {
384
+ if (!$hash)
385
+ return $hash;
386
+
387
+ foreach ($hash as $name => &$value)
388
+ {
389
+ if ($value instanceof \DateTime)
390
+ {
391
+ if (isset($this->columns[$name]) && $this->columns[$name]->type == Column::DATE)
392
+ $hash[$name] = $this->conn->date_to_string($value);
393
+ else
394
+ $hash[$name] = $this->conn->datetime_to_string($value);
395
+ }
396
+ else
397
+ $hash[$name] = $value;
398
+ }
399
+ return $hash;
400
+ }
401
+
402
+ private function set_primary_key()
403
+ {
404
+ if (($pk = $this->class->getStaticPropertyValue('pk',null)) || ($pk = $this->class->getStaticPropertyValue('primary_key',null)))
405
+ $this->pk = is_array($pk) ? $pk : array($pk);
406
+ else
407
+ {
408
+ $this->pk = array();
409
+
410
+ foreach ($this->columns as $c)
411
+ {
412
+ if ($c->pk)
413
+ $this->pk[] = $c->inflected_name;
414
+ }
415
+ }
416
+ }
417
+
418
+ private function set_table_name()
419
+ {
420
+ if (($table = $this->class->getStaticPropertyValue('table',null)) || ($table = $this->class->getStaticPropertyValue('table_name',null)))
421
+ $this->table = $table;
422
+ else
423
+ {
424
+ // infer table name from the class name
425
+ $this->table = Inflector::instance()->tableize($this->class->getName());
426
+
427
+ // strip namespaces from the table name if any
428
+ $parts = explode('\\',$this->table);
429
+ $this->table = $parts[count($parts)-1];
430
+ }
431
+
432
+ if(($db = $this->class->getStaticPropertyValue('db',null)) || ($db = $this->class->getStaticPropertyValue('db_name',null)))
433
+ $this->db_name = $db;
434
+ }
435
+
436
+ private function set_sequence_name()
437
+ {
438
+ if (!$this->conn->supports_sequences())
439
+ return;
440
+
441
+ if (!($this->sequence = $this->class->getStaticPropertyValue('sequence')))
442
+ $this->sequence = $this->conn->get_sequence_name($this->table,$this->pk[0]);
443
+ }
444
+
445
+ private function set_associations()
446
+ {
447
+ require_once 'Relationship.php';
448
+
449
+ foreach ($this->class->getStaticProperties() as $name => $definitions)
450
+ {
451
+ if (!$definitions || !is_array($definitions))
452
+ continue;
453
+
454
+ foreach ($definitions as $definition)
455
+ {
456
+ $relationship = null;
457
+
458
+ switch ($name)
459
+ {
460
+ case 'has_many':
461
+ $relationship = new HasMany($definition);
462
+ break;
463
+
464
+ case 'has_one':
465
+ $relationship = new HasOne($definition);
466
+ break;
467
+
468
+ case 'belongs_to':
469
+ $relationship = new BelongsTo($definition);
470
+ break;
471
+
472
+ case 'has_and_belongs_to_many':
473
+ $relationship = new HasAndBelongsToMany($definition);
474
+ break;
475
+ }
476
+
477
+ if ($relationship)
478
+ $this->add_relationship($relationship);
479
+ }
480
+ }
481
+ }
482
+
483
+ /**
484
+ * Rebuild the delegates array into format that we can more easily work with in Model.
485
+ * Will end up consisting of array of:
486
+ *
487
+ * array('delegate' => array('field1','field2',...),
488
+ * 'to' => 'delegate_to_relationship',
489
+ * 'prefix' => 'prefix')
490
+ */
491
+ private function set_delegates()
492
+ {
493
+ $delegates = $this->class->getStaticPropertyValue('delegate',array());
494
+ $new = array();
495
+
496
+ if (!array_key_exists('processed', $delegates))
497
+ $delegates['processed'] = false;
498
+
499
+ if (!empty($delegates) && !$delegates['processed'])
500
+ {
501
+ foreach ($delegates as &$delegate)
502
+ {
503
+ if (!is_array($delegate) || !isset($delegate['to']))
504
+ continue;
505
+
506
+ if (!isset($delegate['prefix']))
507
+ $delegate['prefix'] = null;
508
+
509
+ $new_delegate = array(
510
+ 'to' => $delegate['to'],
511
+ 'prefix' => $delegate['prefix'],
512
+ 'delegate' => array());
513
+
514
+ foreach ($delegate as $name => $value)
515
+ {
516
+ if (is_numeric($name))
517
+ $new_delegate['delegate'][] = $value;
518
+ }
519
+
520
+ $new[] = $new_delegate;
521
+ }
522
+
523
+ $new['processed'] = true;
524
+ $this->class->setStaticPropertyValue('delegate',$new);
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Builds the getters/setters array by prepending get_/set_ to the method names.
530
+ */
531
+ private function set_setters_and_getters()
532
+ {
533
+ $build = array('setters', 'getters');
534
+
535
+ foreach ($build as $type)
536
+ {
537
+ $methods = array();
538
+ $prefix = substr($type,0,3) . "_";
539
+
540
+ foreach ($this->class->getStaticPropertyValue($type,array()) as $method)
541
+ $methods[] = (substr($method,0,4) != $prefix ? "{$prefix}$method" : $method);
542
+
543
+ $this->class->setStaticPropertyValue($type,$methods);
544
+ }
545
+ }
546
+ };
547
+ ?>