Running phing from its phar

As of phing 2.4.10 you can download phing as a phar file, perfect for using phing on servers with PHP > 5.3 but without access to PEAR. Quite new to phar files I struggled to get started, but it turns out its actually really easy! Failing to find any resources online myself, hopefully this will help somebody else.
Continue reading “Running phing from its phar”

RB Internal Links v2.0.14

A mini maintenance release addressing a shortfall in the wordpress shortcode parser.

Unfortunately the wordpress shortcode API can’t successfully process the following:

[intlink id="1" /]
Normal content
[intlink id="2"]Link content[/intlink]

OR

[intlink id="1"][/intlink]
Normal content
[intlink id="2"]Link content[/intlink]

To circumvent this, where users require no link text (to display the post title), the plugin will now accept the string “{{empty}}” as the link content like so:

[intlink id="1"]{{empty}}[/intlink]
Normal content
[intlink id="2"]Link content[/intlink]

I submitted a bug 2 years ago [http://core.trac.wordpress.org/ticket/9264], unfortunately it remains unfixed at the date of this post.

jQuery find next element in DOM by selector

If you need to find the next occurrence of an element within the DOM, but aren’t sure where it is (i.e. you can’t just use $.next) I wrote a jQuery plugin that will traverse through the DOM from the current element til it hits either the ‘body’ tag or a parent you specify.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(function( $ ){
    $.fn.nextElementInDom = function(selector, options) {
        var defaults = { stopAt : 'body' };
        options = $.extend(defaults, options);
 
        var parent = $(this).parent();
        var found = parent.find(selector);
 
        switch(true){
            case (found.length > 0):
                return found;
            case (parent.length === 0 || parent.is(options.stopAt)):
                return $([]);
            default:
                return parent.nextElementInDom(selector);
        }
    };
})( jQuery );

Download it here: jquery.nextElementInDom.js

And here is how you would use it:

1
var elementNeeded = $('.firstElement').nextElementInDom('.secondElement');

Where your HTML might look like this:

<html>
  <body>
    <div>
      <span class="firstElement">Our first element</span>
    </div>
 
    <ul>
      <li>
        <span class="secondElement">Second element is in a different place</span>
      </li>
    </ul>
  </body>
</html>

php-ssrs v0.1

A beta release of php-ssrs, a PHP SOAP client for Sql Reporting Services, that I helped write with Ideal Websites is now available for download.

Grab a copy of it from the Google Code project page here: php-ssrs

The QuickStart guide should be all you need to get going, there are also more detailed samples available in the download. Getting a rendered report is made real easy, just take a look at the sample below:

1
2
3
4
5
6
7
8
9
10
11
12
13
$options = array(
    'username' => 'testing',
    'password' => 'password'
);
 
$ssrs = new SSRS_Report('http://localhost/reportserver/', $options);
$result = $ssrs->loadReport('/Reports/Reference_Report');
 
$ssrs->setSessionId($result->executionInfo->ExecutionID);
$ssrs->setExecutionParameters(new SSRS_Object_ExecutionParameters($result->executionInfo->Parameters));
 
$output = $ssrs->render('HTML4.0'); // PDF | XML | CSV
echo $output;