本文整理汇总了PHP中AdminHelper::getPersistentData方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::getPersistentData方法的具体用法?PHP AdminHelper::getPersistentData怎么用?PHP AdminHelper::getPersistentData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHelper
的用法示例。
在下文中一共展示了AdminHelper::getPersistentData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRedirectReturn
public static function handleRedirectReturn($data = false)
{
$connections = CASHSystem::getSystemSettings('system_connections');
if (isset($connections['com.amazon'])) {
$s3_default_email = $connections['com.amazon']['email'];
} else {
$s3_default_email = false;
}
$success = S3Seed::connectAndAuthorize($data['key'], $data['secret'], $data['bucket'], $s3_default_email);
if ($success) {
// we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
// calls would only happen in the admin. If this changes we can fuck around with it later.
$new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$connection_name = $data['bucket'] . ' (Amazon S3)';
if (substr($connection_name, 0, 10) == 'cashmusic.') {
$connection_name = 'Amazon S3 (created ' . date("M j, Y") . ')';
}
$result = $new_connection->setSettings($connection_name, 'com.amazon', array('bucket' => $data['bucket']));
if ($result) {
AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
} else {
AdminHelper::formFailure('Error. Something just didn\'t work right.');
}
} else {
//$return_markup = '<h4>Error</h4>'
// . '<p>We couldn\'t connect with your S3 account. Please check the key and secret.</p>';
AdminHelper::formFailure('We couldn\'t connect your S3 account. Please check the key and secret.');
}
return $return_markup;
}
示例2: echoFormOptions
/**
* Tell it what you need. It makes dropdowns. It's a dropdown robot travelling
* at the speed of light — it'll make a supersonic nerd of you. Don't stop it.
*
* @return array
*/
public static function echoFormOptions($base_type, $selected = 0, $range = false, $return = false)
{
switch ($base_type) {
case 'assets':
$plant_name = 'asset';
$action_name = 'getassetsforuser';
$display_information = 'title';
if ($range) {
if (!in_array($selected, $range)) {
$range[] = $selected;
}
}
break;
case 'people_lists':
$plant_name = 'people';
$action_name = 'getlistsforuser';
$display_information = 'name';
break;
case 'venues':
$plant_name = 'calendar';
$action_name = 'getallvenues';
$display_information = 'name';
break;
case 'items':
$plant_name = 'commerce';
$action_name = 'getitemsforuser';
$display_information = 'name';
break;
}
$echoformoptions_cash_request = new CASHRequest(array('cash_request_type' => $plant_name, 'cash_action' => $action_name, 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
$all_options = '';
if (is_array($echoformoptions_cash_request->response['payload']) && $echoformoptions_cash_request->response['status_code'] == 200) {
foreach ($echoformoptions_cash_request->response['payload'] as $item) {
$doloop = true;
if ($range) {
if (!in_array($item['id'], $range)) {
$doloop = false;
}
}
if ($doloop) {
$selected_string = '';
if ($item['id'] == $selected) {
$selected_string = ' selected="selected"';
}
$all_options .= '<option value="' . $item['id'] . '"' . $selected_string . '>' . $item[$display_information] . '</option>';
}
}
}
if ($return) {
return $all_options;
} else {
echo $all_options;
}
unset($echoformoptions_cash_request);
}
示例3: echoFormOptions
/**
* Tell it what you need. It makes dropdowns. It's a dropdown robot travelling
* at the speed of light — it'll make a supersonic nerd of you. Don't stop it.
*
* @return array
*/
public static function echoFormOptions($base_type, $selected = 0)
{
switch ($base_type) {
case 'assets':
$plant_name = 'asset';
$action_name = 'getassetsforuser';
$display_information = 'title';
break;
case 'people_lists':
$plant_name = 'people';
$action_name = 'getlistsforuser';
$display_information = 'name';
break;
case 'venues':
$plant_name = 'calendar';
$action_name = 'getallvenues';
$display_information = 'name';
break;
}
$echoformoptions_cash_request = new CASHRequest(array('cash_request_type' => $plant_name, 'cash_action' => $action_name, 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if (is_array($echoformoptions_cash_request->response['payload']) && $echoformoptions_cash_request->response['status_code'] == 200) {
foreach ($echoformoptions_cash_request->response['payload'] as $item) {
$selected_string = '';
if ($item['id'] == $selected) {
$selected_string = ' selected="selected"';
}
echo '<option value="' . $item['id'] . '"' . $selected_string . '>' . $item[$display_information] . '</option>';
}
}
unset($echoformoptions_cash_request);
}
示例4: CASHRequest
<?php
// add unique page settings:
$page_title = 'Elements: Your Elements';
$page_tips = 'This page lists all your defined elements. Click any of them to see embed details, make edits, or delete them.';
$elements_data = AdminHelper::getElementsData();
$effective_user = AdminHelper::getPersistentData('cash_effective_user');
if ($request_parameters) {
$page_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getelement', 'id' => $request_parameters[0]));
if ($page_request->response['payload']['user_id'] == $effective_user) {
$page_title = 'Elements: View “' . $page_request->response['payload']['name'] . '”';
$element_type = $page_request->response['payload']['type'];
if (@file_exists(CASH_PLATFORM_ROOT . '/elements' . '/' . $element_type . '/help.php')) {
$page_tips = file_get_contents(CASH_PLATFORM_ROOT . '/elements' . '/' . $element_type . '/help.php');
}
$cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'elementbylocation', 'element_id' => $request_parameters[0], 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'elementbylocation');
$cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'elementbymethod', 'element_id' => $request_parameters[0], 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'elementbymethod');
} else {
// var_dump($page_request->response);
header('Location: ' . ADMIN_WWW_BASE_PATH . '/elements/view/');
}
} else {
$cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'getelementsforuser');
}
示例5: CASHRequest
<?php
$all_order_details = false;
$raw_orders = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getordersforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
if (is_array($raw_orders->response['payload'])) {
$all_order_details = array();
foreach ($raw_orders->response['payload'] as $order) {
if ($order['canceled'] == 0) {
$order_details_request = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getorder', 'id' => $order['id'], 'deep' => true));
$order_details = $order_details_request->response['payload'];
if ($order_details['successful']) {
$order_date = $order_details['creation_date'];
if ($order_details['creation_date']) {
$order_date = $order_details['modification_date'];
}
$all_order_details[] = array('id' => '#' . str_pad($order_details['id'], 6, 0, STR_PAD_LEFT), 'date' => CASHSystem::formatTimeAgo((int) $order_date) . '<br /><a href="' . ADMIN_WWW_BASE_PATH . '/commerce/orders/view/' . $order_details['id'] . '">details</a>', 'customer' => $order_details['customer_details']['display_name'] . '<br /><a href="mailto:' . $order_details['customer_details']['email_address'] . '">' . $order_details['customer_details']['email_address'] . '</a>', 'items' => str_replace('\\n', '<br />', $order_details['order_totals']['description']), 'gross' => '$' . sprintf("%01.2f", $order_details['gross_price']), 'net' => '$' . sprintf("%01.2f", $order_details['gross_price'] - $order_details['service_fee']));
}
}
}
if (count($all_order_details) == 0) {
$all_order_details = false;
}
}
示例6: handleRedirectReturn
public static function handleRedirectReturn($data = false)
{
if (!isset($data['state'])) {
return "Please start the Dropbox authentication flow from the beginning.";
}
$connections = CASHSystem::getSystemSettings('system_connections');
if (!isset($connections['com.dropbox'])) {
return 'Please add default Dropbox credentials.';
}
$auth_client = DropboxSeed::getWebAuthClient($connections['com.dropbox']['redirect_uri']);
try {
list($token, $user_id) = $auth_client->finish($data);
} catch (Exception $e) {
$token = false;
}
if (!$token) {
return "The Dropbox authentication flow failed - please try again.";
}
$new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$result = $new_connection->setSettings($user_id . ' (Dropbox)', 'com.dropbox', array('access_token' => $token, 'user_id' => $user_id));
if (!$result) {
$settings_for_user = $new_connection->getAllConnectionsforUser();
if (is_array($settings_for_user)) {
foreach ($settings_for_user as $key => $connection_data) {
if ($connection_data['name'] == $user_id . ' (Dropbox)') {
$result = $connection_data['id'];
break;
}
}
}
}
if (isset($data['return_result_directly'])) {
return $result;
} else {
if ($result) {
AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
} else {
AdminHelper::formFailure('Error. Something just didn\'t work right.', '/settings/connections/');
}
}
}
示例7:
<?php
// add unique page settings:
$page_title = 'Calendar: Venues';
$page_tips = '';
$cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getallvenues', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'visible_event_types' => 'upcoming'), 'getallvenues');
$cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setapicredentials', 'user_id' => 1), 'apishit');
示例8: header
<?php
if (!$request_parameters) {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/elements/view/');
}
$current_element = $cash_admin->setCurrentElement($request_parameters[0]);
if ($current_element) {
$cash_admin->page_data['form_state_action'] = 'doelementedit';
$elements_data = AdminHelper::getElementsData();
$effective_user = AdminHelper::getPersistentData('cash_effective_user');
if ($current_element['user_id'] == $effective_user) {
$cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'elementbylocation', 'element_id' => $request_parameters[0], 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'elementbylocation');
$cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getanalytics', 'analtyics_type' => 'elementbymethod', 'element_id' => $request_parameters[0], 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'elementbymethod');
if (@file_exists(CASH_PLATFORM_ROOT . '/elements' . '/' . $current_element['type'] . '/admin.php')) {
include CASH_PLATFORM_ROOT . '/elements' . '/' . $current_element['type'] . '/admin.php';
$cash_admin->page_data['title'] = 'Elements: “' . $current_element['name'] . '”';
$cash_admin->page_data['element_button_text'] = 'Edit the element';
$element_rendered_content = $cash_admin->mustache_groomer->render(file_get_contents(CASH_PLATFORM_ROOT . '/elements' . '/' . $current_element['type'] . '/templates/admin.mustache'), $cash_admin->page_data);
} else {
$element_rendered_content = "Could not find the admin.php file for this .";
}
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/elements/view/');
}
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/elements/view/');
}
示例9: handleRedirectReturn
public static function handleRedirectReturn($data = false)
{
if (isset($data['error'])) {
return 'There was an error. (general) Please try again.';
} else {
$connections = CASHSystem::getSystemSettings('system_connections');
require_once CASH_PLATFORM_ROOT . '/lib/twitter/OAuth.php';
require_once CASH_PLATFORM_ROOT . '/lib/twitter/twitteroauth.php';
$temporary_credentials = AdminHelper::getPersistentData('twitter_temporary_credentials');
$twitter = new TwitterOAuth($connections['com.twitter']['client_id'], $connections['com.teitter']['client_secret'], $temporary_credentials['oauth_token'], $temporary_credentials['oauth_token_secret']);
$access_token = $twitter->getAccessToken($_REQUEST['oauth_verifier']);
if ($twitter->http_code == 200) {
// we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
// calls would only happen in the admin. If this changes we can fuck around with it later.
$new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$result = $new_connection->setSettings('@' . $access_token['screen_name'] . ' (Twitter)', 'com.twitter', array('token' => $access_token));
if ($result) {
AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
} else {
AdminHelper::formFailure('Error. Could not save connection.', '/settings/connections/');
}
} else {
AdminHelper::formFailure('Error. Problem communicating with Twitter', '/settings/connections/');
}
}
}
示例10: ArrayIterator
<?php
$items_response = $cash_admin->requestAndStore(array('cash_request_type' => 'commerce', 'cash_action' => 'getitemsforuser', 'user_id' => AdminHelper::getPersistentData('cash_effective_user')), 'all_items');
// banner stuff
$settings = $cash_admin->getUserSettings();
if ($settings['banners'][BASE_PAGENAME]) {
$cash_admin->page_data['banner_title_content'] = '<h2>Commerce</h2><b>sell</b> your music<br />review and <b>fulfill</b> orders';
$cash_admin->page_data['banner_main_content'] = 'Here’s where you’ll define products and special offers, check on orders, manage fulfillment, and tracks overall sales. Connect to your Paypal account and off you go.';
}
if (is_array($items_response['payload'])) {
$cash_admin->page_data['items_all'] = new ArrayIterator($items_response['payload']);
}
$cash_admin->setPageContentTemplate('commerce');
示例11: handleRedirectReturn
public static function handleRedirectReturn($data = false)
{
if (isset($data['code'])) {
$connections = CASHSystem::getSystemSettings('system_connections');
if (isset($connections['com.google.drive'])) {
$credentials = GoogleDriveSeed::exchangeCode($data['code'], $connections['com.google.drive']['client_id'], $connections['com.google.drive']['client_secret'], $connections['com.google.drive']['redirect_uri']);
$user_info = GoogleDriveSeed::getUserInfo($credentials, $connections['com.google.drive']['client_id'], $connections['com.google.drive']['client_secret']);
if ($user_info) {
$email_address = $user_info['email'];
$user_id = $user_info['id'];
} else {
$email_address = false;
$user_id = false;
}
$credentials_array = json_decode($credentials, true);
if (isset($credentials_array['refresh_token'])) {
// we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
// calls would only happen in the admin. If this changes we can fuck around with it later.
$new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$result = $new_connection->setSettings($email_address . ' (Google Drive)', 'com.google.drive', array('user_id' => $user_id, 'email_address' => $email_address, 'access_token' => $credentials, 'access_expires' => $credentials_array['created'] + $credentials_array['expires_in'], 'refresh_token' => $credentials_array['refresh_token']));
if (!$result) {
$settings_for_user = $new_connection->getAllConnectionsforUser();
if (is_array($settings_for_user)) {
foreach ($settings_for_user as $key => $connection_data) {
if ($connection_data['name'] == $email_address . ' (Google Drive)') {
$result = $connection_data['id'];
break;
}
}
}
}
if (isset($data['return_result_directly'])) {
return $result;
} else {
if ($result) {
AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
} else {
AdminHelper::formFailure('Error. Something just didn\'t work right.', '/settings/connections/');
}
}
} else {
return 'Could not find a refresh token from google';
}
} else {
return 'Please add default google drive app credentials.';
}
} else {
return 'There was an error. (session) Please try again.';
}
}
示例12: CASHConnection
<?php
$page_data_object = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$settings_types_data = $page_data_object->getConnectionTypes();
$settings_for_user = $page_data_object->getAllConnectionsforUser();
if ($request_parameters) {
$settings_action = $request_parameters[0];
}
示例13: echoFormOptions
/**
* Tell it what you need. It makes dropdowns. It's a dropdown robot travelling
* at the speed of light — it'll make a supersonic nerd of you. Don't stop it.
*
* @return array
*/
public static function echoFormOptions($base_type, $selected = 0, $range = false, $return = false, $shownone = true)
{
global $admin_primary_cash_request;
$available_options = false;
$all_options = '';
if ($shownone) {
$all_options = '<option value="0">None</option>';
}
if (is_array($base_type)) {
$available_options = array();
foreach ($base_type as $key => $value) {
$available_options[] = array('id' => $key, 'display' => $value);
}
$display_information = 'display';
} else {
// fix for an old style. we prefer '/' in app.json but use '_' in other calls
$base_type = str_replace('/', '_', $base_type);
if (substr($base_type, 0, 7) == 'connect') {
$scope = explode('_', $base_type);
return AdminHelper::echoConnectionsOptions($scope[1], $selected, true);
}
switch ($base_type) {
case 'assets':
$plant_name = 'asset';
$action_name = 'getassetsforuser';
$display_information = 'title';
if ($range) {
if (!in_array($selected, $range)) {
$range[] = $selected;
}
}
break;
case 'people_lists':
$plant_name = 'people';
$action_name = 'getlistsforuser';
$display_information = 'name';
break;
case 'venues':
case 'calendar_venues':
$plant_name = 'calendar';
$action_name = 'getallvenues';
$display_information = 'name';
break;
case 'items':
case 'commerce_items':
$plant_name = 'commerce';
$action_name = 'getitemsforuser';
$display_information = 'name';
break;
}
global $admin_primary_cash_request;
$admin_primary_cash_request->processRequest(array('cash_request_type' => $plant_name, 'cash_action' => $action_name, 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'parent_id' => 0));
if (is_array($admin_primary_cash_request->response['payload']) && $admin_primary_cash_request->response['status_code'] == 200) {
$available_options = $admin_primary_cash_request->response['payload'];
}
}
if (is_array($available_options)) {
foreach ($available_options as $item) {
$doloop = true;
if ($range) {
if (!in_array($item['id'], $range)) {
$doloop = false;
}
}
if ($doloop) {
$selected_string = '';
if ($item['id'] == $selected) {
$selected_string = ' selected="selected"';
}
$all_options .= '<option value="' . $item['id'] . '"' . $selected_string . '>' . $item[$display_information] . '</option>';
}
}
} else {
$all_options = false;
}
if ($return) {
return $all_options;
} else {
echo $all_options;
}
}
示例14: header
<?php
if (!$request_parameters) {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
$page_request = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getlist', 'list_id' => $request_parameters[0]), 'getlist');
//var_dump($page_request);
if ($page_request['status_uid'] == 'people_getlist_200') {
$elements_data = AdminHelper::getElementsData();
$effective_user = AdminHelper::getPersistentData('cash_effective_user');
if ($page_request['payload']['user_id'] == $effective_user) {
if (isset($_POST['dodelete']) || isset($_GET['modalconfirm'])) {
$list_delete_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'deletelist', 'list_id' => $request_parameters[0]));
if ($list_delete_request->response['status_uid'] == 'people_deletelist_200') {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
}
$cash_admin->page_data['title'] = 'People: Delete “' . $page_request->response['payload']['name'] . '”';
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/');
}
} else {
header('Location: ' . ADMIN_WWW_BASE_PATH . '/people/lists/delete/' . $request_parameters[0]);
}
$cash_admin->setPageContentTemplate('delete_confirm');
示例15: date
}
// format date for viewing
$event['formatted_date'] = date('d M', $event['date']);
// format location
if (strtolower($event['venue_country']) == 'usa' || strtolower($event['venue_country']) == 'canada') {
$event['event_location'] = $event['venue_city'] . ', ' . $event['venue_region'];
} else {
$event['event_location'] = $event['venue_city'] . ', ' . $event['venue_country'];
}
if ($event['event_location'] == ', ') {
$event['event_location'] = '';
}
}
}
$thisweek_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'geteventsbetween', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'cutoff_date_low' => 'now', 'cutoff_date_high' => time() + 60 * 60 * 24 * 7), 'events_thisweek');
$unpublished_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getevents', 'user_id' => AdminHelper::getPersistentData('cash_effective_user'), 'visible_event_types' => 'upcoming', 'published_status' => 0), 'events_unpublished');
// banner stuff
$settings = $cash_admin->getUserSettings();
if ($settings['banners'][BASE_PAGENAME]) {
$cash_admin->page_data['banner_title_content'] = '<h2>Calendar</h2>enter your <b>shows</b><br />manage <b>guestlists</b><br />check <b>venue</b> details';
$cash_admin->page_data['banner_main_content'] = 'Enter all your shows, manage your calendar and your guest lists, and use all of it to feed elements like show listings, tour archives, and even guest list slot giveaways.';
}
// this week
if (is_array($thisweek_response['payload'])) {
formatEventOutput($thisweek_response);
$cash_admin->page_data['events_thisweek'] = new ArrayIterator($thisweek_response['payload']);
}
// unpublished
// most accessed
if (is_array($unpublished_response['payload'])) {
formatEventOutput($unpublished_response);