Ejemplo n.º 1
0
    require_once WR_CONTACTFORM_PATH . '/includes/required.php';
    require_once WR_CONTACTFORM_PATH . '/includes/upload.php';
    $proFieldType = new WR_Contactform_Includes_Type();
    $proFieldRequired = new WR_Contactform_Includes_Required();
}
require_once WR_CONTACTFORM_PATH . 'libraries/loader.php';
require_once WR_CONTACTFORM_PATH . '/helpers/contactform.php';
require_once WR_CONTACTFORM_PATH . '/helpers/action-hook.php';
require_once WR_CONTACTFORM_PATH . '/helpers/ajax.php';
require_once WR_CONTACTFORM_PATH . '/helpers/sample-form.php';
require_once WR_CONTACTFORM_PATH . '/libraries/contactform.php';
require_once WR_CONTACTFORM_PATH . '/libraries/installer.php';
// Load Add-ons
include_once WR_CONTACTFORM_PATH . '/addons/mailchimp/main.php';
//Get Post Type
register_activation_hook(__FILE__, array('WR_Contactform_Installer', 'on_activate_function'));
register_uninstall_hook(__FILE__, array('WR_Contactform_Installer', 'on_uninstaller_function'));
// Register WR Sample Plugin initialization
add_action('wr_cf_init', 'wr_init_contactform_plugin');
// Register autoloader with WR_ prefix
WR_CF_Loader::register(WR_CONTACTFORM_PATH . 'libraries', 'WR_');
// Initialize WR Library
WR_CF_Init_Plugin::hook();
function wr_init_contactform_plugin()
{
    $WRContactform = new WR_Contactform();
    // Init admin pages
    $WRContactformLoadAjax = new WR_Contactform_Helpers_Ajax();
    // Redirect after plugin activation
    add_action('admin_init', array('WR_Contactform_Installer', 'do_activation_redirect'));
}
Ejemplo n.º 2
0
         * Search a file in registered paths.
         *
         * @param   string  $file  Relative file path to search for.
         *
         * @return  string
         */
        public static function get_path($file)
        {
            // Generate alternative file name
            $slave = str_replace('_', '-', $file);
            // Filter paths to search for file
            self::$paths = apply_filters('wr_cf_loader_get_path', self::$paths);
            foreach (array_reverse(self::$paths) as $base => $prefixes) {
                if (@is_file($base . '/' . $slave)) {
                    return $base . '/' . $slave;
                } elseif (@is_file($base . '/' . $file)) {
                    return $base . '/' . $file;
                }
            }
            return null;
        }
    }
    // Register class autoloader with PHP
    spl_autoload_register(array('WR_CF_Loader', 'load'));
    // Register base path to look for class file
    WR_CF_Loader::register(dirname(__FILE__), 'WR_CF_');
    // Include plugin definition file
    if (@is_file(dirname(dirname(__FILE__)) . '/defines.php')) {
        include_once dirname(dirname(__FILE__)) . '/defines.php';
    }
}