} } arsort($tmp_locations_array); // sort temp array most to least $tmp_locations_array = array_slice($tmp_locations_array, 0, 5); // trim temp array to no more than 5 $locations_array = array(); // let's rebuild the locations array foreach ($tmp_locations_array as $location => $total) { $locations_array[] = array('access_location' => $location, 'total' => $total); } $cash_admin->page_data['location_analytics'] = new ArrayIterator($locations_array); $cash_admin->page_data['method_analytics'] = new ArrayIterator($methods_array); } // Detects if element add has happened and deals with POST data if it has AdminHelper::handleElementFormPOST($_POST, $cash_admin); // Set basic id/name stuff for the element AdminHelper::setBasicElementFormData($cash_admin); // pull stored element data $cash_admin->page_data = array_merge($cash_admin->page_data, AdminHelper::getElementValues($current_element)); $cash_admin->page_data['ui_title'] = '' . $current_element['name'] . ''; $cash_admin->page_data['element_button_text'] = 'Save changes'; $cash_admin->page_data['element_rendered_content'] = $cash_admin->mustache_groomer->render(AdminHelper::getElementTemplate($current_element), $cash_admin->page_data); $campaign_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaignforelement', 'id' => $current_element['id'])); if ($campaign_response['payload']) { $cash_admin->page_data['campaign_id'] = $campaign_response['payload']['id']; $cash_admin->page_data['campaign_title'] = $campaign_response['payload']['title']; } } else { AdminHelper::controllerRedirect('/elements/'); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('email_list_id' => $_POST['email_list_id'], 'display_title' => $_POST['display_title'], 'display_message' => $_POST['display_message'])); } // Page data needed for a blank 'add' form: $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('items', 0, false, true); $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_display_title'] = $current_element['options']['display_title']; $cash_admin->page_data['options_display_message'] = $current_element['options']['display_message']; $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', $current_element['options']['email_list_id'], false, true); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { if (isset($_POST['do_not_verify'])) { $do_not_verify = 1; } else { $do_not_verify = 0; } AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('message_invalid_email' => $_POST['message_invalid_email'], 'message_instructions' => $_POST['message_instructions'], 'image_url' => $_POST['image_url'], 'email_subject' => $_POST['email_subject'], 'email_message' => $_POST['email_message'], 'email_html_message' => $_POST['email_html_message'], 'message_success' => $_POST['message_success'], 'email_list_id' => $_POST['email_list_id'], 'asset_id' => $_POST['asset_id'], 'do_not_verify' => $do_not_verify)); } // Page data needed for a blank 'add' form: $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('items', 0, false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('items', 0, false, true); $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_message_invalid_email'] = $current_element['options']['message_invalid_email']; $cash_admin->page_data['options_message_instructions'] = $current_element['options']['message_instructions']; $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success']; $cash_admin->page_data['options_message_privacy'] = $current_element['options']['message_privacy']; $cash_admin->page_data['options_image_url'] = $current_element['options']['image_url']; $cash_admin->page_data['options_email_subject'] = $current_element['options']['email_subject']; $cash_admin->page_data['options_email_message'] = $current_element['options']['email_message']; $cash_admin->page_data['options_email_html_message'] = $current_element['options']['email_html_message']; $cash_admin->page_data['options_do_not_verify'] = $current_element['options']['do_not_verify']; $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', $current_element['options']['email_list_id'], false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('assets', $current_element['options']['asset_id'], false, true); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('message_error' => $_POST['message_error'], 'message_success' => $_POST['message_success'], 'item_id' => $_POST['item_id'], 'connection_id' => $_POST['connection_id'])); } // Page data needed for a blank 'add' form: $cash_admin->page_data['options_items_dropdown'] = AdminHelper::echoFormOptions('items', 0, false, true); $cash_admin->page_data['options_connections_dropdown'] = AdminHelper::echoConnectionsOptions('commerce', 0, true); $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success']; $cash_admin->page_data['options_message_error'] = $current_element['options']['message_error']; $cash_admin->page_data['options_items_dropdown'] = AdminHelper::echoFormOptions('items', $current_element['options']['item_id'], false, true); $cash_admin->page_data['options_connections_dropdown'] = AdminHelper::echoConnectionsOptions('commerce', $current_element['options']['connection_id'], true); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('message_success' => $_POST['message_success'])); } $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success']; }
if (substr($key, 0, 15) == 'twitterusername' && $value !== '') { $twitterusername = str_replace('@', '', $value); if (isset($_POST[str_replace('twitterusername', 'twitterhidereplies', $key)])) { $twitterhidereplies = true; } else { $twitterhidereplies = false; } $twitterfiltertype = $_POST[str_replace('twitterusername', 'twitterfiltertype', $key)]; $twitterfiltervalue = $_POST[str_replace('twitterusername', 'twitterfiltervalue', $key)]; $twitter_feeds[] = array('twitterusername' => $twitterusername, 'twitterhidereplies' => $twitterhidereplies, 'twitterfiltertype' => $twitterfiltertype, 'twitterfiltervalue' => $twitterfiltervalue); } } $all_feeds['tumblr'] = $tumblr_feeds; $all_feeds['twitter'] = $twitter_feeds; $all_feeds['post_limit'] = $_POST['post_limit']; AdminHelper::handleElementFormPOST($_POST, $cash_admin, $all_feeds); } $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_post_limit'] = $current_element['options']['post_limit']; // Deal with all the feed array mess: $cash_admin->page_data['tumblr_count'] = 1; if (is_array($current_element['options']['tumblr'])) { $tumblr_feeds = array(); $feed_counter = 1; foreach ($current_element['options']['tumblr'] as $feed) { // Flattening each feed type for easier mustache checkbox shit-storming $formatted_feed = array('tumblrurl' => $feed['tumblrurl'], 'tumblrtag' => $feed['tumblrtag'], 'feed_count' => $feed_counter);
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('visible_event_types' => $_POST['visible_event_types'], 'max_display_dates' => $_POST['max_display_dates'])); } $current_element = $cash_admin->getCurrentElement(); $cash_admin->page_data['options_upcoming_checked'] = true; if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_visible_event_types'] = $current_element['options']['visible_event_types']; $cash_admin->page_data['options_max_display_dates'] = $current_element['options']['max_display_dates']; $cash_admin->page_data['options_upcoming_checked'] = false; $cash_admin->page_data['options_archive_checked'] = false; $cash_admin->page_data['options_both_checked'] = false; if ($current_element['options']['visible_event_types'] == 'both') { $cash_admin->page_data['options_both_checked'] = true; } elseif ($current_element['options']['visible_event_types'] == 'archive') { $cash_admin->page_data['options_archive_checked'] = true; } else { $cash_admin->page_data['options_upcoming_checked'] = true; } }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { if (isset($_POST['skip_login'])) { $skip_login = 1; } else { $skip_login = 0; } AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('alternate_password' => $_POST['alternate_password'], 'message_success' => $_POST['message_success'], 'email_list_id' => $_POST['email_list_id'], 'skip_login' => $skip_login, 'asset_id' => $_POST['asset_id'])); } // Page data needed for a blank 'add' form: $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('items', 0, false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('items', 0, false, true); $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_alternate_password'] = $current_element['options']['alternate_password']; $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success']; $cash_admin->page_data['options_skip_login'] = $current_element['options']['skip_login']; $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', $current_element['options']['email_list_id'], false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('assets', $current_element['options']['asset_id'], false, true); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { if (isset($_POST['do_not_verify'])) { $do_not_verify = 1; } else { $do_not_verify = 0; } AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('message_invalid_email' => $_POST['message_invalid_email'], 'message_privacy' => $_POST['message_privacy'], 'message_success' => $_POST['message_success'], 'email_list_id' => $_POST['email_list_id'], 'asset_id' => $_POST['asset_id'], 'comment_or_radio' => 0, 'do_not_verify' => $do_not_verify)); } // Page data needed for a blank 'add' form: $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('items', 0, false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('items', 0, false, true); $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_message_invalid_email'] = $current_element['options']['message_invalid_email']; $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success']; $cash_admin->page_data['options_message_privacy'] = $current_element['options']['message_privacy']; $cash_admin->page_data['options_do_not_verify'] = $current_element['options']['do_not_verify']; $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', $current_element['options']['email_list_id'], false, true); $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('assets', $current_element['options']['asset_id'], false, true); }
<?php // Identify the workflow state: if (AdminHelper::elementFormSubmitted($_POST)) { AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('storedcotent' => $_POST['element_content'])); } $current_element = $cash_admin->getCurrentElement(); if ($current_element) { // Current element found, so fill in the 'edit' form, basics first: AdminHelper::setBasicElementFormData($cash_admin); // Now any element-specific options: $cash_admin->page_data['options_storedcotent'] = $current_element['options']['storedcotent']; }