コード例 #1
0
ファイル: linkbox.php プロジェクト: quinntron/greendot
 function linkbox_filter($content, $id = false)
 {
     //If no ID is provided, get the ID of the current post
     if (!$id) {
         $id = suwp::get_post_id();
     }
     if ($id) {
         //Don't add a linkbox if a "more" link is present (since a linkbox should go at the very bottom of a post)
         $morelink = '<a href="' . get_permalink($id) . '#more-' . $id . '" class="more-link">';
         if (strpos($content, $morelink) !== false) {
             return $content;
         }
         //Load the HTML and replace the variables with the proper values
         $linkbox = $this->get_setting('html');
         $linkbox = str_replace(array('{id}', '{url}', '{title}'), array(intval($id), su_esc_attr(get_permalink($id)), su_esc_attr(get_the_title($id))), $linkbox);
         //Return the content with the linkbox added to the bottom
         return $content . $linkbox;
     }
     return $content;
 }
コード例 #2
0
 function get_postmeta_jlsuggest_boxes($jls_boxes)
 {
     $this->jlsuggest_box_post_id = suwp::get_post_id();
     return parent::get_postmeta_jlsuggest_boxes($jls_boxes);
 }
コード例 #3
0
 function postmeta_fields($fields)
 {
     $id = suwp::get_post_id();
     if ($id) {
         $type = get_post_type($id);
     } elseif (!empty($_GET['post_type'])) {
         $type = $_GET['post_type'];
     } else {
         $type = 'post';
     }
     $fields['links'][10]['autolinks'] = $this->get_postmeta_textarea('autolinks', __('Inbound Autolink Anchors:<br /><em>(one per line)</em>', 'seo-ultimate'));
     if ($this->get_setting("autolink_posttype_{$type}")) {
         $fields['links'][15]['disable_autolinks'] = $this->get_postmeta_checkbox('disable_autolinks', __('Don&#8217;t add autolinks to anchor texts found in this post.', 'seo-ultimate'), __('Autolink Exclusion:', 'seo-ultimate'));
     }
     return $fields;
 }
コード例 #4
0
 function apply_aliases_callback($matches)
 {
     $id = suwp::get_post_id();
     static $aliases = false;
     //Just in case we have duplicate aliases, make sure the most recent ones are applied first
     if ($aliases === false) {
         $aliases = array_reverse($this->get_setting('aliases', array()), true);
     }
     static $alias_dir = false;
     if ($alias_dir === false) {
         $alias_dir = $this->get_setting('alias_dir', 'go');
     }
     $new_url = $old_url = $matches[3];
     foreach ($aliases as $alias) {
         $to = urlencode($alias['to']);
         if ((empty($alias['posts']) || in_array($id, $alias['posts'])) && $to) {
             $from = $alias['from'];
             $h_from = esc_html($from);
             $to = get_bloginfo('url') . "/{$alias_dir}/{$to}/";
             if ($from == $old_url || $h_from == $old_url) {
                 $new_url = $to;
                 break;
             }
         }
     }
     $attrs = "{$matches[1]}href={$matches[2]}{$new_url}{$matches[4]}{$matches[5]}";
     if ($old_url != $new_url && $this->get_setting('nofollow_aliased_links', false) && $this->plugin->module_exists('link-nofollow')) {
         $this->plugin->call_module_func('link-nofollow', 'nofollow_attributes_string', $attrs, $attrs);
     }
     return "<a {$attrs}>";
 }