Exemplo n.º 1
0
 /**
  * Determine if the last selector or the selector provided is an special
  *
  * @param string $type
  * @param string $selector
  * @return boolean
  */
 protected function is_special_selector($type = null, $selector = null)
 {
     $selector = Phery::coalesce($selector, $this->last_selector);
     if ($selector && preg_match('/\\{([\\D]+)\\d+\\}/', $selector, $matches)) {
         if ($type === null) {
             return true;
         }
         return $matches[1] === $type;
     }
     return false;
 }
Exemplo n.º 2
0
     }
     return $r->this->phery('append_args', array('wow' => 'true'));
 }, 'test' => array($instance, 'test'), 'test2' => 'test', 'test4' => array('myClass', 'test2'), 'test5' => function () {
     return PheryResponse::factory()->redirect('http://www.google.com');
 }, 'data' => array($instance, 'data'), 'trigger' => 'trigger', 'form' => 'form', 'thisone' => 'thisone', 'surprise' => function ($data) {
     return PheryResponse::factory()->call(array('location', 'reload'), true);
 }, 'invalid' => function () {
     return PheryResponse::factory()->script('not valid javascript')->jquery('a')->blah();
 }, 'timeout' => 'timeout', 'chain' => function ($data, $complement) {
     $r = PheryResponse::factory($complement['submit_id'])->next('div');
     // If the select has a name, the value of the select element will be passed as
     // a key => value of it's name. Or it could be used as
     // PheryResponse::factory()->this->next('div');
     $html = array();
     error_reporting(0);
     switch (Phery::coalesce($data['named'], $data[0])) {
         case 1:
             $html = array('1' => '1-1', '2' => '1-2', '3' => '1-3');
             break;
         case 2:
             $html = array('1' => '2-1', '2' => '2-2', '3' => '2-3');
             break;
         case 3:
             $html = array('1' => '3-1', '2' => '3-2', '3' => '3-3');
             break;
     }
     // Return a new select inside the adjacent divs
     return $r->html(Phery::select_for('msgbox', $html, array('selected' => '3')));
 }, 'msgbox' => function ($data) {
     return PheryResponse::factory()->alert($data);
 }, 'json' => function ($data) {