add_substitute_control('', $this->dbdata, [ 'type' => Controls::SHORTCODENAME, 'title' => esc_html__('Shortcode Name', 'accordions-or-faqs'), 'placeholder' => esc_html__('Set Your Shortcode Name', 'accordions-or-faqs'), 'showing' => TRUE, ]); } public function thumbnail_sizes() { $default_image_sizes = get_intermediate_image_sizes(); $thumbnail_sizes = array(); foreach ($default_image_sizes as $size) { $image_sizes[$size] = $size . ' - ' . intval(get_option("{$size}_size_w")) . ' x ' . intval(get_option("{$size}_size_h")); $thumbnail_sizes[$size] = str_replace('_', ' ', ucfirst($image_sizes[$size])); } return $thumbnail_sizes; } /** * Template Information * Parent Sector where users will get Information * * @since 2.0.1 */ public function shortcode_info() { $this->add_substitute_control($this->oxiid, $this->dbdata, [ 'type' => Controls::SHORTCODEINFO, 'title' => esc_html__('Shortcode', 'accordions-or-faqs'), 'showing' => TRUE, ]); } /** * Template Modal Form Data * return always false and abstract with current Style Template * * @since 2.0.1 */ public function modal_form_data() { $this->form = 'single'; } /** * Template Parent Item Data Rearrange * * @since 2.0.0 */ public function Rearrange() { return '
  • {{oxi-accordions-modal-title}}
  • '; } /** * Template Parent Item Data Rearrange * * @since 2.0.1 */ public function shortcode_rearrange() { $rearrange = $this->Rearrange(); if (!empty($rearrange)) : $this->add_substitute_control($rearrange, [], [ 'type' => Controls::REARRANGE, 'showing' => TRUE, 'condition' => [ 'oxi-accordions-content-type' => 'content' ], ]); endif; } /** * Template Modal opener * Define Multiple Data With Single Data * * @since 2.0.1 */ public function modal_opener() { $this->add_substitute_control('', [], [ 'type' => Controls::MODALOPENER, 'title' => esc_html__('Accordions Data Form', 'accordions-or-faqs'), 'sub-title' => esc_html__('Open Form', 'accordions-or-faqs'), 'condition' => [ 'oxi-accordions-content-type' => 'content' ], 'showing' => TRUE, ]); } /** * Template CSS Render * * @since 2.0.1 */ public function template_css_render($style) { $styleid = $style['style-id']; $this->oxiid = $styleid; $this->WRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid; $this->CSSWRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid . ' > .oxi-addons-row'; $this->style = $style; ob_start(); $dt = $this->import_font_family(); $dt .= $this->register_controls(); ob_end_clean(); $fullcssfile = ''; foreach ($this->CSSDATA as $key => $responsive) { $tempcss = ''; foreach ($responsive as $class => $classes) { $tempcss .= $class . '{'; foreach ($classes as $properties) { $tempcss .= $properties; } $tempcss .= '}'; } if ($key == 'laptop') : $fullcssfile .= $tempcss; elseif ($key == 'tab') : $fullcssfile .= '@media only screen and (min-width : 769px) and (max-width : 993px){'; $fullcssfile .= $tempcss; $fullcssfile .= '}'; elseif ($key == 'mobile') : $fullcssfile .= '@media only screen and (max-width : 768px){'; $fullcssfile .= $tempcss; $fullcssfile .= '}'; endif; } $font = json_encode($this->font); $this->database->wpdb->query($this->database->wpdb->prepare("UPDATE {$this->database->parent_table} SET stylesheet = %s WHERE id = %d", $fullcssfile, $styleid)); $this->database->wpdb->query($this->database->wpdb->prepare("UPDATE {$this->database->parent_table} SET font_family = %s WHERE id = %d", $font, $styleid)); return 'success'; } /** * Template CSS Render * * @since 2.0.1 */ public function inline_template_css_render($style) { $styleid = $style['style-id']; $this->style = $style; $this->oxiid = $styleid; $this->WRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid; $this->CSSWRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid . ' > .oxi-addons-row'; ob_start(); $dt = $this->import_font_family(); $dt = $this->register_controls(); ob_end_clean(); $fullcssfile = ''; foreach ($this->CSSDATA as $key => $responsive) { $tempcss = ''; foreach ($responsive as $class => $classes) { $tempcss .= $class . '{'; foreach ($classes as $properties) { $tempcss .= $properties; } $tempcss .= '}'; } if ($key == 'laptop') : $fullcssfile .= $tempcss; elseif ($key == 'tab') : $fullcssfile .= '@media only screen and (min-width : 769px) and (max-width : 993px){'; $fullcssfile .= $tempcss; $fullcssfile .= '}'; elseif ($key == 'mobile') : $fullcssfile .= '@media only screen and (max-width : 768px){'; $fullcssfile .= $tempcss; $fullcssfile .= '}'; endif; } foreach ($this->font as $value) { wp_enqueue_style('' . $value . '', 'https://fonts.googleapis.com/css?family=' . $value . ''); } return $fullcssfile; } public function register_controls() { $this->start_section_header( 'shortcode-addons-start-tabs', [ 'options' => [ 'button-settings' => esc_html__('General Settings', 'accordions-or-faqs'), 'custom' => esc_html__('Custom CSS', 'accordions-or-faqs'), ] ] ); $this->start_section_tabs( 'oxi-accordions-start-tabs', [ 'condition' => [ 'oxi-tabs-start-tabs' => esc_html__('button-settings', 'accordions-or-faqs'), ] ] ); $this->start_section_devider(); $this->register_general(); $this->end_section_devider(); $this->start_section_devider(); $this->register_heading(); $this->end_section_devider(); $this->end_section_tabs(); $this->start_section_tabs( 'oxi-tabs-start-tabs', [ 'condition' => [ 'oxi-tabs-start-tabs' => 'custom' ], 'padding' => '10px' ] ); $this->start_controls_section( 'oxi-tabs-start-tabs-css', [ 'label' => esc_html__('Custom CSS', 'accordions-or-faqs'), 'showing' => TRUE, ] ); $this->add_control( 'oxi-tabs-custom-css', $this->style, [ 'label' => esc_html__('', 'accordions-or-faqs'), 'type' => Controls::TEXTAREA, 'default' => '', 'description' => esc_html__('Custom CSS Section. You can add custom css into textarea.') ] ); $this->end_controls_section(); $this->end_section_tabs(); } public function __construct($type = '') { $this->database = new \OXI_ACCORDIONS_PLUGINS\Helper\Database(); $this->oxiid = (!empty($_GET['styleid']) ? (int) $_GET['styleid'] : ''); $this->WRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid; $this->CSSWRAPPER = '.oxi-accordions-wrapper-' . $this->oxiid . ' > .oxi-addons-row'; if ($type != 'admin') { $this->hooks(); $this->render(); } } public function str_replace_first($from, $to, $content) { $from = '/' . preg_quote($from, '/') . '/'; return preg_replace($from, $to, $content, 1); } /** * Template Parent Render * * @since 2.0.1 */ public function render() { ?>
    register_controls(); ?>
    modal_opener(); $this->shortcode_name(); $this->shortcode_info(); $this->shortcode_rearrange(); $this->modal_form(); ?>
    Preview
    admin_elements_editior_loader(); $this->dbdata = $this->database->wpdb->get_row($this->database->wpdb->prepare('SELECT * FROM ' . $this->database->parent_table . ' WHERE id = %d ', $this->oxiid), ARRAY_A); $Get_Nested_Accordions = $this->database->wpdb->get_results($this->database->wpdb->prepare("SELECT id, name FROM {$this->database->parent_table} WHERE type = %s ORDER by id ASC", 'accordions-or-faqs'), ARRAY_A); foreach ($Get_Nested_Accordions as $key => $value) { if ($value['id'] != $this->oxiid) : $this->Get_Nested_Accordions[$value['id']] = !empty($value['name']) ? $value['name'] : 'Accordions id ' . $value['id']; endif; } $this->child = $this->database->wpdb->get_results($this->database->wpdb->prepare("SELECT * FROM {$this->database->child_table} WHERE styleid = %d ORDER by id ASC", $this->oxiid), ARRAY_A); if (!empty($this->dbdata['rawdata'])) : $s = json_decode(stripslashes($this->dbdata['rawdata']), true); if (is_array($s)) : $this->style = $s; endif; endif; $this->import_font_family(); } /** * Template Parent Modal Form * * @since 2.0.1 */ public function modal_form() { echo ''; } }