Google Fonts for WordPress - Version 3.0.13

Version Description

Download this release

Release Info

Developer DannyCooper
Plugin Icon 128x128 Google Fonts for WordPress
Version 3.0.13
Comparing to
See all releases

Code changes from version 3.0.12 to 3.0.13

.stylelintrc ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "extends": "stylelint-config-recommended",
3
+ "rules": {
4
+ "at-rule-no-unknown": [
5
+ true,
6
+ {
7
+ "ignoreAtRules": ["extends"]
8
+ }
9
+ ],
10
+ "block-no-empty": null,
11
+ "rule-empty-line-before": "always",
12
+ "font-weight-notation": "numeric",
13
+ "shorthand-property-no-redundant-values": true,
14
+ "number-no-trailing-zeros": true,
15
+ "unit-case": "lower",
16
+ "property-case": "lower",
17
+ "declaration-colon-space-before": "never",
18
+ "declaration-colon-space-after": "always",
19
+ "declaration-block-semicolon-newline-after": "always",
20
+ "block-closing-brace-newline-after": "always",
21
+ "selector-list-comma-newline-before": "never-multi-line",
22
+ "selector-list-comma-newline-after": "always",
23
+ "selector-list-comma-space-before": "never",
24
+ "max-empty-lines": 1,
25
+ "selector-combinator-space-after": "always",
26
+ "selector-combinator-space-before": "always",
27
+ }
28
+ }
admin/style.css CHANGED
@@ -22,43 +22,43 @@
22
  margin-bottom: 8px
23
  }
24
 
25
-
26
  .eb-content {
27
  background: #fff;
28
  border-radius: 3px;
29
  box-sizing: border-box;
30
- }
31
-
32
- .eb-content {
33
  margin: 0 auto;
34
  max-width: 740px;
35
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
36
  }
37
 
38
-
39
  .eb-content__header {
40
  border-top: 5px solid #b43534;
41
  border-radius: 5px 5px 0 0;
42
  }
 
43
  .eb-content__header h1 {
44
  font-size: 24px;
45
- padding: 50px 50px 0 50px;
46
  margin: 0
47
  }
 
48
  .eb-content__inner {
49
  background-color: #fff;
50
- padding: 25px 50px 50px 50px;
51
  }
52
 
53
  .eb-sidebar__inner {
54
  background-color: white;
55
  }
 
56
  .eb-sidebar__header {
57
  background-color: #0d72a7
58
  }
 
59
  .eb-sidebar__plugin {
60
- padding: 30px 30px;
61
  }
 
62
  .eb-sidebar__header h2 {
63
  color: #fff;
64
  font-size: 16px;
@@ -80,10 +80,12 @@
80
  margin-left: 8px;
81
  height: auto
82
  }
 
83
  #mce-EMAIL {
84
  padding: 5px 12px;
85
  min-height: 27px
86
  }
 
87
  .ebook-cover {
88
  float: right;
89
  max-width: 30%;
@@ -92,25 +94,32 @@
92
  }
93
 
94
  @media only screen and (max-width: 960px) {
 
95
  .eb-content {
96
  max-width: 98%;
97
  float: none;
98
  }
 
99
  .eb-wrap {
100
  margin: 1%;
101
  }
 
102
  }
103
  @media only screen and (max-width: 480px) {
 
104
  .ebook-cover {
105
  display: none
106
  }
 
107
  #mce-EMAIL {
108
  padding: 5px 12px;
109
  width: 100%;
110
  margin-bottom: 10px;
111
- }
 
112
  .eb-wrap .button {
113
  width: 100%;
114
  margin-left: 0;
115
  }
 
116
  }
22
  margin-bottom: 8px
23
  }
24
 
 
25
  .eb-content {
26
  background: #fff;
27
  border-radius: 3px;
28
  box-sizing: border-box;
 
 
 
29
  margin: 0 auto;
30
  max-width: 740px;
31
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
32
  }
33
 
 
34
  .eb-content__header {
35
  border-top: 5px solid #b43534;
36
  border-radius: 5px 5px 0 0;
37
  }
38
+
39
  .eb-content__header h1 {
40
  font-size: 24px;
41
+ padding: 50px 50px 0;
42
  margin: 0
43
  }
44
+
45
  .eb-content__inner {
46
  background-color: #fff;
47
+ padding: 25px 50px 50px;
48
  }
49
 
50
  .eb-sidebar__inner {
51
  background-color: white;
52
  }
53
+
54
  .eb-sidebar__header {
55
  background-color: #0d72a7
56
  }
57
+
58
  .eb-sidebar__plugin {
59
+ padding: 30px;
60
  }
61
+
62
  .eb-sidebar__header h2 {
63
  color: #fff;
64
  font-size: 16px;
80
  margin-left: 8px;
81
  height: auto
82
  }
83
+
84
  #mce-EMAIL {
85
  padding: 5px 12px;
86
  min-height: 27px
87
  }
88
+
89
  .ebook-cover {
90
  float: right;
91
  max-width: 30%;
94
  }
95
 
96
  @media only screen and (max-width: 960px) {
97
+
98
  .eb-content {
99
  max-width: 98%;
100
  float: none;
101
  }
102
+
103
  .eb-wrap {
104
  margin: 1%;
105
  }
106
+
107
  }
108
  @media only screen and (max-width: 480px) {
109
+
110
  .ebook-cover {
111
  display: none
112
  }
113
+
114
  #mce-EMAIL {
115
  padding: 5px 12px;
116
  width: 100%;
117
  margin-bottom: 10px;
118
+ }
119
+
120
  .eb-wrap .button {
121
  width: 100%;
122
  margin-left: 0;
123
  }
124
+
125
  }
assets/css/customize-controls.css CHANGED
@@ -20,14 +20,6 @@
20
  display: none;
21
  }
22
 
23
- .typography-font-size,
24
- .typography-line-height,
25
- .typography-font-color,
26
- .typography-letter-spacing,
27
- .typography-text-transform {
28
- display: none;
29
- }
30
-
31
  .customize-control-typography li.typography-font-family select {
32
  width: 85%;
33
  }
@@ -77,10 +69,13 @@
77
  .customize-control-typography .advanced-settings-wrapper.show {
78
  display: block !important;
79
  margin-top: 10px;
80
- padding: 10px;
81
  background: #dadada;
82
  }
83
 
 
 
 
 
84
  .advanced-settings-wrapper:after {
85
  content: '';
86
  display: table;
@@ -128,10 +123,10 @@
128
  position: relative;
129
  vertical-align: middle;
130
  font-size: 13px;
131
- -moz-user-select: none;
132
- -ms-user-select: none;
133
  -webkit-user-select: none;
134
- user-select: none;
135
  }
136
 
137
  .chosen-container * {
@@ -149,7 +144,7 @@
149
  border-top: 0;
150
  background: #ffffff;
151
  -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
152
- box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
153
  }
154
 
155
  .chosen-container.chosen-with-drop .chosen-drop {
@@ -166,7 +161,7 @@
166
  color: #999999;
167
  overflow: hidden;
168
  text-overflow: ellipsis;
169
- font-weight: normal;
170
  white-space: nowrap;
171
  }
172
 
@@ -353,7 +348,7 @@
353
 
354
  .chosen-container .chosen-results li.group-result {
355
  display: list-item;
356
- font-weight: bold;
357
  cursor: default;
358
  }
359
 
@@ -700,79 +695,93 @@
700
  .slider-custom-control {
701
  margin-bottom: 30px;
702
  }
 
703
  .slider-custom-control input[type=number]::-webkit-inner-spin-button,
704
  .slider-custom-control input[type=number]::-webkit-outer-spin-button {
705
  -webkit-appearance: none;
706
  margin: 0;
707
  }
