juust ~ php oddities

Unordered list of one element
  • rss
  • begin
  • about
    • vcard
    • WTF is BroJesus
  • php scripts
    • flickr wp widget
    • google multi key serp tool, php script
    • gwt plugin
  • php classes
    • php pagerank class
    • fibonacci class
    • robots.txt parser php class
  • serp
    • serp dashboard wordpress plugin
  • services

pressmark – the social bookmarking fork of wordpress

juust | 25/09/2008

Pressmark :
a 5 minute install social bookmarking website : go check it out on the authors site, or my new subdomain pressmark install).

Why Pressmark ? Because its a social bookmarking fork on Wordpress.

I tried Pligg and I just sat there thinking “this is horrible, I want my Wordpress backend!”. And after scouting around what do I find : Pressmark, a wordpress fork. With Pressmark I get the Wordpress backend and all my favorite plugins and all these thingies I love about Wordpress as CMS, just now for a social bookmarking site.

The strong point is the use of OpenId, where a URL pointing to either a blog or website is your ‘identity’ on the net. If sites use an OpenID plugin your entire profile is readily available (name, email, etc.) on every blog or form you care to place your comments.

OpenID lowers user frustration by letting users have control of their login.

For geeks, OpenId is an open, decentralized, free framework for user-centric digital identity. OpenID takes advantage of already existing internet technology (URI, HTTP, SSL, Diffie-Hellman) and realizes that people are already creating identities for themselves whether it be at their blog, photostream, profile page, etc. With OpenID you can easily transform one of these existing URIs into an account which can be used at sites which support OpenID logins.

OpenID is still in the adoption phase and is becoming more and more popular, as large organizations like AOL, Microsoft, Sun, Novell, etc. begin to accept and provide OpenIDs. Today it is estimated that there are over 160-million OpenID enabled URIs with nearly ten-thousand sites supporting OpenID logins.

In Pressmark, by using a ’submit’ bookmarklet to drag on your browser bar, you can enter any site bookmark into your author’s page with 2 clicks.

Fast, sweet.

Sadly in the current pressmark download there is one function missing which causes a code break in the index.php (I hope the author fixes it in the download), causing it to show only an entry form for bookmarks as front-page and leaves you to figure out what the hell the package is about. If you downloaded it and get the “prologue_get_avatar() is missing” error on your front page, add this function in the themes ‘function.php’ file :

  1. function prologue_get_avatar( $wpcom_user_id, $email, $size, $rating = '', $default = 'http://s.wordpress.com/i/mu.gif' ) {
  2.  if( !empty( $wpcom_user_id ) && $wpcom_user_id !== false && function_exists( 'get_avatar' ) ) {
  3.   return get_avatar( $wpcom_user_id, $size );
  4.  }
  5.  elseif( !empty( $email ) && $email !== false ) {
  6.   $default = urlencode( $default );
  7.  
  8.   $out = 'http://www.gravatar.com/avatar.php?gravatar_id=';
  9.   $out .= md5( $email );
  10.   $out .= "&size={$size}";
  11.   $out .= "&default={$default}";
  12.  
  13.   if( !empty( $rating ) ) {
  14.    $out .= "&rating={$rating}";
  15.   }
  16.  
  17.   return "<img alt='' src='{$out}' class='avatar avatar-{$size}' height='{$size}' width='{$size}' />";
  18.  }
  19.  else {
  20.   return "<img alt='' src='{$default}' />";
  21.  }
  22. }

…or sooner grab it from automattic svn, bottom of the file.
(cutting and pasting code from blogs can cause problems with quotes and html markup in php code fragments).

After that it renders a proper index page.

Ofcourse the main advantage : wordpress is a seo killer, nothing performs in google as wordpress does, so a social bookmarking site with a wordpress frame is gonna be a strong competitor for the smaller site segment. It won’t outperform Technorati, but normal people don’t usually want to start Technorati-II, a small well performing easy to maintain bookmarking site will do for most of us :)

Comments
4 Comments »
Categories
links, seo, wordpress
Tags
links, php, wordpress
Comments rss Comments rss
Trackback Trackback

phpLD mod : context sensitive RSS

juust | 21/08/2008

(in case you’re wondering : this is about a small rss plugin for a php link directory site I am setting up, see example : links.trismegistos.net/blogs/).

I tried some free RSS mod but that dont work, I get the same yahoo rss feed on every page. I want context sensitive rss.

Why ? to improve my keyword/content ratio per page and get more pages indexed. I hear 2-5% (1 in 50/20 words) is the ideal ratio if you want to be considered a highly relevant result page on the keyword-content ratio. A list with website links in the category ‘music – classic’ has a very high ratio keyword/content and google won’t index the page. Adding a pot-luck grab of google blogsearch results might level that a little.

So I am gonna add some relevant fresh rss feeds from google blogsearch.

