init();
}
public function get_ext_path() {
return plugin_dir_path(__FILE__);
}
public function get_ext_override_path() {
return get_stylesheet_directory() . DIRECTORY_SEPARATOR . "apffw" . DIRECTORY_SEPARATOR . "ext" . DIRECTORY_SEPARATOR . $this->html_type . DIRECTORY_SEPARATOR;
}
public function get_ext_link() {
return plugin_dir_url(__FILE__);
}
public function init() {
add_filter('apffw_add_html_types', array($this, 'apffw_add_html_types'));
add_action('apffw_print_tax_additional_options_image', array($this, 'print_additional_options'), 10, 1);
add_action('apffw_print_design_additional_options', array($this, 'apffw_print_design_additional_options'), 10, 1);
self::$includes['js']['apffw_' . $this->html_type . '_html_items'] = $this->get_ext_link() . 'js/html_types/' . $this->html_type . '.js';
self::$includes['css']['apffw_' . $this->html_type . '_html_items'] = $this->get_ext_link() . 'css/html_types/' . $this->html_type . '.css';
self::$includes['js_init_functions'][$this->html_type] = 'apffw_init_image';
add_action('admin_head', array($this, 'admin_head'), 50);
$this->taxonomy_type_additional_options = array(
'show_title' => array(
'title' => esc_html__('Show image title', 'apffw-products-filter'),
'tip' => esc_html__('Show image title below picture', 'apffw-products-filter'),
'type' => 'select',
'options' => array(
0 => esc_html__('No', 'apffw-products-filter'),
1 => esc_html__('Yes', 'apffw-products-filter'),
)
),
'as_radio' => array(
'title' => esc_html__('Behavior as radio button', 'apffw-products-filter'),
'tip' => esc_html__('Use image as radio button', 'apffw-products-filter'),
'type' => 'select',
'options' => array(
0 => esc_html__('No', 'apffw-products-filter'),
1 => esc_html__('Yes', 'apffw-products-filter'),
)
),
);
}
public function admin_head() {
if (isset($_GET['tab']) AND $_GET['tab'] == 'apffw') {
wp_enqueue_style('apffw_image', $this->get_ext_link() . 'css/admin.css', array(), APFFW_VERSION);
wp_enqueue_script('apffw_image', $this->get_ext_link() . 'js/html_types/plugin_options.js', array('jquery'), APFFW_VERSION);
}
}
public function apffw_add_html_types($types) {
$types[$this->html_type] = esc_html__('Image', 'apffw-products-filter');
return $types;
}
public function print_additional_options($key) {
global $APFFW;
$apffw_settings = $APFFW->settings;
$terms = APFFW_HELPER::get_terms($key, 0, 0, 0, 0);
if (!empty($terms)) {
?>