Cambios para optimizar el uso de memoria

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@185 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-10-10 17:28:49 +00:00
parent bd39132874
commit 1f505a5383
6 changed files with 435 additions and 467 deletions

View File

@ -18,7 +18,7 @@ function bp_dedication_get_dedications_from_user( $user_id ) {
$args = array( $args = array(
'post_status' => array('publish', 'private'), 'post_status' => array('publish', 'private'),
'numberposts' => -1, 'numberposts' => 10,
'category' => get_cat_id('dedication'), 'category' => get_cat_id('dedication'),
'author' => $user_id 'author' => $user_id
); );
@ -33,7 +33,7 @@ function bp_dedication_get_dedications_to_user( $user_id ) {
$args = array( $args = array(
'post_status' => array('publish', 'private'), 'post_status' => array('publish', 'private'),
'numberposts' => -1, 'numberposts' => 10,
'category' => 'dedication', 'category' => 'dedication',
'meta_key' => 'ghostpool_destination_user_id', 'meta_key' => 'ghostpool_destination_user_id',
'meta_value' => $user_id 'meta_value' => $user_id

View File

@ -1,57 +1,58 @@
<?php <?php
global $bp, $post, $gp_settings; global $bp, $post, $gp_settings;
require(ghostpool_inc . 'options.php'); require(ghostpool_inc . 'options.php');
$from_dedications = bp_dedication_get_dedications_to_user($bp->displayed_user->id); $from_dedications = bp_dedication_get_dedications_to_user($bp->displayed_user->id);
$count = 0; $count = 0;
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/dedicated-2u/page/2/'; $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/dedicated-2u/page/2/';
?> ?>
<h4><?php _e('Dedicated 2 me'); ?></h4> <h4><?php _e('Dedicated 2 me'); ?></h4>
<?php foreach ($from_dedications as $post) : <?php foreach ($from_dedications as $post) :
$count++; $count++;
if ($count > 10) {?> if ($count > 10) {?>
<a href="<?php echo $dedication_link; ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a> <a href="<?php echo $dedication_link; ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a>
<img class='read-more-loader' src='<?php echo get_template_directory_uri(); ?>/lib/images/loader.gif' style='display:none;'/> <img class='read-more-loader' src='<?php echo get_template_directory_uri(); ?>/lib/images/loader.gif' style='display:none;'/>
<?php break; } ?> <?php break; } ?>
<?php setup_postdata($post); ?> <?php setup_postdata($post); ?>
<?php <?php
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width; $gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height; $gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
?> ?>
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?> <?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
<div class="post-<?php the_ID(); ?> home-dedicated-2-me post-loop"<?php // post_class('post-loop'); ?>> <div class="post-<?php the_ID(); ?> home-dedicated-2-me post-loop"<?php // post_class('post-loop'); ?>>
<!--Begin Image--> <!--Begin Image-->
<?php if (has_post_thumbnail()) { ?> <?php if (has_post_thumbnail()) { ?>
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>"> <div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php if (($theme_show_new_label) && ($gp_settings['unreaded'])) { ?><span class="new-label"></span><?php } ?> <?php if (($theme_show_new_label) && ($gp_settings['unreaded'])) { ?><span class="new-label"></span><?php } ?>
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?> <?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { <img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else { } else {
echo get_the_title(); echo get_the_title();
} ?>" /> } ?>" />
</a> </a>
</div> </div>
<?php } ?> <?php } ?>
<!--End Image--> <!--End Image-->
<!--Begin Post Text--> <!--Begin Post Text-->
<div class="post-text"> <div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2> <h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['from_flag']; ?> <?php echo $gp_settings['from_flag']; ?>
<span>FROM: <?php echo $gp_settings['from_user_link']; ?></span> <span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>
</div> </div>
<!--End Post Text--> <!--End Post Text-->
<br/> <br/>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php wp_reset_postdata(); ?> <?php $from_dedications = NULL; ?>
<?php wp_reset_postdata(); ?>

View File

@ -1,56 +1,57 @@
<?php <?php
global $bp, $post, $gp_settings; global $bp, $post, $gp_settings;
require(ghostpool_inc . 'options.php'); require(ghostpool_inc . 'options.php');
$from_dedications = bp_dedication_get_dedications_from_user($bp->displayed_user->id); $from_dedications = bp_dedication_get_dedications_from_user($bp->displayed_user->id);
$count = 0; $count = 0;
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/my-dedications/page/2/'; $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/my-dedications/page/2/';
?> ?>
<h4><?php _e('My dedications'); ?></h4> <h4><?php _e('My dedications'); ?></h4>
<?php foreach ($from_dedications as $post) : <?php foreach ($from_dedications as $post) :
$count++; $count++;
if ($count > 10) {?> if ($count > 10) {?>
<a href="<?php echo $dedication_link; ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a> <a href="<?php echo $dedication_link; ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a>
<img class='read-more-loader' src='<?php echo get_template_directory_uri(); ?>/lib/images/loader.gif' style='display:none;'/> <img class='read-more-loader' src='<?php echo get_template_directory_uri(); ?>/lib/images/loader.gif' style='display:none;'/>
<?php break; } ?> <?php break; } ?>
<?php setup_postdata($post); ?> <?php setup_postdata($post); ?>
<?php <?php
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width; $gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height; $gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
?> ?>
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?> <?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
<div class="post-<?php the_ID(); ?> home-my-dedications post-loop" <?php //post_class('post-loop'); ?>> <div class="post-<?php the_ID(); ?> home-my-dedications post-loop" <?php //post_class('post-loop'); ?>>
<!--Begin Image--> <!--Begin Image-->
<?php if (has_post_thumbnail()) { ?> <?php if (has_post_thumbnail()) { ?>
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>"> <div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?> <?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { <img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else { } else {
echo get_the_title(); echo get_the_title();
} ?>" /> } ?>" />
</a> </a>
</div> </div>
<?php } ?> <?php } ?>
<!--End Image--> <!--End Image-->
<!--Begin Post Text--> <!--Begin Post Text-->
<div class="post-text"> <div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2> <h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['to_flag']; ?> <?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span> <span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div> </div>
<!--End Post Text--> <!--End Post Text-->
<br/> <br/>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php wp_reset_postdata(); ?> <?php $from_dedications = NULL; ?>
<?php wp_reset_postdata(); ?>

View File

@ -1,123 +1,85 @@
<?php <?php
get_header(); get_header();
global $gp_settings, $post, $current_user; global $gp_settings, $post, $current_user;
get_currentuserinfo(); get_currentuserinfo();
?> ?>
<?php <?php
$orderby = 'rand';
//$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&posts_per_page=-1"; $args = array(
/* "cat" => $gp_settings['cats'],
$args = array( "ignore_sticky_posts" => 1,
"cat" => $gp_settings['cats'], "orderby" => $orderby,
"ignore_sticky_posts" => 1, "order" => $order,
"orderby" => $orderby, "paged" => $paged,
"order" => $order, "posts_per_page" => $gp_settings['posts_per_page'],
"paged" => $paged, //"post__not_in" => $ids_descartados
"posts_per_page" => -1 );
);
query_posts($args);
query_posts($args); ?>
$urls_video = array();
$ids_descartados = array(); <div id="content"<?php if($gp_settings['dropdown_filter'] == "0") { ?> class="shift-down"<?php } ?>>
if (have_posts()) : <div id="precontent-wrapper">
while (have_posts()) : <div id="dedicationComments_container" class="columns two first text-left">&nbsp;</div>
the_post(); <div id="sidebar-home" class="columns two last text-left">
include('loop-dedication-data.php'); <?php dynamic_sidebar('homepage-1'); ?>
</div>
// Usuario actual puede ver la dedicatoria? <div class="clear"></div>
if ($post->post_status == 'private') { </div>
if (($current_user->ID != $gp_settings['from_user_id']) && ($current_user->ID != $gp_settings['to_user_id'])) { <div class="clear"></div>
$ids_descartados[] = $post->ID;
}
} <div class="contentInner">
<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-dedication-data.php'); ?>
if ($theme_homepage_not_repeat_videos) { <div <?php post_class('post-loop'); ?>>
// Si la URL del video ya ha salido en una dedicatoria anterior, me la salto <!--Begin Image-->
if (in_array($gp_settings['video'], $urls_video)) { <?php if(has_post_thumbnail()) { ?>
$ids_descartados[] = $post->ID; <div class="post-thumbnail<?php if($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
}
} <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
$urls_video[] = $gp_settings['video']; <img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); } else { echo get_the_title(); } ?>" />
endwhile; </a>
endif;*/ </div>
$orderby = 'rand'; <?php } ?>
$args = array( <!--End Image-->
"cat" => $gp_settings['cats'],
"ignore_sticky_posts" => 1, <!--Begin Post Text-->
"orderby" => $orderby, <div class="post-text">
"order" => $order, <h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
"paged" => $paged, <?php echo $gp_settings['from_flag']; ?><span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>&nbsp;
"posts_per_page" => $gp_settings['posts_per_page'], <?php echo $gp_settings['to_flag']; ?>
//"post__not_in" => $ids_descartados <span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
); </div>
<!--End Post Text-->
query_posts($args);
?> </div>
<?php endwhile; ?>
<div id="content"<?php if($gp_settings['dropdown_filter'] == "0") { ?> class="shift-down"<?php } ?>>
<?php
<div id="precontent-wrapper"> if($gp_settings['pagination'] == "0") {
<div id="dedicationComments_container" class="columns two first text-left">&nbsp;</div> gp_ajax_pagination();
<div id="sidebar-home" class="columns two last text-left"> } else { ?>
<?php dynamic_sidebar('homepage-1'); ?> <div class="more-posts">
</div> <?php
<div class="clear"></div> $category_id = get_cat_ID( DEDICATION_CATEGORY_SLUG );
</div> $category_link = get_category_link( $category_id );
<div class="clear"></div> ?>
<a href="<?php echo esc_url( $category_link ); ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a>
</div>
<div class="contentInner"> <?php } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-dedication-data.php'); ?>
<div <?php post_class('post-loop'); ?>> <?php if($gp_settings['dropdown_filter'] == "0") { require_once('dropdown-filter.php'); } ?>
<!--Begin Image--> <?php else : ?>
<?php if(has_post_thumbnail()) { ?> <h4><?php _e('Try searching for a different term.', 'gp_lang'); ?></h4>
<div class="post-thumbnail<?php if($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>"> <?php endif; ?>
<?php wp_reset_query(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> </div>
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?> </div>
<img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['url']; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); } else { echo get_the_title(); } ?>" />
</a> <?php get_sidebar(); ?>
</div>
<?php } ?>
<!--End Image-->
<!--Begin Post Text-->
<div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['from_flag']; ?><span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>&nbsp;
<?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>
<!--End Post Text-->
</div>
<?php endwhile; ?>
<?php
if($gp_settings['pagination'] == "0") {
gp_ajax_pagination();
} else { ?>
<div class="more-posts">
<?php
$category_id = get_cat_ID( DEDICATION_CATEGORY_SLUG );
$category_link = get_category_link( $category_id );
?>
<a href="<?php echo esc_url( $category_link ); ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a>
</div>
<?php } ?>
<?php if($gp_settings['dropdown_filter'] == "0") { require_once('dropdown-filter.php'); } ?>
<?php else : ?>
<h4><?php _e('Try searching for a different term.', 'gp_lang'); ?></h4>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@ -1,128 +1,131 @@
<?php <?php
require_once( ABSPATH . "wp-config.php" ); require_once( ABSPATH . "wp-config.php" );
function gp_enqueue_ajax_scripts() { function gp_enqueue_ajax_scripts() {
if (!is_admin()) { if (!is_admin()) {
// embed the javascript file that makes the AJAX request // embed the javascript file that makes the AJAX request
wp_enqueue_script( 'gp_ajax_video_data_request', get_template_directory_uri() . '/lib/scripts/custom-ajax.min.js', array( 'jquery' ) ); wp_enqueue_script( 'gp_ajax_video_data_request', get_template_directory_uri() . '/lib/scripts/custom-ajax.min.js', array( 'jquery' ) );
//wp_enqueue_script( 'gp_ajax_video_data_request', get_template_directory_uri() . '/lib/scripts/custom-ajax.js', array( 'jquery' ) ); //wp_enqueue_script( 'gp_ajax_video_data_request', get_template_directory_uri() . '/lib/scripts/custom-ajax.js', array( 'jquery' ) );
// declare the URL to the file that handles the AJAX request (wp-admin/admin-ajax.php) // declare the URL to the file that handles the AJAX request (wp-admin/admin-ajax.php)
wp_localize_script( 'gp_ajax_video_data_request', 'MyAjax', array( wp_localize_script( 'gp_ajax_video_data_request', 'MyAjax', array(
//'ajaxurl' => admin_url( 'admin-ajax.php' ), //'ajaxurl' => admin_url( 'admin-ajax.php' ),
'postCommentNonce' => wp_create_nonce( 'myajax-post-comment-nonce' ) 'postCommentNonce' => wp_create_nonce( 'myajax-post-comment-nonce' )
)); ));
} }
} }
add_action('wp_print_scripts', 'gp_enqueue_ajax_scripts'); add_action('wp_print_scripts', 'gp_enqueue_ajax_scripts');
function gp_ajax_video_data() { function gp_ajax_video_data() {
global $gp_settings, $post, $current_user, $bp; global $gp_settings, $post, $current_user, $bp;
get_currentuserinfo(); get_currentuserinfo();
$nonce = $_POST['postCommentNonce']; $nonce = $_POST['postCommentNonce'];
if ( ! wp_verify_nonce( $nonce, 'myajax-post-comment-nonce' ) ) if ( ! wp_verify_nonce( $nonce, 'myajax-post-comment-nonce' ) )
die ( 'Busted!'); die ( 'Busted!');
// get the submitted parameters // get the submitted parameters
if (isset($_POST['id'])) if (isset($_POST['id']))
$postID = $_POST['id']; $postID = $_POST['id'];
header('Cache-Control: no-cache, must-revalidate'); header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json'); header('Content-type: application/json');
$displayed_id = bp_displayed_user_id(); $displayed_id = bp_displayed_user_id();
$dedication_orderby = "rand"; //date"; $dedication_orderby = "rand"; //date";
$category_name = 'dedication'; $category_name = 'dedication';
$post_status = array('publish', 'private'); $post_status = array('publish', 'private');
if ($postID > 0) { if ($postID > 0) {
$args = array( $args = array(
'p' => $postID 'p' => $postID
); );
} else { } else {
$args = array( $args = array(
'post_type' => array('post'), 'post_type' => array('post'),
'orderby' => $dedication_orderby, 'orderby' => $dedication_orderby,
'posts_per_page' => -1, 'posts_per_page' => 10,
'post_status' => $post_status, 'post_status' => $post_status,
'category_name' => $category_name, 'category_name' => $category_name,
); );
} }
$array = array(); $array = array();
$i = 0; $i = 0;
$listavideos = new WP_Query($args); $listavideos = new WP_Query($args);
while ($listavideos->have_posts()) {
$listavideos->the_post(); while ($listavideos->have_posts()) {
require(dirname(__FILE__).'/../../loop-dedication-data.php'); $listavideos->the_post();
require(dirname(__FILE__).'/../../loop-dedication-data.php');
// Perfil del usuario: sólo mostrar las dedicadas por él y para él. El resto se descartan.
if ( $bp->current_component == BP_DEDICATION_SLUG ) { // Perfil del usuario: sólo mostrar las dedicadas por él y para él. El resto se descartan.
if (($displayed_id != $gp_settings['from_user_id']) && ($displayed_id != $gp_settings['to_user_id'])) { if ( $bp->current_component == BP_DEDICATION_SLUG ) {
continue; // me salto esta dedicatoria if (($displayed_id != $gp_settings['from_user_id']) && ($displayed_id != $gp_settings['to_user_id'])) {
} continue; // me salto esta dedicatoria
} }
}
// Página de inicio / página del video: Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') { // Página de inicio / página del video: Usuario actual puede ver la dedicatoria?
if (($current_user->ID != $gp_settings['from_user_id']) && ($current_user->ID != $gp_settings['to_user_id'])) { if ($post->post_status == 'private') {
continue; // me salto esta dedicatoria if (($current_user->ID != $gp_settings['from_user_id']) && ($current_user->ID != $gp_settings['to_user_id'])) {
} continue; // me salto esta dedicatoria
} }
}
$array[$i] = array();
$array[$i]['id'] = $post->ID; $array[$i] = array();
$array[$i]['title'] = $post->post_title; $array[$i]['id'] = $post->ID;
$array[$i]['video'] = $gp_settings['video']; $array[$i]['title'] = $post->post_title;
$array[$i]['video_id'] = $gp_settings['video_id']; $array[$i]['video'] = $gp_settings['video'];
$array[$i]['video_path'] = $gp_settings['video_path']; $array[$i]['video_id'] = $gp_settings['video_id'];
$array[$i]['video_type'] = $gp_settings['video_type']; $array[$i]['video_path'] = $gp_settings['video_path'];
$array[$i]['permalink'] = $post->guid; $array[$i]['video_type'] = $gp_settings['video_type'];
$array[$i]['extlink'] = $gp_settings['enc_link']; $array[$i]['permalink'] = $post->guid;
$array[$i]['artist'] = $gp_settings['artist_short']; $array[$i]['extlink'] = $gp_settings['enc_link'];
$array[$i]['song'] = $gp_settings['song_short']; $array[$i]['artist'] = $gp_settings['artist_short'];
$array[$i]['unreaded'] = $gp_settings['unreaded']; $array[$i]['song'] = $gp_settings['song_short'];
$array[$i]['unreaded'] = $gp_settings['unreaded'];
$array[$i]['from_to_text'] = $gp_settings['from_flag'];
$array[$i]['from_to_text'] .= '<span>FROM: ' . $gp_settings['from_user_link'] . '</span>&nbsp;'; $array[$i]['from_to_text'] = $gp_settings['from_flag'];
$array[$i]['from_to_text'] .= $gp_settings['to_flag']; $array[$i]['from_to_text'] .= '<span>FROM: ' . $gp_settings['from_user_link'] . '</span>&nbsp;';
$array[$i]['from_to_text'] .= '<span>TO: ' . $gp_settings['to_user_link'] . '</span>'; $array[$i]['from_to_text'] .= $gp_settings['to_flag'];
$array[$i]['from_to_text'] .= '<span>TO: ' . $gp_settings['to_user_link'] . '</span>';
$i++;
$i++;
break;
} break;
wp_reset_postdata(); }
wp_reset_postdata();
$salida = ''; $listavideos = NULL;
foreach($array as $video) {
$salida .= '<li id="playlist-element-' . $video['id'] . '" data-path="' . $video['video_path'] . '" data-type="' . $video['video_type']. '">'; $salida = '';
$salida .= '<span id="postdata-id-' . $video['id'] . '">' . $video['id'] . '</span>'; foreach($array as $video) {
$salida .= '<span id="postdata-title-' . $video['id'] . '"><a href="' . $video['permalink']. '" title="' . $video['title']. '">' . $video['title']. '</a></span>'; $salida .= '<li id="playlist-element-' . $video['id'] . '" data-path="' . $video['video_path'] . '" data-type="' . $video['video_type']. '">';
$salida .= '<span id="postdata-artist-' . $video['id'] . '">' . $video['artist']. '</span>'; $salida .= '<span id="postdata-id-' . $video['id'] . '">' . $video['id'] . '</span>';
$salida .= '<span id="postdata-song-' . $video['id'] . '">' . $video['song']. '</span>'; $salida .= '<span id="postdata-title-' . $video['id'] . '"><a href="' . $video['permalink']. '" title="' . $video['title']. '">' . $video['title']. '</a></span>';
$salida .= '<span id="postdata-link-' . $video['id'] . '">' . $video['permalink']. '</span>'; $salida .= '<span id="postdata-artist-' . $video['id'] . '">' . $video['artist']. '</span>';
$salida .= '<span id="postdata-extlink-' . $video['id'] . '">' . $video['extlink']. '</span>'; $salida .= '<span id="postdata-song-' . $video['id'] . '">' . $video['song']. '</span>';
$salida .= '<span id="postdata-comments-' . $video['id'] . '"></span>'; $salida .= '<span id="postdata-link-' . $video['id'] . '">' . $video['permalink']. '</span>';
$salida .= '<span id="postdata-extlink-' . $video['id'] . '">' . $video['extlink']. '</span>';
if ($video['unreaded']) { $salida .= '<span id="postdata-comments-' . $video['id'] . '"></span>';
$salida .= '<span id="postdata-mark-read-' . $video['id'] . '">';
$salida .= mar_read_unread_links('', '', false); if ($video['unreaded']) {
$salida .= '</span>'; $salida .= '<span id="postdata-mark-read-' . $video['id'] . '">';
} $salida .= mar_read_unread_links('', '', false);
$salida .= '<span id="postdata-from-to-' . $video['id'] . '">'; $salida .= '</span>';
$salida .= $video['from_to_text']; }
$salida .= '</span>'; $salida .= '<span id="postdata-from-to-' . $video['id'] . '">';
$salida .= $video['from_to_text'];
$salida .= '</li>'; $salida .= '</span>';
}
$salida .= '</li>';
echo json_encode($salida); }
$array = NULL;
die();
} echo json_encode($salida);
add_action('wp_ajax_gp_video_data', 'gp_ajax_video_data');
//add_action('wp_ajax_nopriv_gp_video_data', 'gp_ajax_video_data'); die();
}
?> add_action('wp_ajax_gp_video_data', 'gp_ajax_video_data');
//add_action('wp_ajax_nopriv_gp_video_data', 'gp_ajax_video_data');
?>

