Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /** | |
4 | * Base class for UF system integrations | |
5 | */ | |
6 | abstract class CRM_Utils_System_Base { | |
7 | var $is_drupal = FALSE; | |
8 | var $is_joomla = FALSE; | |
9 | var $is_wordpress = FALSE; | |
10 | ||
11 | /* | |
12 | * Does the CMS allow CMS forms to be extended by hooks | |
13 | */ | |
14 | var $supports_form_extensions = FALSE; | |
15 | ||
16 | /** | |
17 | * if we are using a theming system, invoke theme, else just print the | |
18 | * content | |
19 | * | |
20 | * @param string $content the content that will be themed | |
21 | * @param boolean $print are we displaying to the screen or bypassing theming? | |
22 | * @param boolean $maintenance for maintenance mode | |
23 | * | |
24 | * @return void prints content on stdout | |
25 | * @access public | |
26 | */ | |
27 | function theme(&$content, $print = FALSE, $maintenance = FALSE) { | |
28 | $ret = FALSE; | |
29 | ||
30 | // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function | |
31 | // but the parts should be copied into cleaner subclass implementations | |
32 | if (function_exists('theme') && !$print) { | |
33 | if ($maintenance) { | |
34 | drupal_set_breadcrumb(''); | |
35 | drupal_maintenance_theme(); | |
36 | print theme('maintenance_page', array('content' => $content)); | |
37 | exit(); | |
38 | } | |
39 | $ret = TRUE; // TODO: Figure out why D7 returns but everyone else prints | |
40 | } | |
41 | $out = $content; | |
42 | ||
43 | $config = &CRM_Core_Config::singleton(); | |
44 | if (!$print && | |
45 | $config->userFramework == 'WordPress' | |
46 | ) { | |
47 | if (is_admin()) { | |
48 | require_once (ABSPATH . 'wp-admin/admin-header.php'); | |
49 | } | |
50 | else { | |
51 | // FIX ME: we need to figure out to replace civicrm content on the frontend pages | |
52 | } | |
53 | } | |
54 | ||
55 | if ($ret) { | |
56 | return $out; | |
57 | } | |
58 | else { | |
59 | print $out; | |
60 | } | |
61 | } | |
62 | ||
63 | function getDefaultBlockLocation() { | |
64 | return 'left'; | |
65 | } | |
66 | ||
67 | function getVersion() { | |
68 | return 'Unknown'; | |
69 | } | |
70 | ||
71 | /** | |
72 | * Format the url as per language Negotiation. | |
73 | * | |
74 | * @param string $url | |
75 | * | |
76 | * @return string $url, formatted url. | |
77 | * @static | |
78 | */ | |
79 | function languageNegotiationURL( | |
80 | $url, | |
81 | $addLanguagePart = TRUE, | |
82 | $removeLanguagePart = FALSE | |
83 | ) { | |
84 | return $url; | |
85 | } | |
86 | ||
87 | /* | |
88 | * Currently this is just helping out the test class as defaults is calling it - maybe move fix to defaults | |
89 | */ | |
90 | function cmsRootPath() { | |
91 | } | |
92 | ||
93 | /** | |
94 | * Get user login URL for hosting CMS (method declared in each CMS system class) | |
95 | * | |
96 | * @param string $destination - if present, add destination to querystring (works for Drupal only) | |
97 | * | |
98 | * @return string - loginURL for the current CMS | |
99 | * @static | |
100 | */ | |
101 | public abstract function getLoginURL($destination = ''); | |
102 | ||
103 | } | |
104 |