708
- .slider-custom-control input[type=number] {
709
- -moz-appearance: textfield;
710
- }
711
  .slider-custom-control .customize-control-title {
712
  display: inline-block;
713
  }
 
714
  .slider-custom-control input[type=number] {
715
  text-align: right;
716
  width: 50px;
717
  float: right;
 
718
  }
 
719
  .slider-custom-control .slider {
720
  width: 65%;
721
  float: left;
722
- margin: 10px 0 10px;
723
  }
 
724
  .slider-custom-control .slider-reset {
725
  float: right;
726
  cursor: pointer;
727
  }
 
728
  .slider-custom-control .slider-value {
729
  border: none;
730
  text-align: right;
731
  width: 50px;
732
  margin-right: 5px;
733
  }
 
734
  .slider-custom-control .slider-value,
735
  .slider-custom-control .slider-unit {
736
  float: right;
737
  }
 
738
  .slider-custom-control .ui-widget.ui-widget-content {
739
  border: 1px solid #f4f4f4;
740
  }
 
741
  .slider-custom-control .ui-corner-all,
742
  .slider-custom-control .ui-corner-bottom,
743
  .slider-custom-control .ui-corner-right,
744
  .slider-custom-control .ui-corner-br {
745
  border-bottom-right-radius: 3px;
746
  }
 
747
  .slider-custom-control .ui-corner-all,
748
  .slider-custom-control .ui-corner-bottom,
749
  .slider-custom-control .ui-corner-left,
750
  .slider-custom-control .ui-corner-bl {
751
  border-bottom-left-radius: 3px;
752
  }
 
753
  .slider-custom-control .ui-corner-all,
754
  .slider-custom-control .ui-corner-top,
755
  .slider-custom-control .ui-corner-right,
756
  .slider-custom-control .ui-corner-tr {
757
  border-top-right-radius: 3px;
758
  }
 
759
  .slider-custom-control .ui-corner-all,
760
  .slider-custom-control .ui-corner-top,
761
  .slider-custom-control .ui-corner-left,
762
  .slider-custom-control .ui-corner-tl {
763
  border-top-left-radius: 3px;
764
  }
 
765
  .slider-custom-control .ui-widget-content {
766
  background: #f4f4f4 none repeat scroll 0 0;
767
  color: #333;
768
  }
 
769
  .slider-custom-control .ui-slider-horizontal {
770
  height: 3px;
771
  }
 
772
  .slider-custom-control .ui-slider {
773
  position: relative;
774
  text-align: left;
775
  }
 
776
  .slider-custom-control .ui-state-default,
777
  .slider-custom-control .ui-widget-content .ui-state-default,
778
  .slider-custom-control .ui-widget-header .ui-state-default,
@@ -782,13 +791,15 @@
782
  background: #2885bb none repeat scroll 0 0;
783
  border: 1px solid #2885bb;
784
  color: #454545;
785
- font-weight: normal;
786
  }
 
787
  .slider-custom-control .ui-slider-horizontal .ui-slider-handle {
788
  margin-left: -7px;
789
  top: -7px;
790
  border-radius: 50%;
791
  }
 
792
  .slider-custom-control .ui-slider .ui-slider-handle {
793
  cursor: pointer;
794
  height: 14px;
@@ -796,11 +807,13 @@
796
  width: 14px;
797
  z-index: 2;
798
  }
 
799
  .slider-custom-control .dashicons-image-rotate {
800
  color: #989898;
801
  font-size: 16px;
802
  margin-top: 3px;
803
  }
 
804
  .slider-custom-control .dashicons-image-rotate:hover {
805
  color: #a7a7a7;
806
  }
@@ -835,3 +848,7 @@
835
  background-size: 16px !important;
836
  background-position: 15px 50% !important;
837
  }
 
 
 
 
20
  display: none;
21
  }
22
 
 
 
 
 
 
 
 
 
23
  .customize-control-typography li.typography-font-family select {
24
  width: 85%;
25
  }
69
  .customize-control-typography .advanced-settings-wrapper.show {
70
  display: block !important;
71
  margin-top: 10px;
 
72
  background: #dadada;
73
  }
74
 
75
+ .customize-control-typography .inner {
76
+ padding: 10px
77
+ }
78
+
79
  .advanced-settings-wrapper:after {
80
  content: '';
81
  display: table;
123
  position: relative;
124
  vertical-align: middle;
125
  font-size: 13px;
126
+ -moz-user-select: none;
127
+ -ms-user-select: none;
128
  -webkit-user-select: none;
129
+ user-select: none;
130
  }
131
 
132
  .chosen-container * {
144
  border-top: 0;
145
  background: #ffffff;
146
  -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
147
+ box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
148
  }
149
 
150
  .chosen-container.chosen-with-drop .chosen-drop {
161
  color: #999999;
162
  overflow: hidden;
163
  text-overflow: ellipsis;
164
+ font-weight: 400;
165
  white-space: nowrap;
166
  }
167
 
348
 
349
  .chosen-container .chosen-results li.group-result {
350
  display: list-item;
351
+ font-weight: 400;
352
  cursor: default;
353
  }
354
 
695
  .slider-custom-control {
696
  margin-bottom: 30px;
697
  }
698
+
699
  .slider-custom-control input[type=number]::-webkit-inner-spin-button,
700
  .slider-custom-control input[type=number]::-webkit-outer-spin-button {
701
  -webkit-appearance: none;
702
  margin: 0;
703
  }
704
+
 
 
705
  .slider-custom-control .customize-control-title {
706
  display: inline-block;
707
  }
708
+
709
  .slider-custom-control input[type=number] {
710
  text-align: right;
711
  width: 50px;
712
  float: right;
713
+ -moz-appearance: textfield;
714
  }
715
+
716
  .slider-custom-control .slider {
717
  width: 65%;
718
  float: left;
719
+ margin: 10px 0 10px 6px;
720
  }
721
+
722
  .slider-custom-control .slider-reset {
723
  float: right;
724
  cursor: pointer;
725
  }
726
+
727
  .slider-custom-control .slider-value {
728
  border: none;
729
  text-align: right;
730
  width: 50px;
731
  margin-right: 5px;
732
  }
733
+
734
  .slider-custom-control .slider-value,
735
  .slider-custom-control .slider-unit {
736
  float: right;
737
  }
738
+
739
  .slider-custom-control .ui-widget.ui-widget-content {
740
  border: 1px solid #f4f4f4;
741
  }
742
+
743
  .slider-custom-control .ui-corner-all,
744
  .slider-custom-control .ui-corner-bottom,
745
  .slider-custom-control .ui-corner-right,
746
  .slider-custom-control .ui-corner-br {
747
  border-bottom-right-radius: 3px;
748
  }
749
+
750
  .slider-custom-control .ui-corner-all,
751
  .slider-custom-control .ui-corner-bottom,
752
  .slider-custom-control .ui-corner-left,
753
  .slider-custom-control .ui-corner-bl {
754
  border-bottom-left-radius: 3px;
755
  }
756
+
757
  .slider-custom-control .ui-corner-all,
758
  .slider-custom-control .ui-corner-top,
759
  .slider-custom-control .ui-corner-right,
760
  .slider-custom-control .ui-corner-tr {
761
  border-top-right-radius: 3px;
762
  }
763
+
764
  .slider-custom-control .ui-corner-all,
765
  .slider-custom-control .ui-corner-top,
766
  .slider-custom-control .ui-corner-left,
767
  .slider-custom-control .ui-corner-tl {
768
  border-top-left-radius: 3px;
769
  }
770
+
771
  .slider-custom-control .ui-widget-content {
772
  background: #f4f4f4 none repeat scroll 0 0;
773
  color: #333;
774
  }
