/** * get image - v 3.0 23 ian 2015 * @param $thumbType * @return string */ function get_image($thumbType) { $buffy = ''; //the output buffer $tds_hide_featured_image_placeholder = td_util::get_option('tds_hide_featured_image_placeholder'); // do we have a post thumb or a placeholder? if (!is_null($this->post_thumb_id) or $tds_hide_featured_image_placeholder != 'hide_placeholder') { if (!is_null($this->post_thumb_id)) { //if we have a thumb // check to see if the thumb size is enabled in the panel, we don't have to check for the default wordpress // thumbs (the default ones are already cut and we don't have a panel setting for them) if (td_util::get_option('tds_thumb_' . $thumbType) != 'yes' and $thumbType != 'thumbnail') { //the thumb is disabled, show a placeholder thumb from the theme with the "thumb disabled" message global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/thumb-disabled/' . $thumbType . '.png'; $attachment_alt = 'alt=""'; $attachment_title = ''; } else { // the thumb is enabled from the panel, it's time to show the real thumb $td_temp_image_url = wp_get_attachment_image_src($this->post_thumb_id, $thumbType); $attachment_alt = get_post_meta($this->post_thumb_id, '_wp_attachment_image_alt', true); $attachment_alt = 'alt="' . esc_attr(strip_tags($attachment_alt)) . '"'; $attachment_title = ' title="' . esc_attr(strip_tags($this->title)) . '"'; if (empty($td_temp_image_url[0])) { $td_temp_image_url[0] = ''; } if (empty($td_temp_image_url[1])) { $td_temp_image_url[1] = ''; } if (empty($td_temp_image_url[2])) { $td_temp_image_url[2] = ''; } } // end panel thumb enabled check } else { //we have no thumb but the placeholder one is activated global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/no-thumb/' . $thumbType . '.png'; $attachment_alt = 'alt=""'; $attachment_title = ''; } //end if ($this->post_has_thumb) { $buffy .= '<div class="td-module-thumb">'; // if (current_user_can('edit_posts')) { // $buffy .= '<a class="td-admin-edit" href="' . get_edit_post_link($this->post->ID) . '">edit</a>'; // } // ZA Custom if (is_user_logged_in()) { if (wpfp_check_favorited($this->post->ID) === true) { $bookmark_link = '<a class="wpfp-link wpfp-style" href="?wpfpaction=remove&postid=' . $this->post->ID . '" title="Remove" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/12/icon-bookmark-orange.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""></a>'; } else { $bookmark_link = '<a class="wpfp-link wpfp-style" href="?wpfpaction=add&postid=' . $this->post->ID . '" title="Bookmark" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark-added.png" alt=""></a>'; } } else { $bookmark_link = '<a class="wpfp-style register-dialog" href="http://rabbitworld.ready.co.th/?page_id=187" title="Bookmark" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark-added.png" alt=""></a>'; } $buffy .= $bookmark_link . '<a href="' . $this->href . '" rel="bookmark" title="' . $this->title_attribute . '">'; $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb" src="' . $td_temp_image_url[0] . '" ' . $attachment_alt . $attachment_title . '/>'; // on videos add the play icon if (get_post_format($this->post->ID) == 'video') { $use_small_post_format_icon_size = false; // search in all the thumbs for the one that we are currently using here and see if it has post_format_icon_size = small foreach (td_api_thumb::get_all() as $thumb_from_thumb_list) { if ($thumb_from_thumb_list['name'] == $thumbType and $thumb_from_thumb_list['post_format_icon_size'] == 'small') { $use_small_post_format_icon_size = true; break; } } // load the small or medium play icon if ($use_small_post_format_icon_size === true) { $buffy .= '<span class="td-video-play-ico td-video-small"><img width="20" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/video-small.png' . '" alt="video"/></span>'; } else { $buffy .= '<span class="td-video-play-ico"><img width="40" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/ico-video-large.png' . '" alt="video"/></span>'; } } // end on video if $buffy .= '</a>'; $buffy .= '</div>'; //end wrapper return $buffy; } }
function wpfp_do_remove_favorite($post_id) { if (!wpfp_check_favorited($post_id)) { return true; } $a = true; if (is_user_logged_in()) { $user_favorites = wpfp_get_user_meta(); $user_favorites = array_diff($user_favorites, array($post_id)); $user_favorites = array_values($user_favorites); $a = wpfp_update_user_meta($user_favorites); } if ($a) { $a = wpfp_set_cookie($_REQUEST['postid'], ""); } return $a; }
function wpfp_link($return = 0, $action = "", $show_span = 1, $args = array()) { global $post; //print_r($post); $post_id =& $post->ID; extract($args); $str = ""; if ($show_span) { $str = "<span class='wpfp-span'>"; } $str .= wpfp_before_link_img(); $str .= wpfp_loading_img(); if ($action == "remove") { $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); } elseif ($action == "add") { $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); } elseif (wpfp_check_favorited($post_id)) { $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove"); } else { $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add"); } if ($show_span) { $str .= "</span>"; } if ($return) { return $str; } else { echo $str; } }