Changeset 39591 for trunk/src/wp-includes/atomlib.php
- Timestamp:
- 12/13/2016 01:48:41 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/atomlib.php
r38883 r39591 95 95 $this->feed = new AtomFeed(); 96 96 $this->current = null; 97 $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";');98 $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');97 $this->map_attrs_func = array( __CLASS__, 'map_attrs' ); 98 $this->map_xmlns_func = array( __CLASS__, 'map_xmlns' ); 99 99 } 100 100 … … 104 104 public function AtomParser() { 105 105 self::__construct(); 106 } 107 108 /** 109 * Map attributes to key="val" 110 * 111 * @param string $k Key 112 * @param string $v Value 113 * @return string 114 */ 115 public static function map_attrs($k, $v) { 116 return "$k=\"$v\""; 117 } 118 119 /** 120 * Map XML namespace to string. 121 * 122 * @param indexish $p XML Namespace element index 123 * @param array $n Two-element array pair. [ 0 => {namespace}, 1 => {url} ] 124 * @return string 'xmlns="{url}"' or 'xmlns:{namespace}="{url}"' 125 */ 126 public static function map_xmlns($p, $n) { 127 $xd = "xmlns"; 128 if( 0 < strlen($n[0]) ) { 129 $xd .= ":{$n[0]}"; 130 } 131 return "{$xd}=\"{$n[1]}\""; 106 132 } 107 133
Note: See TracChangeset
for help on using the changeset viewer.