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