2021-06-16 23:05:18 -04:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Plugin Name: Cognito Forms
|
|
|
|
Plugin URI: http://wordpress.org/plugins/cognito-forms/
|
|
|
|
Description: Cognito Forms is a free online form builder that integrates seemlessly with WordPress. Create contact forms, registrations forms, surveys, and more!
|
|
|
|
Version: 2.0.0
|
|
|
|
Author: Cognito Apps
|
|
|
|
Author URI: https://www.cognitoforms.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cognito Forms WordPress Plugin.
|
|
|
|
*
|
|
|
|
* The Cognito Forms WordPress Plugin is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License, version 2, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* The Cognito Forms WordPress Plugin is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Exit if accessed directly.
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Block Initializer.
|
|
|
|
*/
|
|
|
|
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Plugin
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( !class_exists('CognitoFormsPlugin') ) {
|
|
|
|
class CognitoFormsPlugin {
|
|
|
|
// Initialization actions
|
|
|
|
private static $actions = array(
|
|
|
|
'admin_menu'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Registers plug-in actions
|
|
|
|
private function addActions($actions) {
|
|
|
|
foreach($actions as $action)
|
|
|
|
add_action($action, array($this, $action));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Entrypoint
|
|
|
|
public function __construct() {
|
|
|
|
$this->addActions(self::$actions);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize administration menu (left-bar)
|
|
|
|
public function admin_menu() {
|
|
|
|
add_menu_page('Cognito Forms', 'Cognito Forms', 'manage_options', 'Cognito', array($this, 'main_page'), '../wp-content/plugins/cognito-forms/cogicon.ico');
|
|
|
|
add_submenu_page('Cognito', 'Cognito Forms', 'View Forms', 'manage_options', 'Cognito', array($this, 'main_page'));
|
|
|
|
add_submenu_page('Cognito', 'Create Form', 'New Form', 'manage_options', 'CognitoCreateForm', array($this, 'main_page'));
|
|
|
|
add_submenu_page('Cognito', 'Templates', 'Templates', 'manage_options', 'CognitoTemplates', array($this, 'main_page'));
|
|
|
|
|
|
|
|
// add_options_page('Cognito Options', 'Cognito Forms', 'manage_options', 'CognitoOptions', array($this, 'options_page'));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Entrypoint for Cognito Forms access
|
|
|
|
public function main_page() {
|
|
|
|
include 'templates/main.php';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
new CognitoFormsPlugin;
|
|
|
|
}
|