|
Server : LiteSpeed System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : nandedex ( 1060) PHP Version : 8.1.33 Disable Function : NONE Directory : /home/nandedex/www/s.nandedexpress.com/ |
PK �
�[���U3 U3 pro/blocks.phpnu �[��� <?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
// Register store.
acf_register_store( 'block-types' );
/**
* acf_register_block_type
*
* Registers a block type.
*
* @date 18/2/19
* @since 5.7.12
*
* @param array $block The block settings.
* @return (array|false)
*/
function acf_register_block_type( $block ) {
// Validate block type settings.
$block = acf_validate_block_type( $block );
// Bail early if already exists.
if( acf_has_block_type($block['name']) ) {
return false;
}
// Add to storage.
acf_get_store( 'block-types' )->set( $block['name'], $block );
// Register block type in WP.
if( function_exists('register_block_type') ) {
register_block_type($block['name'], array(
'attributes' => acf_get_block_type_default_attributes(),
'render_callback' => 'acf_rendered_block',
));
}
// Register action.
add_action( 'enqueue_block_editor_assets', 'acf_enqueue_block_assets' );
// Return block.
return $block;
}
/**
* acf_register_block
*
* See acf_register_block_type().
*
* @date 18/2/19
* @since 5.7.12
*
* @param array $block The block settings.
* @return (array|false)
*/
function acf_register_block( $block ) {
return acf_register_block_type( $block );
}
/**
* acf_has_block_type
*
* Returns true if a block type exists for the given name.
*
* @date 18/2/19
* @since 5.7.12
*
* @param string $name The block type name.
* @return bool
*/
function acf_has_block_type( $name ) {
return acf_get_store( 'block-types' )->has( $name );
}
/**
* acf_get_block_types
*
* Returns an array of all registered block types.
*
* @date 18/2/19
* @since 5.7.12
*
* @param void
* @return array
*/
function acf_get_block_types() {
return acf_get_store( 'block-types' )->get();
}
/**
* acf_get_block_types
*
* Returns a block type for the given name.
*
* @date 18/2/19
* @since 5.7.12
*
* @param string $name The block type name.
* @return (array|null)
*/
function acf_get_block_type( $name ) {
return acf_get_store( 'block-types' )->get( $name );
}
/**
* acf_remove_block_type
*
* Removes a block type for the given name.
*
* @date 18/2/19
* @since 5.7.12
*
* @param string $name The block type name.
* @return void
*/
function acf_remove_block_type( $name ) {
acf_get_store( 'block-types' )->remove( $name );
}
/**
* acf_get_block_type_default_attributes
*
* Returns an array of default attribute settings for a block type.
*
* @date 19/11/18
* @since 5.8.0
*
* @param void
* @return array
*/
function acf_get_block_type_default_attributes() {
return array(
'id' => array(
'type' => 'string',
'default' => '',
),
'name' => array(
'type' => 'string',
'default' => '',
),
'data' => array(
'type' => 'object',
'default' => array(),
),
'align' => array(
'type' => 'string',
'default' => '',
),
'mode' => array(
'type' => 'string',
'default' => '',
)
);
}
/**
* acf_validate_block_type
*
* Validates a block type ensuring all settings exist.
*
* @date 10/4/18
* @since 5.8.0
*
* @param array $block The block settings.
* @return array
*/
function acf_validate_block_type( $block ) {
// Add default settings.
$block = wp_parse_args($block, array(
'name' => '',
'title' => '',
'description' => '',
'category' => 'common',
'icon' => '',
'mode' => 'preview',
'align' => '',
'keywords' => array(),
'supports' => array(),
'post_types' => array(),
'render_template' => false,
'render_callback' => false,
'enqueue_style' => false,
'enqueue_script' => false,
'enqueue_assets' => false,
));
// Restrict keywords to 3 max to avoid JS error in older versions.
if( acf_version_compare('wp', '<', '5.2') ) {
$block['keywords'] = array_slice($block['keywords'], 0, 3);
}
// Generate name with prefix.
$block['name'] = 'acf/' . acf_slugify($block['name']);
// Add default 'supports' settings.
$block['supports'] = wp_parse_args($block['supports'], array(
'align' => true,
'html' => false,
'mode' => true,
));
// Return block.
return $block;
}
/**
* acf_prepare_block
*
* Prepares a block for use in render_callback by merging in all settings and attributes.
*
* @date 19/11/18
* @since 5.8.0
*
* @param array $block The block props.
* @return array
*/
function acf_prepare_block( $block ) {
// Bail early if no name.
if( !isset($block['name']) ) {
return false;
}
// Get block type and return false if doesn't exist.
$block_type = acf_get_block_type( $block['name'] );
if( !$block_type ) {
return false;
}
// Generate default attributes.
$attributes = array();
foreach( acf_get_block_type_default_attributes() as $k => $v ) {
$attributes[ $k ] = $v['default'];
}
// Merge together arrays in order of least to most specific.
$block = array_merge($block_type, $attributes, $block);
// Return block.
return $block;
}
/**
* acf_rendered_block
*
* Returns the HTML from acf_render_block().
*
* @date 28/2/19
* @since 5.7.13
* @see acf_render_block() for list of parameters.
*
* @return string
*/
function acf_rendered_block( $block, $content = '', $is_preview = false, $post_id = 0 ) {
// Start capture.
ob_start();
// Render.
acf_render_block( $block, $content, $is_preview, $post_id );
// Return capture.
return ob_get_clean();
}
/**
* acf_render_block
*
* Renders the block HTML.
*
* @date 19/2/19
* @since 5.7.12
*
* @param array $block The block props.
* @param string $content The block content (emtpy string).
* @param bool $is_preview True during AJAX preview.
* @param int $post_id The post being edited.
* @return void
*/
function acf_render_block( $block, $content = '', $is_preview = false, $post_id = 0 ) {
// Prepare block ensuring all settings and attributes exist.
$block = acf_prepare_block( $block );
if( !$block ) {
return '';
}
// Find post_id if not defined.
if( !$post_id ) {
$post_id = get_the_ID();
}
// Enqueue block type assets.
acf_enqueue_block_type_assets( $block );
// Setup postdata allowing get_field() to work.
acf_setup_meta( $block['data'], $block['id'], true );
// Call render_callback.
if( is_callable( $block['render_callback'] ) ) {
call_user_func( $block['render_callback'], $block, $content, $is_preview, $post_id );
// Or include template.
} elseif( $block['render_template'] ) {
// Locate template.
if( file_exists($block['render_template']) ) {
$path = $block['render_template'];
} else {
$path = locate_template( $block['render_template'] );
}
// Include template.
if( file_exists($path) ) {
include( $path );
}
}
// Reset postdata.
acf_reset_meta( $block['id'] );
}
/**
* acf_get_block_fields
*
* Returns an array of all fields for the given block.
*
* @date 24/10/18
* @since 5.8.0
*
* @param array $block The block props.
* @return array
*/
function acf_get_block_fields( $block ) {
// Vars.
$fields = array();
// Get field groups for this block.
$field_groups = acf_get_field_groups( array(
'block' => $block['name']
));
// Loop over results and append fields.
if( $field_groups ) {
foreach( $field_groups as $field_group ) {
$fields = array_merge( $fields, acf_get_fields( $field_group ) );
}}
// Return fields.
return $fields;
}
/**
* acf_enqueue_block_assets
*
* Enqueues and localizes block scripts and styles.
*
* @date 28/2/19
* @since 5.7.13
*
* @param void
* @return void
*/
function acf_enqueue_block_assets() {
// Localize text.
acf_localize_text(array(
'Switch to Edit' => __('Switch to Edit', 'acf'),
'Switch to Preview' => __('Switch to Preview', 'acf'),
));
// Get block types.
$block_types = acf_get_block_types();
// Localize data.
acf_localize_data(array(
'blockTypes' => array_values( $block_types )
));
// Enqueue script.
wp_enqueue_script('acf-blocks', acf_get_url("pro/assets/js/acf-pro-blocks.min.js"), array('acf-input', 'wp-blocks'), ACF_VERSION, true );
// Enqueue block assets.
array_map( 'acf_enqueue_block_type_assets', $block_types );
}
/**
* acf_enqueue_block_type_assets
*
* Enqueues scripts and styles for a specific block type.
*
* @date 28/2/19
* @since 5.7.13
*
* @param array $block_type The block type settings.
* @return void
*/
function acf_enqueue_block_type_assets( $block_type ) {
// Generate handle from name.
$handle = 'block-' . acf_slugify($block_type['name']);
// Enqueue style.
if( $block_type['enqueue_style'] ) {
wp_enqueue_style( $handle, $block_type['enqueue_style'], array(), false, 'all' );
}
// Enqueue script.
if( $block_type['enqueue_script'] ) {
wp_enqueue_script( $handle, $block_type['enqueue_script'], array(), false, true );
}
// Enqueue assets callback.
if( $block_type['enqueue_assets'] && is_callable($block_type['enqueue_assets']) ) {
call_user_func( $block_type['enqueue_assets'], $block_type );
}
}
/**
* acf_ajax_fetch_block
*
* Handles the ajax request for block data.
*
* @date 28/2/19
* @since 5.7.13
*
* @param void
* @return void
*/
function acf_ajax_fetch_block() {
// Validate ajax request.
if( !acf_verify_ajax() ) {
wp_send_json_error();
}
// Get request args.
extract(acf_request_args(array(
'block' => false,
'post_id' => 0,
'query' => array(),
)));
// Bail ealry if no block.
if( !$block ) {
wp_send_json_error();
}
// Unslash and decode $_POST data.
$block = wp_unslash($block);
$block = json_decode($block, true);
// Prepare block ensuring all settings and attributes exist.
if( !$block = acf_prepare_block( $block ) ) {
wp_send_json_error();
}
// Load field defaults when first previewing a block.
if( !empty($query['preview']) && !$block['data'] ) {
$fields = acf_get_block_fields( $block );
foreach( $fields as $field ) {
$block['data'][ "_{$field['name']}" ] = $field['key'];
}
}
// Setup postdata allowing form to load meta.
acf_setup_meta( $block['data'], $block['id'], true );
// Vars.
$response = array();
// Query form.
if( !empty($query['form']) ) {
// Load fields for form.
$fields = acf_get_block_fields( $block );
// Prefix field inputs to avoid multiple blocks using the same name/id attributes.
acf_prefix_fields( $fields, "acf-{$block['id']}" );
// Start Capture.
ob_start();
// Render.
echo '<div class="acf-block-fields acf-fields">';
acf_render_fields( $fields, $block['id'], 'div', 'field' );
echo '</div>';
// Store Capture.
$response['form'] = ob_get_contents();
ob_end_clean();
}
// Query preview.
if( !empty($query['preview']) ) {
// Render_callback vars.
$content = '';
$is_preview = true;
// Render.
$html = '';
$html .= '<div class="acf-block-preview">';
$html .= acf_rendered_block( $block, $content, $is_preview, $post_id );
$html .= '</div>';
// Store HTML.
$response['preview'] = $html;
}
// Send repsonse.
wp_send_json_success( $response );
}
// Register ajax action.
acf_register_ajax( 'fetch-block', 'acf_ajax_fetch_block' );
/**
* acf_parse_save_blocks
*
* Parse content that may contain HTML block comments and saves ACF block meta.
*
* @date 27/2/19
* @since 5.7.13
*
* @param string $text Content that may contain HTML block comments.
* @return string
*/
function acf_parse_save_blocks( $text = '' ) {
// Search text for dynamic blocks and modify attrs.
return addslashes(
preg_replace_callback(
'/<!--\s+wp:(?P<name>[\S]+)\s+(?P<attrs>{[\S\s]+?})\s+(?P<void>\/)?-->/',
'acf_parse_save_blocks_callback',
stripslashes( $text )
)
);
}
// Hook into saving process.
add_filter( 'content_save_pre', 'acf_parse_save_blocks', 5, 1 );
/**
* acf_parse_save_blocks_callback
*
* Callback used in preg_replace to modify ACF Block comment.
*
* @date 1/3/19
* @since 5.7.13
*
* @param array $matches The preg matches.
* @return string
*/
function acf_parse_save_blocks_callback( $matches ) {
// Defaults
$name = isset($matches['name']) ? $matches['name'] : '';
$attrs = isset($matches['attrs']) ? json_decode( $matches['attrs'], true) : '';
$void = isset($matches['void']) ? $matches['void'] : '';
// Bail early if missing data or not an ACF Block.
if( !$name || !$attrs || !acf_has_block_type($name) ) {
return $matches[0];
}
// Convert "data" to "meta".
// No need to check if already in meta format. Local Meta will do this for us.
if( isset($attrs['data']) ) {
$attrs['data'] = acf_setup_meta( $attrs['data'], $attrs['id'] );
}
// Prevent wp_targeted_link_rel from corrupting JSON.
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
remove_filter( 'content_save_pre', 'wp_targeted_link_rel' );
remove_filter( 'content_save_pre', 'balanceTags', 50 );
/**
* Filteres the block attributes before saving.
*
* @date 18/3/19
* @since 5.7.14
*
* @param array $attrs The block attributes.
*/
$attrs = apply_filters( 'acf/pre_save_block', $attrs );
// Return new comment
return '<!-- wp:' . $name . ' ' . acf_json_encode($attrs) . ' ' . $void . '-->';
}
PK �
�[�����
�
pro/acf-pro.phpnu �[��� <?php
if( !class_exists('acf_pro') ):
class acf_pro {
/*
* __construct
*
*
*
* @type function
* @date 23/06/12
* @since 5.0.0
*
* @param N/A
* @return N/A
*/
function __construct() {
// constants
acf()->define( 'ACF_PRO', true );
// update setting
acf_update_setting( 'pro', true );
acf_update_setting( 'name', __('Advanced Custom Fields PRO', 'acf') );
// includes
acf_include('pro/blocks.php');
acf_include('pro/options-page.php');
acf_include('pro/updates.php');
if( is_admin() ) {
acf_include('pro/admin/admin-options-page.php');
acf_include('pro/admin/admin-updates.php');
}
// actions
add_action('init', array($this, 'register_assets'));
add_action('acf/include_field_types', array($this, 'include_field_types'), 5);
add_action('acf/include_location_rules', array($this, 'include_location_rules'), 5);
add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts'));
add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts'));
}
/*
* include_field_types
*
* description
*
* @type function
* @date 21/10/2015
* @since 5.2.3
*
* @param $post_id (int)
* @return $post_id (int)
*/
function include_field_types() {
acf_include('pro/fields/class-acf-field-repeater.php');
acf_include('pro/fields/class-acf-field-flexible-content.php');
acf_include('pro/fields/class-acf-field-gallery.php');
acf_include('pro/fields/class-acf-field-clone.php');
}
/*
* include_location_rules
*
* description
*
* @type function
* @date 10/6/17
* @since 5.6.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function include_location_rules() {
acf_include('pro/locations/class-acf-location-block.php');
acf_include('pro/locations/class-acf-location-options-page.php');
}
/*
* register_assets
*
* description
*
* @type function
* @date 4/11/2013
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function register_assets() {
// vars
$version = acf_get_setting('version');
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// register scripts
wp_register_script( 'acf-pro-input', acf_get_url( "pro/assets/js/acf-pro-input{$min}.js" ), array('acf-input'), $version );
wp_register_script( 'acf-pro-field-group', acf_get_url( "pro/assets/js/acf-pro-field-group{$min}.js" ), array('acf-field-group'), $version );
// register styles
wp_register_style( 'acf-pro-input', acf_get_url( 'pro/assets/css/acf-pro-input.css' ), array('acf-input'), $version );
wp_register_style( 'acf-pro-field-group', acf_get_url( 'pro/assets/css/acf-pro-field-group.css' ), array('acf-input'), $version );
}
/*
* input_admin_enqueue_scripts
*
* description
*
* @type function
* @date 4/11/2013
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function input_admin_enqueue_scripts() {
wp_enqueue_script('acf-pro-input');
wp_enqueue_style('acf-pro-input');
}
/*
* field_group_admin_enqueue_scripts
*
* description
*
* @type function
* @date 4/11/2013
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function field_group_admin_enqueue_scripts() {
wp_enqueue_script('acf-pro-field-group');
wp_enqueue_style('acf-pro-field-group');
}
}
// instantiate
new acf_pro();
// end class
endif;
?>PK �
�[�͖� pro/updates.phpnu �[��� <?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('acf_pro_updates') ) :
class acf_pro_updates {
/*
* __construct
*
* Initialize filters, action, variables and includes
*
* @type function
* @date 23/06/12
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function __construct() {
// actions
add_action('init', array($this, 'init'), 20);
}
/*
* init
*
* description
*
* @type function
* @date 10/4/17
* @since 5.5.10
*
* @param $post_id (int)
* @return $post_id (int)
*/
function init() {
// bail early if no show_updates
if( !acf_get_setting('show_updates') ) return;
// bail early if not a plugin (included in theme)
if( !acf_is_plugin_active() ) return;
// register update
acf_register_plugin_update(array(
'id' => 'pro',
'key' => acf_pro_get_license_key(),
'slug' => acf_get_setting('slug'),
'basename' => acf_get_setting('basename'),
'version' => acf_get_setting('version'),
));
// admin
if( is_admin() ) {
add_action('in_plugin_update_message-' . acf_get_setting('basename'), array($this, 'modify_plugin_update_message'), 10, 2 );
}
}
/*
* modify_plugin_update_message
*
* Displays an update message for plugin list screens.
*
* @type function
* @date 14/06/2016
* @since 5.3.8
*
* @param $message (string)
* @param $plugin_data (array)
* @param $r (object)
* @return $message
*/
function modify_plugin_update_message( $plugin_data, $response ) {
// bail ealry if has key
if( acf_pro_get_license_key() ) return;
// display message
echo '<br />' . sprintf( __('To enable updates, please enter your license key on the <a href="%s">Updates</a> page. If you don\'t have a licence key, please see <a href="%s">details & pricing</a>.', 'acf'), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'https://www.advancedcustomfields.com/pro' );
}
}
// initialize
new acf_pro_updates();
endif; // class_exists check
/*
* acf_pro_get_license
*
* This function will return the license
*
* @type function
* @date 20/09/2016
* @since 5.4.0
*
* @param n/a
* @return n/a
*/
function acf_pro_get_license() {
// get option
$license = get_option('acf_pro_license');
// bail early if no value
if( !$license ) return false;
// decode
$license = maybe_unserialize(base64_decode($license));
// bail early if corrupt
if( !is_array($license) ) return false;
// return
return $license;
}
/*
* acf_pro_get_license_key
*
* This function will return the license key
*
* @type function
* @date 20/09/2016
* @since 5.4.0
*
* @param n/a
* @return n/a
*/
function acf_pro_get_license_key() {
// vars
$license = acf_pro_get_license();
$home_url = home_url();
// bail early if empty
if( !$license || !$license['key'] ) return false;
// bail early if url has changed
if( acf_strip_protocol($license['url']) !== acf_strip_protocol($home_url) ) return false;
// return
return $license['key'];
}
/*
* acf_pro_update_license
*
* This function will update the DB license
*
* @type function
* @date 20/09/2016
* @since 5.4.0
*
* @param $key (string)
* @return n/a
*/
function acf_pro_update_license( $key = '' ) {
// vars
$value = '';
// key
if( $key ) {
// vars
$data = array(
'key' => $key,
'url' => home_url()
);
// encode
$value = base64_encode(maybe_serialize($data));
}
// re-register update (key has changed)
acf_register_plugin_update(array(
'id' => 'pro',
'key' => $key,
'slug' => acf_get_setting('slug'),
'basename' => acf_get_setting('basename'),
'version' => acf_get_setting('version'),
));
// update
return update_option('acf_pro_license', $value);
}
?>PK �
�[�*�� pro/admin/admin-updates.phpnu �[��� <?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('ACF_Admin_Updates') ) :
class ACF_Admin_Updates {
/** @var array Data used in the view. */
var $view = array();
/**
* __construct
*
* Sets up the class functionality.
*
* @date 23/06/12
* @since 5.0.0
*
* @param void
* @return void
*/
function __construct() {
// Add actions.
add_action( 'admin_menu', array($this, 'admin_menu'), 20 );
}
/**
* display_wp_error
*
* Adds an admin notice using the provided WP_Error.
*
* @date 14/1/19
* @since 5.7.10
*
* @param WP_Error $wp_error The error to display.
* @return void
*/
function display_wp_error( $wp_error ) {
// Only show one error on page.
if( acf_has_done('display_wp_error') ) {
return;
}
// Create new notice.
acf_new_admin_notice(array(
'text' => __('<b>Error</b>. Could not connect to update server', 'acf') . ' <span class="description">(' . esc_html( $wp_error->get_error_message() ) . ').</span>',
'type' => 'error'
));
}
/**
* get_changelog_changes
*
* Finds the specific changes for a given version from the provided changelog snippet.
*
* @date 14/1/19
* @since 5.7.10
*
* @param string $changelog The changelog text.
* @param string $version The version to find.
* @return string
*/
function get_changelog_changes( $changelog = '', $version = '' ) {
// Explode changelog into sections.
$bits = array_filter( explode('<h4>', $changelog) );
// Loop over each version chunk.
foreach( $bits as $bit ) {
// Find the version number for this chunk.
$bit = explode('</h4>', $bit);
$bit_version = trim( $bit[0] );
$bit_text = trim( $bit[1] );
// Compare the chunk version number against param and return HTML.
if( acf_version_compare($bit_version, '==', $version) ) {
return '<h4>' . esc_html($bit_version) . '</h4>' . acf_esc_html($bit_text);
}
}
// Return.
return '';
}
/**
* admin_menu
*
* Adds the admin menu subpage.
*
* @date 28/09/13
* @since 5.0.0
*
* @param void
* @return void
*/
function admin_menu() {
// Bail early if no show_admin.
if( !acf_get_setting('show_admin') ) {
return;
}
// Bail early if no show_updates.
if( !acf_get_setting('show_updates') ) {
return;
}
// Bail early if not a plugin (included in theme).
if( !acf_is_plugin_active() ) {
return;
}
// Add submenu.
$page = add_submenu_page( 'edit.php?post_type=acf-field-group', __('Updates','acf'), __('Updates','acf'), acf_get_setting('capability'), 'acf-settings-updates', array($this,'html') );
// Add actions to page.
add_action( "load-$page", array($this,'load') );
}
/**
* load
*
* Runs when loading the submenu page.
*
* @date 7/01/2014
* @since 5.0.0
*
* @param void
* @return void
*/
function load() {
// Check activate.
if( acf_verify_nonce('activate_pro_licence') ) {
$this->activate_pro_licence();
// Check deactivate.
} elseif( acf_verify_nonce('deactivate_pro_licence') ) {
$this->deactivate_pro_licence();
}
// vars
$license = acf_pro_get_license_key();
$this->view = array(
'license' => $license,
'active' => $license ? 1 : 0,
'current_version' => acf_get_setting('version'),
'remote_version' => '',
'update_available' => false,
'changelog' => '',
'upgrade_notice' => ''
);
// get plugin updates
$force_check = !empty( $_GET['force-check'] );
$info = acf_updates()->get_plugin_info('pro', $force_check);
// Display error.
if( is_wp_error($info) ) {
return $this->display_wp_error( $info );
}
// add info to view
$this->view['remote_version'] = $info['version'];
// add changelog if the remote version is '>' than the current version
$version = acf_get_setting('version');
// check if remote version is higher than current version
if( version_compare($info['version'], $version, '>') ) {
// update view
$this->view['update_available'] = true;
$this->view['changelog'] = $this->get_changelog_changes($info['changelog'], $info['version']);
$this->view['upgrade_notice'] = $this->get_changelog_changes($info['upgrade_notice'], $info['version']);
// perform update checks if license is active
$basename = acf_get_setting('basename');
$update = acf_updates()->get_plugin_update( $basename );
if( $license ) {
// display error if no package url
// - possible if license key has been modified
if( $update && !$update['package'] ) {
$this->view['update_available'] = false;
acf_new_admin_notice(array(
'text' => __('<b>Error</b>. Could not authenticate update package. Please check again or deactivate and reactivate your ACF PRO license.', 'acf'),
'type' => 'error'
));
}
// refresh transient
// - if no update exists in the transient
// - or if the transient 'new_version' is stale
if( !$update || $update['new_version'] !== $info['version'] ) {
acf_updates()->refresh_plugins_transient();
}
}
}
}
/**
* activate_pro_licence
*
* Activates the submitted license key.
*
* @date 16/01/2014
* @since 5.0.0
*
* @param void
* @return void
*/
function activate_pro_licence() {
// Connect to API.
$post = array(
'acf_license' => trim($_POST['acf_pro_licence']),
'acf_version' => acf_get_setting('version'),
'wp_name' => get_bloginfo('name'),
'wp_url' => home_url(),
'wp_version' => get_bloginfo('version'),
'wp_language' => get_bloginfo('language'),
'wp_timezone' => get_option('timezone_string'),
);
$response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
// Check response is expected JSON array (not string).
if( is_string($response) ) {
$response = new WP_Error( 'server_error', esc_html($response) );
}
// Display error.
if( is_wp_error($response) ) {
return $this->display_wp_error( $response );
}
// On success.
if( $response['status'] == 1 ) {
// Update license.
acf_pro_update_license( $response['license'] );
// Refresh plugins transient to fetch new update data.
acf_updates()->refresh_plugins_transient();
// Show notice.
acf_add_admin_notice( $response['message'], 'success' );
// On failure.
} else {
// Show notice.
acf_add_admin_notice( $response['message'], 'warning' );
}
}
/**
* activate_pro_licence
*
* Deactivates the registered license key.
*
* @date 16/01/2014
* @since 5.0.0
*
* @param void
* @return void
*/
function deactivate_pro_licence() {
// Get license key.
$license = acf_pro_get_license_key();
// Bail early if no key.
if( !$license ) {
return;
}
// Connect to API.
$post = array(
'acf_license' => $license,
'wp_url' => home_url(),
);
$response = acf_updates()->request('v2/plugins/deactivate?p=pro', $post);
// Check response is expected JSON array (not string).
if( is_string($response) ) {
$response = new WP_Error( 'server_error', esc_html($response) );
}
// Display error.
if( is_wp_error($response) ) {
return $this->display_wp_error( $response );
}
// Remove license key from DB.
acf_pro_update_license('');
// Refresh plugins transient to fetch new update data.
acf_updates()->refresh_plugins_transient();
// On success.
if( $response['status'] == 1 ) {
// Show notice.
acf_add_admin_notice( $response['message'], 'info' );
// On failure.
} else {
// Show notice.
acf_add_admin_notice( $response['message'], 'warning' );
}
}
/**
* html
*
* Displays the submenu page's HTML.
*
* @date 7/01/2014
* @since 5.0.0
*
* @param void
* @return void
*/
function html() {
acf_get_view( dirname(__FILE__) . '/views/html-settings-updates.php', $this->view);
}
}
// Initialize.
acf_new_instance('ACF_Admin_Updates');
endif; // class_exists check
PK �
�[}sP�� � pro/admin/admin-options-page.phpnu �[��� <?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('acf_admin_options_page') ) :
class acf_admin_options_page {
/** @var array Contains the current options page */
var $page;
/*
* __construct
*
* Initialize filters, action, variables and includes
*
* @type function
* @date 23/06/12
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
function __construct() {
// add menu items
add_action('admin_menu', array($this,'admin_menu'), 99, 0);
}
/*
* admin_menu
*
* description
*
* @type function
* @date 24/02/2014
* @since 5.0.0
*
* @param
* @return
*/
function admin_menu() {
// vars
$pages = acf_get_options_pages();
// bail early if no pages
if( empty($pages) ) return;
// loop
foreach( $pages as $page ) {
// vars
$slug = '';
// parent
if( empty($page['parent_slug']) ) {
$slug = add_menu_page( $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html'), $page['icon_url'], $page['position'] );
// child
} else {
$slug = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html') );
}
// actions
add_action("load-{$slug}", array($this,'admin_load'));
}
}
/*
* load
*
* description
*
* @type function
* @date 2/02/13
* @since 3.6
*
* @param $post_id (int)
* @return $post_id (int)
*/
function admin_load() {
// globals
global $plugin_page;
// vars
$this->page = acf_get_options_page( $plugin_page );
// get post_id (allow lang modification)
$this->page['post_id'] = acf_get_valid_post_id($this->page['post_id']);
// verify and remove nonce
if( acf_verify_nonce('options') ) {
// save data
if( acf_validate_save_post(true) ) {
// set autoload
acf_update_setting('autoload', $this->page['autoload']);
// save
acf_save_post( $this->page['post_id'] );
// redirect
wp_redirect( add_query_arg(array('message' => '1')) );
exit;
}
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action( 'acf/input/admin_enqueue_scripts', array($this,'admin_enqueue_scripts') );
add_action( 'acf/input/admin_head', array($this,'admin_head') );
// add columns support
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
}
/*
* admin_enqueue_scripts
*
* This function will enqueue the 'post.js' script which adds support for 'Screen Options' column toggle
*
* @type function
* @date 23/03/2016
* @since 5.3.2
*
* @param
* @return
*/
function admin_enqueue_scripts() {
wp_enqueue_script('post');
}
/*
* admin_head
*
* This action will find and add field groups to the current edit page
*
* @type action (admin_head)
* @date 23/06/12
* @since 3.1.8
*
* @param n/a
* @return n/a
*/
function admin_head() {
// get field groups
$field_groups = acf_get_field_groups(array(
'options_page' => $this->page['menu_slug']
));
// notices
if( !empty($_GET['message']) && $_GET['message'] == '1' ) {
acf_add_admin_notice( $this->page['updated_message'], 'success' );
}
// add submit div
add_meta_box('submitdiv', __('Publish','acf'), array($this, 'postbox_submitdiv'), 'acf_options_page', 'side', 'high');
if( empty($field_groups) ) {
acf_add_admin_notice( sprintf( __('No Custom Field Groups found for this options page. <a href="%s">Create a Custom Field Group</a>', 'acf'), admin_url('post-new.php?post_type=acf-field-group') ), 'warning' );
} else {
foreach( $field_groups as $i => $field_group ) {
// vars
$id = "acf-{$field_group['key']}";
$title = $field_group['title'];
$context = $field_group['position'];
$priority = 'high';
$args = array( 'field_group' => $field_group );
// tweaks to vars
if( $context == 'acf_after_title' ) {
$context = 'normal';
} elseif( $context == 'side' ) {
$priority = 'core';
}
// filter for 3rd party customization
$priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
// add meta box
add_meta_box( $id, $title, array($this, 'postbox_acf'), 'acf_options_page', $context, $priority, $args );
}
// foreach
}
// if
}
/*
* postbox_submitdiv
*
* This function will render the submitdiv metabox
*
* @type function
* @date 23/03/2016
* @since 5.3.2
*
* @param n/a
* @return n/a
*/
function postbox_submitdiv( $post, $args ) {
/**
* Fires before the major-publishing-actions div.
*
* @date 24/9/18
* @since 5.7.7
*
* @param array $page The current options page.
*/
do_action( 'acf/options_page/submitbox_before_major_actions', $this->page );
?>
<div id="major-publishing-actions">
<div id="publishing-action">
<span class="spinner"></span>
<input type="submit" accesskey="p" value="<?php echo $this->page['update_button']; ?>" class="button button-primary button-large" id="publish" name="publish">
</div>
<?php
/**
* Fires before the major-publishing-actions div.
*
* @date 24/9/18
* @since 5.7.7
*
* @param array $page The current options page.
*/
do_action( 'acf/options_page/submitbox_major_actions', $this->page );
?>
<div class="clear"></div>
</div>
<?php
}
/*
* render_meta_box
*
* description
*
* @type function
* @date 24/02/2014
* @since 5.0.0
*
* @param $post (object)
* @param $args (array)
* @return n/a
*/
function postbox_acf( $post, $args ) {
// extract args
extract( $args ); // all variables from the add_meta_box function
extract( $args ); // all variables from the args argument
// vars
$o = array(
'id' => $id,
'key' => $field_group['key'],
'style' => $field_group['style'],
'label' => $field_group['label_placement'],
'editLink' => '',
'editTitle' => __('Edit field group', 'acf'),
'visibility' => true
);
// edit_url
if( $field_group['ID'] && acf_current_user_can_admin() ) {
$o['editLink'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit');
}
// load fields
$fields = acf_get_fields( $field_group );
// render
acf_render_fields( $fields, $this->page['post_id'], 'div', $field_group['instruction_placement'] );
?>
<script type="text/javascript">
if( typeof acf !== 'undefined' ) {
acf.newPostbox(<?php echo json_encode($o); ?>);
}
</script>
<?php
}
/*
* html
*
* @description:
* @since: 2.0.4
* @created: 5/12/12
*/
function html() {
// load view
acf_get_view(dirname(__FILE__) . '/views/html-options-page.php', $this->page);
}
}
// initialize
new acf_admin_options_page();
endif;
?>PK �
�[B
q�� � % pro/admin/views/html-options-page.phpnu �[��� <div class="wrap acf-settings-wrap">
<h1><?php echo $page_title; ?></h1>
<form id="post" method="post" name="post">
<?php
// render post data
acf_form_data(array(
'screen' => 'options',
'post_id' => $post_id,
));
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
?>
<div id="poststuff" class="poststuff">
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
<div id="postbox-container-1" class="postbox-container">
<?php do_meta_boxes('acf_options_page', 'side', null); ?>
</div>
<div id="postbox-container-2" class="postbox-container">
<?php do_meta_boxes('acf_options_page', 'normal', null); ?>
</div>
</div>
<br class="clear">
</div>
</form>
</div>PK �
�[�q;u u ) pro/admin/views/html-settings-updates.phpnu �[��� <?php
// vars
$active = $license ? true : false;
$nonce = $active ? 'deactivate_pro_licence' : 'activate_pro_licence';
$input = $active ? 'password' : 'text';
$button = $active ? __('Deactivate License', 'acf') : __('Activate License', 'acf');
$readonly = $active ? 1 : 0;
?>
<div class="wrap acf-settings-wrap">
<h1><?php _e('Updates', 'acf'); ?></h1>
<div class="acf-box" id="acf-license-information">
<div class="title">
<h3><?php _e('License Information', 'acf'); ?></h3>
</div>
<div class="inner">
<p><?php printf(__('To unlock updates, please enter your license key below. If you don\'t have a licence key, please see <a href="%s" target="_blank">details & pricing</a>.','acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?></p>
<form action="" method="post">
<div class="acf-hidden">
<?php acf_nonce_input($nonce); ?>
</div>
<table class="form-table">
<tbody>
<tr>
<th>
<label for="acf-field-acf_pro_licence"><?php _e('License Key', 'acf'); ?></label>
</th>
<td>
<?php
// render field
acf_render_field(array(
'type' => $input,
'name' => 'acf_pro_licence',
'value' => str_repeat('*', strlen($license)),
'readonly' => $readonly
));
?>
</td>
</tr>
<tr>
<th></th>
<td>
<input type="submit" value="<?php echo $button; ?>" class="button button-primary">
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="acf-box" id="acf-update-information">
<div class="title">
<h3><?php _e('Update Information', 'acf'); ?></h3>
</div>
<div class="inner">
<table class="form-table">
<tbody>
<tr>
<th>
<label><?php _e('Current Version', 'acf'); ?></label>
</th>
<td>
<?php echo esc_html( $current_version ); ?>
</td>
</tr>
<tr>
<th>
<label><?php _e('Latest Version', 'acf'); ?></label>
</th>
<td>
<?php echo esc_html( $remote_version ); ?>
</td>
</tr>
<tr>
<th>
<label><?php _e('Update Available', 'acf'); ?></label>
</th>
<td>
<?php if( $update_available ): ?>
<span style="margin-right: 5px;"><?php _e('Yes', 'acf'); ?></span>
<?php if( $active ): ?>
<a class="button button-primary" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a>
<?php else: ?>
<a class="button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a>
<?php endif; ?>
<?php else: ?>
<span style="margin-right: 5px;"><?php _e('No', 'acf'); ?></span>
<a class="button" href="<?php echo add_query_arg('force-check', 1); ?>"><?php _e('Check Again', 'acf'); ?></a>
<?php endif; ?>
</td>
</tr>
<?php if( $changelog ): ?>
<tr>
<th>
<label><?php _e('Changelog', 'acf'); ?></label>
</th>
<td>
<?php echo acf_esc_html( $changelog ); ?>
</td>
</tr>
<?php endif; ?>
<?php if( $upgrade_notice ): ?>
<tr>
<th>
<label><?php _e('Upgrade Notice', 'acf'); ?></label>
</th>
<td>
<?php echo acf_esc_html( $upgrade_notice ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<style type="text/css">
#acf_pro_licence {
width: 75%;
}
#acf-update-information td h4 {
display: none;
}
</style>PK �
�[jT�d�M �M &