| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Administrative CSS/JS for menu pages (inner processing routines). |
| 5 |
* |
| 6 |
* Copyright: © 2009-2011 |
| 7 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 8 |
* (coded in the USA) |
| 9 |
* |
| 10 |
* Released under the terms of the GNU General Public License. |
| 11 |
* You should have received a copy of the GNU General Public License, |
| 12 |
* along with this software. In the main directory, see: /licensing/ |
| 13 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 14 |
* |
| 15 |
* @package s2Member\Admin_CSS_JS |
| 16 |
* @since 3.5 |
| 17 |
*/ |
| 18 |
if(!defined('WPINC')) // MUST have WordPress. |
| 19 |
exit("Do not access this file directly."); |
| 20 |
|
| 21 |
if(!class_exists("c_ws_plugin__s2member_admin_css_js_in")) |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Administrative CSS/JS for menu pages (inner processing routines). |
| 25 |
* |
| 26 |
* @package s2Member\Admin_CSS_JS |
| 27 |
* @since 3.5 |
| 28 |
*/ |
| 29 |
class c_ws_plugin__s2member_admin_css_js_in |
| 30 |
{ |
| 31 |
/** |
| 32 |
* Outputs the CSS for administrative menu pages. |
| 33 |
* |
| 34 |
* @package s2Member\Admin_CSS_JS |
| 35 |
* @since 3.5 |
| 36 |
* |
| 37 |
* @attaches-to ``add_action("init");`` |
| 38 |
* |
| 39 |
* @return null Or exits script execution after loading CSS. |
| 40 |
*/ |
| 41 |
public static function menu_pages_css() |
| 42 |
{ |
| 43 |
do_action("ws_plugin__s2member_before_menu_pages_css", get_defined_vars()); |
| 44 |
|
| 45 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in() && current_user_can("create_users")) |
| 46 |
{ |
| 47 |
status_header(200); // 200 OK status header. |
| 48 |
|
| 49 |
header("Content-Type: text/css; charset=UTF-8"); |
| 50 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT"); |
| 51 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
| 52 |
header("Cache-Control: no-cache, must-revalidate, max-age=0"); |
| 53 |
header("Pragma: no-cache"); |
| 54 |
|
| 55 |
while(@ob_end_clean()) ; // Clean any existing output buffers. |
| 56 |
|
| 57 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]; |
| 58 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/src/images"; |
| 59 |
|
| 60 |
ob_start("c_ws_plugin__s2member_utils_assets::compress_css"); |
| 61 |
|
| 62 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages.css"; |
| 63 |
|
| 64 |
echo "\n"; // Add a line break before inclusion of this file. |
| 65 |
|
| 66 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s.css"; |
| 67 |
|
| 68 |
do_action("ws_plugin__s2member_during_menu_pages_css", get_defined_vars()); |
| 69 |
|
| 70 |
exit(); // Clean exit. |
| 71 |
} |
| 72 |
do_action("ws_plugin__s2member_after_menu_pages_css", get_defined_vars()); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Outputs the JS for administrative menu pages. |
| 77 |
* |
| 78 |
* @package s2Member\Admin_CSS_JS |
| 79 |
* @since 3.5 |
| 80 |
* |
| 81 |
* @attaches-to ``add_action("init");`` |
| 82 |
* |
| 83 |
* @return null Or exits script execution after loading JS. |
| 84 |
*/ |
| 85 |
public static function menu_pages_js() |
| 86 |
{ |
| 87 |
do_action("ws_plugin__s2member_before_menu_pages_js", get_defined_vars()); |
| 88 |
|
| 89 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in() && current_user_can("create_users")) |
| 90 |
{ |
| 91 |
status_header(200); // 200 OK status header. |
| 92 |
|
| 93 |
header("Content-Type: application/x-javascript; charset=UTF-8"); |
| 94 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT"); |
| 95 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
| 96 |
header("Cache-Control: no-cache, must-revalidate, max-age=0"); |
| 97 |
header("Pragma: no-cache"); |
| 98 |
|
| 99 |
while(@ob_end_clean()) ; // Clean any existing output buffers. |
| 100 |
|
| 101 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]; |
| 102 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/src/images"; |
| 103 |
|
| 104 |
for($n = 0, $labels = ""; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) |
| 105 |
$labels .= "labels['level".$n."'] = '".((!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"])) ? str_replace('"', "", c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"], 3)) : "")."';"; |
| 106 |
unset($n); |
| 107 |
|
| 108 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages.min.js"; |
| 109 |
|
| 110 |
echo "\n"; // Add a line break before inclusion of this file. |
| 111 |
|
| 112 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s.min.js"; |
| 113 |
|
| 114 |
do_action("ws_plugin__s2member_during_menu_pages_js", get_defined_vars()); |
| 115 |
|
| 116 |
exit(); // Clean exit. |
| 117 |
} |
| 118 |
do_action("ws_plugin__s2member_after_menu_pages_js", get_defined_vars()); |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
|