Making WordPress.org


Ignore:
Timestamp:
09/05/2022 05:14:31 AM (3 years ago)
Author:
dufresnesteven
Message:

wporg-developer: Sync with https://github.com/WordPress/wporg-developer/commit/790d402933d2725374de0d19e6bf6a576c8b15d2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php

    r11765 r12050  
    5555        // Customize allowed tags
    5656        add_filter( 'wp_kses_allowed_html',            array( __CLASS__, 'wp_kses_allowed_html' ), 10, 2 );
    57 
    58         // Make 'php' the default language
    59         add_filter( 'syntaxhighlighter_shortcodeatts', array( __CLASS__, 'syntaxhighlighter_shortcodeatts' ) );
    60 
    61         // Tweak code contained in shortcode
    62         add_filter( 'syntaxhighlighter_precode',       array( __CLASS__, 'syntaxhighlighter_precode' ) );
    6357
    6458        // Allowed HTML for a new child comment
     
    170164    public static function scripts_and_styles() {
    171165        if ( is_singular() ) {
    172             wp_enqueue_script( 'wporg-developer-function-reference', get_template_directory_uri() . '/js/function-reference.js', array( 'jquery', 'syntaxhighlighter-core', 'syntaxhighlighter-brush-php' ), '20180724', true );
    173             wp_enqueue_style( 'syntaxhighlighter-core' );
    174             wp_enqueue_style( 'syntaxhighlighter-theme-default' );
    175 
    176             wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'jquery', 'quicktags' ), '20200110', true );
    177             wp_enqueue_script( 'wporg-developer-user-notes-feedback', get_template_directory_uri() . '/js/user-notes-feedback.js', array( 'jquery', 'quicktags' ), '20181023', true );
    178             wp_localize_script( 'wporg-developer-user-notes-feedback', 'wporg_note_feedback', array(
    179                 'show'             => __( 'Show Feedback', 'wporg' ),
    180                 'hide'             => __( 'Hide Feedback', 'wporg' ),
    181             ) );
    182         }
    183     }
    184 
    185     /**
    186      * Sets the default language for SyntaxHighlighter shortcode.
    187      *
    188      * @param array $atts Shortcode attributes.
    189      * @return array
    190      */
    191     public static function syntaxhighlighter_shortcodeatts( $atts ) {
    192         $atts['language'] = 'php';
    193         return $atts;
    194     }
    195 
    196     /**
    197      * Subverts capital_P_dangit for SyntaxHighlighter shortcode.
    198      *
    199      * @param string $code
    200      * @return string
    201      */
    202     public static function syntaxhighlighter_precode( $code ) {
    203         return str_replace( 'Wordpress', 'Wordpress', $code );
     166            wp_enqueue_script(
     167                'wporg-developer-function-reference',
     168                get_template_directory_uri() . '/js/function-reference.js',
     169                array( 'jquery', 'wp-a11y' ),
     170                filemtime( dirname( __DIR__ ) . '/js/function-reference.js' ),
     171                true
     172            );
     173            wp_localize_script(
     174                'wporg-developer-function-reference',
     175                'wporgFunctionReferenceI18n',
     176                array(
     177                    'copy'   => __( 'Copy', 'wporg' ),
     178                    'copied' => __( 'Code copied', 'wporg' ),
     179                    'expand'   => __( 'Expand code', 'wporg' ),
     180                    'collapse' => __( 'Collapse code', 'wporg' ),
     181                )
     182            );
     183
     184            wp_enqueue_script(
     185                'wporg-developer-user-notes',
     186                get_template_directory_uri() . '/js/user-notes.js',
     187                array( 'jquery', 'quicktags' ),
     188                filemtime( dirname( __DIR__ ) . '/js/user-notes.js' ),
     189                true
     190            );
     191
     192            wp_enqueue_script(
     193                'wporg-developer-user-notes-feedback',
     194                get_template_directory_uri() . '/js/user-notes-feedback.js',
     195                array( 'jquery', 'quicktags' ),
     196                filemtime( dirname( __DIR__ ) . '/js/user-notes-feedback.js' ),
     197                true
     198            );
     199            wp_localize_script(
     200                'wporg-developer-user-notes-feedback',
     201                'wporg_note_feedback',
     202                array(
     203                    'show' => __( 'Show Feedback', 'wporg' ),
     204                    'hide' => __( 'Hide Feedback', 'wporg' ),
     205                )
     206            );
     207        }
    204208    }
    205209
Note: See TracChangeset for help on using the changeset viewer.