Posts Tagged ‘WordPress plugin’

Advanced Scriplaculous Sortable Demo Fix

Monday, April 20th, 2009

Heh.

There is a good example of using nested Scriplaculous Sortables. With one little flaw – Scriplaculous ver 1.6.x is used, and when you try to execute the code with newer version of library – sections.each is not a function error pops up.

Here is the way to fix it – you’ll probably need it if you want to save the results :-D

Just replace “document.getElementsByClassName(’section’);” to “$$(‘.section’);”

Before

function getGroupOrder() {
	var sections = document.getElementsByClassName('section');
	var alerttext = '';
	sections.each(function(section) {
		var sectionID = section.id;
		var order = Sortable.serialize(sectionID);
		alerttext += sectionID + ': ' + Sortable.sequence(section) + '\n';
	});
	alert(alerttext);
	return false;
}

After

function getGroupOrder() {
	var sections = $$('.section');
	var alerttext = '';
	sections.each(function(section) {
		var sectionID = section.id;
		var order = Sortable.serialize(sectionID);
		alerttext += sectionID + ': ' + Sortable.sequence(section) + '\n';
	});
	alert(alerttext);
	return false;
}

Then modify it for your needs and go on )

What was that?
Quote:

As of Prototype 1.6, document.getElementsByClassName has been deprecated since native implementations return a NodeList rather than an Array.

Popularity: 32% [?]

Fixed BoxOver js library

Wednesday, May 28th, 2008

Hi there, my dear java-damned-script fans!

boxoverToday I used to find an strange bug in pretty little fine-looking-hints library, called BoxOver from here. As you know, for the chars ", [ and ] with this library you must use ", [[ and ]] to display… It works, but only once for brackets.

So, I tried to find a fix… None found. At the forum some guy gave an ugly fix with &rbr; and so on…

Shame on you guys, did you ever heard of regexp syntax? ;)

Here’s the BoxOver library with fixed [ and ] brackets display:

Download BoxOver 2.1a javascript library (28th May 2008)

BTW, when I tried to register on forum to post my fix – I can’t – because of captcha insult, and that’s why I posted it here.

Popularity: 85% [?]

Are you a web developer for real?

Friday, July 20th, 2007

Just a simple test.

Check this out.

If all you see – is your browser’s “not found” page – well, bad luck! All others – welcome to the club!

Popularity: 26% [?]

War Against SPam – step two!

Friday, July 20th, 2007

Second step – it’s use of Simple Trackback Validation plugin by Michael Woehrer.

Many spam messages is come through trackbacks.

This plugin eliminates spam trackbacks by:

  1. checking if the IP address of the trackback sender is equal to the IP address of the webserver the trackback URL is referring to and
  2. by retrieving the web page located at the URL used in the trackback and checking if the page contains a link to your blog.

Plug has options page. Everything seems pretty good – and again – wait for more info.

Popularity: 19% [?]

War Against SPam – WASP!

Friday, July 20th, 2007

Hi there!

I’ve been thinking of getting post done (about smart MySQL sorting techniques), but when I logged on….

A bunch of spam comments – about meds, about autos, about porn (of course) and all the bloody stuff around this bloody world…

So – I proclaim the War Against SPam (WASP).

The first step in WASP strategy – it’s a set of plugins. I’ll try some, and you’ll be informed about the hostilities.

First in the line will be Math Comment Spam Protection Plugin by Michael Woehrer. You can see its output under the comment form. Also I use the aggressive digits naming – like thr33 or f1ve

Popularity: 15% [?]

Scrap

Tuesday, June 26th, 2007

Hmmmm…
The previous piece of code is a scrap if you have to deal with MySql4 server with all-defaults.
So… I continued my challenge – I want my data back (and workin’) ;)
Stay tuned for next round…

P.S. For MySql5 all works great…

Popularity: 15% [?]

UTF-8 fix – when charset is set to Latin1

Saturday, June 23rd, 2007

Situation: you have MySQL 5 database with tables which claimed to have Latin1 charset. You filled the base (with MySQL Front, PhpMyAdmin or any other tool) with info. There IS non alnum chars (like TM, (c), long –, ellipsis etc.)

Now you want it back, and your pages are utf-8 encoded, but when you queries the base, ??’ sign returned instead of your cute symbols. Shit.

Never mind, if you can see those chars with PhpMyAdmin – I’ll help you to convert them to use them.

First, mysql5 seems to be utf-8 lover (even if other charset is claimed). So – it’s simple. Just exec SET NAMES utf8 right after database initialisation.

Second, query all the data you need into array.

Third, just do utf8_encode on data with your loved scrap

Forth, exec SET NAMES latin1

Fifth – write your data back

Sixth – tell your application to use utf8_decode when reading and utf8_encode when writing those data.

That’s all – now you can easilly transfer your data to MySQL4* or MySQL5 servers – and your app will work there!

Example:

// init skipped 
 
/*********************************** 
 * Database connect 
 **********************************/ 
$o_db = new myDB(DB::connect(DB_DSN)); 
$o_db->db_setFetchMode(DB_FETCHMODE_ASSOC); 
$o_db->db_query('SET NAMES utf8'); 
 
$q = 'SELECT page_id, page_head_title, page_head_description, page_head_keywords 
  FROM '.DB_PREFIX.'pages 
'; 
foreach ($page as $k => $p) 
  foreach (array('page_head_title', 'page_head_description', 'page_head_keywords') as $field) 
    $page[$k][$field] = utf8_encode($p[$field]); 
$o_db->db_query('SET NAMES latin1'); 
 
foreach ($page as $p) 
{ 
  $up = 'UPDATE '.DB_PREFIX.'pages 
    SET 
    page_head_title = '.$o_db->db_quote($p['page_head_title']).', 
    page_head_description = '.$o_db->db_quote($p['page_head_description']).', 
    page_head_keywords = '.$o_db->db_quote($p['page_head_keywords']).', 
    WHERE page_id = '.$o_db->db_quote($p['page_id']).' 
  '; 
  $o_db->db_query($up); 
}

*see next post

Popularity: 14% [?]

Developers versus clients

Monday, June 4th, 2007

Why always they think that coding – it’s an instant process?

Just another little quote:

We were under the understanding that coding would have been complete and we were to have seen your work late last week

Yeah, right. Do you mean next week?

Popularity: 11% [?]

PHP 4 and XML

Thursday, May 31st, 2007

What a mess.

Php 4 had no human usable XML handling implementation.
And almost all libraries it’s a mess…

I found one good article about it, but it’s in russian.
OK, I’ll try to translate it later (maybe only examples  )

And as for me – I found what i wanted. Small and effective library.

Here it is under more tag

(more…)

Popularity: 11% [?]

Feed ShowZ plugin update

Wednesday, April 25th, 2007

Feed ShowZ plugin updated to 0.92 version.
Added: Autocensor, Bottom link code.
Some bugs fixed.
Code re-arranged.

Available here: Feed ShowZ plugin homepage

Popularity: 15% [?]

youthumb – another video plugin

Tuesday, March 27th, 2007

Hi!

I wrote a new plugin – youthumb.
Lightweight and fast.

After a few checks i’ll publish it for your pleasure.

Popularity: 11% [?]

Ad RotateZ & Feed ShowZ now online

Thursday, February 15th, 2007

I checked both for WP 2.1 compatibility, they works.

Now files is available to download. Have fun!
Ad RotateZ plugin homepage
Feed ShowZ plugin homepage

Popularity: 11% [?]