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,288 @@
1
+ <?php
2
+ /**
3
+ * @package ActiveRecord
4
+ */
5
+ namespace ActiveRecord;
6
+ use Closure;
7
+
8
+ /**
9
+ * Manages configuration options for ActiveRecord.
10
+ *
11
+ * <code>
12
+ * ActiveRecord::initialize(function($cfg) {
13
+ * $cfg->set_model_home('models');
14
+ * $cfg->set_connections(array(
15
+ * 'development' => 'mysql://user:pass@development.com/awesome_development',
16
+ * 'production' => 'mysql://user:pass@production.com/awesome_production'));
17
+ * });
18
+ * </code>
19
+ *
20
+ * @package ActiveRecord
21
+ */
22
+ class Config extends Singleton
23
+ {
24
+ /**
25
+ * Name of the connection to use by default.
26
+ *
27
+ * <code>
28
+ * ActiveRecord\Config::initialize(function($cfg) {
29
+ * $cfg->set_model_directory('/your/app/models');
30
+ * $cfg->set_connections(array(
31
+ * 'development' => 'mysql://user:pass@development.com/awesome_development',
32
+ * 'production' => 'mysql://user:pass@production.com/awesome_production'));
33
+ * });
34
+ * </code>
35
+ *
36
+ * This is a singleton class so you can retrieve the {@link Singleton} instance by doing:
37
+ *
38
+ * <code>
39
+ * $config = ActiveRecord\Config::instance();
40
+ * </code>
41
+ *
42
+ * @var string
43
+ */
44
+ private $default_connection = 'development';
45
+
46
+ /**
47
+ * Contains the list of database connection strings.
48
+ *
49
+ * @var array
50
+ */
51
+ private $connections = array();
52
+
53
+ /**
54
+ * Directory for the auto_loading of model classes.
55
+ *
56
+ * @see activerecord_autoload
57
+ * @var string
58
+ */
59
+ private $model_directory;
60
+
61
+ /**
62
+ * Switch for logging.
63
+ *
64
+ * @var bool
65
+ */
66
+ private $logging = false;
67
+
68
+ /**
69
+ * Contains a Logger object that must impelement a log() method.
70
+ *
71
+ * @var object
72
+ */
73
+ private $logger;
74
+
75
+ /**
76
+ * The format to serialize DateTime values into.
77
+ *
78
+ * @var string
79
+ */
80
+ private $date_format = \DateTime::ISO8601;
81
+
82
+ /**
83
+ * Allows config initialization using a closure.
84
+ *
85
+ * This method is just syntatic sugar.
86
+ *
87
+ * <code>
88
+ * ActiveRecord\Config::initialize(function($cfg) {
89
+ * $cfg->set_model_directory('/path/to/your/model_directory');
90
+ * $cfg->set_connections(array(
91
+ * 'development' => 'mysql://username:password@127.0.0.1/database_name'));
92
+ * });
93
+ * </code>
94
+ *
95
+ * You can also initialize by grabbing the singleton object:
96
+ *
97
+ * <code>
98
+ * $cfg = ActiveRecord\Config::instance();
99
+ * $cfg->set_model_directory('/path/to/your/model_directory');
100
+ * $cfg->set_connections(array('development' =>
101
+ * 'mysql://username:password@localhost/database_name'));
102
+ * </code>
103
+ *
104
+ * @param Closure $initializer A closure
105
+ * @return void
106
+ */
107
+ public static function initialize(Closure $initializer)
108
+ {
109
+ $initializer(parent::instance());
110
+ }
111
+
112
+ /**
113
+ * Sets the list of database connection strings.
114
+ *
115
+ * <code>
116
+ * $config->set_connections(array(
117
+ * 'development' => 'mysql://username:password@127.0.0.1/database_name'));
118
+ * </code>
119
+ *
120
+ * @param array $connections Array of connections
121
+ * @param string $default_connection Optionally specify the default_connection
122
+ * @return void
123
+ * @throws ActiveRecord\ConfigException
124
+ */
125
+ public function set_connections($connections, $default_connection=null)
126
+ {
127
+ if (!is_array($connections))
128
+ throw new ConfigException("Connections must be an array");
129
+
130
+ if ($default_connection)
131
+ $this->set_default_connection($default_connection);
132
+
133
+ $this->connections = $connections;
134
+ }
135
+
136
+ /**
137
+ * Returns the connection strings array.
138
+ *
139
+ * @return array
140
+ */
141
+ public function get_connections()
142
+ {
143
+ return $this->connections;
144
+ }
145
+
146
+ /**
147
+ * Returns a connection string if found otherwise null.
148
+ *
149
+ * @param string $name Name of connection to retrieve
150
+ * @return string connection info for specified connection name
151
+ */
152
+ public function get_connection($name)
153
+ {
154
+ if (array_key_exists($name, $this->connections))
155
+ return $this->connections[$name];
156
+
157
+ return null;
158
+ }
159
+
160
+ /**
161
+ * Returns the default connection string or null if there is none.
162
+ *
163
+ * @return string
164
+ */
165
+ public function get_default_connection_string()
166
+ {
167
+ return array_key_exists($this->default_connection,$this->connections) ?
168
+ $this->connections[$this->default_connection] : null;
169
+ }
170
+
171
+ /**
172
+ * Returns the name of the default connection.
173
+ *
174
+ * @return string
175
+ */
176
+ public function get_default_connection()
177
+ {
178
+ return $this->default_connection;
179
+ }
180
+
181
+ /**
182
+ * Set the name of the default connection.
183
+ *
184
+ * @param string $name Name of a connection in the connections array
185
+ * @return void
186
+ */
187
+ public function set_default_connection($name)
188
+ {
189
+ $this->default_connection = $name;
190
+ }
191
+
192
+ /**
193
+ * Sets the directory where models are located.
194
+ *
195
+ * @param string $dir Directory path containing your models
196
+ * @return void
197
+ * @throws ConfigException if specified directory was not found
198
+ */
199
+ public function set_model_directory($dir)
200
+ {
201
+ if (!file_exists($dir))
202
+ throw new ConfigException("Invalid or non-existent directory: $dir");
203
+
204
+ $this->model_directory = $dir;
205
+ }
206
+
207
+ /**
208
+ * Returns the model directory.
209
+ *
210
+ * @return string
211
+ */
212
+ public function get_model_directory()
213
+ {
214
+ return $this->model_directory;
215
+ }
216
+
217
+ /**
218
+ * Turn on/off logging
219
+ *
220
+ * @param boolean $bool
221
+ * @return void
222
+ */
223
+ public function set_logging($bool)
224
+ {
225
+ $this->logging = (bool)$bool;
226
+ }
227
+
228
+ /**
229
+ * Sets the logger object for future SQL logging
230
+ *
231
+ * @param object $logger
232
+ * @return void
233
+ * @throws ConfigException if Logger objecct does not implement public log()
234
+ */
235
+ public function set_logger($logger)
236
+ {
237
+ $klass = Reflections::instance()->add($logger)->get($logger);
238
+
239
+ if (!$klass->getMethod('log') || !$klass->getMethod('log')->isPublic())
240
+ throw new ConfigException("Logger object must implement a public log method");
241
+
242
+ $this->logger = $logger;
243
+ }
244
+
245
+ /**
246
+ * Return whether or not logging is on
247
+ *
248
+ * @return boolean
249
+ */
250
+ public function get_logging()
251
+ {
252
+ return $this->logging;
253
+ }
254
+
255
+ /**
256
+ * Returns the logger
257
+ *
258
+ * @return object
259
+ */
260
+ public function get_logger()
261
+ {
262
+ return $this->logger;
263
+ }
264
+
265
+ /**
266
+ * Returns the date format.
267
+ *
268
+ * @return string
269
+ */
270
+ public function get_date_format()
271
+ {
272
+ return $this->date_format;
273
+ }
274
+
275
+ /**
276
+ * Sets the date format.
277
+ *
278
+ * Accepts date formats accepted by PHP's date() function.
279
+ *
280
+ * @link http://us.php.net/manual/en/function.date.php
281
+ * @param string $format
282
+ */
283
+ public function set_date_format($format)
284
+ {
285
+ $this->date_format = $format;
286
+ }
287
+ };
288
+ ?>