Inventory_Presser_Admin_Options::callback_manage()


Source

File: includes/admin/class-admin-options.php

	public function callback_manage() {
		// Load Sample Vehicles button.
		if ( current_user_can( 'edit_posts' ) ) {
			$url = add_query_arg(
				array(
					self::QUERY_VAR_MANAGE_VEHICLES => 'load_sample_vehicles',
					'_wpnonce'                      => wp_create_nonce( self::QUERY_VAR_MANAGE_VEHICLES ),
				),
				admin_url( 'edit.php?post_type=' . INVP::POST_TYPE . '&page=' . INVP::OPTION_PAGE )
			);
			printf(
				'<a class="button action" id="load_sample_vehicles" href="%s">%s</a> ',
				esc_url( $url ),
				esc_html__( 'Load Sample Vehicles', 'inventory-presser' )
			);
		}

		// Delete All Vehicles button.
		if ( current_user_can( 'delete_posts' ) ) {
			$url = add_query_arg(
				array(
					self::QUERY_VAR_MANAGE_VEHICLES => 'delete_all_vehicles',
					'_wpnonce'                      => wp_create_nonce( self::QUERY_VAR_MANAGE_VEHICLES ),
				),
				admin_url( 'edit.php?post_type=' . INVP::POST_TYPE . '&page=' . INVP::OPTION_PAGE )
			);
			printf(
				'<a class="button action" id="delete_all_vehicles" href="%s">%s</a>',
				esc_url( $url ),
				esc_html__( 'Delete All Vehicles', 'inventory-presser' )
			);
		}

		if ( current_user_can( 'edit_posts' ) || current_user_can( 'delete_posts' ) ) {
			printf(
				'<p class="description">%s</p>',
				esc_html__( 'These features may be impacted by time and memory limits set by your web host.', 'inventory-presser' )
			);
		}
	}