Exemple #1
0
/**
 * Get a registered form
 *
 * @param string $form_id
 *
 * @throws Exception when WP_DEBUG is on
 * @return bool|WP_Form
 */
function wp_get_form($form_id)
{
    $registrar = WP_Form_Registrar::get_instance();
    try {
        $args = func_get_args();
        $form = call_user_func_array(array($registrar, 'get_form'), $args);
    } catch (Exception $e) {
        if (defined('WP_DEBUG') && WP_DEBUG) {
            throw $e;
        }
        return FALSE;
    }
    return $form;
}
 /**
  * Get (and instantiate, if necessary) the instance of the class
  * @static
  * @return WP_Form_Registrar
  */
 public static function get_instance()
 {
     if (!is_a(self::$instance, __CLASS__)) {
         self::$instance = new self();
     }
     return self::$instance;
 }