/home/vianto5/hidalgoresidences.mx/wp-content/themes/Bridge100/bridge/includes
NameSizeModeActions
comment/-0755rm
font_awesome/-0755rm
import/-0755rm
nav_menu/-0755rm
pagination/-0755rm
plugins/-0755rm
qode_carousel/-0755rm
shortcodes/-0755rm
sidebar/-0755rm
ajax_mail.php16150644editdlrm
custom-fields-post-formats.php96300644editdlrm
qode-blog-helper-functions.php75660644editdlrm
qode-breadcrumbs.php62140644editdlrm
qode-custom-post-types.php97000644editdlrm
qode-custom-taxonomy-field.php195330644editdlrm
qode-gradient-helper-functions.php15250644editdlrm
qode-like.php48070644editdlrm
qode-loading-spinners.php49140644editdlrm
qode-related-posts.php33350644editdlrm
recaptchalib.php97660644editdlrm
Edit: /home/vianto5/hidalgoresidences.mx/wp-content/themes/Bridge100/bridge/includes/qode-like.php (4807B)
admin_url('admin-ajax.php') )); } /** * Method that hooks to WP ajax functionality. Calss */ public function ajax() { $type = isset($_POST['type']) ? $_POST['type'] : ''; //update if(isset($_POST['likes_id'])) { $post_id = str_replace('qode-like-', '', $_POST['likes_id']); echo $this->likePost($post_id, 'update', $type); } //get else { $post_id = str_replace('qode-like-', '', $_POST['likes_id']); echo $this->likePost($post_id, 'get', $type); } exit; } /** * Returns inner HTML of like button / icon. Also updates like value if action param is update * @param $post_id ID of post for which to get likes * @param string $action could be update or get. If it's update increases number of likes, if it's get it only generats inner HTML * @param string $type type of output to generate. Could be icon or default (button) * @return int|mixed|string|void */ public function likePost($post_id, $action = 'get', $type = '') { if(!is_numeric($post_id)) { return; } switch($action) { case 'get': $like_count = get_post_meta($post_id, '_qode-like', true); if(!$like_count) { $like_count = 0; add_post_meta($post_id, '_qode-like', $like_count, true); } if($type == 'icon') { return; } $return_value = $like_count; if($like_count != 1) { $return_value .= " " . __(' Likes', 'qode') . ""; } else { $return_value .= " " . __(' Like', 'qode') . ""; } return $return_value; break; case 'update': $like_count = get_post_meta($post_id, '_qode-like', true); if(isset($_COOKIE['qode-like_' . $post_id])) { return $like_count; } $like_count++; update_post_meta($post_id, '_qode-like', $like_count); setcookie('qode-like_' . $post_id, $post_id, time() * 20, '/'); if($type == 'icon') { return; } $return_value = $like_count; if($like_count != 1) { $return_value .= " " . __(' Likes', 'qode') . ""; } else { $return_value .= " " . __(' Like', 'qode') . ""; } return $return_value; break; } } /** * Generates HTML for like button / icon * @param string $type type of output to generate. It's passed to QodeLike::likePost method * @return string generated HTML * * @see QodeLike::likePost() */ public function generateLikeHTML($type = '') { global $post; $output = $this->likePost($post->ID, 'get', $type); $class = 'qode-like'; $title = __('Like this', 'qode'); if(isset($_COOKIE['qode-like_' . $post->ID])) { $class = 'qode-like liked'; $title = __('You already like this!', 'qode'); } return '' . $output . ''; } } global $qode_like; $qode_like = new QodeLike(); /** * */ function qode_like() { global $qode_like; echo $qode_like->generateLikeHTML(); } /** * @return string */ function qode_like_latest_posts() { global $qode_like; return $qode_like->generateLikeHTML(); } /** * @return string */ function qode_like_portfolio_list($type = '') { global $qode_like; return $qode_like->generateLikeHTML($type); }