for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the WPFoundation library.
*
* Copyright (c) 2015-present LIN3S <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LIN3S\WPFoundation\Ajax;
/**
* Abstract class of AJAX class that implements the interface.
* This class avoids the use of callbacks in the constructor.
* @author Beñat Espiña <[email protected]>
abstract class Ajax implements AjaxInterface
{
* The AJAX action name.
* @var string
protected $action;
* Constructor.
public function __construct()
add_action('wp_ajax_nopriv_' . $this->action, [$this, 'ajax']);
add_action()
add_action('wp_ajax_' . $this->action, [$this, 'ajax']);
}