775
+
776
  .slider-custom-control .ui-slider-horizontal {
777
  height: 3px;
778
  }
779
+
780
  .slider-custom-control .ui-slider {
781
  position: relative;
782
  text-align: left;
783
  }
784
+
785
  .slider-custom-control .ui-state-default,
786
  .slider-custom-control .ui-widget-content .ui-state-default,
787
  .slider-custom-control .ui-widget-header .ui-state-default,
791
  background: #2885bb none repeat scroll 0 0;
792
  border: 1px solid #2885bb;
793
  color: #454545;
794
+ font-weight: 400;
795
  }
796
+
797
  .slider-custom-control .ui-slider-horizontal .ui-slider-handle {
798
  margin-left: -7px;
799
  top: -7px;
800
  border-radius: 50%;
801
  }
802
+
803
  .slider-custom-control .ui-slider .ui-slider-handle {
804
  cursor: pointer;
805
  height: 14px;
807
  width: 14px;
808
  z-index: 2;
809
  }
810
+
811
  .slider-custom-control .dashicons-image-rotate {
812
  color: #989898;
813
  font-size: 16px;
814
  margin-top: 3px;
815
  }
816
+
817
  .slider-custom-control .dashicons-image-rotate:hover {
818
  color: #a7a7a7;
819
  }
848
  background-size: 16px !important;
849
  background-position: 15px 50% !important;
850
  }
