Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7d9c5f5
Merge branch 'master' into customizer-remake
marekdedic Sep 6, 2019
4f5d9aa
Merge branch 'master' into customizer-remake
marekdedic Sep 7, 2019
fa2af16
Merge branch 'master' into customizer-remake
marekdedic Sep 20, 2019
7d1a569
(Almost) remade body background to be GeneratePress-compatible
marekdedic Sep 22, 2019
d70af32
Copied over default values
marekdedic Sep 22, 2019
d5c99a6
Remade body background-repeat to be GeneratePress-compatible
marekdedic Sep 23, 2019
657f1cb
Remade body background-size to be GeneratePress-compatible
marekdedic Sep 23, 2019
acbed4b
Fixed lint issues
marekdedic Sep 23, 2019
4b7b4f2
Merge branch 'master' into customizer-remake
marekdedic Sep 23, 2019
9bb77b1
Remade body background-attachment to be GeneratePress-compatible
marekdedic Sep 23, 2019
81b8cd9
Remade body background to be GeneratePress-compatible
marekdedic Sep 23, 2019
14d8f36
Added Background_Image_Customize_Control
marekdedic Sep 25, 2019
d3c419b
Split body background config
marekdedic Sep 25, 2019
a443afa
Remade header background to be GeneratePress-compatible
marekdedic Sep 27, 2019
c68d63e
Fixed default value for body background image
marekdedic Sep 27, 2019
4c016e7
Remade header foreground to be GeneratePress-compatible
marekdedic Sep 27, 2019
2ffdef4
Not adding sections if added by GP
marekdedic Sep 27, 2019
ef92d4f
Remade header grass image to be GeneratePress-compatible
marekdedic Sep 27, 2019
a1cec1b
Removed Kirki from background class
marekdedic Sep 27, 2019
c224ece
Enabled multiple outputs for webpack
marekdedic Sep 28, 2019
bfb9baf
Added preset control
marekdedic Sep 29, 2019
429e76b
Removed old code
marekdedic Sep 29, 2019
f807352
Functional preset changing
marekdedic Sep 29, 2019
8d8aadb
Added body color selection to presets
marekdedic Sep 29, 2019
ab95e96
Styled the preset chooser
marekdedic Sep 29, 2019
87e1958
Added the Customizer_Category class to reuse code better
marekdedic Sep 29, 2019
993d976
Remade border radius to be GeneratePress-compatible
marekdedic Sep 29, 2019
a5354a6
Setting border radius in new presets
marekdedic Sep 30, 2019
7eeff60
Added dummy color configuration
marekdedic Sep 30, 2019
f6e1f17
Added primary navigation background color control
marekdedic Sep 30, 2019
55c4a97
Controling menu background & color through GP-compatible functions
marekdedic Oct 1, 2019
636a93c
Added color sanitization
marekdedic Oct 4, 2019
c78453b
Merge branch 'master' into customizer-remake
marekdedic Oct 11, 2019
3cd6e92
Merge branch 'master' into customizer-remake
marekdedic Oct 22, 2019
50e01cd
Fixed a missing switch case
marekdedic Oct 23, 2019
7108d6a
Lint fixes
marekdedic Oct 23, 2019
001d151
Converted content font
marekdedic Oct 23, 2019
5de0b1f
Removed SCSS overrides to GP
marekdedic Oct 23, 2019
6931cbc
Converted menu font
marekdedic Oct 24, 2019
2b9e9a6
Fixed lint issues
marekdedic Oct 24, 2019
4c3b338
Converted H1 font
marekdedic Oct 24, 2019
664a5ce
Converted H2 font
marekdedic Oct 24, 2019
4ae6971
Fixed GP Premium error
marekdedic Oct 24, 2019
fa6e7c4
Merge branch 'master' into customizer-remake
marekdedic Nov 12, 2019
9593215
Switched [] to array()
marekdedic Nov 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class Generate_Range_Slider_Control {
public function __construct( $manager, $id, $args = [] ) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class Generate_Typography_Customize_Control {
public function __construct( $manager, $id, $args = [] ) {
}
}
4 changes: 4 additions & 0 deletions .phan/stubs/GeneratePress/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

function generatepress_is_module_active( $module, $definition ) {
}
18 changes: 18 additions & 0 deletions .phan/stubs/WordPress/class-wp-control.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

class WP_Customize_Control {
public $json;
public $settings;

public function __construct( $a, $b, $c ) {
}

public function get_link( $a ) {
}

public function to_json() {
}

public function value( $a ) {
}
}
6 changes: 6 additions & 0 deletions .phan/stubs/WordPress/class-wp-customize-color-control.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class WP_Customize_Color_Control {
public function __construct( $manager, $id, $args = [] ) {
}
}
6 changes: 6 additions & 0 deletions .phan/stubs/WordPress/class-wp-customize-image-control.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class WP_Customize_Image_Control {
public function __construct( $manager, $id, $args = [] ) {
}
}
18 changes: 18 additions & 0 deletions .phan/stubs/WordPress/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

class WP_Customize_manager {
public function add_control( $id, $args = [] ) {
}

public function add_panel( $id, $args = [] ) {
}

public function add_section( $id, $args = [] ) {
}

public function add_setting( $id, $args = [] ) {
}

public function register_control_type( $a ) {
}
}
34 changes: 33 additions & 1 deletion .phan/stubs/WordPress/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
* @package skaut-google-drive-gallery
*/

function __($a, $b) {
return '';
}

function absint( $a ) {
return 0;
}

function add_action( $a, $b, $c = '' ) {
}

Expand Down Expand Up @@ -34,6 +42,10 @@ function esc_html__( $a, $b ) {
return '';
}

function esc_url( $a ) {
return '';
}

function get_option( $a, $b ) {
switch ( wp_rand( 0, 2 ) ) {
case 0:
Expand Down Expand Up @@ -85,6 +97,10 @@ function remove_action( $a, $b, $c = '' ) {
return false;
}

function sanitize_text_field( $a ) {
return '';
}

function switch_theme( $a ) {
}

Expand All @@ -101,11 +117,27 @@ function trailingslashit( $a ) {
return '';
}

function wp_add_inline_style( $a, $b ) {
}

function wp_enqueue_script( $a, $b, $c, $d, $e ) {
}

function wp_enqueue_style( $a, $b, $c, $d ) {
function wp_enqueue_style( $a, $b = '', $c = [], $d = false ) {
}

function wp_localize_script( $a, $b, $c ) {
}

/**
* @return array
*/
function wp_parse_args( $a, $b ) {
return [];
}

function wp_rand( $a, $b ) {
}

function wp_register_style( $a, $b, $c, $d ) {
}
6 changes: 6 additions & 0 deletions src/js/admin/colors_live_preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

jQuery( 'document' ).ready( function( $ ) {
generatepress_colors_live_update( 'h1_color', 'h1', 'color', '', 'text_color' );
generatepress_colors_live_update( 'h2_color', 'h2', 'color', '', 'text_color' );
});
45 changes: 45 additions & 0 deletions src/js/admin/preset_customize_control.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import '../../scss/admin/preset_customize_control.scss';
'use strict';

jQuery( 'document' ).ready( function( $ ) {
function flatten( input ) {
const ret = {};
$.each( input, function( key, value ) {
if ( 'object' === typeof ( value ) ) {
$.each( value, function( subKey, subValue ) {
ret[key + '[' + subKey + ']'] = subValue;
});
} else {
ret[key] = value;
}
});
return ret;
}

wp.customize.control(
'crdm_basic_preset',
function( control ) {
const presets = [];
$.each( crdmbasicPresetCustomizeControlLocalize, function( key, value ) {
presets[key] = flatten( value );
});
control.container.find( 'input[name=crdm_basic_preset]' ).change( function() {
control.container.find( '.button' ).prop( 'disabled', false );
});
control.container.find( '.button' ).on( 'click', function() {
const chosen = control.container.find( 'input[name=crdm_basic_preset]:checked' ).val();
if ( ! chosen ) {
console.log( 'FAIL' );
return;
}
$.each( presets[chosen], function( key, value ) {
const setting = wp.customize( key );
if ( ! setting ) {
return;
}
setting.set( value );
});
});
}
);
});
22 changes: 22 additions & 0 deletions src/js/admin/typography_live_preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

jQuery( 'document' ).ready( function( $ ) {
generatepress_typography_live_update( 'navigation_font_size', '.main-navigation a, .menu-toggle', 'font-size', 'px', crdmTypographyLivePreview.desktop );
generatepress_typography_live_update( 'mobile_navigation_font_size', '.main-navigation:not(.slideout-navigation) a, .menu-toggle', 'font-size', 'px', crdmTypographyLivePreview.mobile );
generatepress_typography_live_update( 'navigation_font_weight', '.main-navigation a, .menu-toggle', 'font-weight' );
generatepress_typography_live_update( 'navigation_font_transform', '.main-navigation a, .menu-toggle', 'text-transform' );

generatepress_typography_live_update( 'heading_1_font_size', 'h1', 'font-size', 'px', crdmTypographyLivePreview.desktop );
generatepress_typography_live_update( 'mobile_heading_1_font_size', 'h1', 'font-size', 'px', crdmTypographyLivePreview.mobile );
generatepress_typography_live_update( 'heading_1_weight', 'h1', 'font-weight' );
generatepress_typography_live_update( 'heading_1_transform', 'h1', 'text-transform' );
generatepress_typography_live_update( 'heading_1_line_height', 'h1', 'line-height', 'em' );
generatepress_typography_live_update( 'heading_1_margin_bottom', 'h1', 'margin-bottom', 'px' );

generatepress_typography_live_update( 'heading_2_font_size', 'h2', 'font-size', 'px', crdmTypographyLivePreview.desktop );
generatepress_typography_live_update( 'mobile_heading_2_font_size', 'h2', 'font-size', 'px', crdmTypographyLivePreview.mobile );
generatepress_typography_live_update( 'heading_2_weight', 'h2', 'font-weight' );
generatepress_typography_live_update( 'heading_2_transform', 'h2', 'text-transform' );
generatepress_typography_live_update( 'heading_2_line_height', 'h2', 'line-height', 'em' );
generatepress_typography_live_update( 'heading_2_margin_bottom', 'h2', 'margin-bottom', 'px' );
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* Contains the Background_Image_Customize_Control class.
*
* @package crdm-basic
*/

declare(strict_types = 1);

namespace CrdmBasic\Customizer\Controls;

/**
* A WP_Customize_Control for background image configuration
*
* Allows for controlling the repeat, size, attachment and position of a background image.
*/
class Background_Image_Customize_Control extends \WP_Customize_Control {

/**
* Control's type.
*
* @var string
*/
public $type = 'crdm-basic-background-image';

/**
* Exports control parameters for JS.
*
* @inheritDoc
*/
public function to_json() {
parent::to_json();

$this->json['position_description'] = esc_html__( 'left top, x%, y%, xpos ypos (px)', 'crdm-basic' );
$this->json['position_placeholder'] = esc_html__( 'Position', 'crdm-basic' );

foreach ( $this->settings as $key => $id ) {
$this->json['settings'][ $key ] = array(
'link' => $this->get_link( $key ),
'value' => $this->value( $key ),
'id' => $id->id ?? '',
);
}

$this->json['repeat_choices'] = array(
'' => esc_html__( 'Repeat', 'crdm-basic' ),
'repeat-x' => esc_html__( 'Repeat x', 'crdm-basic' ),
'repeat-y' => esc_html__( 'Repeat y', 'crdm-basic' ),
'no-repeat' => esc_html__( 'No Repeat', 'crdm-basic' ),
);
$this->json['size_choices'] = array(
'' => esc_html__( 'Size (Auto)', 'crdm-basic' ),
'100' => esc_html__( '100% Width', 'crdm-basic' ),
'cover' => esc_html__( 'Cover', 'crdm-basic' ),
'contain' => esc_html__( 'Contain', 'crdm-basic' ),
);
$this->json['attachment_choices'] = array(
'' => esc_html__( 'Attachment', 'crdm-basic' ),
'fixed' => esc_html__( 'Fixed', 'crdm-basic' ),
'local' => esc_html__( 'Local', 'crdm-basic' ),
'inherit' => esc_html__( 'Inherit', 'crdm-basic' ),
);
}

/**
* Prints the Underscore.js template for the control.
*
* @inheritDoc
*/
public function content_template() {
?>
<# _.each( [ [ data.settings.repeat, data.repeat_choices ], [ data.settings.size, data.size_choices ], [ data.settings.attachment, data.attachment_choices] ], function( tuple ) {
if ( tuple[0] ) { #>
<label>
<select {{{ tuple[0].link }}}>
<# _.each( tuple[1], function( label, choice ) { #>
<option value="{{{ choice }}}" <# if ( choice === tuple[0].value ) { #> selected="selected" <# } #>>{{{ label }}}</option>
<# } ) #>
</select>
</label>
<# }
} ); #>

<# if ( data.settings.position ) { #>
<label>
<input name="{{{ data.settings.position.id }}}" type="text" {{{ data.settings.position.link }}} value="{{{ data.settings.position.value }}}" placeholder="{{{ data.position_placeholder }}}" />
<p class="description">{{{ data.position_description }}}</p>
</label>
<# } #>
<?php
}
}
Loading