public static function bookmark($target_url) { global $prli_options, $prli_blogurl, $prli_link; $redirect_type = esc_html((isset($_GET['rt']) and $_GET['rt'] != '-1') ? $_GET['rt'] : ''); $track = esc_html((isset($_GET['trk']) and $_GET['trk'] != '-1') ? $_GET['trk'] : ''); $group = esc_html((isset($_GET['grp']) and $_GET['grp'] != '-1') ? $_GET['grp'] : ''); $result = prli_create_pretty_link(esc_url_raw($target_url, array('http', 'https')), '', '', '', $group, $track, '', $redirect_type); $plink = $prli_link->getOne($result); $target_url = $plink->url; $target_url_title = $plink->name; $pretty_link = $prli_blogurl . PrliUtils::get_permalink_pre_slug_uri() . $plink->slug; $twitter_status = substr($target_url_title, 0, 114 - strlen($pretty_link)) . (strlen($target_url_title) > 114 ? "..." : '') . " | {$pretty_link}"; require PRLI_VIEWS_PATH . '/prli-tools/bookmarklet.php'; }
if ($record_count <= 0) { ?> <tr> <td colspan="5"><?php _e('Watch this video to see how to get started!', 'pretty-link'); ?> -- <a href="http://blairwilliams.com/xba"><strong><?php _e('Get More Video Tutorials like this one', 'pretty-link'); ?> ...</strong></a><br/><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/i6C2Bljby3k&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/i6C2Bljby3k&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></td> </tr> <?php } else { global $prli_blogurl; foreach ($links as $link) { $struct = PrliUtils::get_permalink_pre_slug_uri(); $pretty_link_url = "{$prli_blogurl}{$struct}{$link->slug}"; ?> <tr class="link_row"> <td class="edit_link"> <input type="checkbox" name="link-action[<?php echo $link->id; ?> ]" class="link-action-checkbox" data-id="<?php echo $link->id; ?> " data-title="<?php echo stripslashes($link->name); ?> " />
public function get_target_to_pretty_urls($urls = array(), $create_pretty_links = false) { global $wpdb, $prli_blogurl; if (empty($urls)) { return false; } $decoded_urls = array_map(create_function('$url', 'return html_entity_decode(urldecode($url));'), $urls); if (count($decoded_urls) > 1) { $where = "IN (" . implode(',', array_map(create_function('$url', 'return "\\"{$url}\\"";'), $decoded_urls)) . ")"; } else { $where = "= '" . html_entity_decode(urldecode($decoded_urls[0])) . "'"; } $query = "SELECT li.url AS target_url, " . "CONCAT(%s, li.slug) AS pretty_url " . "FROM {$this->table_name} AS li " . "WHERE li.url {$where}"; $query = $wpdb->prepare($query, $prli_blogurl . PrliUtils::get_permalink_pre_slug_uri()); $results = (array) $wpdb->get_results($query); $prli_lookup = array(); foreach ($results as $url_hash) { if (isset($prli_lookup[$url_hash->target_url])) { $prli_lookup[$url_hash->target_url][] = $url_hash->pretty_url; } else { $prli_lookup[$url_hash->target_url] = array($url_hash->pretty_url); } } if ($create_pretty_links) { foreach ($decoded_urls as $url) { if (!isset($prli_lookup[$url])) { if ($id = prli_create_pretty_link($url)) { $prli_lookup[$url] = array(prli_get_pretty_link_url($id)); } } } } return $prli_lookup; }
/** * Gets the full pretty link url from an id * * @return bool (false if failure) | string the pretty link url */ function prli_get_pretty_link_url($id) { global $prli_link, $prli_blogurl; if ($pretty_link = $prli_link->getOne($id)) { return "{$prli_blogurl}" . PrliUtils::get_permalink_pre_slug_uri() . "{$pretty_link->slug}"; } return false; }
public static function get_plp_permalink($link) { global $prli_blogurl; $struct = PrliUtils::get_permalink_pre_slug_uri(); if (isset($link->slug)) { return "{$prli_blogurl}{$struct}{$link->slug}"; } else { return false; } }