851
+
852
+ .customize-control-typography .customize-control-title {
853
+ font-size: 13px;
854
+ }
assets/js/customize-controls.js CHANGED
@@ -4,6 +4,39 @@
4
  {
5
  ready: function() {
6
  const control = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  // Load the Google Font for the preview.
9
  function addGoogleFont( fontName ) {
4
  {
5
  ready: function() {
6
  const control = this;
7
+ const controlClass = '.customize-control-typography';
8
+ const footerActions = jQuery( '#customize-footer-actions' );
9
+ //
10
+ // Do stuff when device icons are clicked
11
+ jQuery( control.selector + ' .ogf-device-controls > div' ).on( 'click', function( event ) {
12
+ console.log(event);
13
+ var device = jQuery( this ).data( 'option' );
14
+ wp.customize.previewedDevice.set( device );
15
+
16
+ jQuery( controlClass + ' .ogf-device-controls div' ).each( function() {
17
+ var _this = jQuery( this );
18
+
19
+ if ( device === _this.attr( 'data-option' ) ) {
20
+ _this.addClass( 'selected' );
21
+ _this.siblings().removeClass( 'selected' );
22
+ }
23
+ } );
24
+
25
+ });
26
+
27
+ // Set the selected devices in our control when the Customizer devices are clicked
28
+ footerActions.find( '.devices button' ).on( 'click', function() {
29
+ var device = jQuery( this ).data( 'device' );
30
+
31
+ jQuery( controlClass + ' .ogf-device-controls div' ).each( function() {
32
+ var _this = jQuery( this );
33
+
34
+ if ( device === _this.attr( 'data-option' ) ) {
35
+ _this.addClass( 'selected' );
36
+ _this.siblings().removeClass( 'selected' );
37
+ }
38
+ } );
39
+ });
40
 
41
  // Load the Google Font for the preview.
42
  function addGoogleFont( fontName ) {
changelog.txt CHANGED
@@ -1,6 +1,6 @@
1
- = 3.0.12 =
2
 
3
- * Version bump
4
 
5
  = 3.0.11 =
6
 
1
+ = 3.0.13 =
2
 
3
+ * Fix issue where resource hints were being loaded when using local fonts
4
 
5
  = 3.0.11 =
6
 
class-olympus-google-fonts.php CHANGED
@@ -39,7 +39,7 @@ class Olympus_Google_Fonts {
39
  */
40
  public function constants() {
41
  if ( ! defined( 'OGF_VERSION' ) ) {
42
- define( 'OGF_VERSION', '3.0.12' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
@@ -134,6 +134,12 @@ class Olympus_Google_Fonts {
134
  * @return array $urls URLs to print for resource hints.
135
  */
136
  public function resource_hints( $urls, $relation_type ) {
 
 
 
 
 
 
137
  if ( wp_style_is( 'olympus-google-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
138
  $urls[] = array(
139
  'href' => 'https://fonts.gstatic.com',
@@ -175,6 +181,7 @@ class Olympus_Google_Fonts {
175
  * Add custom links to plugin settings page.
176
  *
177
  * @param array $links Current links array.
 
178
  */
179
  public function links( $links ) {
180
  // Customizer Settings Link.
39
  */
40
  public function constants() {
41
  if ( ! defined( 'OGF_VERSION' ) ) {
42
+ define( 'OGF_VERSION', '3.0.13' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
134
  * @return array $urls URLs to print for resource hints.
135
  */
136
  public function resource_hints( $urls, $relation_type ) {
137
+
138
+ // If we are using local fonts we don't need this.
139
+ if ( get_theme_mod( 'fpp_host_locally' ) === true ) {
140
+ return $urls;
141
+ }
142
+
143
  if ( wp_style_is( 'olympus-google-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
144
  $urls[] = array(
145
  'href' => 'https://fonts.gstatic.com',
181
  * Add custom links to plugin settings page.
182
  *
183
  * @param array $links Current links array.
184
+ * @return array $links Modified links array.
185
  */
186
  public function links( $links ) {
187
  // Customizer Settings Link.
includes/class-ogf-classic-editor.php CHANGED
@@ -13,13 +13,6 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
13
  */
14
  class OGF_Classic_Editor {
15
 
16
- /**
17
- * WP_Customize object.
18
- *
19
- * @var WP_Customize_Manager
20
- */
21
- private $wp_customize;
22
-
23
  /**
24
  * OGF_Fonts object.
25
  *
@@ -70,7 +63,8 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
70
  /**
71
  * Add buttons to the editor.
72
  *
73
- * @param array $buttons Tiny MCE buttons.
 
74
  */
75
  public function tinymce_add_buttons( $buttons ) {
76
  return array_merge(
@@ -83,6 +77,7 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
83
  * Customize the Tiny MCE settings.
84
  *
85
  * @param array $opt Tiny MCE options.
 
86
  */
87
  public function tinymce_custom_options( $opt ) {
88
  $base_type = get_theme_mod( 'ogf_body_font' );
@@ -130,7 +125,8 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
130
  /**
131
  * Add fonts to the classic editor list.
132
  *
133
- * @param array $old_default The default fonts.
 
134
  */
135
  public function tinymce_add_fonts( $old_default ) {
136
  $new_default = '';
13
  */
14
  class OGF_Classic_Editor {
15
 
 
 
 
 
 
 
 
16
  /**
17
  * OGF_Fonts object.
18
  *
63
  /**
64
  * Add buttons to the editor.
65
  *
66
+ * @param array $buttons Tiny MCE buttons array.
67
+ * @return array Modified Tiny MCE buttons array.
68
  */
69
  public function tinymce_add_buttons( $buttons ) {
70
  return array_merge(
77
  * Customize the Tiny MCE settings.
78
  *
79
  * @param array $opt Tiny MCE options.
80
+ * @return array Modified Tiny MCE options.
81
  */
82
  public function tinymce_custom_options( $opt ) {
83
  $base_type = get_theme_mod( 'ogf_body_font' );
125
  /**
126
  * Add fonts to the classic editor list.
127
  *
128
+ * @param string $old_default The default fonts.
129
+ * @return string Modified fonts string.
130
  */
131
  public function tinymce_add_fonts( $old_default ) {
132
  $new_default = '';
includes/class-ogf-fonts-taxonomy.php CHANGED
@@ -12,28 +12,28 @@ class OGF_Fonts_Taxonomy {
12
  /**
13
  * Instance of OGF_Fonts_Taxonomy
14
  *
15
- * @var (Object) OGF_Fonts_Taxonomy
16
  */
17
  private static $instance = null;
18
 
19
  /**
20
  * Fonts
21
  *
22
- * @var (string) $fonts
23
  */
24
  public static $fonts = null;
25
 
26
  /**
27
  * Capability required for this menu to be displayed
28
  *
29
- * @var (string) $capability
30
  */
31
  public static $capability = 'edit_theme_options';
32
 
33
  /**
34
  * Register Taxonomy
35
  *
36
- * @var (string) $register_taxonomy
37
  */
38
  public static $taxonomy_slug = 'ogf_custom_fonts';
39
 
@@ -98,6 +98,7 @@ class OGF_Fonts_Taxonomy {
98
  * Default fonts
99
  *
100
  * @param array $fonts fonts array of fonts.
 
101
  */
102
  protected static function default_args( $fonts ) {
103
  return wp_parse_args(
@@ -130,7 +131,7 @@ class OGF_Fonts_Taxonomy {
130
 
131
  if ( ! empty( $terms ) ) {
132
  foreach ( $terms as $term ) {
133
- self::$fonts[ $term->slug ]['id'] = $term->slug;
134
  self::$fonts[ $term->slug ]['label'] = $term->name;
135
  self::$fonts[ $term->slug ]['stack'] = $term->slug;
136
  self::$fonts[ $term->slug ]['files'] = self::get_font_links( $term->term_id );
12
  /**
13
  * Instance of OGF_Fonts_Taxonomy
14
  *
15
+ * @var object OGF_Fonts_Taxonomy
16
  */
17
  private static $instance = null;
18
 
19
  /**
20
  * Fonts
21
  *
22
+ * @var array $fonts
23
  */
24
  public static $fonts = null;
25
 
26
  /**
27
  * Capability required for this menu to be displayed
28
  *
29
+ * @var string $capability
30
  */
31
  public static $capability = 'edit_theme_options';
32
 
33
  /**
34
  * Register Taxonomy
35
  *
36
+ * @var string $register_taxonomy
37
  */
38
  public static $taxonomy_slug = 'ogf_custom_fonts';
39
 
98
  * Default fonts
99
  *
100
  * @param array $fonts fonts array of fonts.
101
+ * @return array
102
  */
103
  protected static function default_args( $fonts ) {
104
  return wp_parse_args(
131
 
132
  if ( ! empty( $terms ) ) {
133
  foreach ( $terms as $term ) {
134
+ self::$fonts[ $term->slug ]['id'] = $term->slug;
135
  self::$fonts[ $term->slug ]['label'] = $term->name;
136
  self::$fonts[ $term->slug ]['stack'] = $term->slug;
137
  self::$fonts[ $term->slug ]['files'] = self::get_font_links( $term->term_id );
includes/class-ogf-fonts.php CHANGED
@@ -11,7 +11,6 @@
11
  * This class builds the Google Fonts URL.
12
  */
13
  class OGF_Fonts {
14
-
15
  /**
16
  * All Google Fonts.
17
  *
@@ -133,10 +132,11 @@ class OGF_Fonts {
133
  }
134
 
135
  /**
136
- * Remove the fonts the user has chosen not to load.
137
  *
138
  * @param string $font_id The font ID.
139
- * @param string $weights The font weights.
 
140
  */
141
  public function filter_selected_weights( $font_id, $weights ) {
142
  unset( $weights['0'] );
@@ -154,20 +154,21 @@ class OGF_Fonts {
154
  }
155
 
156
  /**
157
- * Return the Google Fonts url.
 
 
158
  */
159
  public function build_url() {
160
  $families = array();
161
  $subsets = array();
162
 
163
  if ( empty( $this->choices ) ) {
164
- return;
165
  }
166
 
167
  $fonts = array_unique( $this->choices );
168
 
169
  foreach ( $fonts as $font_id ) {
170
-
171
  // Check the users choice is a real font.
172
  if ( array_key_exists( $font_id, self::$google_fonts ) ) {
173
 
@@ -176,7 +177,6 @@ class OGF_Fonts {
176
  $weights = $this->filter_selected_weights( $font_id, self::$google_fonts[ $font_id ]['v'] );
177
 
178
  $families[] = $font_id_for_url . ':' . implode( ',', array_keys( $weights ) );
179
-
180
  }
181
  }
182
 
@@ -188,5 +188,4 @@ class OGF_Fonts {
188
 
189
  return add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
190
  }
191
-
192
  }
11
  * This class builds the Google Fonts URL.
12
  */
13
  class OGF_Fonts {
 
14
  /**
15
  * All Google Fonts.
16
  *
132
  }
133
 
134
  /**
135
+ * Remove the font variants the user has chosen not to load.
136
  *
137
  * @param string $font_id The font ID.
138
+ * @param array $weights The font weights.
139
+ * @return array
140
  */
141
  public function filter_selected_weights( $font_id, $weights ) {
142
  unset( $weights['0'] );
154
  }
155
 
156
  /**
157
+ * Return the Google Fonts URL.
158
+ *
159
+ * @return false|string
160
  */
161
  public function build_url() {
162
  $families = array();
163
  $subsets = array();
164
 
165
  if ( empty( $this->choices ) ) {
166
+ return false;
167
  }
168
 
169
  $fonts = array_unique( $this->choices );
170
 
171
  foreach ( $fonts as $font_id ) {
 
172
  // Check the users choice is a real font.
173
  if ( array_key_exists( $font_id, self::$google_fonts ) ) {
174
 
177
  $weights = $this->filter_selected_weights( $font_id, self::$google_fonts[ $font_id ]['v'] );
178
 
179
  $families[] = $font_id_for_url . ':' . implode( ',', array_keys( $weights ) );
 
180
  }
181
  }
182
 
188
 
189
  return add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
190
  }
 
191
  }
includes/class-ogf-notifications.php CHANGED
@@ -31,7 +31,7 @@ if ( ! class_exists( 'OGF_Notifications' ) ) :
31
  /**
32
  * Time limit.
33
  *
34
- * @var string $time_limit
35
  */
36
  private $time_limit;
37
 
@@ -52,7 +52,7 @@ if ( ! class_exists( 'OGF_Notifications' ) ) :
52
  /**
53
  * Class constructor.
54
  *
55
- * @param string $args Arguments.
56
  */
57
  public function __construct( $args ) {
58
  $this->slug = $args['slug'];
@@ -72,7 +72,8 @@ if ( ! class_exists( 'OGF_Notifications' ) ) :
72
  /**
73
  * Seconds to words.
74
  *
75
- * @param string $seconds Seconds in time.
 
76
  */
77
  public function seconds_to_words( $seconds ) {
78
  // Get the years.
@@ -85,14 +86,16 @@ if ( ! class_exists( 'OGF_Notifications' ) ) :
85
  $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
86
  if ( $weeks > 1 ) {
87
  /* translators: Number of weeks */
88
- return sprintf( __( 'a week', '%s weeks', $weeks, 'olympus-google-fonts' ), $weeks );
89
  }
90
  // Get the days.
91
  $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
92
  if ( $days > 1 ) {
93
  /* translators: Number of days */
94
- return sprintf( __( '%s days', 'olympus-google-fonts' ), $days );
95
  }
 
 
96
  }
97
 
98
  /**
31
  /**
32
  * Time limit.
33
  *
34
+ * @var int $time_limit
35
  */
36
  private $time_limit;
37
 
52
  /**
53
  * Class constructor.
54
  *
55
+ * @param array $args Arguments.
56
  */
57
  public function __construct( $args ) {
58
  $this->slug = $args['slug'];
72
  /**
73
  * Seconds to words.
74
  *
75
+ * @param int $seconds Seconds in time.
76
+ * @return string
77
  */
78
  public function seconds_to_words( $seconds ) {
79
  // Get the years.
86
  $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
87
  if ( $weeks > 1 ) {
88
  /* translators: Number of weeks */
89
+ return sprintf( _n( 'a week', '%s weeks', $weeks, 'olympus-google-fonts' ), $weeks );
90
  }
91
  // Get the days.
92
  $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
93
  if ( $days > 1 ) {
94
  /* translators: Number of days */
95
+ return sprintf( _n( '%s day', '%s days', $days, 'olympus-google-fonts' ), $days );
96
  }
97
+
98
+ return sprintf( _n( '%s second', '%s seconds', $seconds, 'olympus-google-fonts' ), intval( $seconds ) );
99
  }
100
 
101
  /**
includes/class-ogf-welcome.php CHANGED
@@ -58,7 +58,7 @@ if ( ! class_exists( 'OGF_Welcome' ) ) :
58
  */
59
  public function enqueue() {
60
 
61
- wp_enqueue_script( 'ogf-admin', esc_url( OGF_DIR_URL . 'assets/js/admin.js' ), 'jquery', OGF_VERSION, false );
62
 
63
  }
64
 
58
  */
59
  public function enqueue() {
60
 
61
+ wp_enqueue_script( 'ogf-admin', esc_url( OGF_DIR_URL . 'assets/js/admin.js' ), array( 'jquery' ), OGF_VERSION, false );
62
 
63
  }
64
 
includes/customizer/controls/class-ogf-customize-multiple-checkbox-control.php CHANGED
@@ -24,8 +24,6 @@ class OGF_Customize_Multiple_Checkbox_Control extends WP_Customize_Control {
24
  public $type = 'multiple-checkbox';
25
  /**
26
  * Enqueue control related scripts/styles.
27
- *
28
- * @access public
29
  */
30
  public function enqueue() {
31
  wp_enqueue_script( 'ogf-multicheck', OGF_DIR_URL . 'assets/js/multiple-checkbox.js', array( 'jquery' ), OGF_VERSION, true );
@@ -54,10 +52,6 @@ class OGF_Customize_Multiple_Checkbox_Control extends WP_Customize_Control {
54
 
55
  /**
56
  * Overwrite this method as we are rendering the template with JS.
57
- *
58
- * @access protected
59
- * @since 1.0
60
- * @return void
61
  */
62
  protected function render_content() {}
63
 
@@ -95,5 +89,4 @@ class OGF_Customize_Multiple_Checkbox_Control extends WP_Customize_Control {
95
  </ul>
96
  <?php
97
  }
98
-
99
  }
24
  public $type = 'multiple-checkbox';
25
  /**
26
  * Enqueue control related scripts/styles.
 
 
27
  */
28
  public function enqueue() {
29
  wp_enqueue_script( 'ogf-multicheck', OGF_DIR_URL . 'assets/js/multiple-checkbox.js', array( 'jquery' ), OGF_VERSION, true );
52
 
53
  /**
54
  * Overwrite this method as we are rendering the template with JS.
 
 
 
 
55
  */
56
  protected function render_content() {}
57
 
89
  </ul>
90
  <?php
91
  }
 
92
  }
includes/customizer/controls/class-ogf-customize-panel.php CHANGED
@@ -33,6 +33,8 @@ class OGF_Customize_Panel extends WP_Customize_Panel {
33
 
34
  /**
35
  * Gather the parameters passed to client JavaScript via JSON.
 
 
36
  */
37
  public function json() {
38
  $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type', 'panel' ) );
33
 
34
  /**
35
  * Gather the parameters passed to client JavaScript via JSON.
36
+ *
37
+ * @return array
38
  */
39
  public function json() {
40
  $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type', 'panel' ) );
includes/customizer/controls/class-ogf-customize-repeater-control.php CHANGED
@@ -117,7 +117,7 @@ class OGF_Customize_Repeater_Control extends WP_Customize_Control {
117
  * Input Control
118
  *
119
  * @param object $values Values for the controls.
120
- * @param string $count Count how many controls have been displayed so far.
121
  */
122
  private function input_control( $values = '', $count = 0 ) {
123
  $label = ( isset( $values->label ) ? $values->label : '' );
117
  * Input Control
118
  *
119
  * @param object $values Values for the controls.
120
+ * @param int $count Count how many controls have been displayed so far.
121
  */
122
  private function input_control( $values = '', $count = 0 ) {
123
  $label = ( isset( $values->label ) ? $values->label : '' );
includes/customizer/controls/class-ogf-customize-typography-control.php CHANGED
@@ -16,7 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  * Typography control class.
17
  */
18
  class OGF_Customize_Typography_Control extends WP_Customize_Control {
19
-
20
  /**
21
  * The type of customize control being rendered.
22
  *
@@ -27,7 +26,7 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
27
  /**
28
  * Array
29
  *
30
- * @var string
31
  */
32
  public $l10n = array();
33
 
@@ -95,8 +94,6 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
95
  /**
96
  * Overwrite this method as we are rendering the template with JS.
97
  *
98
- * @access protected
99
- * @since 1.0
100
  * @return void
101
  */
102
  protected function render_content() {}
@@ -154,9 +151,8 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
154
  </button>
155
  </li>
156
  <# } #>
157
-
158
-
159
  <div class="advanced-settings-wrapper">
 
160
  <# if ( data.weight && data.weight.choices ) { #>
161
  <li class="typography-font-weight">
162
  <# if ( data.weight.label ) { #>
@@ -183,70 +179,8 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
183
  </li>
184
  <# } #>
185
 
186
- <# if ( data.color ) { #>
187
- <li class="typography-font-color">
188
- <# if ( data.color.label ) { #>
189
- <span class="customize-control-title">{{ data.color.label }}</span>
190
- <# } #>
191
- <input class="color-picker-hex" type="text" maxlength="7" {{{ data.color.link }}} value="{{ data.color.value }}" />
192
- </li>
193
- <# } #>
194
-
195
- <# if ( data.size ) { #>
196
- <li class="typography-font-size">
197
- <div class="slider-custom-control">
198
- <# if ( data.size.label ) { #>
199
- <span class="customize-control-title">{{ data.size.label }}</span>
200
- <# } #>
201
- <span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="{{ data.size.value }}"></span>
202
- <div class="slider" slider-min-value="1" slider-max-value="72" slider-step-value="1"></div>
203
- <input class="customize-control-slider-value" {{{ data.size.link }}} type="number" value="{{ data.size.value }}">
204
- </div>
205
- </li>
206
- <# } #>
207
-
208
- <# if ( data.line_height ) { #>
209
- <li class="typography-line-height">
210
- <div class="slider-custom-control">
211
- <# if ( data.line_height.label ) { #>
212
- <span class="customize-control-title">{{ data.line_height.label }}</span>
213
- <# } #>
214
- <span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="{{ data.line_height.value }}"></span>
215
-
216
- <div class="slider" slider-min-value="0" slider-max-value="3" slider-step-value=".1"></div>
217
- <input class="customize-control-slider-value" {{{ data.line_height.link }}} type="number" value="{{ data.line_height.value }}">
218
- </div>
219
- </li>
220
- <# } #>
221
-
222
- <# if ( data.letter_spacing ) { #>
223
- <li class="typography-letter-spacing">
224
- <div class="slider-custom-control">
225
- <# if ( data.letter_spacing.label ) { #>
226
- <span class="customize-control-title">{{ data.letter_spacing.label }}</span>
227
- <# } #>
228
- <span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="{{ data.letter_spacing.value }}"></span>
229
- <div class="slider" slider-min-value="-5" slider-max-value="5" slider-step-value=".1"></div>
230
- <input class="customize-control-slider-value" {{{ data.letter_spacing.link }}} type="number" value="{{ data.letter_spacing.value }}">
231
- </div>
232
- </li>
233
- <# } #>
234
-
235
- <# if ( data.text_transform && data.text_transform.choices ) { #>
236
- <li class="typography-text-transform">
237
- <# if ( data.text_transform.label ) { #>
238
- <span class="customize-control-title">{{ data.text_transform.label }}</span>
239
- <# } #>
240
- <select {{{ data.text_transform.link }}}>
241
- <# _.each( data.text_transform.choices, function( label, choice ) { #>
242
- <option value="{{ choice }}" <# if ( choice === data.text_transform.value ) { #> selected="selected" <# } #>>{{ label }}</option>
243
- <# } ) #>
244
- </select>
245
- </li>
246
- <# } #>
247
-
248
  </div>
249
-
250
  </ul>
251
  <?php
252
  }
@@ -255,6 +189,7 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
255
  * Returns the available font weights.
256
  *
257
  * @param string $font User's font choice.
 
258
  */
259
  public function get_font_weight_choices( $font ) {
260
 
@@ -280,7 +215,7 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
280
  $fonts_array = ogf_typekit_fonts();
281
 
282
  if ( ! array_key_exists( $font, $fonts_array ) ) {
283
- return;
284
  }
285
 
286
  $variants = $fonts_array[ $font ]['variants'];
@@ -303,6 +238,8 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
303
 
304
  /**
305
  * Returns the available font styles.
 
 
306
  */
307
  public function get_font_style_choices() {
308
  return array(
@@ -315,6 +252,8 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
315
 
316
  /**
317
  * Returns the available text-transform values.
 
 
318
  */
319
  public function get_text_transform_choices() {
320
  return array(
@@ -325,5 +264,4 @@ class OGF_Customize_Typography_Control extends WP_Customize_Control {
325
  'none' => esc_html__( 'None', 'olympus-google-fonts' ),
326
  );
327
  }
328
-
329
  }
16
  * Typography control class.
17
  */
18
  class OGF_Customize_Typography_Control extends WP_Customize_Control {
 
19
  /**
20
  * The type of customize control being rendered.
21
  *
26
  /**
27
  * Array
28
  *
29
+ * @var array
30
  */
31
  public $l10n = array();
32
 
94
  /**
95
  * Overwrite this method as we are rendering the template with JS.
96
  *
 
 
97
  * @return void
98
  */
99
  protected function render_content() {}
151
  </button>
152
  </li>
153
  <# } #>
 
 
154
  <div class="advanced-settings-wrapper">
155
+ <div class="inner">
156
  <# if ( data.weight && data.weight.choices ) { #>
157
  <li class="typography-font-weight">
158
  <# if ( data.weight.label ) { #>
179
  </li>
180
  <# } #>
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </div>
183
+ </div>
184
  </ul>
185
  <?php
186
  }
189
  * Returns the available font weights.
190
  *
191
  * @param string $font User's font choice.
192
+ * @return array Available font variants.
193
  */
194
  public function get_font_weight_choices( $font ) {
195
 
215
  $fonts_array = ogf_typekit_fonts();
216
 
217
  if ( ! array_key_exists( $font, $fonts_array ) ) {
218
+ return array();
219
  }
220
 
221
  $variants = $fonts_array[ $font ]['variants'];
238
 
239
  /**
240
  * Returns the available font styles.
241
+ *
242
+ * @return array CSS font-style values.
243
  */
244
  public function get_font_style_choices() {
245
  return array(
252
 
253
  /**
254
  * Returns the available text-transform values.
255
+ *
256
+ * @return array CSS text-transform values.
257
  */
258
  public function get_text_transform_choices() {
259
  return array(
264
  'none' => esc_html__( 'None', 'olympus-google-fonts' ),
265
  );
266
  }
 
267
  }
includes/customizer/controls/class-ogf-customize-upsell-control.php CHANGED
@@ -20,7 +20,6 @@ class OGF_Customize_Upsell_Control extends WP_Customize_Control {
20
  /**
21
  * The control type.
22
  *
23
- * @access public
24
  * @var string
25
  */
26
  public $type = 'upsell';
@@ -43,5 +42,4 @@ class OGF_Customize_Upsell_Control extends WP_Customize_Control {
43
  </div>
44
  <?php
45
  }
46
-
47
  }
20
  /**
21
  * The control type.
22
  *
 
23
  * @var string
24
  */
25
  public $type = 'upsell';
42
  </div>
43
  <?php
44
  }
 
45
  }
includes/customizer/output-css.php CHANGED
@@ -22,6 +22,7 @@ function ogf_output_css() {
22
  foreach ( ogf_get_custom_elements() as $id => $values ) {
23
  ogf_generate_css( $values['selectors'], $id );
24
  }
 
25
  ?>
26
  </style>
27
  <!-- Fonts Plugin CSS -->
@@ -31,6 +32,8 @@ add_action( 'wp_head', 'ogf_output_css', 1000 );
31
 
32
  /**
33
  * Return the CSS for enqueing Custom Font Uploads.
 
 
34
  */
35
  function ogf_return_custom_font_css() {
36
  $fonts = OGF_Fonts_Taxonomy::get_fonts();
@@ -185,7 +188,6 @@ function ogf_generate_css( $selector, $option_name ) {
185
  */
186
  function ogf_build_font_stack( $font_id ) {
187
  if ( strpos( $font_id, 'sf-' ) !== false ) {
188
-
189
  $system_fonts = ogf_system_fonts();
190
 
191
  $font_id = str_replace( 'sf-', '', $font_id );
@@ -196,7 +198,6 @@ function ogf_build_font_stack( $font_id ) {
196
 
197
  }
198
  } elseif ( strpos( $font_id, 'cf-' ) !== false ) {
199
-
200
  $custom_fonts = ogf_custom_fonts();
201
 
202
  $font_id = str_replace( 'cf-', '', $font_id );
@@ -205,27 +206,29 @@ function ogf_build_font_stack( $font_id ) {
205
  return $custom_fonts[ $font_id ]['stack'];
206
  }
207
  } elseif ( strpos( $font_id, 'tk-' ) !== false ) {
208
-
209
  $typekit_fonts = ogf_typekit_fonts();
210
 
211
  if ( array_key_exists( $font_id, $typekit_fonts ) ) {
212
  return $typekit_fonts[ $font_id ]['stack'];
213
  }
214
  } else {
215
-
216
  $google_fonts = ogf_fonts_array();
217
 
218
  if ( array_key_exists( $font_id, $google_fonts ) ) {
219
 
220
  $stack = '"' . $google_fonts[ $font_id ]['f'] . '"';
221
-
222
  return $stack;
223
  }
224
  }
 
 
 
225
  }
226
 
227
  /**
228
  * Check if the styles should be forced.
 
 
229
  */
230
  function ogf_is_forced() {
231
  if ( 1 === (int) get_theme_mod( 'ogf_force_styles' ) ) {
22
  foreach ( ogf_get_custom_elements() as $id => $values ) {
23
  ogf_generate_css( $values['selectors'], $id );
24
  }
25
+ do_action( 'ogf_after_inline_styles' );
26
  ?>
27
  </style>
28
  <!-- Fonts Plugin CSS -->
32
 
33
  /**
34
  * Return the CSS for enqueing Custom Font Uploads.
35
+ *
36
+ * @return string @font-face output.
37
  */
38
  function ogf_return_custom_font_css() {
39
  $fonts = OGF_Fonts_Taxonomy::get_fonts();
188
  */
189
  function ogf_build_font_stack( $font_id ) {
190
  if ( strpos( $font_id, 'sf-' ) !== false ) {
 
191
  $system_fonts = ogf_system_fonts();
192
 
193
  $font_id = str_replace( 'sf-', '', $font_id );
198
 
199
  }
200
  } elseif ( strpos( $font_id, 'cf-' ) !== false ) {
 
201
  $custom_fonts = ogf_custom_fonts();
202
 
203
  $font_id = str_replace( 'cf-', '', $font_id );
206
  return $custom_fonts[ $font_id ]['stack'];
207
  }
208
  } elseif ( strpos( $font_id, 'tk-' ) !== false ) {
 
209
  $typekit_fonts = ogf_typekit_fonts();
210
 
211
  if ( array_key_exists( $font_id, $typekit_fonts ) ) {
212
  return $typekit_fonts[ $font_id ]['stack'];
213
  }
214
  } else {
 
215
  $google_fonts = ogf_fonts_array();
216
 
217
  if ( array_key_exists( $font_id, $google_fonts ) ) {
218
 
219
  $stack = '"' . $google_fonts[ $font_id ]['f'] . '"';
 
220
  return $stack;
221
  }
222
  }
223
+
224
+ // If the code gets this far a font has gone missing.
225
+ return 'sans-serif';
226
  }
227
 
228
  /**
229
  * Check if the styles should be forced.
230
+ *
231
+ * @return string
232
  */
233
  function ogf_is_forced() {
234
  if ( 1 === (int) get_theme_mod( 'ogf_force_styles' ) ) {
includes/customizer/settings.php CHANGED
@@ -7,6 +7,14 @@
7
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
  */
9
 
 
 
 
 
 
 
 
 
10
  /**
11
  * An array containing the customizer sections, settings and controls.
12
  *
@@ -14,14 +22,13 @@
14
  */
15
  function ogf_customize_register( $wp_customize ) {
16
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-fonts-control.php';
17
- require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-typography-control.php';
18
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-repeater-control.php';
19
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-upsell-control.php';
20
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-checkbox-control.php';
21
 
22
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Fonts_Control' );
23
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Checkbox_Control' );
24
- $wp_customize->register_control_type( 'OGF_Customize_Typography_Control' );
25
 
26
  $wp_customize->add_setting(
27
  'ogf_custom_selectors',
@@ -66,11 +73,9 @@ function ogf_customize_register( $wp_customize ) {
66
  * @param array $elements array of elements to build controls based on.
67
  */
68
  function ogf_build_customizer_controls( $elements ) {
69
-
70
  global $wp_customize;
71
 
72
  foreach ( $elements as $id => $values ) {
73
-
74
  $wp_customize->add_setting(
75
  $id . '_font',
76
  array(
@@ -102,6 +107,20 @@ function ogf_customize_register( $wp_customize ) {
102
  )
103
  );
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  $wp_customize->add_setting(
106
  $id . '_line_height',
107
  array(
@@ -109,6 +128,20 @@ function ogf_customize_register( $wp_customize ) {
109
  )
110
  );
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  $wp_customize->add_setting(
113
  $id . '_font_color',
114
  array(
@@ -144,7 +177,11 @@ function ogf_customize_register( $wp_customize ) {
144
  'weight' => $id . '_font_weight',
145
  'style' => $id . '_font_style',
146
  'size' => $id . '_font_size',
 
 
147
  'line_height' => $id . '_line_height',
 
 
148
  'color' => $id . '_font_color',
149
  'letter_spacing' => $id . '_letter_spacing',
150
  'text_transform' => $id . '_text_transform',
@@ -310,13 +347,14 @@ function ogf_customize_register( $wp_customize ) {
310
  }
311
 
312
  }
313
- add_action( 'customize_register', 'ogf_customize_register' );
314
 
315
  /**
316
  * Sanitize value from select field.
317
  *
318
  * @param string $input The selected input.
319
- * @param string $setting The setting.
 
320
  */
321
  function ogf_sanitize_select( $input, $setting ) {
322
  // Ensure input is a slug.
7
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
  */
9
 
10
+ function ogf_register_typography_control( $wp_customize ) {
11
+ if ( ! class_exists( 'OGF_Customize_Typography_Control' ) ) {
12
+ require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-typography-control.php';
13
+ $wp_customize->register_control_type( 'OGF_Customize_Typography_Control' );
14
+ }
15
+ }
16
+ add_action( 'customize_register', 'ogf_register_typography_control', 10 );
17
+
18
  /**
19
  * An array containing the customizer sections, settings and controls.
20
  *
22
  */
23
  function ogf_customize_register( $wp_customize ) {
24
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-fonts-control.php';
25
+
26
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-repeater-control.php';
27
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-upsell-control.php';
28
  require_once OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-checkbox-control.php';
29
 
30
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Fonts_Control' );
31
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Checkbox_Control' );
 
32
 
33
  $wp_customize->add_setting(
34
  'ogf_custom_selectors',
73
  * @param array $elements array of elements to build controls based on.
74
  */
75
  function ogf_build_customizer_controls( $elements ) {
 
76
  global $wp_customize;
77
 
78
  foreach ( $elements as $id => $values ) {
 
79
  $wp_customize->add_setting(
80
  $id . '_font',
81
  array(
107
  )
108
  );
109
 
110
+ $wp_customize->add_setting(
111
+ $id . '_font_size_tablet',
112
+ array(
113
+ 'transport' => 'refresh',
114
+ )
115
+ );
116
+
117
+ $wp_customize->add_setting(
118
+ $id . '_font_size_mobile',
119
+ array(
120
+ 'transport' => 'refresh',
121
+ )
122
+ );
123
+
124
  $wp_customize->add_setting(
125
  $id . '_line_height',
126
  array(
128
  )
129
  );
130
 
131
+ $wp_customize->add_setting(
132
+ $id . '_line_height_tablet',
133
+ array(
134
+ 'transport' => 'refresh',
135
+ )
136
+ );
137
+
138
+ $wp_customize->add_setting(
139
+ $id . '_line_height_mobile',
140
+ array(
141
+ 'transport' => 'refresh',
142
+ )
143
+ );
144
+
145
  $wp_customize->add_setting(
146
  $id . '_font_color',
147
  array(
177
  'weight' => $id . '_font_weight',
178
  'style' => $id . '_font_style',
179
  'size' => $id . '_font_size',
180
+ 'size_tablet' => $id . '_font_size_tablet',
181
+ 'size_mobile' => $id . '_font_size_mobile',
182
  'line_height' => $id . '_line_height',
183
+ 'line_height_tablet' => $id . '_line_height_tablet',
184
+ 'line_height_mobile' => $id . '_line_height_mobile',
185
  'color' => $id . '_font_color',
186
  'letter_spacing' => $id . '_letter_spacing',
187
  'text_transform' => $id . '_text_transform',
347
  }
348
 
349
  }
350
+ add_action( 'customize_register', 'ogf_customize_register', 20 );
351
 
352
  /**
353
  * Sanitize value from select field.
354
  *
355
  * @param string $input The selected input.
356
+ * @param object $setting The setting.
357
+ * @return bool
358
  */
359
  function ogf_sanitize_select( $input, $setting ) {
360
  // Ensure input is a slug.
includes/functions.php CHANGED
@@ -9,6 +9,8 @@
9
 
10
  /**
11
  * An array of user-defined elements that can be customized using the plugin.
 
 
12
  */
13
  function ogf_get_custom_elements() {
14
  $theme_mod = get_theme_mod( 'ogf_custom_selectors', false );
@@ -28,6 +30,8 @@ function ogf_get_custom_elements() {
28
 
29
  /**
30
  * An array of elements that can be customized using the plugin.
 
 
31
  */
32
  function ogf_get_elements() {
33
  $elements = array(
@@ -149,9 +153,11 @@ function ogf_get_elements() {
149
  /**
150
  * Return an array of all available Google Fonts.
151
  *
152
- * @return array All Google Fonts.
153
  */
154
  function ogf_fonts_array() {
 
 
155
  $fonts_json = file_get_contents( OGF_DIR_PATH . '/blocks/src/google-fonts/fonts.json' );
156
 
157
  // Change the object to a multidimensional array.
@@ -159,7 +165,6 @@ function ogf_fonts_array() {
159
 
160
  // Format the variants array for easier use.
161
  foreach ( $fonts_array['items'] as $key => $font ) {
162
-
163
  $variants_remove = array(
164
  '100italic',
165
  '200italic',
@@ -188,7 +193,6 @@ function ogf_fonts_array() {
188
  $font['v'] = array_flip( $font['v'] );
189
 
190
  $fonts_array['items'][ $key ] = $font;
191
-
192
  }
193
 
194
  // Change the array key to the font's ID.
@@ -202,13 +206,17 @@ function ogf_fonts_array() {
202
 
203
  /**
204
  * Return a array of custom fonts.
 
 
205
  */
206
  function ogf_custom_fonts() {
207
  return OGF_Fonts_Taxonomy::get_fonts();
208
  }
209
 
210
  /**
211
- * Return a array of custom fonts.
 
 
212
  */
213
  function ogf_typekit_fonts() {
214
  return OGF_Typekit::get_fonts();
@@ -216,6 +224,8 @@ function ogf_typekit_fonts() {
216
 
217
  /**
218
  * Return a array of system fonts.
 
 
219
  */
220
  function ogf_system_fonts() {
221
  $system_fonts = array(
@@ -303,6 +313,8 @@ function ogf_system_fonts() {
303
 
304
  /**
305
  * Return the full range of font variants.
 
 
306
  */
307
  function ogf_font_variants() {
308
  return array(
@@ -332,6 +344,7 @@ function ogf_font_variants() {
332
  * Check if a font is a system font (not Google Font).
333
  *
334
  * @param string $font_id The ID of the font to check.
 
335
  */
336
  function ogf_is_system_font( $font_id ) {
337
  if ( ! is_string( $font_id ) ) {
@@ -348,6 +361,7 @@ function ogf_is_system_font( $font_id ) {
348
  * Check if a font is a custom font (not Google Font).
349
  *
350
  * @param string $font_id The ID of the font to check.
 
351
  */
352
  function ogf_is_custom_font( $font_id ) {
353
  if ( ! is_string( $font_id ) ) {
@@ -364,9 +378,9 @@ function ogf_is_custom_font( $font_id ) {
364
  * Check if a font is a Typekit font (not Google Font).
365
  *
366
  * @param string $font_id The ID of the font to check.
 
367
  */
368
  function ogf_is_typekit_font( $font_id ) {
369
-
370
  if ( ! is_string( $font_id ) ) {
371
  return false;
372
  }
@@ -381,6 +395,7 @@ function ogf_is_typekit_font( $font_id ) {
381
  * Check if a font is a Google font.
382
  *
383
  * @param string $font_id The ID of the font to check.
 
384
  */
385
  function ogf_is_google_font( $font_id ) {
386
  if ( ! is_string( $font_id ) ) {
9
 
10
  /**
11
  * An array of user-defined elements that can be customized using the plugin.
12
+ *
13
+ * @return array An array of user-defined elements.
14
  */
15
  function ogf_get_custom_elements() {
16
  $theme_mod = get_theme_mod( 'ogf_custom_selectors', false );
30
 
31
  /**
32
  * An array of elements that can be customized using the plugin.
33
+ *
34
+ * @return array Elements the plugin can target.
35
  */
36
  function ogf_get_elements() {
37
  $elements = array(
153
  /**
154
  * Return an array of all available Google Fonts.
155
  *
156
+ * @return array All Google Fonts.
157
  */
158
  function ogf_fonts_array() {
159
+ $fonts = array();
160
+
161
  $fonts_json = file_get_contents( OGF_DIR_PATH . '/blocks/src/google-fonts/fonts.json' );
162
 
163
  // Change the object to a multidimensional array.
165
 
166
  // Format the variants array for easier use.
167
  foreach ( $fonts_array['items'] as $key => $font ) {
 
168
  $variants_remove = array(
169
  '100italic',
170
  '200italic',
193
  $font['v'] = array_flip( $font['v'] );
194
 
195
  $fonts_array['items'][ $key ] = $font;
 
196
  }
197
 
198
  // Change the array key to the font's ID.
206
 
207
  /**
208
  * Return a array of custom fonts.
209
+ *
210
+ * @return array User uploaded fonts.
211
  */
212
  function ogf_custom_fonts() {
213
  return OGF_Fonts_Taxonomy::get_fonts();
214
  }
215
 
216
  /**
217
+ * Return a array of typekit fonts.
218
+ *
219
+ * @return array Typekit fonts.
220
  */
221
  function ogf_typekit_fonts() {
222
  return OGF_Typekit::get_fonts();
224
 
225
  /**
226
  * Return a array of system fonts.
227
+ *
228
+ * @return array System fonts.
229
  */
230
  function ogf_system_fonts() {
231
  $system_fonts = array(
313
 
314
  /**
315
  * Return the full range of font variants.
316
+ *
317
+ * @return array Font variants.
318
  */
319
  function ogf_font_variants() {
320
  return array(
344
  * Check if a font is a system font (not Google Font).
345
  *
346
  * @param string $font_id The ID of the font to check.
347
+ * @return bool
348
  */
349
  function ogf_is_system_font( $font_id ) {
350
  if ( ! is_string( $font_id ) ) {
361
  * Check if a font is a custom font (not Google Font).
362
  *
363
  * @param string $font_id The ID of the font to check.
364
+ * @return bool
365
  */
366
  function ogf_is_custom_font( $font_id ) {
367
  if ( ! is_string( $font_id ) ) {
378
  * Check if a font is a Typekit font (not Google Font).
379
  *
380
  * @param string $font_id The ID of the font to check.
381
+ * @return bool
382
  */
383
  function ogf_is_typekit_font( $font_id ) {
 
384
  if ( ! is_string( $font_id ) ) {
385
  return false;
386
  }
395
  * Check if a font is a Google font.
396
  *
397
  * @param string $font_id The ID of the font to check.
398
+ * @return bool
399
  */
400
  function ogf_is_google_font( $font_id ) {
401
  if ( ! is_string( $font_id ) ) {
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: Fonts Plugin | Google Fonts Typography
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
8
- * Version: 3.0.12
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_medium=readme&utm_campaign=description
11
  * Text Domain: olympus-google-fonts
@@ -28,6 +28,8 @@ add_action( 'plugins_loaded', 'ogf_initiate', 10 );
28
 
29
  /**
30
  * Add a redirection check on activation.
 
 
31
  */
32
  function ogf_activate() {
33
  add_option( 'ogf_do_activation_redirect', true );
5
  * Plugin Name: Fonts Plugin | Google Fonts Typography
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
8
+ * Version: 3.0.13
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_medium=readme&utm_campaign=description
11
  * Text Domain: olympus-google-fonts
28
 
29
  /**
30
  * Add a redirection check on activation.
31
+ *
32
+ * @return void
33
  */
34
  function ogf_activate() {
35
  add_option( 'ogf_do_activation_redirect', true );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.9
7
  License: GPLv2 or later
8
- Stable tag: 3.0.12
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
11
 
5
  Requires at least: 4.0
6
  Tested up to: 5.9
7
  License: GPLv2 or later
8
+ Stable tag: 3.0.13
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
11