sections, $parent->args, $parent->extra_tabs);
$this->field = $field;
$this->value = $value;
$this->parent = $parent;
}//function
/**
* Field Render Function.
*
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function render(){
global $wp_filesystem;
// Initialize the Wordpress filesystem, no more using file_put_contents function
if (empty($wp_filesystem)) {
require_once(ABSPATH .'/wp-admin/includes/file.php');
WP_Filesystem();
}
// No errors please
$defaults = array(
'font-family' => true,
'font-size' => true,
'subsets' => true,
'font-weight' => true,
'font-style' => true,
'font-backup' => false,
'color' => true,
'preview' => true,
'line-height' => true,
'word-spacing' => false,
'letter-spacing' => false,
'google' => true,
'update_weekly' => false // Enable to force updates of Google Fonts to be weekly
);
$this->field = wp_parse_args( $this->field, $defaults );
$defaults = array(
'font-family'=>'',
'font-backup'=>'',
'line-height'=>'',
'word-spacing' => '',
'letter-spacing' => '',
'subsets'=>'',
'google'=>false,
'font-script'=>'',
'font-weight'=>'',
'font-style'=>'',
'color'=>'',
'font-size'=>'',
);
$this->value = wp_parse_args( $this->value, $defaults );
if (empty($this->field['units']) && !empty($this->field['default']['units'])) {
$this->field['units'] = $this->field['default']['units'];
}
if ( empty( $this->field['units'] ) || !in_array( $this->field['units'], array( 'px', 'em', '%' ) ) ) {
$this->field['units'] = 'px';
}
$unit = $this->field['units'];
if ($this->field['font-family'] === true):
echo '
';
/**
Font Family
**/
if ( filter_var($this->value['google'], FILTER_VALIDATE_BOOLEAN) ) {
$fontFamily = explode(', ', $this->value['font-family'],2);
if (empty($fontFamily[0]) && !empty($fontFamily[1])) {
$fontFamily[0] = $fontFamily[1];
$fontFamily[1] = "";
}
}
if (!isset($fontFamily)) {
$fontFamily = array();
$fontFamily[0] = $this->value['font-family'];
$fontFamily[1] = "";
}
echo '';
echo '
';
echo '
';
if ($this->field['google'] === true) {
// Set a flag so we know to set a header style or not
echo '';
}
endif;
/**
Font Style/Weight
**/
if ($this->field['font-style'] === true || $this->field['font-weight'] === true):
echo '
';
endif;
/**
Font Script
**/
if ($this->field['subsets'] === true && $this->field['google'] === true):
echo '
';
echo '
';
endif;
/**
Font Size
**/
if ($this->field['font-size'] === true):
echo '
'.$unit.'
';
echo '';
endif;
/**
Line Height
**/
if ($this->field['line-height'] === true):
echo '
'.$unit.'
';
echo '';
endif;
/**
Word Spacing
**/
if ($this->field['word-spacing'] === true):
echo '
'.$unit.'
';
echo '';
endif;
/**
Letter Spacing
**/
if ($this->field['letter-spacing'] === true):
echo '
'.$unit.'
';
echo '';
endif;
/**
Backup Font
**/
if ($this->field['font-family'] === true && $this->field['google'] === true) {
// Set a flag so we know to set a header style or not
echo '';
if ($this->field['font-backup'] === true) {
echo '
';
echo '
';
}
}
/**
Font Color
**/
if ($this->field['color'] === true):
$default = "";
if (empty($this->field['default']['color']) && !empty($this->field['color'])) {
$default = $this->value['color'];
} else if (!empty($this->field['default']['color'])) {
$default = $this->field['default']['color'];
}
echo '