PHP formatting fixes
This commit is contained in:
parent
054ceef45e
commit
6a5c99e483
|
@ -49,24 +49,24 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
|
||||
// Supported shortcodes
|
||||
private static $shortcodes = array(
|
||||
'CognitoForms' => 'render_shortcode',
|
||||
'cognitoforms' => 'render_shortcode'
|
||||
'CognitoForms' => 'render_cognito_shortcode',
|
||||
'cognitoforms' => 'render_cognito_shortcode'
|
||||
);
|
||||
|
||||
// Registers plug-in actions
|
||||
private function addActions($actions) {
|
||||
private function add_actions( $actions ) {
|
||||
foreach ( $actions as $action )
|
||||
add_action( $action, array( $this, $action ) );
|
||||
}
|
||||
|
||||
// Registers plug-in filters
|
||||
private function addFilters($filters) {
|
||||
private function add_filters( $filters ) {
|
||||
foreach ( $filters as $filter )
|
||||
add_filter( $filter, array( $this, $filter ) );
|
||||
}
|
||||
|
||||
// Registers shortcodes
|
||||
private function addShortcodes($shortcodes) {
|
||||
private function add_shortcodes( $shortcodes ) {
|
||||
foreach ( $shortcodes as $tag => $func )
|
||||
add_shortcode( $tag, array( $this, $func ) );
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
|
||||
// Entrypoint
|
||||
public function __construct() {
|
||||
$this->addActions(self::$actions);
|
||||
$this->addShortcodes(self::$shortcodes);
|
||||
$this->add_actions( self::$actions );
|
||||
$this->add_shortcodes( self::$shortcodes );
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
@ -104,7 +104,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
if( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) )
|
||||
return;
|
||||
|
||||
register_setting('cognito_plugin', 'cognito_public_key');
|
||||
add_option( 'cognito_public_key' );
|
||||
|
||||
// Remove old API keys from the database
|
||||
$this->remove_options( array(
|
||||
|
@ -165,21 +165,21 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
// Initialize classic editor (TinyMCE)
|
||||
public function tinymce_init() {
|
||||
if ( get_user_option( 'rich_editing' ) == 'true' ) {
|
||||
$this->addFilters( array(
|
||||
'mce_buttons',
|
||||
'mce_external_plugins'
|
||||
$this->add_filters( array(
|
||||
'tinymce_buttons',
|
||||
'tinymce_external_plugins'
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
// Set up TinyMCE buttons
|
||||
public function mce_buttons( $buttons ) {
|
||||
public function tinymce_buttons( $buttons ) {
|
||||
array_push($buttons, '|', 'cognito');
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
// Set up TinyMCE plug-in
|
||||
public function mce_external_plugins( $plugin_array ) {
|
||||
public function tinymce_external_plugins( $plugin_array ) {
|
||||
$plugin_array['cognito_mce_plugin'] = plugins_url( '/tinymce/plugin.js', __FILE__ );
|
||||
return $plugin_array;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
}
|
||||
|
||||
// Called when a 'CognitoForms' shortcode is encountered, renders form embed script
|
||||
public function render_shortcode($atts, $content = null, $code = '') {
|
||||
public function render_cognito_shortcode( $atts, $content = null, $code = '' ) {
|
||||
// Default to key setting, unless overridden in shortcode (allows for modules from multiple orgs)
|
||||
$key = empty( $atts['key'] ) ? get_option( 'cognito_public_key' ) : $atts['key'];
|
||||
if ( empty( $atts['id'] ) || empty( $key ) ) return '';
|
||||
|
|
Loading…
Reference in New Issue