Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class My_Plugin {
- private $error;
- public function __construct()
- {
- add_shortcode('my_plugin_form', array($this, 'form_shortcode'));
- }
- public function setError($value)
- {
- $this->error = $value;
- }
- public function getError()
- {
- return $this->error;
- }
- public function form_validation()
- {
- // Validation has failed
- $this->setError('Please complete all of the fields.');
- }
- public function form_shortcode()
- {
- $err = $this->getError();
- ob_start();
- // Some HTML
- $this->getError();
- // Some more HTML
- $html = ob_get_contents();
- ob_end_clean();
- return $html;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement