* * @copyright (c) 2018, César Maeso (https://superadmin.es) */ /** * Ui class. * * @since 0.0.0 */ class ARGPD_Ui { /** * Parent plugin class. * * @var string * @since 0.0.0 */ protected $plugin = null; /** * Constructor. * * @since 0.0.0 * * @param string $plugin Plugin name. */ public function __construct( $plugin ) { // set parent plugin. $this->plugin = $plugin; // initiate our hooks. $this->hooks(); } /** * Initiate our hooks. * * @since 0.0.0 */ public function hooks() { if ( ! current_user_can( 'manage_options' ) ) { return; } // config tab. add_action( 'argpd_settings_tab', array( $this, 'argpd_ajustes_tab' ), 1 ); add_action( 'argpd_settings_content', array( $this, 'argpd_ajustes_content' ) ); // pages tab. add_action( 'argpd_settings_tab', array( $this, 'argpd_paginas_tab' ), 2 ); add_action( 'argpd_settings_content', array( $this, 'argpd_paginas_content' ) ); // ayuda. add_action( 'argpd_settings_tab', array( $this, 'argpd_ayuda_tab' ), 3 ); add_action( 'argpd_settings_content', array( $this, 'argpd_ayuda_content' ) ); // ajax scripts. add_action( 'admin_footer', array( $this, 'argpd_change_country' ) ); add_action( 'wp_ajax_argpd_get_states', array( $this, 'argpd_get_states' ) ); add_action( 'admin_footer', array( $this, 'create_page_events' ) ); add_action( 'wp_ajax_argpd_create_page', array( $this, 'create_page' ) ); // intercambio entre negocio y particular. add_action( 'admin_footer', array( $this, 'argpd_toggle_bussines' ) ); } /** * Function wp-ajax to create pages * * @since 1.0.1 */ public function create_page() { check_ajax_referer( 'argpd_create_page', 'security' ); $id = 0; $page = ! empty( $_POST['page'] ) ? sanitize_text_field( wp_unslash( $_POST['page'] ) ) : ''; switch ( $page ) { case 'crear-pagina-legal': $id = $this->plugin->pages->create_legal_page(); break; case 'crear-pagina-privacidad': $id = $this->plugin->pages->create_privacy_page(); break; case 'crear-pagina-cookies': $id = $this->plugin->pages->create_cookies_page(); break; default: break; } echo esc_attr( $id ); wp_die(); } /** * Javascript events to create page * * @since 1.0.1 */ public function create_page_events() { ?> plugin->argpd_settings; $states = $settings->get_states( $country ); ?> plugin->argpd_settings; $classes = array(); $classes['empresa'] = $settings->get_setting('es-empresa')?'empresa':'empresa oculto'; $classes['particular'] = $settings->get_setting('es-empresa')?'particular oculto':'particular'; ?>
plugin->argpd_settings; ?>
Tu valoración de ★★★★★ ayuda a mejorar el plugin. ¡Muchas gracias!