'text/css' )); // wpcomment_pa($css_code_editor); exit; if (false !== $css_code_editor) { $css_code_editor['codemirror']['autoRefresh'] = true; $css_code_editor['codemirror']['theme'] = 'darcula'; wp_add_inline_script( 'code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "wpcomment-css-editor", %s ); } );', wp_json_encode( $css_code_editor ) ) ); } // Js Code Editor Files $js_code_editor = wp_enqueue_code_editor(array( 'type' => 'text/javascript' )); if (false !== $js_code_editor) { $js_code_editor['codemirror']['autoRefresh'] = true; $js_code_editor['codemirror']['theme'] = 'darcula'; wp_add_inline_script( 'code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "wpcomment-js-editor", %s ); } );', wp_json_encode( $js_code_editor ) ) ); } } // Tabletojson JS File wp_enqueue_script('wpcomment-tabletojson', WPCOMMENT_URL."/js/admin/jquery.tabletojson.min.js", array('jquery'), WPCOMMENT_VERSION, true); // Datatable Files // wp_enqueue_style('wpcomment-datatables', WPCOMMENT_URL."/js/datatable/datatables.min.css"); // wp_enqueue_script('wpcomment-datatables', WPCOMMENT_URL."/js/datatable/jquery.dataTables.min.js", array('jquery'), WPCOMMENT_VERSION, true); // Description Tooltips JS File wp_enqueue_script('wpcomment-tooltip', WPCOMMENT_URL."/js/wpcomment-tooltip.js", array('jquery'), WPCOMMENT_VERSION, true); // Add the color picker css file wp_enqueue_style( 'wp-color-picker' ); // PPOM Admin Files wp_enqueue_style('wpcomment-field', WPCOMMENT_URL."/css/wpcomment-admin.css", '', WPCOMMENT_VERSION); wp_enqueue_script('wpcomment-field', WPCOMMENT_URL."/js/admin/wpcomment-admin.js", array('wpcomment-swal','wpcomment-select2','wpcomment-tabletojson','wpcomment-tooltip','jquery-ui-core', 'jquery-ui-sortable','wpcomment-perload','wp-color-picker'), WPCOMMENT_VERSION, true); wp_enqueue_media (); $wpcomment_admin_meta = array( 'plugin_admin_page' => admin_url( 'admin.php?page=wpcomment'), 'loader' => WPCOMMENT_URL.'/images/loading.gif', ); // localize wpcomment_vars wp_localize_script( 'wpcomment-field', 'wpcomment_vars', $wpcomment_admin_meta); // wp_localize_script( 'wpcomment-meta-table', 'wpcomment_vars', $wpcomment_admin_meta); } /* **============ Render all fields =========== */ function render_field_settings() { $html = ''; $html .= '
'; foreach( WPCOMMENT_ADMIN()->get_all_inputs() as $fields_type => $meta ) { $field_title = isset($meta -> title) ? $meta -> title : null; $field_desc = isset($meta -> desc) ? $meta -> desc : null; $settings = isset($meta -> settings) ? $meta -> settings : array(); $settings = $this->wpcomment_tabs_panel_classes($settings); // new model $html .= '
'; $html .= '
'; $html .= '

'.sprintf(__("%s","wpcomment"), $field_title).'

'; $html .= '
'; $html .= '
'; $html .= $this->render_field_meta($settings, $fields_type); $html .= '
'; $html .= ''; $html .= '
'; } $html .= '
'; echo wpcomment_esc_html($html); } /* **============ Render all fields meta =========== */ function render_field_meta($field_meta, $fields_type, $field_index='', $save_meta='') { // wpcomment_pa($save_meta); $html = ''; $html .= '
'; $html .= ''; $html .= '
'; $wpcomment_field_tabs = $this->wpcomment_fields_tabs($fields_type); foreach ($wpcomment_field_tabs as $tab_index => $tab_meta) { $tab_label = isset($tab_meta['label']) ? $tab_meta['label'] : ''; $tab_class = isset($tab_meta['class']) ? $tab_meta['class'] : ''; $tab_depend = isset($tab_meta['field_depend']) ? $tab_meta['field_depend'] : array(); $not_allowed = isset($tab_meta['not_allowed']) ? $tab_meta['not_allowed'] : array(); $tab_class = implode(' ',$tab_class); if ( in_array('all', $tab_depend) && !in_array($fields_type, $not_allowed)) { $html .= ''; }else if( in_array($fields_type, $tab_depend) ){ $html .= ''; } } $html .= '
'; if ($field_meta) { foreach ($field_meta as $fields_meta_key => $meta) { $title = isset($meta['title']) ? $meta['title'] : ''; $desc = isset($meta['desc']) ? $meta['desc'] : ''; $type = isset($meta['type']) ? $meta['type'] : ''; $link = isset($meta['link']) ? $meta['link'] : ''; $values = isset($save_meta[$fields_meta_key]) ? $save_meta[$fields_meta_key] : ''; $default_value = isset($meta ['default']) ? $meta ['default'] : ''; // wpcomment_pa($fields_meta_key); if ( empty( $values) ){ $values = $default_value; } $input_wrapper_classes = isset($meta['col_classes']) ? $meta['col_classes'] : array(); // $input_wrapper_classes = array('col-md-6', 'col-sm-6'); if (empty($input_wrapper_classes)) { $input_wrapper_classes = array('col-md-6', 'col-sm-12'); } $panel_classes = isset($meta['tabs_class']) ? $meta['tabs_class'] : array_merge($input_wrapper_classes, array('wpcomment_handle_fields_tab')); $panel_classes[] = 'wpcomment-control-all-fields-tabs'; if ($type == 'checkbox') { $panel_classes[] = 'wpcomment-checkboxe-style'; } if (!empty($panel_classes)) { $panel_classes = implode(' ',$panel_classes); } $html .= '
'; $html .= '
'; $html .= ''; $html .= $this-> render_all_input_types( $fields_meta_key, $meta, $fields_type, $field_index, $values ); $html .= '
'; $html .= '
'; } } $html .= '
'; return ($html); } /* * this function is rendring input field for settings */ function render_all_input_types($name, $data, $fields_type, $field_index, $values ) { // wpcomment_pa($values); $type = (isset( $data ['type'] ) ? $data ['type'] : ''); $options = (isset( $data ['options'] ) ? $data ['options'] : ''); $placeholders = isset($data['placeholders']) ? $data['placeholders'] : ''; $existing_name = 'name="wpcomment['.esc_attr($field_index).']['.esc_attr($name).']"'; $html_input = ''; if(!is_array($values)) $values = stripslashes($values); switch ($type) { case 'number': case 'text' : // wpcomment_pa($values); $html_input .= ''; break; case 'select' : $html_input .= ''; break; case 'paired' : $plc_option = (!empty($placeholders)) ? $placeholders[0] : __('Option',"wpcomment"); $plc_id = (isset($placeholders[3]) && !empty($placeholders)) ? $placeholders[3] : __('Unique Option ID)', "wpcomment"); $opt_index0 = 1; $html_input .= '