Ejemplo n.º 1
0
<?php

//Ensure that it's completly compatible with strict mode and throws no notices or warnings, and not using any deprecated code
error_reporting(-1);
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
    die('This demo needs at least PHP 5.3.3');
}
ini_set('display_errors', 1);
$end_line = 907;
date_default_timezone_set('UTC');
$memory_start = 0;
$start_time = microtime(true);
require_once 'Phery.php';
PheryResponse::set_global('global', true);
//sleep(2); // uncomment to emulate latency
// Create a named response so we can include it later by the name
PheryResponse::factory()->j('<div/>', array('css' => array('cursor' => 'pointer', 'border' => 'solid 3px #000')))->html('This is a <i>new</i> <b>element</b>')->one('click', PheryFunction::factory(array('var $this = $(this);', '$(this).fadeOut("slow").promise().done(function(){ $this.remove(); });')))->prependTo('body')->set_response_name('my name is');
// << Name of this response
PheryResponse::factory('html,body')->scrollTop(0)->set_response_name('scrollTop');
class myClass
{
    function test($ajax_data, $callback_data)
    {
        return PheryResponse::factory('div.test')->merge('scrollTop')->filter(':eq(1)')->addClass('fast')->text($ajax_data['hi'])->jquery('a')->each(PheryFunction::factory(<<<JSON
\tfunction(i, el){
\t\tconsole.log("inside each!", i);
\t\tif (\$(this).text().length > 17) {
\t\t\t\$(this).css({"color":"green","textDecoration":"none"});
\t\t}
\t}
JSON