queue as $handle) : $array[] = $handle; endforeach; wp_dequeue_script($array); wp_dequeue_script($array); } public static function amp_styles() { global $wp_styles; foreach( $wp_styles->queue as $style ) { self::$style_files[] = $wp_styles->registered[$style]->src; } foreach ($wp_styles->registered as $handle => $data){ wp_deregister_style($handle); wp_dequeue_style($handle); } } /** * Static function get_style_theme * @access public * @return void * @since 1.0 */ public static function get_style_theme() { global $wp_filesystem; if (empty($wp_filesystem)) { require_once (ABSPATH . '/wp-admin/includes/file.php'); WP_Filesystem(); } if (!self::$get_style) { self::$get_style = true; } else { return ''; } $content_style = ''; /* Append content of all styles on custom tag. foreach (self::$style_files as $style_src) { $content_style .= file_get_contents($style_src); } */ $default_logo = WP_AMP_THEME_URL.'/assets/images/logo-blue.svg'; $custom_logo_id = get_theme_mod('custom_logo'); if (!empty($custom_logo_id)) { $image = wp_get_attachment_image_src( $custom_logo_id , 'full'); if (!empty($image)) { $default_logo = $image[0]; } } $hamburger_img = WP_AMP_THEME_URL.'/assets/images/hamburger.svg'; $search_img = WP_AMP_THEME_URL.'/assets/images/search.svg'; $close_img = WP_AMP_THEME_URL.'/assets/images/close.svg'; $style_path = get_template_directory(). '/style.css'; $content_style .= $wp_filesystem->get_contents($style_path); $content_style = str_replace('{$custom_logo}', $default_logo, $content_style); $content_style = str_replace('{$hamburger_img}', $hamburger_img, $content_style); $content_style = str_replace('{$search_img}', $search_img, $content_style); $content_style = str_replace('{$close_img}', $close_img, $content_style); $content_style = amp_converter::minify_css($content_style); echo ''; } /** * Static function get_default_scripts * @access public * @return void * @since 1.0 */ public static function get_default_scripts() { global $wp_amp_defaults_scripts, $wp_amp_theme_extra_scripts; echo ''; echo $wp_amp_theme_extra_scripts; foreach ($wp_amp_defaults_scripts as $name => $src) { echo ''; } } public static function amp_cache($response, $url_to_cache) { remove_filter('wpematico_cache_response_html', array('wpematico_cache_process', 'cache_response_html'), 100, 2); remove_filter('wpematico_cache_response_html','amp_cache', 99, 2); return $response; } public static function comment_form( $args = array(), $post_id = null ) { if ( null === $post_id ) $post_id = get_the_ID(); // Exit the function when comments for the post are closed. if ( ! comments_open( $post_id ) ) { /** * Fires after the comment form if comments are closed. * * @since 3.0.0 */ do_action( 'comment_form_comments_closed' ); return; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5' === $args['format']; $fields = array( 'author' => '
', 'email' => '' . '
', 'url' => '' . '
', ); $required_text = sprintf( ' ' . __('Required fields are marked %s', 'wp-amp-theme'), '*' ); /** * Filters the default comment form fields. * * @since 3.0.0 * * @param array $fields The default comment fields. */ $fields = apply_filters( 'comment_form_default_fields', $fields ); $defaults = array( 'fields' => $fields, 'comment_field' => '', /** This filter is documented in wp-includes/link-template.php */ 'must_log_in' => '
' . sprintf( /* translators: %s: login URL */ __( 'You must be logged in to post a comment.', 'wp-amp-theme' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', /** This filter is documented in wp-includes/link-template.php */ 'logged_in_as' => '' . sprintf( /* translators: 1: edit user link, 2: accessibility text, 3: user name, 4: logout URL */ __( 'Logged in as %3$s. Log out?', 'wp-amp-theme' ), get_edit_user_link(), /* translators: %s: user name */ esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.', 'wp-amp-theme' ), $user_identity ) ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
', 'comment_notes_before' => '' . __( 'Your email address will not be published.', 'wp-amp-theme' ) . ''. ( $req ? $required_text : '' ) . '
', 'comment_notes_after' => '', 'action' => admin_url('admin-post.php'), 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_form' => 'comment-form', 'class_submit' => 'submit', 'name_submit' => 'submit', 'title_reply' => __( 'Leave a Reply', 'wp-amp-theme' ), 'title_reply_to' => __( 'Leave a Reply to %s', 'wp-amp-theme' ), 'title_reply_before' => '%1$s %2$s
', 'format' => 'xhtml', ); /** * Filters the comment form default arguments. * * Use {@see 'comment_form_default_fields'} to filter the comment fields. * * @since 3.0.0 * * @param array $defaults The default comment form arguments. */ $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); // Ensure that the filtered args contain all required default values. $args = array_merge( $defaults, $args ); /** * Fires before the comment form. * * @since 3.0.0 */ do_action( 'comment_form_before' ); ?>