settings = array( 'plugin' => 'ACF Columns', 'this_acf_version' => 0, 'min_acf_version' => '5.4.0', 'version' => '1.2.1', 'url' => plugin_dir_url( __FILE__ ), 'path' => plugin_dir_path( __FILE__ ), 'plugin_path' => 'https://wordpress.org/plugins/acf-columns/' ); // set text domain load_plugin_textdomain( 'acf_column', false, dirname( plugin_basename(__FILE__) ) . '/languages/' ); // check for ACF and min version add_action( 'admin_init', array($this, 'acf_or_die'), 11); // include field add_action('acf/include_field_types', array($this, 'include_field_types_column')); if ( DHZ_SHOW_DONATION_LINK == true ) { // add plugin to $plugins array for the metabox add_filter( '_dhz_plugins_list', array($this, '_dhz_meta_box_data') ); // metabox callback for plugins list and donation link add_action( 'add_meta_boxes_acf-field-group', array($this, '_dhz_plugins_list_meta_box') ); } } /** * Let's make sure ACF Pro is installed & activated * If not, we give notice and kill the activation of ACF RGBA Color Picker. * Also works if ACF Pro is deactivated. */ function acf_or_die() { if ( !class_exists('acf') ) { $this->kill_plugin(); } else { $this->settings['this_acf_version'] = acf()->settings['version']; if ( version_compare( $this->settings['this_acf_version'], $this->settings['min_acf_version'], '<' ) ) { $this->kill_plugin(); } } } function kill_plugin() { deactivate_plugins( plugin_basename( __FILE__ ) ); if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } add_action( 'admin_notices', array($this, 'acf_dependent_plugin_notice') ); } function acf_dependent_plugin_notice() { echo '

' . sprintf( __('%1$s requires ACF PRO v%2$s or higher to be installed and activated.', 'acf_column'), $this->settings['plugin'], $this->settings['min_acf_version']) . '

'; } function include_field_types_column( $version ) { if ( version_compare(acf()->settings['version'], '5.7.0', '>' ) ) { // echo "
";
			// print_r('ist größer oder gleich 5.7.0');
			// echo "
"; include_once('fields/acf-column-v5.7.php'); } else if ( version_compare(acf()->settings['version'], '5.7.0', '<' ) ) { // echo "
";
			// print_r('ist kleiner als 5.7.0');
			// echo "
"; include_once('fields/acf-column-v5.php'); } // support empty $version if( !$version ) $version = 5; // include include_once('fields/acf-column-v5.php'); } /* * Add plugin to $plugins array for the metabox */ function _dhz_meta_box_data($plugins=array()) { $plugins[] = array( 'title' => $this->settings['plugin'], 'screens' => array('acf-field-group'), 'doc' => $this->settings['plugin_path'] ); return $plugins; } // end function meta_box /* * Add metabox for plugins list and donation link */ function _dhz_plugins_list_meta_box() { if (apply_filters('remove_dhz_nag', false)) { return; } $plugins = apply_filters('_dhz_plugins_list', array()); $id = 'plugins-by-dreihochzwo'; $title = ''.__("Plugins by dreihochzwo", "acf-admin-flex-collapse").''; $callback = array($this, 'show_dhz_plugins_list_meta_box'); $screens = array(); foreach ($plugins as $plugin) { $screens = array_merge($screens, $plugin['screens']); } $context = 'side'; $priority = 'default'; add_meta_box($id, $title, $callback, $screens, $context, $priority); } // end function _dhz_plugins_list_meta_box /* * Metabox callback for plugins list and donation link */ function show_dhz_plugins_list_meta_box() { $plugins = apply_filters('_dhz_plugins_list', array()); ?>