Forums

[Plugin: Twitter Tools] Lots of Validation Errors (3 posts)

  1. databell96
    Member
    Posted 1 year ago #

    I seem notice a lot of validation errors and warnings on my clients' website. All mainly because of Twitter Tools. Mainly because a line of code like this:

    <link rel="stylesheet" type="text/css" href="http://www.radioactivemedia.net/index.php?ak_action=aktt_css&v=2.4" />

    See the ampersand? That shouldn't be there. If it read & it would validate. Can this script be fixed?

  2. stackedsax
    Member
    Posted 1 year ago #

    The ampersand looks fine. It's just separating HTTP variables in the request. One variable is 'ak_action' and another variable is 'v'. No harm done.

    Now, what IS strange is that Twitter Tools loads its css like this. Why can they not use wp_enqueue_style like you're supposed to?

    Using index.php to dynamically generate a css file is one of the most bizarre things I've seen done in a long, long time. There is no need for the css to be generated dynamically. It's not like Twitter Tools is using PHP variables in any of the CSS definitions. Why on earth is this like this?

    To make this better, rip out the code from lines 997 to 1523 (lines refer to Twitter Tools 2.4). Remove everything from aktt_init() until and including add_action('init', 'aktt_resources', 1);

    In other words, remove this:

    function aktt_init() {
    	global $wpdb, $aktt;
    	$wpdb->aktt = $wpdb->prefix.'ak_twitter';
    	$aktt = new twitter_tools;
    ...
    ...
    ...
    <and everything in between>
    ...
    ...
    ...
    add_action('init', 'aktt_resources', 1);

    Then, replace with some improved init functions:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Create two directories:

    wp-content/plugins/twitter-tools/js
    wp-content/plugins/twitter-tools/css

    And create 5 files:

    wp-content/plugins/twitter-tools/js/aktt.js
    wp-content/plugins/twitter-tools/js/aktt_admin.js
    wp-content/plugins/twitter-tools/js/aktt_prototype.js
    wp-content/plugins/twitter-tools/css/aktt.css
    wp-content/plugins/twitter-tools/css/aktt_admin.css

    With the contents:

    wp-content/plugins/twitter-tools/js/aktt.js:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I could make one or two more improvements, like not loading the aktt.css in the admin, but whatever. At least this allows me to cache the css and js on my CDN now. Phew.

  3. stackedsax
    Member
    Posted 1 year ago #

    Oh whatever. Thanks very much, moderator.

    http://wordpress.pastebin.com/paKqZJYA

    You can figure it out if you guys want to. I'm done helping the community for the day.

Topic Closed

This topic has been closed to new replies.

About this Topic