Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed v3.2.4 #28

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab3a67d
Update readme.txt
codejp3 Oct 9, 2022
70c99be
Update acf-typography.php
codejp3 Oct 9, 2022
5975c04
Update README.md
codejp3 Oct 9, 2022
b43f263
Update CHANGELOG.md
codejp3 Oct 9, 2022
2b563e0
Update admin_settings.php
codejp3 Oct 9, 2022
eb3b83c
Update api-template.php
codejp3 Oct 9, 2022
f85927b
Update functions.php
codejp3 Oct 9, 2022
8098905
Update acf-Typography-v4.php
codejp3 Oct 9, 2022
9c63b76
Update acf-Typography-v5.php
codejp3 Oct 9, 2022
caa4ee6
Create acf-Typography-v6.php
codejp3 Oct 9, 2022
36f00dd
Update README.md
codejp3 Oct 9, 2022
d65b09e
Update README.md
codejp3 Oct 9, 2022
6c69be8
tabs / spaces for vscode
codejp3 Oct 12, 2022
4d3d97a
tabs / spaces for vscode
codejp3 Oct 12, 2022
702a16d
tabs / spaces for vscode
codejp3 Oct 12, 2022
d9d7a3f
tabs / spaces for vscode
codejp3 Oct 12, 2022
99749ae
tabs / spaces for vscode
codejp3 Oct 12, 2022
be5c753
tabs / spaces for vscode
codejp3 Oct 12, 2022
229a038
Tested against WP 6.0.3
codejp3 Oct 12, 2022
4af5970
Tested against WP 6.0.3
codejp3 Oct 12, 2022
194d3c7
php8.2 deprecated dynamic properties update
codejp3 Oct 12, 2022
ff58e2b
php8.2 deprecated dynamic properties update
codejp3 Oct 12, 2022
4695c2b
php8.2 deprecated empty haystack update
codejp3 Oct 12, 2022
fe4e287
Update README.md
codejp3 Oct 12, 2022
1a16cf5
backward compatibility with pre-php8.2 fix
codejp3 Oct 15, 2022
ec2496d
backward compatibility with pre-php8.2 fix
codejp3 Oct 15, 2022
41aa9e2
removed comma for php7.0 sprintf compatibility
codejp3 Oct 15, 2022
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

##### 3.2.4
* [NEW] Plugin now officially supports ACF v6!
* [NEW] Tested up to PHP 8.2.
* [BUG] Fixed 'Notice: Trying to get property ID of non-object' when enqueueing font files on non-objects. ( WP Support )
* [BUG] Fixed 'Warning: failed to open stream: HTTP request failed' when bad API Key supplied, or other API connection issues. #27
* [NEW] Admin Settings - checks and help messages for Google API Key/connection issues.
* [NEW] Admin Settings - description and link provided for getting Google Fonts API key.
* [NEW] Admin Settings - checks to make sure ACF is installed and activated.
* [UPDATE] Translation string and textdomain updates to get plugin translation-ready (coming next release).
* [UPDATE] Added a few minor additional checks for some variables to prevent possible errors in the future.
* [UPDATE] Minor code cleanup for readability.

##### 3.2.3
* Added new font-weight values

Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
A Typography Add-on for the Advanced Custom Fields Plugin.

- Requires at least: WP 3.5.0
- Tested up to: WP 6.0
- Stable: 3.2.3
- Latest: 3.2.3
- Tested up to: WP 6.0.3
- Tested up to: PHP 8.2
- Tested up to: ACF 6.0
- Stable: 3.2.4
- Latest: 3.2.4

## Description
Typography field type for "Advanced Custom Fields" plugin that lets you add different text properties e.g. Font Size, Font Family, Font Color etc.

If you want any kind of font/typography features within ACF, this is the plugin for you! There's nothing else like it!

### Supported Subfields
* Font Size
* Font Family
Expand Down Expand Up @@ -55,6 +60,7 @@ the_typography_sub_field( $selector, $property, [$format_value] );
## Compatibility

This ACF field type is compatible with:
* ACF plugin v4, v5 & v6
* Free and paid versions of the ACF plugin

## Installation
Expand All @@ -63,4 +69,4 @@ This ACF field type is compatible with:
- Google API Key is required for Google Fonts. Please add one by going to `WordPress Admin Dashboard > Settings > ACF Typography Settings`

