Archive for the ‘PHP’ Category

A little tweak on Code Filter by Owen Winkler

I don’t want to change the CSS for CODE tag, so I add a little style property to that code in the cf_callback function & have a smaller font:

function cf_callback($stuff)
{
//return ”
<pre>[[code{$stuff[1]}]]”.htmlspecialchars(clean_pre($stuff[2]), ENT_NOQUOTES).”[[/code]]</pre>
“;
$pre_style=”display: block;font-family: monospace;font-size: 9px;white-space: pre;unicode-bidi: embed;page-break-inside: avoid;pitch: medium; pitch-range: 0; stress: 0; richness: 80;”;
return ”
<pre>[[code{$stuff[1]} style=’$pre_style’]]”.htmlspecialchars(clean_pre($stuff[2]), ENT_NOQUOTES).”[[/code]]</pre>
“;
}

Notes:
Change the “[[” and “]]” to “” […]

Posted February 25th, 2006 by mightyhitter under PHP, Wordpress | No Comments »

 

Adding login/logout menu to be-nice sidebar menu

Download your be-nice/sidebar.php
Then search this code in that file:

<h2>RSS Feeds</h2>
<ul>
<li><a xhref=”<?php bloginfo(’rss2_url’); ?>”>Posts</a></li>
<li><a xhref=”<?php bloginfo(’comments_rss2_url’); ?>”>Comments</a></li>
</ul>

Add few more lines to it:

<h2>RSS Feeds</h2>
<ul>
<li><a xhref=”<?php bloginfo(’rss2_url’); ?>”>Posts</a></li>
<li><a xhref=”<?php bloginfo(’comments_rss2_url’); ?>”>Comments</a></li>
</ul>
<h2>System</h2>
<ul>
<li><?php wp_loginout(); ?></li>
<li><?php wp_register(); ?></li>
</ul>

Posted February 25th, 2006 by mightyhitter under PHP, Wordpress | No Comments »

 

MightyAdsense - wordpress adsense plugin

I did search through the plugins at http://wp-plugins.net on any Google Adsense plugin and found 2 of them. I think of their plugins too much advance for me, so I created my own.
Simple and plain wordpress adsense plugin where it will display Google Adsense ads in the index & single file. I created the […]

Posted February 25th, 2006 by mightyhitter under Google Adsense, PHP | 1 Comment »

 

Wordpress Single Page Plugin Lesson

Hoping to gain more knowledge on single page plugin now. I don’t know much about wordpress, but interested to learn more. Any links to single page plugin is appreciated.
Just bookmarking what I found:
http://www.ugelow.c…rt-single-page-view/
http://www.randyp…ress/index.php?p=648
http://weblogtool…xtual-related-posts/

Posted February 25th, 2006 by mightyhitter under PHP, Wordpress | No Comments »

 

Cool be-nice template by Gigadesign

Thanks to Gigadesign ( http://www.gigadesign.be/be-nice/ ) for this cool template. On my first attempt, I downloaded it from http://themes.wordpress.net/ but being unsure about whats wrong since the sidebar portion seemed to be positioned at the bottom.
Following the link to Gigadesign, I downloaded it again, with clearly the same result. Then I noticed about the […]

Posted February 25th, 2006 by mightyhitter under PHP, Wordpress | No Comments »

 

Checking MightyLinker plugin

I’m writing my first plugin to convert any URLs in post to clickable link automatically. It also shorten it to few characters in order not to mess up the page design. Suppose all links below get shorten and clickable.
http://forums.seo…e-revenue-59963.html and this is a link in the middle of text http://forums.seoch…e-revenue-59963.html and this is a […]

Posted February 25th, 2006 by mightyhitter under PHP, Wordpress | No Comments »

 

Technorati RSS

There is a website which is offering technorati RSS (technorati does not have it all in RSS):
http://berserk.org/technoratiRSS/
The source is available in python.
Another good reference is from simplepie, which looks better than magpie rss:
http://www.simplepie.org/

Posted February 23rd, 2006 by mightyhitter under PHP | No Comments »

 

Setting up a cron job with Cpanel

Cron job make can our life easier. If you have a daily task to do, create a cron job with your cpanel.
1. Login to your cpanel.
2. Click on cron job.
3. Pick standard.
4. Enter the minutes, hour, or days your job to be executed. Fairly easy there.
5. Enter this line (example): php -q /home/path-to-cron-file/sample.php
This example […]

Posted February 17th, 2006 by mightyhitter under PHP | 1 Comment »

 

PHP script to display short URL

Long URL sometimes will break your page design.
I have been using this function quite a while on my forum site, so there is no more problem with long URL pasted by users:
function shortu($url,$chr_limit = 30,$add = ‘…’) {
$patterns=array(”!(>http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*https:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*ftp:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*=$chr_limit*2 ? substr(’\\1′,0,$chr_limit).’$add’.substr(’\\1′,0-$chr_limit,-1).’

Posted February 17th, 2006 by mightyhitter under PHP | No Comments »