<commit_before><?php
/**
 * The AdminHelper class provides a single location for various formatting and 
 * quick processing methods needed throughout the admin
 * 
 * Most functions that are simple/static framework wrappers or data formatting should go here
 *
 * @package admin.org.cashmusic
 * @author <NAME>
 * @link http://cashmusic.org/
 *
 * Copyright (c) 2012, CASH Music
 * Licensed under the Affero General Public License version 3.
 * See http://www.gnu.org/licenses/agpl-3.0.html
 *
 */abstract class AdminHelper  {

	public static function doLogin($email_address,$password,$require_admin=true) {
		global $admin_primary_cash_request;
		$admin_primary_cash_request->processRequest(
			array(
				'cash_request_type' => 'system', 
				'cash_action' => 'validatelogin',
				'address' => $email_address, 
				'password' => $password,
				'require_admin' => $require_admin
			)
		);
		return $admin_primary_cash_request->response['payload'];
	}

	/**********************************************
	 *
	 * PAGE/UI RENDERING DETAILS
	 *
	 *********************************************/

	public static function getPageMenuDetails() {
		$pages_array = json_decode(file_get_contents(dirname(__FILE__).'/../components/interface/en/menu.json'),true);
		// remove non-multi links
		$platform_type = CASHSystem::getSystemSettings('instancetype');
		if ($platform_type == 'multi') {
			unset($pages_array['settings/update'],$pages_array['people/contacts']);
		}
		// make an array for return
		$return_array = array(
			'page_title' => 'CASH Music',
			'tagline' => null,
			'section_menu' => '',
			'link_text' => null
		);

		// generate submenu markup
		$current_endpoint = '';
		$previous_endpoint = '';
		$menustr = '';

		foreach ($pages_array as $page_endpoint => $page) {
			$exploded = explode('/',$page_endpoint);
			$current_endpoint = $exploded[0];
			if ($current_endpoint !== $previous_endpoint) {
				if ($previous_endpoint !== '') {
					$menustr .= '</ul>';
					$return_array[$previous_endpoint . '_section_menu'] = $menustr;
				}
				$menustr = '<ul>';
				$previous_endpoint = $current_endpoint;
			}

			$menulevel = substr_count($page_endpoint, '/');
			if ($menulevel == 1 && !isset($page['hide'])) { // only show top-level menu items
				if (!isset($page['add_class'])) {
					$page['add_class'] = '';
				}
				$menustr .= "<li><a title=\"{$page['page_name']}\" class=\"{$page['add_class']}\" href=\"" . ADMIN_WWW_BASE_PATH . "/$page_endpoint/\"><span>{$page['page_name']}</span><div class=\"icon icon-{$page['menu_icon']}\"></div><!--icon--></a></li>";
			}
		}

		// find the right page title
		$endpoint = str_replace('_','/',BASE_PAGENAME);
		$endpoint_parts = explode('/',$endpoint);
		if (isset($pages_array[$endpoint])) {
			$current_title = '';
			/*if (count($endpoint_parts) > 1) {
				$current_title .= $pages_array[$endpoint_parts[0]]['page_name'] . ': ';
			}*/
			$current_title .= $pages_array[$endpoint]['page_name'];
			$return_array['page_title'] = $current_title;
			if (isset($pages_array[$endpoint]['tagline'])) {
				$return_array['tagline'] = $pages_array[$endpoint]['tagline'];
			}
		}

		// set link text for the main template
		$return_array['link_text'] = array(
			'link_main_page' => $pages_array['mainpage']['page_name'],
			'link_menu_assets' => $pages_array['assets']['page_name'],
			'link_menu_people' => $pages_array['people']['page_name'],
			'link_menu_commerce' => $pages_array['commerce']['page_name'],<commit_msg>Remove comment<commit_after><?php
/**
 * The AdminHelper class provides a single location for various formatting and 
 * quick processing methods needed throughout the admin
 * 
 * Most functions that are simple/static framework wrappers or data formatting should go here
 *
 * @package admin.org.cashmusic
 * @author CASH Music
 * @link http://cashmusic.org/
 *
 * Copyright (c) 2012, CASH Music
 * Licensed under the Affero General Public License version 3.
 * See http://www.gnu.org/licenses/agpl-3.0.html
 *
 */abstract class AdminHelper  {

	public static function doLogin($email_address,$password,$require_admin=true) {
		global $admin_primary_cash_request;
		$admin_primary_cash_request->processRequest(
			array(
				'cash_request_type' => 'system', 
				'cash_action' => 'validatelogin',
				'address' => $email_address, 
				'password' => <PASSWORD>,
				'require_admin' => $require_admin
			)
		);
		return $admin_primary_cash_request->response['payload'];
	}

	/**********************************************
	 *
	 * PAGE/UI RENDERING DETAILS
	 *
	 *********************************************/

	public static function getPageMenuDetails() {
		$pages_array = json_decode(file_get_contents(dirname(__FILE__).'/../components/interface/en/menu.json'),true);
		// remove non-multi links
		$platform_type = CASHSystem::getSystemSettings('instancetype');
		if ($platform_type == 'multi') {
			unset($pages_array['settings/update'],$pages_array['people/contacts']);
		}
		// make an array for return
		$return_array = array(
			'page_title' => 'CASH Music',
			'tagline' => null,
			'section_menu' => '',
			'link_text' => null
		);

		// generate submenu markup
		$current_endpoint = '';
		$previous_endpoint = '';
		$menustr = '';

		foreach ($pages_array as $page_endpoint => $page) {
			$exploded = explode('/',$page_endpoint);
			$current_endpoint = $exploded[0];
			if ($current_endpoint !== $previous_endpoint) {
				if ($previous_endpoint !== '') {
					$menustr .= '</ul>';
					$return_array[$previous_endpoint . '_section_menu'] = $menustr;
				}
				$menustr = '<ul>';
				$previous_endpoint = $current_endpoint;
			}

			$menulevel = substr_count($page_endpoint, '/');
			if ($menulevel == 1 && !isset($page['hide'])) { // only show top-level menu items
				if (!isset($page['add_class'])) {
					$page['add_class'] = '';
				}
				$menustr .= "<li><a title=\"{$page['page_name']}\" class=\"{$page['add_class']}\" href=\"" . ADMIN_WWW_BASE_PATH . "/$page_endpoint/\"><span>{$page['page_name']}</span><div class=\"icon icon-{$page['menu_icon']}\"></div><!--icon--></a></li>";
			}
		}

		// find the right page title
		$endpoint = str_replace('_','/',BASE_PAGENAME);
		$endpoint_parts = explode('/',$endpoint);
		if (isset($pages_array[$endpoint])) {
			$current_title = '';
			$current_title .= $pages_array[$endpoint]['page_name'];
			$return_array['page_title'] = $current_title;
			if (isset($pages_array[$endpoint]['tagline'])) {
				$return_array['tagline'] = $pages_array[$endpoint]['tagline'];
			}
		}

		// set link text for the main template
		$return_array['link_text'] = array(
			'link_main_page' => $pages_array['mainpage']['page_name'],
			'link_menu_assets' => $pages_array['assets']['page_name'],
			'link_menu_people' => $pages_array['people']['page_name'],
			'link_menu_commerce' => $pages_array['commerce']['page_name'],
{'fraction_non_alphanumeric': 0.20371453641415618, 'fraction_numerical': 0.0029248318221702253, 'mean_word_length': 4.5466342254663425, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2876045', 'n_tokens_mistral': 2470, 'n_tokens_neox': 2144, 'n_words': 404}