original_string: public static function link_to($content, $function, array $attributes = array(), Phery $phery = null, $no_close = false)
      {
          if ($phery && !isset($phery->functions[$function])) {
              self::exception($phery, 'The function "' . $function . '" provided in "link_to" hasnt been set', self::ERROR_TO);
          }
  
          $tag = 'a';
          if (isset($attributes['tag'])) {
              $tag = $attributes['tag'];
              unset($attributes['tag']);
          }
  
          $encoding = self::common_check($attributes);
  
          if ($function) {
              $attributes['data-phery-remote'] = $function;
          }
  
          $ret = array();
          $ret[] = "<{$tag}";
          foreach ($attributes as $attribute => $value) {
              $ret[] = "{$attribute}=\"" . htmlentities($value, ENT_COMPAT, $encoding, false) . "\"";
          }
  
          if (!in_array(strtolower($tag), array('img', 'input', 'iframe', 'hr', 'area', 'embed', 'keygen'))) {
              $ret[] = ">{$content}";
              if (!$no_close) {
                  $ret[] = "</{$tag}>";
              }
          } else {
              $ret[] = "/>";
          }
  
          return join(' ', $ret);
      }
code: public static function link_to($content, $function, array $attributes = array(), Phery $phery = null, $no_close = false)
      {
          if ($phery && !isset($phery->functions[$function])) {
              self::exception($phery, 'The function "' . $function . '" provided in "link_to" hasnt been set', self::ERROR_TO);
          }
  
          $tag = 'a';
          if (isset($attributes['tag'])) {
              $tag = $attributes['tag'];
              unset($attributes['tag']);
          }
  
          $encoding = self::common_check($attributes);
  
          if ($function) {
              $attributes['data-phery-remote'] = $function;
          }
  
          $ret = array();
          $ret[] = "<{$tag}";
          foreach ($attributes as $attribute => $value) {
              $ret[] = "{$attribute}=\"" . htmlentities($value, ENT_COMPAT, $encoding, false) . "\"";
          }
  
          if (!in_array(strtolower($tag), array('img', 'input', 'iframe', 'hr', 'area', 'embed', 'keygen'))) {
              $ret[] = ">{$content}";
              if (!$no_close) {
                  $ret[] = "</{$tag}>";
              }
          } else {
              $ret[] = "/>";
          }
  
          return join(' ', $ret);
      }
code_tokens: public static function link_to ( $ content , $ function , array $ attributes = array ( ) , Phery $ phery = null , $ no_close = false ) { if ( $ phery && ! isset ( $ phery -> functions [ $ function ] ) ) { self :: exception ( $ phery , 'The function "' . $ function . '" provided in "link_to" hasnt been set' , self :: ERROR_TO ) ; } $ tag = 'a' ; if ( isset ( $ attributes [ 'tag' ] ) ) { $ tag = $ attributes [ 'tag' ] ; unset ( $ attributes [ 'tag' ] ) ; } $ encoding = self :: common_check ( $ attributes ) ; if ( $ function ) { $ attributes [ 'data-phery-remote' ] = $ function ; } $ ret = array ( ) ; $ ret [ ] = "<{$tag}" ; foreach ( $ attributes as $ attribute => $ value ) { $ ret [ ] = "{$attribute}=\"" . htmlentities ( $ value , ENT_COMPAT , $ encoding , false ) . "\"" ; } if ( ! in_array ( strtolower ( $ tag ) , array ( 'img' , 'input' , 'iframe' , 'hr' , 'area' , 'embed' , 'keygen' ) ) ) { $ ret [ ] = ">{$content}" ; if ( ! $ no_close ) { $ ret [ ] = "</{$tag}>" ; } } else { $ ret [ ] = "/>" ; } return join ( ' ' , $ ret ) ; }
docstring: Helper function that generates an ajax link, defaults to "A" tag
  
  @param string $content The content of the link. This is ignored for self closing tags, img, input, iframe
  @param string $function The PHP function assigned name on Phery::set()
  @param array $attributes Extra attributes that can be passed to the link, like class, style, etc
  <pre>
  array(
  // Display confirmation on click
  'confirm' => 'Are you sure?',
  
  // The tag for the item, defaults to a. If the tag is set to img, the
  // 'src' must be set in attributes parameter
  'tag' => 'a',
  
  // Define another URI for the AJAX call, this defines the HREF of A
  'href' => '/path/to/url',
  
  // Extra arguments to pass to the AJAX function, will be stored
  // in the data-phery-args attribute as a JSON notation
  'args' => array(1, "a"),
  
  // Set the "href" attribute for non-anchor (a) AJAX tags (like buttons or spans).
  // Works for A links too, but it won't function without javascript, through data-phery-target
  'target' => '/default/ajax/controller',
  
  // Define the data-phery-type for the expected response, json, xml, text, etc
  'phery-type' => 'json',
  
  // Enable clicking on structural HTML, like DIV, HEADER, HGROUP, etc
  'clickable' => true,
  
  // Force cache of the response
  'cache' => true,
  
  // Aggregate data from other DOM elements, can be forms, inputs (textarea, selects),
  // pass multiple selectors, like "#input1,#form1,~ input:hidden,select.job"
  // that are searched in this order:
  // - $(this).find(related)
  // - $(related)
  // So you can use sibling, children selectors, like ~, +, >, :parent
  // You can also, through Javascript, append a jQuery object to the related, using
  // $('#element').phery('data', 'related', $('#other_element'));
  'related' => true,
  
  // Disables the AJAX on element while the last action is not completed
  'only' => true,
  
  // Set the encoding of the data, defaults to UTF-8
  'encoding' => 'UTF-8',
  
  // Set the method (for restful responses)
  'method' => 'PUT'
  );
  </pre>
  
  @param Phery $phery Pass the current instance of phery, so it can check if the
  functions are defined, and throw exceptions
  @param boolean $no_close Don't close the tag, useful if you want to create an AJAX DIV with a lot of content inside,
  but the DIV itself isn't clikable
  
  <pre>
  <?php echo Phery::link_to('', 'remote', array('target' => '/another-url', 'args' => array('id' => 1), 'class' => 'ajaxified'), null, true); ?>
  <p>This new content</p>
  <div class="result></div>
  </div>
  <?php echo Phery::link_to('', 'remote', array('target' => '/another-url', 'args' => array('id' => 2), 'class' => 'ajaxified'), null, true); ?>
  <p>Another content will have div result filled</p>
  <div class="result></div>
  </div>
  
  <script>
  $('.ajaxified').phery('remote');
  </script>
  </pre>
  
  @static
  @return string The mounted HTML tag
docstring_tokens: Helper function that generates an ajax link defaults to A tag