Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added api.php, for ensuring against death inside themes. Address issu…

…e of missing gateway page.
  • Loading branch information...
commit 49e7464610a7629eb8b28b2a61333f64cedde11e 1 parent 2e1be41
@collegeman authored
Showing with 40 additions and 4 deletions.
  1. +10 −4 core-plugin/WPCI.php
  2. +30 −0 core-plugin/api.php
View
14 core-plugin/WPCI.php
@@ -188,10 +188,16 @@ static function flush_rules() {
}
static function generate_rewrite_rules($wp_rewrite) {
- $gateway = wpci_get_gateway();
- $wp_rewrite->rules = array(
- '^'.wpci_get_slug().'/.*' => 'index.php?pagename='.$gateway->post_name
- ) + $wp_rewrite->rules;
+ if ($gateway = wpci_get_gateway()) {
+ $wp_rewrite->rules = array(
+ '^'.wpci_get_slug().'/.*' => 'index.php?pagename='.$gateway->post_name
+ ) + $wp_rewrite->rules;
+ }
+ else {
+ add_action('admin_notices', create_function('', "
+ return '<div class=\"error\"><p>Gateway page is missing. To restore, please disable and then enable your WP-CI or WP-CMSPLUS plugin.</p></div>';
+ "));
+ }
}
static function rewrite_query_vars($vars) {
View
30 core-plugin/api.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * WP-CI The CodeIgniter plugin for WordPress.
+ * Copyright (C)2009-2010 Collegeman.net, LLC.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// Include this file at the top of theme functions.php to prevent fatal errors
+// on the off-chance that WP-CI should become disabled.
+
+if (!function_exists('add_module')):
+function add_module() {}
+endif;
+
+if (!function_exists('in_page')):
+function in_page() {}
+endif;
Please sign in to comment.
Something went wrong with that request. Please try again.