## Changelog
See changelog on [CHANGELOG.md](CHANGELOG.md) file.
See changelog on [CHANGELOG.md](CHANGELOG.md) file.
130 changes: 69 additions & 61 deletions acf-typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
Plugin Name: Advanced Custom Fields: Typography Field
Plugin URI: https://wordpress.org/plugins/acf-typography-field
Description: A Typography Add-on for the Advanced Custom Fields Plugin.
Version: 3.2.3
Version: 3.2.4
Author: Mujahid Ishtiaq
Author URI: https://github.com/mujahidi
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: acf-typography
*/

// exit if accessed directly
Expand All @@ -17,86 +18,93 @@
$acft_options = get_option( 'acft_settings' );

if( $acft_options && $acft_options['google_key'] )
define('YOUR_API_KEY', $acft_options['google_key']);
define( 'YOUR_API_KEY', $acft_options['google_key'] );

// check if class already exists
if( !class_exists('acf_plugin_Typography') ) :

class acf_plugin_Typography {

/*
* __construct
*
* This function will setup the class functionality
*
* @type function
* @date 17/02/2016
* @since 1.0.0
*
* @param n/a
* @return n/a
*/

function __construct() {

// vars
$this->settings = array(
'version' => '3.2.2',
'url' => plugin_dir_url( __FILE__ ),
'path' => plugin_dir_path( __FILE__ )
);

// include files
require plugin_dir_path( __FILE__ ) . 'includes/api-template.php';
require plugin_dir_path( __FILE__ ) . 'includes/admin_settings.php';
require plugin_dir_path( __FILE__ ) . 'includes/functions.php';

// include field
add_action('acf/include_field_types', array($this, 'include_field_types')); // v5
add_action('acf/register_fields', array($this, 'include_field_types')); // v4
add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts'));

}

var $settings; // php8.2 compatibility (deprecated dynamic properties)

/*
* include_field_types
*
* This function will include the field type class
*
* @type function
* @date 17/02/2016
* @since 1.0.0
*
* @param $version (int) major ACF version. Defaults to false
* @return n/a
*/

function include_field_types( $version = false ) {
/*
* __construct
*
* This function will setup the class functionality
*
* @type function
* @date 17/02/2016
* @since 1.0.0
*
* @param n/a
* @return n/a
*/

// support empty $version
if( !$version ) $version = 4;
function __construct() {

// vars
$this->settings = array(
'version' => '3.2.4',
'url' => plugin_dir_url( __FILE__ ),
'path' => plugin_dir_path( __FILE__ )
);

// include files
require plugin_dir_path( __FILE__ ) . 'includes/api-template.php';
require plugin_dir_path( __FILE__ ) . 'includes/admin_settings.php';
require plugin_dir_path( __FILE__ ) . 'includes/functions.php';

// include field
add_action('acf/include_field_types', array($this, 'include_field_types')); // v5, v6
add_action('acf/register_fields', array($this, 'include_field_types')); // v4
add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts'));

}


// include
include_once('fields/acf-Typography-v' . $version . '.php');
/*
* include_field_types
*
* This function will include the field type class
*
* @type function
* @date 17/02/2016
* @since 1.0.0
*
* @param $version (int) major ACF version. Defaults to false
* @return n/a
*/

}
function include_field_types( $version = false ) {

/**
* ACF currently does not check for, or use version 6.
* It only checks for/uses v5 even when v6 installed/active.
* Eventually they'll push for v6-specific fields.
* Until then, we go ahead & specify the version ourselves.
*/
if ( get_option( 'acf_version' ) ) $version = explode( '.', get_option( 'acf_version' ) )[0];

// if version is any version other than 5 or 6, set version to 4
if ( !$version || !$version === 5 || !$version === 6 ) $version = 4;

// include
include_once('fields/acf-Typography-v' . $version . '.php');

}

function field_group_admin_enqueue_scripts(){
function field_group_admin_enqueue_scripts(){

wp_enqueue_script( 'acf-typography-fieldgroup-script', plugin_dir_url( __FILE__ ) . 'assets/js/admin-field-group.js', array(), $this->settings['version'] );
wp_enqueue_script( 'acf-typography-fieldgroup-script', plugin_dir_url( __FILE__ ) . 'assets/js/admin-field-group.js', array(), $this->settings['version'] );

}
}

}


// initialize
new acf_plugin_Typography();


// class_exists check
endif;

?>
?>
Loading