File "acf-pro.php"
Full Path: /home/elegucvf/public_html/video/wp-content/plugins/atlas-core/framework/acf-pro/acf-pro.php
File size: 2.58 KB
MIME-type: text/x-php
Charset: utf-8
<?php
if ( ! class_exists( 'acf_pro' ) ) :
/**
* The main ACF PRO class.
*/
class acf_pro {
/**
* Main ACF PRO constructor
*
* @since 5.0.0
*/
public function __construct() {
// actions
add_action( 'init', array( $this, 'register_assets' ) );
add_action( 'acf/include_field_types', array( $this, 'include_field_types' ), 5 );
add_action( 'acf/input/admin_enqueue_scripts', array( $this, 'input_admin_enqueue_scripts' ) );
}
/**
* Includes any files necessary for field types.
*
* @date 21/10/2015
* @since 5.2.3
*/
function include_field_types() {
include_once( plugin_dir_path( __FILE__ ) . 'fields/class-acf-repeater-table.php' );
include_once( plugin_dir_path( __FILE__ ) . 'fields/class-acf-field-repeater.php' );
include_once( plugin_dir_path( __FILE__ ) . 'fields/class-acf-field-flexible-content.php' );
include_once( plugin_dir_path( __FILE__ ) . 'fields/class-acf-field-gallery.php' );
include_once( plugin_dir_path( __FILE__ ) . 'fields/class-acf-field-clone.php' );
}
/**
* Registers styles and scripts used by ACF PRO.
*
* @since 5.0.0
*/
public function register_assets() {
$version = acf_get_setting( 'version' );
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
// Register scripts.
wp_register_script( 'acf-pro-input', plugin_dir_url( __FILE__ ) . 'pro-assets/js/acf-pro-input' . $min . '.js', array('acf-input'), $version );
// Register styles.
wp_register_style( 'acf-pro-input', plugin_dir_url( __FILE__ ) . 'pro-assets/css/acf-pro-input.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_script( 'acf-pro-ui-options-page' );
wp_enqueue_style( 'acf-pro-input' );
}
/**
* Filters the $where clause allowing for custom WP_Query args.
*
* @since 6.2
*
* @param string $where The WHERE clause.
* @param WP_Query $wp_query The query object.
* @return string
*/
public function posts_where( $where, $wp_query ) {
global $wpdb;
$options_page_key = $wp_query->get( 'acf_ui_options_page_key' );
// Add custom "acf_options_page_key" arg.
if ( $options_page_key ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_name = %s", $options_page_key );
}
return $where;
}
}
// instantiate
new acf_pro();
// end class
endif;