Skip to content

Commit

Permalink
Merge pull request civicrm#16 from dlobo/CRM-10242
Browse files Browse the repository at this point in the history
CRM-10242
  • Loading branch information
kurund committed May 6, 2013
2 parents 0840ee4 + 7ea9f90 commit 70769ec
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ function civicrm_wp_frontend($shortcode = FALSE) {
$config = CRM_Core_Config::singleton();
$config->userFrameworkFrontend = TRUE;

$argString = NULL;
$args = array();
if (isset($_GET['q'])) {
$args = explode('/', trim($_GET['q']));
$argString = trim($_GET['q']);
$args = explode('/', $argString);
}

if ($shortcode) {
Expand All @@ -383,24 +386,25 @@ function civicrm_wp_frontend($shortcode = FALSE) {

require_once ABSPATH . WPINC . '/pluggable.php';

// if snippet is set, which means ajax call, we just
// output civicrm html and skip the header
// output civicrm html only in a few cases and skip the WP header
if (
// snippet is set - i.e. ajax call
CRM_Utils_Array::value('snippet', $_GET) ||
(
CRM_Utils_Array::value(0, $args) == 'civicrm' &&
CRM_Utils_Array::value(1, $args) == 'ajax'
) ||
// we also follow this pattern where civicrm controls the
// entire page like an ical feed
(
CRM_Utils_Array::value(0, $args) == 'civicrm' &&
CRM_Utils_Array::value(1, $args) == 'event' &&
CRM_Utils_Array::value(2, $args) == 'ical' &&
// skip the html page since that is rendered in the CMS theme
CRM_Utils_Array::value('html', $_GET) != 1
// ical feed
($argString == 'civicrm/event/ical' &&
// skip the html page since it is rendered in the CMS theme
CRM_Utils_Array::value('html', $_GET) != 1) ||
in_array(
$argString,
// ajax and file download urls
array(
'civicrm/ajax',
'civicrm/file'
)
)
) {
// from my limited understanding, putting this in the init hook, allows civi to
// echo all output and exit before the theme code outputs anything
add_filter('init', 'civicrm_wp_invoke');
return;
}
Expand Down

0 comments on commit 70769ec

Please sign in to comment.