WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #23236, comment 6


Ignore:
Timestamp:
05/16/13 04:15:04 (11 months ago)
Author:
ryanve
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23236, comment 6

    initial v1  
    11I added [https://github.com/airve/phat/blob/master/wphat.php wphat.php] in the [https://github.com/airve/phat phat repo] called  where I'm working on this. I think it'll be better to name the functions `wp_attr` and `wp_attr_parse` b/c both can handle 1+ attributes. 
    22 
    3 How do we want to encode complex (array|object) attributes?  [https://github.com/airve/phat/blob/4835480c3c925023199eef65b22ded9866f50b66/wphat.php#LC113 Currently] it checks for the ~10 attributes that take tokens (`[class]`, `[media]`, [http://dev.w3.org/html5/spec-author-view/index.html#attributes-1 etc.]) and implode them with the correct glue. Otherwise it uses `json_encode`. Should we skip the check and go with the simple approach of using `json_encode` for any complex value? In either case I'll include a `'complex_attr_value'` filter.  
    4  
    5 I avoided `esc_attr` b/c it breaks JSON and b/c it double-encodes entities.  
     3How do we want to encode complex (array|object) attributes?  [https://github.com/airve/phat/blob/4835480c3c925023199eef65b22ded9866f50b66/wphat.php#LC113 Currently] it checks for the ~10 attributes that take tokens (`[class]`, `[media]`, [http://dev.w3.org/html5/spec-author-view/index.html#attributes-1 etc.]) and implode them with the correct glue. Otherwise it uses `json_encode`. Should we skip the check and go with the simple approach of using `json_encode` for any complex value? In either case I'll include a `'complex_attr_value'` filter. I avoided `esc_attr` b/c it breaks JSON and b/c it double-encodes entities.