Plugin Directory

Changeset 1981281


Ignore:
Timestamp:
11/27/2018 12:08:28 PM (7 years ago)
Author:
loremipsumgraz
Message:

Update for jupiter theme changes

Location:
hardcore-google-fonts-localizer
Files:
324 added
6 edited

Legend:

Unmodified
Added
Removed
  • hardcore-google-fonts-localizer/trunk/admin/class-google-fonts-localizer-admin-settings.php

    r1956697 r1981281  
    4040            [
    4141                'field_id'    => 'deactivate_plugin_font_loaders',
    42                 'title'       => __('Re-Build Cache', 'google-fonts-localizer'),
     42                'title'       => __('Disable Fonts from', 'google-fonts-localizer'),
    4343                'label' => [
    4444                    'jupiter' => __('Jupiter Theme by Artbees', 'google-fonts-localizer'),
  • hardcore-google-fonts-localizer/trunk/google-fonts-localizer.php

    r1956697 r1981281  
    33 * Plugin Name:       Hardcore Google Fonts Localizer
    44 * Description:       A Plugin that enables you to host google fonts on your server with no effort (GDPR safe)
    5  * Version:           1.0.0
     5 * Version:           1.0.1
    66 * Author:            Lorem Ipsum web.solutions GmbH
    77 * Author URI:        https://www.loremipsum.at/
     
    1818load_plugin_textdomain( 'google-fonts-localizer', false, basename( dirname( __FILE__ ) ) . '/languages' );
    1919
    20 define( 'GOOGLE_FONTS_LOCALIZER_PLUGIN_VERSION', '1.0.0' );
     20define( 'GOOGLE_FONTS_LOCALIZER_PLUGIN_VERSION', '1.0.1' );
    2121define( 'GOOGLE_FONTS_LOCALIZER_PLUGIN_FILE', __FILE__);
    2222define( 'GOOGLE_FONTS_LOCALIZER_PLUGIN_TITLE', 'Hardcore Google Fonts Localizer');
  • hardcore-google-fonts-localizer/trunk/includes/class-google-fonts-localizer-filters.php

    r1956697 r1981281  
    11<?php
    22
    3 class Google_Fonts_Localizer_Filters {
     3class Google_Fonts_Localizer_Filters
     4{
    45
    56    public function __construct()
    67    {
    7         add_action('after_setup_theme', [$this,'deactivate_font_loaders']);
     8        add_action('after_setup_theme', [$this, 'deactivate_font_loaders']);
    89    }
    910
    10     public function deactivate_font_loaders() {
     11    public function deactivate_font_loaders()
     12    {
    1113        $options = get_option('Google_Fonts_Localizer_Settings');
    1214
     
    1517
    1618            if ($loader_options['jupiter'] === '1' && defined('THEME_JS') && defined('THEME_VERSION')) {
    17                 add_action('wp_print_scripts', [$this,'dequeue_jupiter_font_styles'], 100);
     19                add_action('wp_print_scripts', [$this, 'dequeue_jupiter_font_styles'], 100);
     20                add_action('wp_footer', [$this, 'dequeue_jupiter_footer_font_includes'], 5);
    1821            }
    1922
    2023            if ($loader_options['vc'] === '1' && class_exists('Vc_Manager')) {
    21                 add_filter( 'vc_google_fonts_get_fonts_filter', [$this,'change_vc_fonts_list'], 100);
    22                 add_filter( 'get_footer', [$this,'dequeue_vc_font_styles'], 100);
     24                add_filter('vc_google_fonts_get_fonts_filter', [$this, 'change_vc_fonts_list'], 100);
     25                add_filter('get_footer', [$this, 'dequeue_vc_font_styles'], 100);
    2326            }
    2427
    2528            if ($loader_options['revo'] === '1' && class_exists('RevSliderFront')) {
    26                 add_filter('revslider_printCleanFontImport', [$this,'disable_rev_slider_font_import'], 100, 6);
    27                 add_filter('revslider_operations_getArrFontFamilys', [$this,'change_rev_fonts_list'], 100 ,1);
     29                add_filter('revslider_printCleanFontImport', [$this, 'disable_rev_slider_font_import'], 100, 6);
     30                add_filter('revslider_operations_getArrFontFamilys', [$this, 'change_rev_fonts_list'], 100, 1);
    2831            }
    2932
     
    3134    }
    3235
    33     public function dequeue_jupiter_font_styles() {
    34         wp_dequeue_script( 'mk-webfontloader',THEME_JS . '/plugins/wp-enqueue/min/webfontloader.js', array( 'jquery' ), THEME_VERSION, true );
    35         wp_dequeue_script( 'mk-webfontloader',THEME_JS . '/plugins/wp-enqueue/webfontloader.js', array( 'jquery' ), THEME_VERSION, true );
     36    public function dequeue_jupiter_footer_font_includes() {
     37        if(! is_admin()) {
     38            global $wp_styles;
     39            $registered_styles = $wp_styles->registered;
     40
     41            foreach ($registered_styles as $registered_style) {
     42                if (strpos($registered_style->src, 'fonts.googleapis.com') != false) {
     43                    wp_deregister_style($registered_style->handle);
     44                }
     45            }
     46        }
     47    }
     48
     49    public function dequeue_jupiter_font_styles()
     50    {
     51        wp_dequeue_script('mk-webfontloader', THEME_JS . '/plugins/wp-enqueue/min/webfontloader.js', array('jquery'),
     52            THEME_VERSION, true);
     53        wp_dequeue_script('mk-webfontloader', THEME_JS . '/plugins/wp-enqueue/webfontloader.js', array('jquery'),
     54            THEME_VERSION, true);
    3655    }
    3756
     
    4564            foreach ($fonts_cache as $family => $variants) {
    4665                $styles = [];
    47                 $types = [];
     66                $types  = [];
    4867                foreach ($variants as $variant => $url_pairs) {
    4968                    $variant_parts = explode('-', $variant);
    50                     $weight = $variant_parts[0];
    51                     $style = $variant_parts[1];
     69                    $weight        = $variant_parts[0];
     70                    $style         = $variant_parts[1];
    5271
    5372                    $styles[] = $weight . $style === 'italic' ? 'italic' : '';
    54                     $types[] = "$weight $style:$weight:$style";
     73                    $types[]  = "$weight $style:$weight:$style";
    5574                }
    5675
    57                 $fonts_list[] = (object) [
     76                $fonts_list[] = (object)[
    5877                    'font_family' => $family,
    5978                    'font_styles' => implode(',', $styles),
    60                     'font_types' => implode(',', $types)
     79                    'font_types'  => implode(',', $types)
    6180                ];
    6281            }
     
    6887    }
    6988
    70     public function dequeue_vc_font_styles() {
     89    public function dequeue_vc_font_styles()
     90    {
    7191        $fonts_cache = get_option('google_fonts_localizer_cache');
    7292
     
    7898    }
    7999
    80     public function disable_rev_slider_font_import() {
     100    public function disable_rev_slider_font_import()
     101    {
    81102        return '';
    82103    }
    83104
    84     public function change_rev_fonts_list($fonts) {
     105    public function change_rev_fonts_list($fonts)
     106    {
    85107        $fonts_cache = get_option('google_fonts_localizer_cache');
    86108
     
    92114                foreach ($variants as $variant => $url_pairs) {
    93115                    $variant_parts = explode('-', $variant);
    94                     $weight = $variant_parts[0];
    95                     $style = $variant_parts[1];
     116                    $weight        = $variant_parts[0];
     117                    $style         = $variant_parts[1];
    96118
    97119                    if ($style === 'normal') {
     
    107129
    108130                $fonts[] = [
    109                     'type' => 'googlefont',
    110                     'version' => 'Google Fonts',
    111                     'label' => $family,
     131                    'type'     => 'googlefont',
     132                    'version'  => 'Google Fonts',
     133                    'label'    => $family,
    112134                    'variants' => $variations
    113135                ];
  • hardcore-google-fonts-localizer/trunk/languages/google-fonts-localizer-de_DE.po

    r1956697 r1981281  
    22msgstr ""
    33"Project-Id-Version: LI Lazy Load\n"
    4 "POT-Creation-Date: 2018-10-11 15:54+0200\n"
    5 "PO-Revision-Date: 2018-10-11 15:55+0200\n"
     4"POT-Creation-Date: 2018-11-27 12:48+0100\n"
     5"PO-Revision-Date: 2018-11-27 12:49+0100\n"
    66"Last-Translator: Michael Uno <michael@michaeluno.jp>\n"
    77"Language-Team: \n"
     
    2424#: admin/class-google-fonts-localizer-admin-settings.php:24
    2525msgid "Place the import URL of the Google Font you want to import here."
    26 msgstr "Füge hier die Import URL der Google Fonts ein, die du importieren möchtest."
     26msgstr ""
     27"Füge hier die Import URL der Google Fonts ein, die du importieren möchtest."
    2728
    2829#: admin/class-google-fonts-localizer-admin-settings.php:32
    29 #: admin/class-google-fonts-localizer-admin-settings.php:42
    3030msgid "Re-Build Cache"
    3131msgstr "Cache neu aufbauen"
     
    3333#: admin/class-google-fonts-localizer-admin-settings.php:33
    3434msgid "Delete all Files and Folders associated with the Fonts Cache"
    35 msgstr "Lösche alle Dateien und Ordner, welche mit dem Font Cache in Verbindung stehen."
     35msgstr ""
     36"Lösche alle Dateien und Ordner, welche mit dem Font Cache in Verbindung "
     37"stehen."
     38
     39#: admin/class-google-fonts-localizer-admin-settings.php:42
     40msgid "Disable Fonts from"
     41msgstr "Schriften deaktivieren von"
    3642
    3743#: admin/class-google-fonts-localizer-admin-settings.php:44
     
    8793#~ msgstr "Tolleranz"
    8894
    89 #~ msgid "Value (in%) by how much smaller the image size may be than the actual displayed size."
    90 #~ msgstr "Wert (in %) um wie viel kleiner die Bildgröße sein darf (als die eigentliche Anzeigegröße)."
     95#~ msgid ""
     96#~ "Value (in%) by how much smaller the image size may be than the actual "
     97#~ "displayed size."
     98#~ msgstr ""
     99#~ "Wert (in %) um wie viel kleiner die Bildgröße sein darf (als die "
     100#~ "eigentliche Anzeigegröße)."
    91101
    92102#~ msgid "Overwrite settings"
  • hardcore-google-fonts-localizer/trunk/readme.txt

    r1956697 r1981281  
    66Requires at least: 4.8
    77Tested up to: 4.9.8
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.1
    99Requires PHP: 7.0
    1010
     
    5454
    5555== Changelog ==
     56= 1.0.0 =
     57Accommodated for Jupiter-Theme changes how fonts are handled
    5658
    5759= 1.0.0 =
Note: See TracChangeset for help on using the changeset viewer.