Skip to content

Commit

Permalink
Merge branch 'hotfix/go_ranks_header_sent' into dev-forest
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMacLab committed Dec 24, 2014
2 parents d73c193 + 1fa9a12 commit 89b2252
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 135 deletions.
3 changes: 2 additions & 1 deletion go_admin_bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function go_admin_bar(){
if($dom <= 0){
$dom = 1;
}
go_update_ranks($current_user_id, $current_points);
$ranks_output = go_update_ranks($current_user_id, $current_points);
$percentage = $rng/$dom*100;
if($percentage <= 0){ $percentage = 0;} else if($percentage >= 100){$percentage = 100;}

Expand Down Expand Up @@ -205,6 +205,7 @@ function go_admin_bar(){
'parent' => 'appearance'
));
}
echo $ranks_output;
}
}
?>
103 changes: 53 additions & 50 deletions go_messages.php
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
<?php
add_action('admin_bar_init','go_messages_bar');

function go_messages_bar(){
function go_messages_bar () {
global $wpdb;
global $wp_admin_bar;
$messages = get_user_meta(get_current_user_id(), 'go_admin_messages',true);
if((int)$messages[0] > 0){
$style = 'background: -webkit-radial-gradient(5px -9px, circle, white 8%, red 26px);';
$messages = get_user_meta(get_current_user_id(), 'go_admin_messages', true);
if (!empty($messages)) {
$msg_count = intval($mesages[0]);
if (!empty($msg_count) && $msg_count < 0) {
$style = 'background: -webkit-radial-gradient(5px -9px, circle, white 8%, red 26px);';
} else {
$style = 'background: -webkit-radial-gradient(5px -9px, circle, white 8%, green 26px);';
$wp_admin_bar->add_menu( array(
'title' => 'You have no messages from admin',
'href' => '#',
'parent' => 'go_messages'
));
}
if (!is_admin_bar_showing() || !is_user_logged_in()) {
return;
}
$wp_admin_bar->add_menu( array(
'title' => '<div style="padding-top:5px;"><div id="go_messages_bar" style="'.$style.'">'.(int)$messages[0].'</div></div>',
'href' => '#',
'id' => 'go_messages',
));
if (!empty($messages[1])) {
foreach ($messages[1] as $date => $values) {
if (preg_match("/[<>]+/", $values[0])) {
$title_temp = preg_replace("/(<a\s?href=\".*\">)+/", '', $values[0]);
$title = preg_replace("/(<\/a>)+/", '', $title_temp);
} else {
$title = $values[0];
}
$style = '';
$is_seen = true;
if ((int)$values[1] == 1) {
$style = 'color: rgba(255, 215, 0, .4);';
$is_seen = false;
}
if ($is_seen == false) {
$seen_elem = date('m-d-Y',$date)." <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"unseen\"); go_change_seen({$date}, \"unseen\", this);' style='display: inline;' href='#'>Mark Seen</a> <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"remove\");' style='display:inline;' href='#'>Remove</a>";
} else {
$seen_elem = date('m-d-Y',$date)." <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"seen\"); go_change_seen({$date}, \"seen\", this);' style='display: inline;' href='#'>Mark Unseen</a> <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"remove\");' style='display:inline;' href='#'>Remove</a>";
}
$wp_admin_bar->add_menu( array(
'title' => '<div style="'.$style.'">'.$title.'...</div>',
$style = 'background: -webkit-radial-gradient(5px -9px, circle, white 8%, green 26px);';
$wp_admin_bar->add_menu( array(
'title' => 'You have no messages from admin',
'href' => '#',
'id' => $date,
'parent' => 'go_messages'
));
$wp_admin_bar->add_menu( array(
'title' => $seen_elem,
'parent' => $date,
'meta' => array('html' => '<div class="go_message_container" style="width:350px;">'.$values[0].'</div>'),
'id' => rand()
));
}
if (!is_admin_bar_showing() || !is_user_logged_in()) {
return;
}
$wp_admin_bar->add_menu( array(
'title' => '<div style="padding-top:5px;"><div id="go_messages_bar" style="'.$style.'">'.(int)$messages[0].'</div></div>',
'href' => '#',
'id' => 'go_messages',
));
if (!empty($messages[1])) {
foreach ($messages[1] as $date => $values) {
if (preg_match("/[<>]+/", $values[0])) {
$title_temp = preg_replace("/(<a\s?href=\".*\">)+/", '', $values[0]);
$title = preg_replace("/(<\/a>)+/", '', $title_temp);
} else {
$title = $values[0];
}
$style = '';
$is_seen = true;
if ((int)$values[1] == 1) {
$style = 'color: rgba(255, 215, 0, .4);';
$is_seen = false;
}
if ($is_seen == false) {
$seen_elem = date('m-d-Y',$date)." <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"unseen\"); go_change_seen({$date}, \"unseen\", this);' style='display: inline;' href='#'>Mark Seen</a> <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"remove\");' style='display:inline;' href='#'>Remove</a>";
} else {
$seen_elem = date('m-d-Y',$date)." <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"seen\"); go_change_seen({$date}, \"seen\", this);' style='display: inline;' href='#'>Mark Unseen</a> <a class='go_messages_anchor' onClick='go_mark_seen({$date}, \"remove\");' style='display:inline;' href='#'>Remove</a>";
}
$wp_admin_bar->add_menu( array(
'title' => '<div style="'.$style.'">'.$title.'...</div>',
'href' => '#',
'id' => $date,
'parent' => 'go_messages'
));
$wp_admin_bar->add_menu( array(
'title' => $seen_elem,
'parent' => $date,
'meta' => array('html' => '<div class="go_message_container" style="width:350px;">'.$values[0].'</div>'),
'id' => rand()
));
}
}
}
}

add_action('wp_ajax_go_mark_read','go_mark_read');
function go_mark_read(){
function go_mark_read () {
global $wpdb;
$messages = get_user_meta(get_current_user_id(), 'go_admin_messages',true);
if($_POST['type'] == 'unseen'){
Expand All @@ -82,7 +85,7 @@ function go_mark_read(){
die();
}

function go_message_user($user_id, $message){
function go_message_user ($user_id, $message) {
$current_messages = get_user_meta($user_id, 'go_admin_messages',true);
$current_messages[1][time()] = array($message, 1);
krsort($current_messages[1]);
Expand Down
5 changes: 3 additions & 2 deletions go_ranks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function go_update_ranks ($user_id, $total_points) {
$ranks = get_option('go_ranks');
$name_array = $ranks['name'];
$points_array = $ranks['points'];
$update = false;

if ($next_rank != '') {
if ($total_points >= $next_rank_points) {
Expand Down Expand Up @@ -80,7 +81,7 @@ function go_update_ranks ($user_id, $total_points) {
global $counter;
$counter++;
$space = $counter*85;
echo '
return '
<div id="go_notification_level" class="go_notification" style="top: '.($space - 17).'px; color: white; background: #ffcc00; text-align: center; width: 300px; line-height: 68px; height: 81.6px; font-size: 52px;"> '.$current_rank.'!</div>
<script type="text/javascript" language="javascript">
go_notification(3000, jQuery("#go_notification_level"));
Expand Down Expand Up @@ -118,11 +119,11 @@ function go_clean_ranks () {
echo '<option value="'.$points.'">'.$level.'</option>';
}
}

function go_get_rank_key ($points) {
global $wpdb;
$ranks = get_option('go_ranks',false);
$key = array_search($points, $ranks['points']);
return $key;
}

?>
156 changes: 74 additions & 82 deletions types/store/super-store.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,57 @@
//Adds Store Texonomy
add_action('init' , 'go_store_taxonomy' );
function go_store_taxonomy()
{
$labels = array(
'name' => _x( get_option('go_store_name').' Categories', 'taxonomy general name' ),
'singular_name' => _x( get_option('go_store_name').' Item Category', 'taxonomy singular name' ),
'search_items' => __( 'Search '.get_option('go_store_name').' Categories' ),
'all_items' => __( 'All '.get_option('go_store_name').' Categories' ),
'parent_item' => __( 'Parent '.get_option('go_store_name').' Categories' ),
'parent_item_colon' => __( 'Parent '.get_option('go_store_name').' Category:' ),
'edit_item' => __( 'Edit '.get_option('go_store_name').' Category' ),
'update_item' => __( 'Update '.get_option('go_store_name').' Category' ),
'add_new_item' => __( 'Add New '.get_option('go_store_name').' Category' ),
'new_item_name' => __( 'New '.get_option('go_store_name').' Category' ),
);
{
$labels = array(
'name' => _x( get_option('go_store_name').' Categories', 'taxonomy general name' ),
'singular_name' => _x( get_option('go_store_name').' Item Category', 'taxonomy singular name' ),
'search_items' => __( 'Search '.get_option('go_store_name').' Categories' ),
'all_items' => __( 'All '.get_option('go_store_name').' Categories' ),
'parent_item' => __( 'Parent '.get_option('go_store_name').' Categories' ),
'parent_item_colon' => __( 'Parent '.get_option('go_store_name').' Category:' ),
'edit_item' => __( 'Edit '.get_option('go_store_name').' Category' ),
'update_item' => __( 'Update '.get_option('go_store_name').' Category' ),
'add_new_item' => __( 'Add New '.get_option('go_store_name').' Category' ),
'new_item_name' => __( 'New '.get_option('go_store_name').' Category' ),
);

register_taxonomy('store_types',array('jobs'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'rewrite' => array('slug' => 'store-types', 'with_front' => false),
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'show_in_nav_menus' => true,
'rewrite' => array('slug' => 'store-types', 'with_front' => false),
));

$labels_focus = array(
'name' => _x( go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'singular_name' => _x(go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'search_items' => _x( 'Search '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'popular_items' => _x( 'Popular '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'all_items' => _x( 'All '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'parent_item' => _x(go_return_options('go_focus_name').' Category Parent', 'store_focus_categories' ),
'parent_item_colon' => _x( 'Parent '.go_return_options('go_focus_name').' Category:', 'store_focus_categories' ),
'edit_item' => _x( 'Edit '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'update_item' => _x( 'Update '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'add_new_item' => _x( 'Add New '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'new_item_name' => _x( 'New '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'separate_items_with_commas' => _x( 'Separate '.go_return_options('go_focus_name').' categories with commas', 'store_focus_categories' ),
'add_or_remove_items' => _x( 'Add or remove '.go_return_options('go_focus_name').' categories', 'store_focus_categories' ),
'choose_from_most_used' => _x( 'Choose from the most used '.go_return_options('go_focus_name').' categories', 'store_focus_categories' ),
'menu_name' => _x( go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
);
'name' => _x( go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'singular_name' => _x(go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'search_items' => _x( 'Search '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'popular_items' => _x( 'Popular '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'all_items' => _x( 'All '.go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
'parent_item' => _x(go_return_options('go_focus_name').' Category Parent', 'store_focus_categories' ),
'parent_item_colon' => _x( 'Parent '.go_return_options('go_focus_name').' Category:', 'store_focus_categories' ),
'edit_item' => _x( 'Edit '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'update_item' => _x( 'Update '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'add_new_item' => _x( 'Add New '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'new_item_name' => _x( 'New '.go_return_options('go_focus_name').' Category', 'store_focus_categories' ),
'separate_items_with_commas' => _x( 'Separate '.go_return_options('go_focus_name').' categories with commas', 'store_focus_categories' ),
'add_or_remove_items' => _x( 'Add or remove '.go_return_options('go_focus_name').' categories', 'store_focus_categories' ),
'choose_from_most_used' => _x( 'Choose from the most used '.go_return_options('go_focus_name').' categories', 'store_focus_categories' ),
'menu_name' => _x( go_return_options('go_focus_name').' Categories', 'store_focus_categories' ),
);
$args_focus = array(
'labels' => $labels_focus,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => true,
'show_admin_column' => false,
'hierarchical' => true,
'rewrite' => true,
'query_var' => true
);
'labels' => $labels_focus,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => true,
'show_admin_column' => false,
'hierarchical' => true,
'rewrite' => true,
'query_var' => true
);

register_taxonomy('store_focus_categories', array('go_store'), $args_focus);

Expand All @@ -79,20 +79,20 @@ function go_store_post_type() {
register_post_type( 'go_store',
array(
'labels' => array(
'name' => __(get_option('go_store_name')),
'menu_name' => __(get_option('go_store_name')),
'singular_name' => __(get_option('go_store_name').' Item'),
'add_new' => __('New '.get_option('go_store_name').' Item'),
'add_new_item' => __('New '.get_option('go_store_name').' Item'),
'edit' => __('Edit '.get_option('go_store_name').' Items'),
'edit_item' => __('Edit '.get_option('go_store_name').' Items'),
'new_item' => __('New '.get_option('go_store_name').' Item'),
'view' => __('View Items'),
'view_item' => __('View '.get_option('go_store_name').' Items'),
'search_items' => __('Search '.get_option('go_store_name').' Items'),
'not_found' => __('No '.get_option('go_store_name').' Items found'),
'not_found_in_trash' => __('No '.get_option('go_store_name').' Items found in Trash'),
'parent' => 'Parent Store Item'
'name' => __(get_option('go_store_name')),
'menu_name' => __(get_option('go_store_name')),
'singular_name' => __(get_option('go_store_name').' Item'),
'add_new' => __('New '.get_option('go_store_name').' Item'),
'add_new_item' => __('New '.get_option('go_store_name').' Item'),
'edit' => __('Edit '.get_option('go_store_name').' Items'),
'edit_item' => __('Edit '.get_option('go_store_name').' Items'),
'new_item' => __('New '.get_option('go_store_name').' Item'),
'view' => __('View Items'),
'view_item' => __('View '.get_option('go_store_name').' Items'),
'search_items' => __('Search '.get_option('go_store_name').' Items'),
'not_found' => __('No '.get_option('go_store_name').' Items found'),
'not_found_in_trash' => __('No '.get_option('go_store_name').' Items found in Trash'),
'parent' => 'Parent Store Item'
),
'taxonomies' => array('store_types'),
'public' => true,
Expand All @@ -106,30 +106,22 @@ function go_store_post_type() {
)
);
}
// Default Content
$go_store_new_page = $_GET["go_store"]; // Gets t/f from permalink
if($go_store_new_page == true) { // if was linked to from the go_store content type
function go_store_editor_content( $content ) { // run this function (that accepts $content paramater)
$go_store_id = $_GET["go_store_id"]; // define the go_store item's id as a variable
$content = '[go_store id="'.$go_store_id.'"]'; // paste the id in a shortcode
return $content; // return all of that
}
add_filter( 'default_content', 'go_store_editor_content' ); // filter the content area using wp's default_content filter

function go_store_editor_content ($content, $post) {
$post_type = $post->post_type;
$post_id = $post->ID;
if ($post_type === 'go_store') {
$content = '[go_store id="'.$post_id.'"]';
}
return $content;
}
add_filter('default_content', 'go_store_editor_content', 10, 2);

// Add New Post(of any content type) w/ Store Item Button
$item_id = $_GET["post"];
$go_post_type = get_post_type($item_id);
if ($go_post_type === 'go_store') {
function go_new_item_permalink( $arg, $post_id ){
global $is_resetable;
if( ereg('edit-slug', $arg) ){
$is_resetable = true;
$go_store_id = $_GET["post"];
$arg .= '<span id="edit-slug button button-small hide-if-no-js"><a href="javascript:void(0)" onclick = "document.getElementById(\'go_lightbox\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\'" class="button button-small" >Insert </a></span>';
function go_new_item_permalink ($return, $post_id, $new_title, $new_slug) {
if (strpos($return, 'edit-slug') !== false) {
$return .= '<span id="edit-slug button button-small hide-if-no-js"><a href="javascript:void(0)" onclick = "document.getElementById(\'go_lightbox\').style.display=\'block\';document.getElementById(\'fade\').style.display=\'block\'" class="button button-small" >Insert </a></span>';
return $return;
}
return $arg;
}
add_filter( 'get_sample_permalink_html', 'go_new_item_permalink',5,2 );
}
?>
add_filter('get_sample_permalink_html', 'go_new_item_permalink', 5, 4);
?>

0 comments on commit 89b2252

Please sign in to comment.