Ejemplo n.º 1
0
 function ajax_deactivate_license()
 {
     $module = isset($_POST['module']) ? trim($_POST['module']) : '';
     $nonce = isset($_POST['nonce']) ? trim($_POST['nonce']) : '';
     if (!$module || !$nonce || !wp_verify_nonce($nonce, 'license activation')) {
         die;
     }
     $result = $this->deactivate_license($module);
     $response = new WPBDP_Ajax_Response();
     if (is_wp_error($result)) {
         $response->send_error(sprintf(_x('Could not deactivate license: %s.', 'licensing', 'WPBDM'), $result->get_error_message()));
     }
     $response->set_message(_x('License deactivated', 'licensing', 'WPBDM'));
     $response->send();
 }
Ejemplo n.º 2
0
 /**
  * @since 3.5.3
  */
 public function ajax_create_main_page()
 {
     $nonce = isset($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '';
     if (!current_user_can('administrator') || !$nonce || !wp_verify_nonce($nonce, 'create main page')) {
         exit;
     }
     if (wpbdp_get_page_id('main')) {
         exit;
     }
     $page = array('post_status' => 'publish', 'post_title' => _x('Business Directory', 'admin', 'WPBDM'), 'post_type' => 'page', 'post_content' => '[businessdirectory]');
     $page_id = wp_insert_post($page);
     if (!$page_id) {
         exit;
     }
     $res = new WPBDP_Ajax_Response();
     $res->set_message(str_replace('<a>', '<a href="' . get_permalink($page_id) . '" target="_blank">', _x('You\'re all set. Visit your new <a>Business Directory</a> page.', 'admin', 'WPBDM')));
     $res->send();
 }