Changeset 2793714
- Timestamp:
- 10/03/2022 10:15:06 PM (3 years ago)
- Location:
- uqrate/trunk
- Files:
-
- 3 edited
-
class.core.php (modified) (1 diff)
-
class.sync.php (modified) (3 diffs)
-
uqrate.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uqrate/trunk/class.core.php
r2789730 r2793714 154 154 } 155 155 public static function rfc3339z( $date ) { 156 return substr(date_format( date_create( $date ), 'c' ), 0, 19).'Z'; 156 return substr(date_format( date_create( $date ), 'c' ), 0, 19) . 'Z'; 157 } 158 public static function toCamelCaseAlphaNum( $str, $jsCompliant = false ) { 159 if ( !$str ) return $str; 160 if ( str_replace(' ', '', $str ) == $str ) return $str; 161 $str = str_replace(' ', '', ucwords(str_replace('-', ' ', $str ))); 162 if ( $jsCompliant) $str[0] = strtolower($str[0]); 163 $str = preg_replace( '/[^a-z0-9]/i', '', $str); 164 return $str; 157 165 } 158 166 public static function errWrap($what, $where = '') { -
uqrate/trunk/class.sync.php
r2789730 r2793714 153 153 if ( $got ) 154 154 foreach ( $got as $obj) { 155 array_push($tags, $obj->name); 155 $tag = self::toCamelCaseAlphaNum($obj->name); 156 if ( !$tag ) continue; 157 array_push($tags, $tag); 156 158 }; 157 159 $cats = []; … … 161 163 if ( $obj->name == 'Uncategorized' ) 162 164 continue; 163 array_push($cats, $obj->name); 165 $tag = self::toCamelCaseAlphaNum($obj->name); 166 if ( !$tag ) continue; 167 array_push($cats, $tag); 164 168 }; 165 169 $msg = [ … … 170 174 ]; 171 175 if ( $post->post_excerpt ) $msg['summary'] = $post->post_excerpt; 172 if ( count( $tags ) ) $msg[' keywords']= $tags;173 if ( count( $cats ) ) $msg['cat egories'] = $cats;176 if ( count( $tags ) ) $msg['tags'] = $tags; 177 if ( count( $cats ) ) $msg['cats'] = $cats; 174 178 $data = wp_json_encode( $msg, JSON_UNESCAPED_SLASHES ); 175 179 $resp = wp_remote_post( $upsert_url, [ -
uqrate/trunk/uqrate.php
r2790521 r2793714 29 29 define( 'UQRATE_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 30 30 $_UQRATE_ENV = [ 31 'build' => "2022- 09-26T23.49.04Z",31 'build' => "2022-10-03T22.10.08Z", 32 32 'mode_debug' => false, 33 33 'mode_local' => false,
Note: See TracChangeset
for help on using the changeset viewer.