Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/overview.tar

class-overview.php000066600000006651151130444030010235 0ustar00<?php

/**
 * Primary overview page inside the admin which lists all forms.
 *
 * @package    WPForms
 * @author     WPForms
 * @since      1.0.0
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2016, WPForms LLC
 */
class WPForms_Overview {

	/**
	 * Primary class constructor.
	 *
	 * @since 1.0.0
	 */
	public function __construct() {

		// Maybe load overview page.
		add_action( 'admin_init', array( $this, 'init' ) );

		// Setup screen options.
		add_action( 'load-toplevel_page_wpforms-overview', array( $this, 'screen_options' ) );
		add_filter( 'set-screen-option', array( $this, 'screen_options_set' ), 10, 3 );
	}

	/**
	 * Determine if the user is viewing the overview page, if so, party on.
	 *
	 * @since 1.0.0
	 */
	public function init() {

		// Check what page we are on.
		$page = isset( $_GET['page'] ) ? $_GET['page'] : '';

		// Only load if we are actually on the overview page.
		if ( 'wpforms-overview' === $page ) {

			// The overview page leverages WP_List_Table so we must load it.
			if ( ! class_exists( 'WP_List_Table', false ) ) {
				require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
			}

			// Load the class that builds the overview table.
			require_once WPFORMS_PLUGIN_DIR . 'includes/admin/overview/class-overview-table.php';

			add_action( 'admin_enqueue_scripts', array( $this, 'enqueues' ) );
			add_action( 'wpforms_admin_page', array( $this, 'output' ) );

			// Provide hook for addons.
			do_action( 'wpforms_overview_init' );
		}
	}

	/**
	 * Add per-page screen option to the Forms table.
	 *
	 * @since 1.0.0
	 */
	public function screen_options() {

		$screen = get_current_screen();

		if ( 'toplevel_page_wpforms-overview' !== $screen->id ) {
			return;
		}

		add_screen_option(
			'per_page',
			array(
				'label'   => esc_html__( 'Number of forms per page:', 'wpforms-lite' ),
				'option'  => 'wpforms_forms_per_page',
				'default' => apply_filters( 'wpforms_overview_per_page', 20 ),
			)
		);
	}

	/**
	 * Forms table per-page screen option value.
	 *
	 * @since 1.0.0
	 *
	 * @param mixed $status
	 * @param string $option
	 * @param mixed $value
	 *
	 * @return mixed
	 */
	public function screen_options_set( $status, $option, $value ) {

		if ( 'wpforms_forms_per_page' === $option ) {
			return $value;
		}

		return $status;
	}

	/**
	 * Enqueue assets for the overview page.
	 *
	 * @since 1.0.0
	 */
	public function enqueues() {

		// Hook for addons.
		do_action( 'wpforms_overview_enqueue' );
	}

	/**
	 * Build the output for the overview page.
	 *
	 * @since 1.0.0
	 */
	public function output() {

		?>
		<div id="wpforms-overview" class="wrap wpforms-admin-wrap">

			<h1 class="page-title">
				<?php esc_html_e( 'Forms Overview', 'wpforms-lite' ); ?>
				<a href="<?php echo admin_url( 'admin.php?page=wpforms-builder&view=setup' ); ?>" class="add-new-h2 wpforms-btn-orange">
					<?php esc_html_e( 'Add New', 'wpforms-lite' ); ?>
				</a>
			</h1>

			<?php
			$overview_table = new WPForms_Overview_Table;
			$overview_table->prepare_items();
			?>

			<div class="wpforms-admin-content">

				<form id="wpforms-overview-table" method="get" action="<?php echo admin_url( 'admin.php?page=wpforms-overview' ); ?>">

					<input type="hidden" name="post_type" value="wpforms"/>

					<input type="hidden" name="page" value="wpforms-overview"/>

					<?php $overview_table->views(); ?>
					<?php $overview_table->display(); ?>

				</form>

			</div>

		</div>
		<?php
	}
}

new WPForms_Overview;
.htaccess000066600000000424151130444030006341 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>class-overview-table.php000066600000022125151130444030011314 0ustar00<?php

/**
 * Generates the table on the plugin overview page.
 *
 * @package    WPForms
 * @author     WPForms
 * @since      1.0.0
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2016, WPForms LLC
 */
class WPForms_Overview_Table extends WP_List_Table {

	/**
	 * Number of forms to show per page.
	 *
	 * @since 1.0.0
	 */
	public $per_page;

	/**
	 * Primary class constructor.
	 *
	 * @since 1.0.0
	 */
	public function __construct() {

		// Utilize the parent constructor to build the main class properties.
		parent::__construct(
			array(
				'singular' => 'form',
				'plural'   => 'forms',
				'ajax'     => false,
			)
		);

		// Default number of forms to show per page
		$this->per_page = apply_filters( 'wpforms_overview_per_page', 20 );
	}

