Plugin Directory

Changeset 158918


Ignore:
Timestamp:
09/29/2009 11:23:14 AM (16 years ago)
Author:
littlejon
Message:

Commiting updates for release of Version 1.3 of LJ Longtail SEO

Location:
lj-longtail-seo/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lj-longtail-seo/trunk/lj-longtail-seo.php

    r158509 r158918  
    55Description: LJ Longtail SEO is a tool that detects search engine visits and uses this information to display a list of links based on second page search results
    66Author: Jon Smith
    7 Version: 1.2
     7Version: 1.3
    88Author URI: http://www.thelazysysadmin.net/
    99*/
     
    1212
    1313  private $dbversion = "1.75";
    14   private $pluginversion = "1.2";
     14  private $pluginversion = "1.3";
    1515
    1616  private $defaults = array
     
    2020      'widget-numitems' => '5',
    2121      'daysbeforearchive' => '28',
    22       'showdonate' => false
     22      'showdonate' => false,
     23      'showkeywordreport' => false
    2324    );
    2425
     
    2829    add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
    2930
    30     add_filter("wp_head", array(&$this, "checkreferrer"));
     31    add_filter('wp_head', array(&$this, 'checkreferrer'));
     32    add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2 );
    3133
    3234    register_activation_hook(__FILE__, array(&$this, 'db_install'));
     
    6567        if ($query != false) {
    6668          $query = urldecode($query);
    67           $query = preg_replace('/[^a-zA-Z0-9-\/. ]/', '', $query);
    68           $query = ereg_replace("[ \t\n\r]+", " ", $query);
     69          $query = $this->stripunwantedcharacters($query);
    6970          $query = strtolower($query);
    7071          $serpposition = $this->get_serpposition($arraylist);
     
    7475      }
    7576    }
     77  }
     78 
     79  function stripunwantedcharacters($string) {
     80    $return = str_replace("'", '', $string);
     81    $return = str_replace('"', '', $return);
     82    $return = str_replace('+', '', $return);
     83    $return = ereg_replace("[ \t\n\r]+", " ", $return);
     84    $return = htmlspecialchars($return);
     85   
     86    return $return;
    7687  }
    7788 
     
    255266
    256267        $links_archivedays = isset($_REQUEST['linksarchivedays']) ? $_REQUEST['linksarchivedays'] : 28;
     268        $links_keywordreport = isset($_REQUEST['linkskeywordreport']) ? $_REQUEST['linkskeywordreport'] : 0;
    257269        $links_donate = isset($_REQUEST['linksdonate']) ? $_REQUEST['linksdonate'] : 0;
    258270
    259271        $options['daysbeforearchive'] = sprintf("%d", $links_archivedays);
     272        $options['showkeywordreport'] = ($links_keywordreport == 1) ? true : false;
    260273        $options['showdonate'] = ($links_donate == 1) ? true : false;
    261274       
     
    368381</table>
    369382
     383<?php
     384  if ($options['showkeywordreport']) {
     385?>
     386<h3>Keyword Report</h3>
     387<div class="clear"></div>
     388<style type="text/css">
     389<!--
     390.ljlongtailseo-box {
     391  padding: 0px 0px 0px 25px;
     392}
     393.ljlongtailseo-section {
     394  float: left;
     395}
     396.ljlongtailseo-section ul {
     397  list-style-type: disc;
     398  padding: 0px 15px 0px 0px;
     399}
     400.ljlongtailseo-section li {
     401  margin-bottom: 0px;
     402}
     403.ljlongtailseo-section-next {
     404  padding-left: 10px;
     405}
     406.ljlongtailseo-clear {
     407  clear: both;
     408}
     409-->
     410</style>
     411<?php
     412 
     413    $array = $this->getkeywordarray();
     414   
     415    echo "<div class='ljlongtailseo-box'>\n";
     416
     417    $count = count($array);
     418   
     419    if ($count > 100) {
     420      $count = 100;
     421    }
     422   
     423    $mod = ceil($count / 4);
     424
     425    $i = 0;
     426    foreach ($array as $item) {
     427      if (($i % $mod) == 0) {
     428        echo "  <div class='ljlongtailseo-section";
     429        if ($i > 0) {
     430          echo " ljlongtailseo-section-next";
     431        }
     432        echo "'>\n";
     433        echo "    <ul>\n";
     434      }
     435
     436      echo "      <li>".$item['term']." (".$item['count'].")</li>\n";
     437
     438      if ((($i+1) % $mod) == 0) {
     439        echo "    </ul>\n";
     440        echo "  </div>\n";
     441      }
     442
     443      $i++;
     444     
     445      if ($i >= $count) break;
     446    }
     447
     448    if ((($i) % $mod) != 0) {
     449      echo "    </ul>\n";
     450      echo "  </div>\n";
     451    }
     452
     453    echo "</div>\n";
     454   
     455    echo "<div class='ljlongtailseo-clear'></div>\n";
     456 
     457  }
     458?>
    370459<h3>Maintenance</h3>
    371460<div class="clear"></div>
     
    389478
    390479    <td><input name="linksarchivedays" id="linksarchivedays" type="text" value="<?php echo $options['daysbeforearchive']; ?>" size="40" aria-required="true" /><br />
    391           <span class="description">Number of days before database records get marked as archived. Records marked as archive are not used for the widget display.</span></td>
     480          <span class="description">Number of days before database records get marked as archived. Records marked as archived are not used for the widget display.</span></td>
     481  </tr>
     482  <tr valign="top">
     483  <th scope="row">Show Keyword Report</th>
     484  <td><fieldset><legend class="screen-reader-text"><span>Show Keyword Report</span></legend>
     485  <label for="linkskeywordreport">
     486  <input name="linkskeywordreport" type="checkbox" id="linkskeywordreport" value="1" <?php if ($options['showkeywordreport']) echo "checked='checked'"; ?> />
     487  To display a keyword report in the admin screen check this option.</label><br />
     488  </fieldset></td>
    392489  </tr>
    393490  <tr valign="top">
     
    426523
    427524  }
     525
     526  function getkeywordarray() {
     527    global $wpdb;
     528
     529    $table_name = $wpdb->prefix."ljlongtailseo";
     530
     531    $sql = "SELECT query FROM $table_name WHERE archive = 0;";
     532    $results = $wpdb->get_results($sql, ARRAY_A);
     533   
     534    $array = array();
     535   
     536    foreach ($results as $result) {
     537      $terms = explode(' ', $result['query']);
     538      foreach ($terms as $term) {
     539        if (isset($array[$term])) {
     540          $array[$term]["count"]++;
     541        } else {
     542          $array[$term]["count"] = 1;
     543          $array[$term]["term"] = $term;
     544        }
     545      }
     546    }
     547   
     548    //arsort($array);
     549    uasort($array, array(&$this, 'sort_terms'));
     550
     551    return $array;   
     552  }
     553 
     554  function sort_terms($a, $b) {
     555    return ($b['count'] - $a['count']);
     556  }
    428557 
    429558  function db_install() {
     
    471600  }
    472601
     602  function plugin_action_links( $links, $file ) {
     603    static $this_plugin;
     604   
     605    if( empty($this_plugin) )
     606      $this_plugin = plugin_basename(__FILE__);
     607
     608    if ( $file == $this_plugin )
     609      $links[] = '<a href="' . admin_url( 'options-general.php?page=lj-longtail-seo/lj-longtail-seo.php' ) . '">Settings</a>';
     610
     611    return $links;
     612  }
    473613}
    474614
  • lj-longtail-seo/trunk/readme.txt

    r158509 r158918  
    11=== Plugin Name ===
    22Contributors: littlejon
    3 Tags: serp, position, longtail, long tail, results, google, bing, yahoo, SEO, widget, sidebar
     3Tags: serp, position, longtail, long tail, results, google, bing, yahoo, SEO, widget, sidebar, keywords, keyword
    44Requires at least: 2.5
    55Tested up to: 2.8.4
    66Donate link: http://www.thelazysysadmin.net/software/appreciation/
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88
    99LJ Longtail SEO is a tool that detects search engine visits and uses this information to display a list of links based on second page search results
     
    1414
    1515The results in the database are aged off based on customizable settings so that once your longtail keywords have been boosted they will fall off the list and give way for other searches.
     16
     17Admin interface has an optional keyword report that can be turned on via an option (On a large blog it is possible that there could be a performance hit on the admin page when using this option. Please note this will not slow down the blog side, just the admin page.). The keyword report will show the Top 100 keywords ordered by popularity and also showing the number of times the keyword has occurred.
    1618
    1719A widget will display a list of the popular searches that have come from search engine result pages beyond the first and provide a link on your sidebar back to the pages found.
     
    4850== Changelog ==
    4951
     52= 1.3 =
     53
     54* Added support for international characters
     55* Added keyword report section in admin interface
     56
    5057= 1.2 =
    5158
Note: See TracChangeset for help on using the changeset viewer.