public function checkEmployeeAccess() { global $current_user; // determine is current employee has access to the current page if (class_exists("MM_Employee")) { $employee = MM_Employee::findByUserId($current_user->ID); if ($employee->isValid()) { $crntPage = MM_ModuleUtils::getPage(); $crntModule = MM_ModuleUtils::getModule(); if (empty($crntModule)) { $crntModule = $crntPage; } if (MM_ModuleUtils::isMemberMousePage($crntPage) && !$employee->hasPermission(array("module" => $crntModule))) { wp_redirect(MM_ModuleUtils::getUrl("mm_access_denied")); exit; } return true; } else { return false; } } else { return false; } }
<?php /** * * MemberMouse(TM) (http://www.membermouse.com) * (c) MemberMouse, LLC. All rights reserved. */ MM_MemberMouseService::validateLicense(new MM_License()); $crntPage = MM_ModuleUtils::getPage(); $primaryTab = MM_ModuleUtils::getPrimaryTab(); $module = MM_ModuleUtils::getModule(); if (isset($_REQUEST[MM_Session::$PARAM_USER_ID])) { $user = new MM_User($_REQUEST[MM_Session::$PARAM_USER_ID]); } else { $user = new MM_User(); } $resourceUrl = MM_RESOURCES_URL; if (MM_Utils::isSSL()) { $resourceUrl = preg_replace("/(http\\:)/", "https:", MM_RESOURCES_URL); } if (version_compare(get_bloginfo('version'), "3.8", ">=")) { ?> <!-- override WordPress 3.8 styles --> <style> #wpwrap { background-color: #fff; } .ui-widget { font-size:1em;
public function loadResources() { global $wp_scripts; $customCssFiles = array(); $customCssFiles["main"] = 'resources/css/common/mm-main.css'; $customCssFiles["buttons"] = 'resources/css/common/mm-buttons.css'; $module = MM_ModuleUtils::getModule(); if ($module == MM_MODULE_REPORTING) { $customCssFiles["reporting"] = 'resources/css/admin/reporting/mm-reporting.css'; } $useJQueryUI = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_USE_JQUERY_UI); if (function_exists("wp_scripts") && ($useJQueryUI == "1" || is_admin())) { wp_scripts(); // get registered script object for jquery-ui, use that to load the appropriate theme version $jqueryUICore = $wp_scripts->query('jquery-ui-core'); $jquery_ui_version = isset($jqueryUICore->ver) ? $jqueryUICore->ver : "1.11.2"; wp_enqueue_style("membermouse-jquery-css", "//ajax.googleapis.com/ajax/libs/jqueryui/{$jquery_ui_version}/themes/" . MM_JQUERY_UI_THEME . "/jquery-ui.css", array(), $jquery_ui_version); } $version = self::getPluginVersion(); foreach ($customCssFiles as $cssId => $cssFile) { wp_enqueue_style("membermouse-" . $cssId, plugins_url($cssFile, __FILE__), array(), $version); } $subfolder = $module == MM_MODULE_REPORTING ? "reporting/" : ""; if (file_exists(MM_PLUGIN_ABSPATH . "/resources/css/admin/{$subfolder}mm-" . $module . ".css")) { wp_enqueue_style('membermouse-' . $module, plugins_url("resources/css/admin/{$subfolder}mm-" . $module . '.css', __FILE__), array()); } wp_enqueue_style('membermouse-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css', array()); $this->loadJavascript($module); }