	/**
	 * Retrieve the table columns.
	 *
	 * @since 1.0.0
	 * @return array $columns Array of all the list table columns.
	 */
	public function get_columns() {

		$columns = array(
			'cb'        => '<input type="checkbox" />',
			'form_name' => esc_html__( 'Name', 'wpforms-lite' ),
			'shortcode' => esc_html__( 'Shortcode', 'wpforms-lite' ),
			'created'   => esc_html__( 'Created', 'wpforms-lite' ),
		);

		return apply_filters( 'wpforms_overview_table_columns', $columns );
	}

	/**
	 * Render the checkbox column.
	 *
	 * @since 1.0.0
	 *
	 * @param WP_Post $form
	 *
	 * @return string
	 */
	public function column_cb( $form ) {

		return '<input type="checkbox" name="form_id[]" value="' . absint( $form->ID ) . '" />';
	}

	/**
	 * Renders the columns.
	 *
	 * @since 1.0.0
	 *
	 * @param WP_Post $form
	 * @param string $column_name
	 *
	 * @return string
	 */
	public function column_default( $form, $column_name ) {

		switch ( $column_name ) {
			case 'id':
				$value = $form->ID;
				break;

			case 'shortcode':
				$value = '[wpforms id="' . $form->ID . '"]';
				break;

			case 'created':
				$value = get_the_date( get_option( 'date_format' ), $form );
				break;

			case 'modified':
				$value = get_post_modified_time( get_option( 'date_format' ), false, $form );
				break;

			case 'author':
				$author = get_userdata( $form->post_author );
				$value  = $author->display_name;
				break;

			case 'php':
				$value = '<code style="display:block;font-size:11px;">if( function_exists( \'wpforms_get\' ) ){ wpforms_get( ' . $form->ID . ' ); }</code>';
				break;

			default:
				$value = '';
		}

		return apply_filters( 'wpforms_overview_table_column_value', $value, $form, $column_name );
	}

	/**
	 * Render the form name column with action links.
	 *
	 * @since 1.0.0
	 *
	 * @param WP_Post $form
	 *
	 * @return string
	 */
	public function column_form_name( $form ) {

		// Prepare variables.
		$name = ! empty( $form->post_title ) ? $form->post_title : $form->post_name;
		$name = sprintf(
			'<a class="row-title" href="%s" title="%s"><strong>%s</strong></a>',
			add_query_arg(
				array(
					'view'    => 'fields',
					'form_id' => $form->ID,
				),
				admin_url( 'admin.php?page=wpforms-builder' )
			),
			esc_html__( 'Edit This Form', 'wpforms-lite' ),
			$name
		);

		// Build all of the row action links.
		$row_actions = array();

		// Edit.
		$row_actions['edit'] = sprintf(
			'<a href="%s" title="%s">%s</a>',
			add_query_arg(
				array(
					'view'    => 'fields',
					'form_id' => $form->ID,
				),
				admin_url( 'admin.php?page=wpforms-builder' )
			),
			esc_html__( 'Edit This Form', 'wpforms-lite' ),
			esc_html__( 'Edit', 'wpforms-lite' )
		);

		// Entries.
		$row_actions['entries'] = sprintf(
			'<a href="%s" title="%s">%s</a>',
			add_query_arg(
				array(
					'view'    => 'list',
					'form_id' => $form->ID,
				),
				admin_url( 'admin.php?page=wpforms-entries' )
			),
			esc_html__( 'View entries', 'wpforms-lite' ),
			esc_html__( 'Entries', 'wpforms-lite' )
		);

		// Preview.
		$row_actions['preview_'] = sprintf(
			'<a href="%s" title="%s" target="_blank" rel="noopener noreferrer">%s</a>',
			esc_url( wpforms_get_form_preview_url( $form->ID ) ),
			esc_html__( 'View preview', 'wpforms-lite' ),
			esc_html__( 'Preview', 'wpforms-lite' )
		);

		// Duplicate.
		$row_actions['duplicate'] = sprintf(
			'<a href="%s" title="%s">%s</a>',
			wp_nonce_url(
				add_query_arg(
					array(
						'action'  => 'duplicate',
						'form_id' => $form->ID,
					),
					admin_url( 'admin.php?page=wpforms-overview' )
				),
				'wpforms_duplicate_form_nonce'
			),
			esc_html__( 'Duplicate this form', 'wpforms-lite' ),
			esc_html__( 'Duplicate', 'wpforms-lite' )
		);

		// Delete.
		$row_actions['delete'] = sprintf(
			'<a href="%s" title="%s">%s</a>',
			wp_nonce_url(
				add_query_arg(
					array(
						'action'  => 'delete',
						'form_id' => $form->ID,
					),
					admin_url( 'admin.php?page=wpforms-overview' )
				),
				'wpforms_delete_form_nonce'
			),
			esc_html__( 'Delete this form', 'wpforms-lite' ),
			esc_html__( 'Delete', 'wpforms-lite' )
		);

		// Build the row action links and return the value.
		return $name . $this->row_actions( apply_filters( 'wpforms_overview_row_actions', $row_actions, $form ) );
	}

