Plugin Directory

Changeset 2793714


Ignore:
Timestamp:
10/03/2022 10:15:06 PM (3 years ago)
Author:
uqrate
Message:

v1.0.0 build 2022-10-03T22.10.08Z to trunk

Location:
uqrate/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uqrate/trunk/class.core.php

    r2789730 r2793714  
    154154    }
    155155    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;
    157165    }
    158166    public static function errWrap($what, $where = '') {
  • uqrate/trunk/class.sync.php

    r2789730 r2793714  
    153153        if ( $got )
    154154            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);
    156158            };
    157159        $cats = [];
     
    161163                if ( $obj->name == 'Uncategorized' )
    162164                    continue;
    163                 array_push($cats, $obj->name);
     165                $tag = self::toCamelCaseAlphaNum($obj->name);
     166                if ( !$tag ) continue;
     167                array_push($cats, $tag);
    164168            };
    165169        $msg = [
     
    170174        ];
    171175        if ( $post->post_excerpt ) $msg['summary'] = $post->post_excerpt;
    172         if ( count( $tags ) ) $msg['keywords']  = $tags;
    173         if ( count( $cats ) ) $msg['categories'] = $cats;
     176        if ( count( $tags ) ) $msg['tags'] = $tags;
     177        if ( count( $cats ) ) $msg['cats'] = $cats;
    174178        $data = wp_json_encode( $msg, JSON_UNESCAPED_SLASHES );
    175179        $resp = wp_remote_post( $upsert_url, [
  • uqrate/trunk/uqrate.php

    r2790521 r2793714  
    2929define( 'UQRATE_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    3030$_UQRATE_ENV = [
    31     'build'                 => "2022-09-26T23.49.04Z",
     31    'build'                 => "2022-10-03T22.10.08Z",
    3232    'mode_debug'            => false,
    3333    'mode_local'            => false,
Note: See TracChangeset for help on using the changeset viewer.