GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — gravity-tools/wp-loader.php at master · gravityforms/gravity-tools Expand file tree/ Copy pathwp-loader.phpMore file actions 360 lines (269 loc) · 8.29 KB / Copy pathwp-loader.phpFile metadata and controls360 lines (269 loc) · 8.29 KB 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 <?php use tad\FunctionMocker\FunctionMocker; class WpLoader { public function init() { $this->setConstants(); $this->preLoadWP(); $this->loadWP(); $this->postLoadWP(); $this->requireTestCaseParents(); $this->bootstrapMockAddon(); $this->onShutdown(); } protected function setConstants() { if ( ! defined( 'GMT_TESTS_DIR' ) ) { define( 'GMT_PLUGIN_DIR', __DIR__ . '/' ); define( 'GMT_TESTS_DIR', GMT_PLUGIN_DIR . 'tests' ); define( 'WP_TESTS_DIR', GMT_PLUGIN_DIR . 'vendor/wordpress/wordpress/tests/phpunit/' ); define( 'WP_TESTS_CONFIG_FILE_PATH', GMT_PLUGIN_DIR . '/wp-tests-config.php' ); } } protected function preLoadWP() { // if WordPress test suite isn't found then we can't do anything. if ( ! is_readable( WP_TESTS_DIR . 'includes/functions.php' ) ) { die( 'The WordPress PHPUnit test suite could not be found at: ' . WP_TESTS_DIR ); } require_once WP_TESTS_DIR . 'includes/functions.php'; // set filter for bootstrapping EE which needs to happen BEFORE loading WP. tests_add_filter( 'muplugins_loaded', array( $this, 'setupAndLoadWP' ) ); } protected function loadWP() { FunctionMocker::setup(); require WP_TESTS_DIR . 'includes/bootstrap.php'; FunctionMocker::replace( 'wp_send_json_success', function( $text, $code = null, $flags = array() ) { global $hermes_test_response; var_dump( $text ); $hermes_test_response = $text; return; } ); FunctionMocker::replace( 'wp_send_json_error', function( $text, $code ) { global $hermes_test_response; $hermes_test_response = $text; return; } ); } public function setupAndLoadWP() { if ( ! defined( 'SAVEQUERIES' ) ) { define( 'SAVEQUERIES', true ); } } public function postLoadWP() { // ensure date and time formats are set if ( ! get_option( 'date_format' ) ) { update_option( 'date_format', 'F j, Y' ); } if ( ! get_option( 'time_format' ) ) { update_option( 'time_format', 'g:i a' ); } wp_set_current_user( 1 ); } protected function requireTestCaseParents() { // good place to require any other files needed by tests, like mock files and test case parent files } protected function bootstrapMockAddon() { // good place to load any add-on files which we might want to also test } protected function onShutdown() { // nuke all PMB data once the tests are done, so that it doesn't carry over to the next time we run tests register_shutdown_function( function () { FunctionMocker::tearDown(); \gravitytools_tests_reset_db(); } ); } // Entities //////// public function contact() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_contact'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, firstName varchar(100) NOT NULL, lastName varchar(100) NOT NULL, email varchar(100) NOT NULL, phone varchar(100) NOT NULL, profile_picture varchar(100) NOT NULL, dateCreated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, dateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, FULLTEXT(firstName), FULLTEXT(lastName), FULLTEXT(email), FULLTEXT(phone), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function company() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_company'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, company_name varchar(100) NOT NULL, url varchar(100) NOT NULL, description text NOT NULL, dateCreated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, dateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, FULLTEXT(company_name), FULLTEXT(url), FULLTEXT(description), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function group() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_group'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, label varchar(100) NOT NULL, dateCreated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, dateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, FULLTEXT(label), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function deal() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_deal'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, label varchar(100) NOT NULL, status varchar(100) NOT NULL, dateCreated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, dateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, FULLTEXT(label), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function pipeline() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_pipeline'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, label varchar(100) NOT NULL, dateCreated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, dateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, FULLTEXT(label), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } // Relationships //////// public function company_to_contact() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_company_contact'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, company_id mediumint(9) NOT NULL, contact_id mediumint(9) NOT NULL, is_main tinyint(1) DEFAULT 0 NOT NULL, PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function group_to_contact() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_group_contact'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, group_id mediumint(9) NOT NULL, contact_id mediumint(9) NOT NULL, PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function deal_to_company() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_deal_company'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, deal_id mediumint(9) NOT NULL, company_id mediumint(9) NOT NULL, PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function deal_to_contact() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_deal_contact'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, deal_id mediumint(9) NOT NULL, contact_id mediumint(9) NOT NULL, PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } public function pipeline_to_deal() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_pipeline_deal'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, pipeline_id mediumint(9) NOT NULL, deal_id mediumint(9) NOT NULL, PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } /*//////// Meta ////////*/ public function meta() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'gravitycrm_meta'; $sql = " CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, object_type varchar(100) NOT NULL, object_id mediumint(9) NOT NULL, meta_name varchar(100) NOT NULL, meta_value mediumtext NOT NULL, FULLTEXT(meta_value), PRIMARY KEY (id) ) $charset_collate; "; dbDelta( $sql ); } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |