private function _check_nonce() { if (WPDD_Utils::user_not_admin()) { die('You don\'t have permission to perform this action'); } if (!isset($_POST['wpnonce']) || !wp_verify_nonce($_POST['wpnonce'], 'wp_nonce_individual-pages-assigned')) { die('verification failed'); } }
function export_and_download_layouts() { if (isset($_POST['export_and_download'])) { $nonce = $_POST["wp_nonce_export_layouts"]; if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (wp_verify_nonce($nonce, 'wp_nonce_export_layouts')) { $results = $this->export_for_download(); $sitename = sanitize_key(get_bloginfo('name')); if (!empty($sitename)) { $sitename .= '.'; } require_once WPDDL_TOOLSET_COMMON_ABSPATH . '/Zip.php'; if (class_exists('Zip')) { $dirname = $sitename . 'dd-layouts.' . date('Y-m-d'); $zipName = $dirname . '.zip'; $zip = new Zip(); $zip->addDirectory($dirname); foreach ($results as $file_data) { $zip->addFile($file_data['file_data'], $dirname . '/' . $file_data['file_name']); } $zip->sendZip($zipName); } } die; } }
public function ddl_switch_layout_from_post_callback() { if (WPDD_Utils::user_not_admin()) { die(WPDD_Utils::ajax_caps_fail(__METHOD__)); } if (wp_verify_nonce($_POST['ddl_switch_layout_from_post_nonce'], 'ddl_switch_layout_from_post_nonce')) { $this->post_id = $_POST['post_id']; $meta = $this->update_layout_for_page($_POST['layout_slug'], $_POST['post_id']); $send = wp_json_encode(array('message' => array('meta' => $meta, 'current' => $_POST['layout_id'], 'post_id' => $this->post_id, 'key' => WPDDL_LAYOUTS_META_KEY))); } else { $send = WPDD_Utils::ajax_nonce_fail(__METHOD__); } die($send); }
?> " <?php if (!$wpddlayout_theme->file_manager_export->dir_is_writable()) { ?> disabled<?php } ?> > </p> </form> <?php if (isset($_POST['export_to_theme_dir'])) { $nonce = $_POST["wp_nonce_export_layouts_to_theme"]; if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (wp_verify_nonce($nonce, 'wp_nonce_export_layouts_to_theme')) { $results = $wpddlayout_theme->export_layouts_to_theme($wpddlayout_theme->file_manager_export->get_layouts_theme_dir()); ?> <?php if (sizeof($results)) { ?> <p> <?php _e('The following layouts have been exported.', 'ddl-layouts'); ?> </p>
function ddl_get_option_for_cred_form_callback() { global $wpdb; if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (!isset($_POST['wpnonce']) || !wp_verify_nonce($_POST['wpnonce'], 'ddl_layout_cred_nonce')) { die('verification failed'); } $result = array(); $fm = CRED_Loader::get('MODEL/Forms'); $form = $fm->getForm($_POST['cred_id']); $post_title = $wpdb->get_var($wpdb->prepare("SELECT post_title FROM {$wpdb->posts} WHERE ID = %d ", $_POST['cred_id'])); $result['option'] = $this->ddl_cred_get_option_element($_POST['cred_id'], $post_title, $form->fields['form_settings']->form['type'], $form->fields['form_settings']->post['post_type']); print wp_json_encode($result); die; }
function ddl_save_view_columns() { global $wpdb; if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (!isset($_POST['wpnonce']) || !wp_verify_nonce($_POST['wpnonce'], 'ddl_layout_view_nonce')) { die('verification failed'); } $result = array(); print wp_json_encode($result); die; }
function get_ct_editor_preview() { if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (!isset($_POST["wpnonce"]) || !wp_verify_nonce($_POST["wpnonce"], 'wpv-ct-inline-edit')) { die("Undefined Nonce."); } global $WPV_templates; if (isset($WPV_templates) && isset($_POST['id'])) { $content_template_id = $_POST['id']; $content = $WPV_templates->get_template_content($content_template_id); $content; ?> <textarea name="name" rows="10" id="wpv-ct-inline-editor-<?php echo $content_template_id; ?> "><?php echo $content; ?> </textarea> <?php } die; }
function widget_cell_get_controls() { if (WPDD_Utils::user_not_admin()) { die(__("You don't have permission to perform this action!", 'ddl-layouts')); } if (wp_verify_nonce($_POST['nonce'], 'ddl-get-widget')) { global $wp_widget_factory; foreach ($wp_widget_factory->widgets as $widget) { if ($widget->widget_options['classname'] == $_POST['widget']) { $widget->form(null); // Output a field so we can work out how the fields are named. // We use this in JS to load and save the settings to the layout. ?> <input type="hidden" id="ddl-widget-name-ref" value="<?php echo $widget->get_field_name('ddl-layouts'); ?> "> <?php break; } } } die; }