'',
'installation' => '',
'changelog' => '',
'upgrade_notice' => ''
);
foreach( $sections as $k => $v ) {
$sections[ $k ] = $info->$k;
unset( $info->$k );
}
$info->sections = $sections;
// return
return $info;
}
/*
* plugin_update
*
* This function will return an object of data saved in transient and used by WP do perform an update
*
* @type function
* @date 16/01/2014
* @since 5.0.0
*
* @param $update (object)
* @param $transient (object)
* @return $update
*/
function plugin_update( $update, $transient ) {
// bail early if no update available
if( !acf_pro_is_update_available() ) return false;
// vars
$info = acf_get_remote_plugin_info();
$basename = acf_get_setting('basename');
$slug = acf_get_setting('slug');
// create new object for update
$obj = new stdClass();
$obj->slug = $slug;
$obj->plugin = $basename;
$obj->new_version = $info['version'];
$obj->url = $info['homepage'];
$obj->package = '';
// license
if( acf_pro_is_license_active() ) {
$obj->package = acf_pro_get_remote_url('download', array(
'k' => acf_pro_get_license_key(),
'wp_url' => home_url(),
'acf_version' => acf_get_setting('version'),
'wp_version' => get_bloginfo('version'),
));
}
// return
return $obj;
}
/*
* 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 plugin_update_message( $message, $plugin_data, $r ) {
// validate
if( acf_pro_is_license_active() ) return $message;
// vars
$activate_message = sprintf(
__('To enable updates, please enter your license key on the Updates page. If you don\'t have a licence key, please see details & pricing.', 'acf'),
admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'),
'https://www.advancedcustomfields.com/pro'
);
// return
// override $message (if plugin is not active, there is no need to see upgrade_notice)
return '
' . $activate_message;
}
}
// initialize
new acf_pro_updates();
endif; // class_exists check
?>