public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Hooks into taxonomy-specific actions if there are some term field groups associated. */ private function add_hooks() { $factory = Types_Field_Group_Term_Factory::get_instance(); $groups_by_taxonomies = $factory->get_groups_by_taxonomies(); $is_toolset_forms_support_needed = false; // Hooks for editing term fields foreach ($groups_by_taxonomies as $taxonomy => $groups) { if (!empty($groups)) { add_action("{$taxonomy}_add_form_fields", array($this, 'on_term_add')); add_action("{$taxonomy}_edit_form_fields", array($this, 'on_term_edit'), 10, 2); add_action("create_{$taxonomy}", array($this, 'on_term_update'), 10, 2); add_action("edit_{$taxonomy}", array($this, 'on_term_update'), 10, 2); $is_toolset_forms_support_needed = true; } } // Columns on the term listing $main_controller = Types_Main::get_instance(); $is_term_listing_page = $main_controller->is_admin() && 'edit' != wpcf_getget('action'); if ($is_term_listing_page) { $screen = get_current_screen(); add_action("manage_{$screen->id}_columns", array($this, 'manage_term_listing_columns')); add_filter("manage_{$screen->taxonomy}_custom_column", array($this, 'manage_term_listing_cell'), 10, 3); add_filter('hidden_columns', array($this, 'filter_hidden_columns'), 10, 3); } if ($is_toolset_forms_support_needed) { $this->add_toolset_forms_support(); } }
/** * Store field definition array in the options. * * This is a low-level method that doesn't perform any kind of validation or sanitization. Use with care. * * @param string $field_slug * @param array $definition_array * @since 2.0 */ private function set_field_definition($field_slug, $definition_array) { $fields_from_options = $this->get_fields_from_options(); $fields_from_options[$field_slug] = $definition_array; $this->update_field_definition_option($fields_from_options); // This can be called during an AJAX call, in which case the legacy code is not loaded Types_Main::get_instance()->require_legacy_functions(); // Clear the underlying legacy cache. wpcf_admin_fields_get_fields(false, false, false, $this->get_option_name(), false, true); }
define('WPCF_EMBEDDED_TOOLSET_ABSPATH', TYPES_ABSPATH . '/library/toolset'); } if (!defined('WPCF_EMBEDDED_TOOLSET_RELPATH')) { define('WPCF_EMBEDDED_TOOLSET_RELPATH', TYPES_RELPATH . '/library/toolset'); } if (!defined('WPTOOLSET_COMMON_PATH')) { define('WPTOOLSET_COMMON_PATH', TYPES_ABSPATH . '/library/toolset/toolset-common'); } if (!defined('EDITOR_ADDON_RELPATH')) { define('EDITOR_ADDON_RELPATH', WPCF_EMBEDDED_TOOLSET_RELPATH . '/toolset-common/visual-editor'); } // installer $installer = TYPES_ABSPATH . '/library/otgs/installer/loader.php'; if (file_exists($installer)) { /** @noinspection PhpIncludeInspection */ include_once $installer; if (function_exists('WP_Installer_Setup')) { WP_Installer_Setup($wp_installer_instance, array('plugins_install_tab' => '1', 'repositories_include' => array('toolset', 'wpml'))); } } // Get new functions.php require_once dirname(__FILE__) . '/functions.php'; // Initialize legacy code require_once dirname(__FILE__) . '/../library/toolset/types/wpcf.php'; // Public API require_once dirname(__FILE__) . '/api.php'; // Handle embedded plugin mode Types_Embedded::initialize(); // Jumpstart new Types Types_Main::initialize();