if (preg_match('/^FrmPro.+$/', $class_name) || 'FrmUpdatesController' == $class_name) { $filepath .= '/pro'; } $filepath .= '/classes'; if (preg_match('/^.+Helper$/', $class_name)) { $filepath .= '/helpers/'; } else { if (preg_match('/^.+Controller$/', $class_name)) { $filepath .= '/controllers/'; } else { $filepath .= '/models/'; } } $filepath .= $class_name . '.php'; if (file_exists($filepath)) { include $filepath; } } // if __autoload is active, put it on the spl_autoload stack if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions())) { spl_autoload_register('__autoload'); } // Add the autoloader spl_autoload_register('frm_forms_autoloader'); $frm_path = dirname(__FILE__); if (file_exists($frm_path . '/pro/formidable-pro.php')) { include $frm_path . '/pro/formidable-pro.php'; } FrmHooksController::trigger_load_hook(); include_once $frm_path . '/deprecated.php'; unset($frm_path);
<?php FrmHooksController::trigger_load_hook('load_admin_hooks'); FrmHooksController::trigger_load_hook('load_ajax_hooks'); FrmHooksController::trigger_load_hook('load_form_hooks'); /** * @group ajax */ class FrmAjaxUnitTest extends WP_Ajax_UnitTestCase { protected $form_id = 0; protected $field_id = 0; protected $user_id = 0; protected $is_pro_active = false; protected $contact_form_key = 'contact-with-email'; function setUp() { parent::setUp(); FrmAppController::install(); $this->import_xml(); $this->factory->form = new Form_Factory($this); $this->factory->field = new Field_Factory($this); $this->factory->entry = new Entry_Factory($this); $this->is_pro_active = FrmAppHelper::pro_is_installed(); $current_class_name = get_class($this); if (strpos($current_class_name, 'FrmPro') && !$this->is_pro_active) { $this->markTestSkipped('Pro is not active'); } } function import_xml() {
function set_admin_screen($page = 'index.php') { global $current_screen; $screens = array('index.php' => array('base' => 'dashboard', 'id' => 'dashboard'), 'admin.php?page=formidable' => array('base' => 'admin', 'id' => 'toplevel_page_formidable')); if ($page == 'formidable-edit') { $form = $this->factory->form->get_object_by_id($this->contact_form_key); $page = 'admin.php?page=formidable&frm_action=edit&id=' . $form->id; $screens[$page] = $screens['admin.php?page=formidable']; } $screen = $screens[$page]; $_GET = $_POST = $_REQUEST = array(); $GLOBALS['taxnow'] = $GLOBALS['typenow'] = ''; $screen = (object) $screen; $hook = parse_url($page); $GLOBALS['hook_suffix'] = $hook['path']; set_current_screen(); $this->assertTrue($current_screen->in_admin(), 'Failed to switch to the back-end'); $this->assertEquals($screen->base, $current_screen->base, $page); FrmHooksController::trigger_load_hook(); }
public static function trigger_load_view_hooks() { FrmHooksController::trigger_load_hook('load_view_hooks'); }