	/**
	 * Define bulk actions available for our table listing.
	 *
	 * @since 1.0.0
	 *
	 * @return array
	 */
	public function get_bulk_actions() {

		$actions = array(
			'delete' => esc_html__( 'Delete', 'wpforms-lite' ),
		);

		return $actions;
	}

	/**
	 * Process the bulk actions.
	 *
	 * @since 1.0.0
	 */
	public function process_bulk_actions() {

		$ids = isset( $_GET['form_id'] ) ? $_GET['form_id'] : array();

		if ( ! is_array( $ids ) ) {
			$ids = array( $ids );
		}

		$ids    = array_map( 'absint', $ids );
		$action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false; // phpcs:ignore

		// Checking the sortable column link.
		$is_orderby_link = ! empty( $_REQUEST['orderby'] ) && ! empty( $_REQUEST['order'] );

		if ( empty( $ids ) || empty( $action ) || $is_orderby_link ) {
			return;
		}

		// Delete one or multiple forms - both delete links and bulk actions.
		if ( 'delete' === $this->current_action() ) {

			if (
				wp_verify_nonce( $_GET['_wpnonce'], 'bulk-forms' ) ||
				wp_verify_nonce( $_GET['_wpnonce'], 'wpforms_delete_form_nonce' )
			) {
				foreach ( $ids as $id ) {
					wpforms()->form->delete( $id );
				}
				?>
				<div class="notice updated">
					<p>
						<?php
						if ( count( $ids ) === 1 ) {
							esc_html_e( 'Form was successfully deleted.', 'wpforms-lite' );
						} else {
							esc_html_e( 'Forms were successfully deleted.', 'wpforms-lite' );
						}
						?>
					</p>
				</div>
				<?php
			} else {
				?>
				<div class="notice updated">
					<p>
						<?php esc_html_e( 'Security check failed. Please try again.', 'wpforms-lite' ); ?>
					</p>
				</div>
				<?php
			}
		}

		// Duplicate form - currently just delete links (no bulk action at the moment).
		if ( 'duplicate' === $this->current_action() ) {

			if ( wp_verify_nonce( $_GET['_wpnonce'], 'wpforms_duplicate_form_nonce' ) ) {
				foreach ( $ids as $id ) {
					wpforms()->form->duplicate( $id );
				}
				?>
				<div class="notice updated">
					<p>
						<?php
						if ( count( $ids ) === 1 ) {
							esc_html_e( 'Form was successfully duplicated.', 'wpforms-lite' );
						} else {
							esc_html_e( 'Forms were successfully duplicated.', 'wpforms-lite' );
						}
						?>
					</p>
				</div>
				<?php
			} else {
				?>
				<div class="notice updated">
					<p>
						<?php esc_html_e( 'Security check failed. Please try again.', 'wpforms-lite' ); ?>
					</p>
				</div>
				<?php
			}
		}
	}

	/**
	 * Message to be displayed when there are no forms.
	 *
	 * @since 1.0.0
	 */
	public function no_items() {
		printf(
			wp_kses(
				/* translators: %s - WPForms Builder page. */
				__( 'Whoops, you haven\'t created a form yet. Want to <a href="%s">give it a go</a>?', 'wpforms-lite' ),
				array(
					'a' => array(
						'href' => array(),
					),
				)
			),
			admin_url( 'admin.php?page=wpforms-builder' )
		);
	}

	/**
	 * Fetch and setup the final data for the table.
	 *
	 * @since 1.0.0
	 */
	public function prepare_items() {

		// Process bulk actions if found.
		$this->process_bulk_actions();

		// Setup the columns.
		$columns = $this->get_columns();

		// Hidden columns (none).
		$hidden = array();

		// Define which columns can be sorted - form name, date.
		$sortable = array(
			'form_name' => array( 'title', false ),
			'created'   => array( 'date', false ),
		);

		// Set column headers.
		$this->_column_headers = array( $columns, $hidden, $sortable );

		// Get forms.
		$total    = wp_count_posts( 'wpforms' )->publish;
		$page     = $this->get_pagenum();
		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'ID';
		$per_page = $this->get_items_per_page( 'wpforms_forms_per_page', $this->per_page );
		$data     = wpforms()->form->get( '', array(
			'orderby'        => $orderby,
			'order'          => $order,
			'nopaging'       => false,
			'posts_per_page' => $per_page,
			'paged'          => $page,
			'no_found_rows'  => false,
		) );

		// Giddy up.
		$this->items = $data;

		// Finalize pagination.
		$this->set_pagination_args(
			array(
				'total_items' => $total,
				'per_page'    => $per_page,
				'total_pages' => ceil( $total / $per_page ),
			)
		);
	}
}