Same trick as the pagerank plug-in, the last part of the url contains the subcategory, I can use these as keywords for google blogsearch :

  1. $PT = $_SERVER["REQUEST_URI"];
  2. $ttl = explode('/', $PT);
  3. $mykeys = $ttl[count($ttl)-2];
  4. $mykey=trim(preg_replace('/_/', ' ', $mykeys));
  5. $xmlSource="http://blogsearch.google.com/blogsearch_feeds?hl=en&c2coff=1&lr=&safe=active&as_drrb=q&as_qdr=d&q=".urlencode($mykey)."&ie=utf-8&num=5&output=rss";
  • I take the URI
  • explode it on the / slashes
  • take the last text
  • replace ‘_’ with spaces
  • and urlencode the keywords for google blog-search.

A generic rss parser handles the xml file, i delimit it to 5 results to keep traffic down. I add some class markers in the script to be able to add extra markup in a .css file, and I save the result to $thisfeed.

  1.  foreach($result as $arr){
  2.  $strResult .= '<div class="rssdiv">';
  3.  $strResult .= '<div class="rss_title"><h3>'.$arr["title"].'</h3></div>';
  4.  $strResult .= '<div class="rss_description">'.$arr["description"].'</div><br />';
  5.  
  6.  $strResult .= '<div class="rss_link"><a href="'.$arr["link"].'" rel="nofollow" title="'.$arr["title"].'">more: "'.$arr["title"].'"</a></div>';
  7.  $strResult .= '</div>';
  8. }
  9.  
  10. $tpl->assign('thisfeed', $strResult);

I call the store feed in the footer with {$thisfeed}
and include the sourcefile in index.php with
require_once ‘readrss.php’;
just below require_once ‘init.php’;

See example : links.trismegistos.net/blogs/

Now I am going to add a single google adsense slot, not too loud, just enough to get Google to come crawl the pages to assert the context. Then I need to resubmit the sitemap. And that’ll be all for today.

(readrss.php text source)
for the record, consider it GPL’ed (it ain’t exactly rocket science)

Comments
No Comments »
Categories
links, optimization, php
Tags
links, php, seo
Comments rss Comments rss
Trackback Trackback

php link directory mod : page rank per page

juust | 20/08/2008

Lets add a seo stats plug in to phpLinkDirectory, page rank per page, same method as the Socialize bookmark plug-in.

The actual code to retrieve the pagerank is in pr.php, so I only need a tiny bit of code for prank.php :

  1. include('pr.php');
  2. $URL = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
  3. $prank = pagerank($URL);
  4. $tpl->assign('prank', $prank);

I zipped the files :

download

  • put pr.php and prank.php in the link directory root
  • add require_once ‘prank.php’; to index.php (below “require_once ‘init.php’;”)
  • add {$prank} somewhere in footer.tpl

Enjoy.

If you are commercially smart, you want to make sure a rank shows only if the page actually has a rank. In pr.php, change the function curl_getpr() :

  1.  if(!$data) {
  2.    curl_close($cr);
  3.    unset($cr);
  4.  
  5. //   $pr="not ranking";
  6.                         $pr = "";
  7.  
  8.    return $pr;
  9.  } else {
  10.   $pos = strpos($data, "Rank_");
  11.   if($pos === false){} else{
  12.    $pr=substr($data, $pos + 9);
  13.    $pr=trim($pr);
  14.    $pr=str_replace("\n",'',$pr);
  15.    curl_close($cr);
  16.    unset($cr);
  17.  
  18. //   return $pr;
  19.                         return "This page has a Google pagerank of ".$pr;
  20.  
  21.   }
  22.          }
  23. }

Then, only if you have a rank you get an actual remark in the footer.

In case of trouble :
pr.php uses the cUrl library, if cUrl does not work on your server,
www.highrankforum.com/ has a version without cUrl.

If you are on an IIS server and get in trouble, on IIS the $_SERVER['REQUEST_URI'] serverside
variable is empty.

Try using $_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO'] in stead of $_SERVER['REQUEST_URI'] in prank.php :
$URL = “http://” . $_SERVER["HTTP_HOST"] . $_SERVER['SCRIPT_NAME'].$_SERVER['PATH_INFO'];

Comments
2 Comments »
Categories
links, pagerank, php
Tags
links, pagerank, php
Comments rss Comments rss
Trackback Trackback

« Previous Entries Next Entries »

Recent Posts

  • geert wilders
  • gone till september
  • socialize me
  • Pagerank sculpting session
  • wish you were here

click me!
rss
Comments rss
Blog Directory
Web Developement Blogs - BlogCatalog Blog Directory
Listed in LS Blogs the Blog Directory and Blog Search Engine
Blog Flux Directory
joopita.com free web directory and search engine
design by jide
sitemap
22258 confirmed spam kills