View File

@ -1,102 +1,103 @@
<?php <?php
global $gp_settings, $post; global $gp_settings, $post;
// Post Type // Post Type
$gp_settings['post_type'] = get_post_meta($post->ID, 'ghostpool_post_type', true); $gp_settings['post_type'] = get_post_meta($post->ID, 'ghostpool_post_type', true);
// Image Dimensions // Image Dimensions
if(get_post_meta($post->ID, 'ghostpool_thumbnail_width', true) && get_post_meta($post->ID, 'ghostpool_thumbnail_width', true)) { if(get_post_meta($post->ID, 'ghostpool_thumbnail_width', true) && get_post_meta($post->ID, 'ghostpool_thumbnail_width', true)) {
$gp_settings['image_width'] = get_post_meta($post->ID, 'ghostpool_thumbnail_width', true); $gp_settings['image_width'] = get_post_meta($post->ID, 'ghostpool_thumbnail_width', true);
} else { } else {
$gp_settings['image_width'] = $gp_settings['thumbnail_width']; $gp_settings['image_width'] = $gp_settings['thumbnail_width'];
} }
if(get_post_meta($post->ID, 'ghostpool_thumbnail_height', true) && get_post_meta($post->ID, 'ghostpool_thumbnail_height', true)) { if(get_post_meta($post->ID, 'ghostpool_thumbnail_height', true) && get_post_meta($post->ID, 'ghostpool_thumbnail_height', true)) {
$gp_settings['image_height'] = get_post_meta($post->ID, 'ghostpool_thumbnail_height', true); $gp_settings['image_height'] = get_post_meta($post->ID, 'ghostpool_thumbnail_height', true);
} else { } else {
$gp_settings['image_height'] = $gp_settings['thumbnail_height']; $gp_settings['image_height'] = $gp_settings['thumbnail_height'];
} }
$gp_settings['enc_link'] = add_query_arg('refid', bp_dedication_encode(get_permalink()), get_option('siteurl') . '/index.php'); $gp_settings['enc_link'] = add_query_arg('refid', bp_dedication_encode(get_permalink()), get_option('siteurl') . '/index.php');
// Song data // Song data
$gp_settings['video'] = get_post_meta($post->ID, 'ghostpool_dedication_url', true); $gp_settings['video'] = get_post_meta($post->ID, 'ghostpool_dedication_url', true);
if (isYoutubeVideo($gp_settings['video'])) { if (isYoutubeVideo($gp_settings['video'])) {
$gp_settings['video_type'] = 'youtube_single'; $gp_settings['video_type'] = 'youtube_single';
if (strpos($gp_settings['video'], "youtube.com")) { if (strpos($gp_settings['video'], "youtube.com")) {
$video = parse_str(parse_url($gp_settings['video'], PHP_URL_QUERY), $my_array_of_vars); $video = parse_str(parse_url($gp_settings['video'], PHP_URL_QUERY), $my_array_of_vars);
$gp_settings['video_id'] = $my_array_of_vars['v']; $gp_settings['video_id'] = $my_array_of_vars['v'];
$gp_settings['video_path'] = 'http://gdata.youtube.com/feeds/api/videos/' . $gp_settings['video_id'] . '?v=2&amp;alt=jsonc'; $gp_settings['video_path'] = 'http://gdata.youtube.com/feeds/api/videos/' . $gp_settings['video_id'] . '?v=2&amp;alt=jsonc';
} }
if (strpos($gp_settings['video'], "youtu.be")) { if (strpos($gp_settings['video'], "youtu.be")) {
$gp_settings['video_id'] = substr(parse_url($gp_settings['video'], PHP_URL_PATH), 1); $gp_settings['video_id'] = substr(parse_url($gp_settings['video'], PHP_URL_PATH), 1);
$gp_settings['video_path'] = 'http://gdata.youtube.com/feeds/api/videos/' . $gp_settings['video_id'] . '?v=2&amp;alt=jsonc'; $gp_settings['video_path'] = 'http://gdata.youtube.com/feeds/api/videos/' . $gp_settings['video_id'] . '?v=2&amp;alt=jsonc';
} }
} }
if (isVimeoVideo($gp_settings['video'])) { if (isVimeoVideo($gp_settings['video'])) {
$gp_settings['video_type'] = 'vimeo_single'; $gp_settings['video_type'] = 'vimeo_single';
$gp_settings['video_id'] = substr(parse_url($gp_settings['video'], PHP_URL_PATH), 1); $gp_settings['video_id'] = substr(parse_url($gp_settings['video'], PHP_URL_PATH), 1);
$gp_settings['video_path'] = 'http://vimeo.com/api/v2/video/' . $gp_settings['video_id'] . '.json'; $gp_settings['video_path'] = 'http://vimeo.com/api/v2/video/' . $gp_settings['video_id'] . '.json';
} }
$gp_settings['artist'] = get_post_meta($post->ID, 'ghostpool_dedication_artist', true); $gp_settings['artist'] = get_post_meta($post->ID, 'ghostpool_dedication_artist', true);
$gp_settings['artist_short'] = cutstr($gp_settings['artist'], 47, '...'); $gp_settings['artist_short'] = cutstr($gp_settings['artist'], 47, '...');
$gp_settings['song'] = get_post_meta($post->ID, 'ghostpool_dedication_song', true); $gp_settings['song'] = get_post_meta($post->ID, 'ghostpool_dedication_song', true);
$gp_settings['song_short'] = cutstr($gp_settings['song'], 47, '...'); $gp_settings['song_short'] = cutstr($gp_settings['song'], 47, '...');
$gp_settings['artist_song'] = $gp_settings['artist'] . '. ' . $gp_settings['song']; $gp_settings['artist_song'] = $gp_settings['artist'] . '. ' . $gp_settings['song'];
$gp_settings['artist_song_span'] = '<span>' . $gp_settings['artist'] . '</span>. ' . $gp_settings['song']; $gp_settings['artist_song_span'] = '<span>' . $gp_settings['artist'] . '</span>. ' . $gp_settings['song'];
$gp_settings['artist_song_span_short'] = cutstr($gp_settings['artist_song_span'], 38, ''); $gp_settings['artist_song_span_short'] = cutstr($gp_settings['artist_song_span'], 38, '');
if ($gp_settings['artist_song_span_short'] != $gp_settings['artist_song_span']) { if ($gp_settings['artist_song_span_short'] != $gp_settings['artist_song_span']) {
$gp_settings['artist_song_span_short'] .= '...'; $gp_settings['artist_song_span_short'] .= '...';
} }
// from user // from user
$gp_settings['from_user_id'] = get_the_author_meta('ID'); $gp_settings['from_user_id'] = get_the_author_meta('ID');
$gp_settings['from_user_link'] = '<a href="'.bp_core_get_userlink($gp_settings['from_user_id'], false, true).'" title="'.bp_core_get_username($gp_settings['from_user_id']).'">'.bp_core_get_username($gp_settings['from_user_id']).'</a>'; $gp_settings['from_user_link'] = '<a href="'.bp_core_get_userlink($gp_settings['from_user_id'], false, true).'" title="'.bp_core_get_username($gp_settings['from_user_id']).'">'.bp_core_get_username($gp_settings['from_user_id']).'</a>';
//bp_core_get_userlink($gp_settings['from_user_id']); //bp_core_get_userlink($gp_settings['from_user_id']);
$gp_settings['from_flag'] = gp_get_the_flag($gp_settings['from_user_id']); $gp_settings['from_flag'] = gp_get_the_flag($gp_settings['from_user_id']);
if ($gp_settings['from_user_id'] == mar_get_user_id()) : if ($gp_settings['from_user_id'] == mar_get_user_id()) :
$mark_as_read = mar_add_to_usermeta($post->ID); $mark_as_read = mar_add_to_usermeta($post->ID);
$update_count = mar_increase_count($post->ID); $update_count = mar_increase_count($post->ID);
endif; endif;
$read_posts = gp_get_unread_dedications( mar_get_user_id() ); $read_posts = gp_get_unread_dedications( mar_get_user_id() );
$gp_settings['unreaded'] = (in_array($post->ID, $read_posts)); $gp_settings['unreaded'] = (in_array($post->ID, $read_posts));
$read_posts = NULL;
// to user
$gp_settings['to_user_id'] = get_post_meta($post->ID, 'ghostpool_destination_user_id', true); // to user
$gp_settings['to_user_email'] = get_post_meta($post->ID, 'ghostpool_destination_user_email', true); $gp_settings['to_user_id'] = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
$gp_settings['to_user_name'] = get_post_meta($post->ID, 'ghostpool_destination_user_name', true); $gp_settings['to_user_email'] = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
$gp_settings['to_user_country'] = get_post_meta($post->ID, 'ghostpool_destination_user_country', true); $gp_settings['to_user_name'] = get_post_meta($post->ID, 'ghostpool_destination_user_name', true);
$gp_settings['to_user'] = get_userdata($gp_settings['to_user_id']); $gp_settings['to_user_country'] = get_post_meta($post->ID, 'ghostpool_destination_user_country', true);
$gp_settings['to_user'] = get_userdata($gp_settings['to_user_id']);
if ($gp_settings['to_user']) {
$gp_settings['to_flag'] = gp_get_the_flag($gp_settings['to_user']->ID, 32); if ($gp_settings['to_user']) {
$gp_settings['to_user_name'] = bp_core_get_username($gp_settings['to_user']->ID); $gp_settings['to_flag'] = gp_get_the_flag($gp_settings['to_user']->ID, 32);
$gp_settings['to_user_link'] = '<a href="'.bp_core_get_userlink($gp_settings['to_user']->ID, false, true).'" title="'.$gp_settings['to_user_name'].'">'.$gp_settings['to_user_name'].'</a>'; $gp_settings['to_user_name'] = bp_core_get_username($gp_settings['to_user']->ID);
//bp_core_get_userlink($gp_settings['to_user']->ID); $gp_settings['to_user_link'] = '<a href="'.bp_core_get_userlink($gp_settings['to_user']->ID, false, true).'" title="'.$gp_settings['to_user_name'].'">'.$gp_settings['to_user_name'].'</a>';
} else { //bp_core_get_userlink($gp_settings['to_user']->ID);
$gp_settings['to_flag'] = gp_get_flag_img_country($gp_settings['to_user_country'], 32); } else {
$gp_settings['to_user_link'] = $gp_settings['to_user_name']; $gp_settings['to_flag'] = gp_get_flag_img_country($gp_settings['to_user_country'], 32);
} $gp_settings['to_user_link'] = $gp_settings['to_user_name'];
}
// Post Text Width
if(!has_post_thumbnail() OR $gp_settings['image_wrap'] == "Disable") { // Post Text Width
$gp_settings['post_text_width'] = $gp_settings['content_width']; if(!has_post_thumbnail() OR $gp_settings['image_wrap'] == "Disable") {
} else { $gp_settings['post_text_width'] = $gp_settings['content_width'];
$gp_settings['post_text_width'] = $gp_settings['content_width'] - $gp_settings['image_width'] - 17; } else {
} $gp_settings['post_text_width'] = $gp_settings['content_width'] - $gp_settings['image_width'] - 17;
}
// Post Left Width
if($gp_settings['post_type'] == "Review" && $gp_settings['review_date_column'] == "0" && (($gp_settings['score_type'] == "Site Score" && $gp_settings['gp_gdsr']->review > 0) OR ($gp_settings['score_type'] == "User Score" && $gp_settings['user_voting'] != "Users cannot vote") OR ($gp_settings['score_type'] == "Site & User Score" && ($gp_settings['gp_gdsr']->review > 0 OR $gp_settings['user_voting'] != "Users cannot vote")))) { // Post Left Width
$gp_settings['post_left_width'] = $gp_settings['post_text_width'] - 190; if($gp_settings['post_type'] == "Review" && $gp_settings['review_date_column'] == "0" && (($gp_settings['score_type'] == "Site Score" && $gp_settings['gp_gdsr']->review > 0) OR ($gp_settings['score_type'] == "User Score" && $gp_settings['user_voting'] != "Users cannot vote") OR ($gp_settings['score_type'] == "Site & User Score" && ($gp_settings['gp_gdsr']->review > 0 OR $gp_settings['user_voting'] != "Users cannot vote")))) {
} elseif($gp_settings['post_type'] == "Review" && $gp_settings['review_date_column'] == "1" && (($gp_settings['score_type'] == "Site Score" && $gp_settings['gp_gdsr']->review > 0) OR ($gp_settings['score_type'] == "User Score" && $gp_settings['user_voting'] != "Users cannot vote") OR ($gp_settings['score_type'] == "Site & User Score" && ($gp_settings['gp_gdsr']->review > 0 OR $gp_settings['user_voting'] != "Users cannot vote")))) { $gp_settings['post_left_width'] = $gp_settings['post_text_width'] - 190;
$gp_settings['post_left_width'] = $gp_settings['post_text_width'] - 95; } elseif($gp_settings['post_type'] == "Review" && $gp_settings['review_date_column'] == "1" && (($gp_settings['score_type'] == "Site Score" && $gp_settings['gp_gdsr']->review > 0) OR ($gp_settings['score_type'] == "User Score" && $gp_settings['user_voting'] != "Users cannot vote") OR ($gp_settings['score_type'] == "Site & User Score" && ($gp_settings['gp_gdsr']->review > 0 OR $gp_settings['user_voting'] != "Users cannot vote")))) {
} else { $gp_settings['post_left_width'] = $gp_settings['post_text_width'] - 95;
$gp_settings['post_left_width'] = $gp_settings['post_text_width']; } else {
} $gp_settings['post_left_width'] = $gp_settings['post_text_width'];
}
?>
?>