plugin_name = 'tableberg'; $this->version = TABLEBERG_VERSION; $this->plugin_path = TABLEBERG_DIR_PATH; $this->plugin_url = TABLEBERG_URL; $this->add_tableberg_admin_hook(); // initialize version sync manager. Tableberg\Version_Sync_Manager::init(); // initialize version control manager. Version_Control::init(); add_action('admin_menu', array($this, 'register_admin_menus')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_script')); add_action('admin_notices', array($this, 'tableberg_review_notice')); add_action('wp_ajax_TablebergReviewNoticeHide', array($this, 'tableberg_hide_review_notify')); add_filter('tableberg/filter/admin_settings_menu_data', array($this, 'add_settings_menu_data'), 1, 1); } /** * Add hook */ public function add_tableberg_admin_hook() { add_action('wp_ajax_toggle_control', array($this, 'update_toggle_control')); add_action('wp_ajax_block_properties', array($this, 'update_block_properties')); } /** * Block properties control */ private function update_block_properties() { check_ajax_referer('block_properties'); if (isset($_POST['value']) && isset($_POST['property_name'])) { $value = sanitize_text_field(wp_unslash($_POST['value'])); $property_name = sanitize_text_field(wp_unslash($_POST['property_name'])); $saved_properties = get_option('tableberg_block_properties', false); if ($saved_properties) { foreach ($saved_properties as $key => $property) { if ($property['name'] === $property_name) { $saved_properties[$key]['value'] = (int) $value; } } } update_option('tableberg_block_properties', $saved_properties); } die(); } /** * Toggle control */ private function update_toggle_control() { check_ajax_referer('toggle_control'); if (isset($_POST['enable']) && isset($_POST['toggle_name'])) { $enable = sanitize_text_field(wp_unslash($_POST['enable'])); $toggle_name = sanitize_text_field(wp_unslash($_POST['toggle_name'])); update_option($toggle_name, $enable); } die(); } /** * Add data for admin settings menu frontend. * * @param array $data frontend data. * * @return array filtered frontend data */ public function add_settings_menu_data($data) { $data['assets'] = array( 'logo' => trailingslashit($this->plugin_url) . 'includes/Admin/images/logos/menu-icon-colored.svg', 'logoTransparent' => trailingslashit($this->plugin_url) . 'includes/Admin/images/logos/menu-icon-colored-transparent.svg', ); $data['individual_control'] = array( 'data' => get_option('tableberg_individual_control', false), 'ajax' => array( 'toggleControl' => array( 'url' => admin_url('admin-ajax.php'), 'action' => 'toggle_control', 'nonce' => wp_create_nonce('toggle_control'), ), ), ); $data['global_control'] = array( 'data' => get_option('tableberg_global_control', false), 'ajax' => array( 'toggleControl' => array( 'url' => admin_url('admin-ajax.php'), 'action' => 'toggle_control', 'nonce' => wp_create_nonce('toggle_control'), ), ), ); $data['block_properties'] = array( 'data' => get_option('tableberg_block_properties', false), 'ajax' => array( 'blockProperties' => array( 'url' => admin_url('admin-ajax.php'), 'action' => 'block_properties', 'nonce' => wp_create_nonce('block_properties'), ), ), ); global $tp_fs; if (isset($tp_fs)) { $data['misc'] = [ 'pro_status' => $tp_fs->is__premium_only() && $tp_fs->can_use_premium_code() ]; } else { $data['misc'] = [ 'pro_status' => false ]; } $data = array_merge($data, Tableberg\Utils\Utils::welcome_page()); return $data; } /** * Enqueue admin scripts. */ public function enqueue_admin_script() { $tableberg_assets = new Tableberg\Assets(); $tableberg_assets->register_admin_assets(); } /** * Set template for main setting page * * @return void */ public function main_menu_template_cb() { ?>
format('U') - $datetime1->format('U')) / (60 * 60 * 24)); if ($diff_interval >= 21 && get_option('tableberg_review_notify') == 'no') { ?>
I noticed that you have been using Tableberg Plugin for a while now - that’s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress? Just to help us spread the word and boost our motivation.
~ Imtiaz Rayhan
~ Lead Developer, Tableberg.',
'tableberg'
);
?>