| @@ -18,27 +18,27 @@ discard block | ||
| 18 | 18 | */ | 
| 19 | 19 | |
| 20 | 20 | // If this file is called directly, abort. | 
| 21 | -if ( ! defined( 'WPINC' ) ) { | |
| 21 | +if (!defined('WPINC')) { | |
| 22 | 22 | die; | 
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | 25 | // Set some constants | 
| 26 | -define( 'LASSO_VERSION', '0.10.0.2' ); | |
| 27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); | |
| 28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); | |
| 29 | -define( 'LASSO_FILE', __FILE__ ); | |
| 26 | +define('LASSO_VERSION', '0.10.0.2'); | |
| 27 | +define('LASSO_DIR', plugin_dir_path(__FILE__)); | |
| 28 | +define('LASSO_URL', plugins_url('', __FILE__)); | |
| 29 | +define('LASSO_FILE', __FILE__); | |
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | 32 | * Load plugin if PHP version is 5.4 or later. | 
| 33 | 33 | */ | 
| 34 | -if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { | |
| 34 | +if (version_compare(PHP_VERSION, '5.4.0', '>=')) { | |
| 35 | 35 | |
| 36 | - include_once( LASSO_DIR . '/bootstrap.php' ); | |
| 36 | + include_once(LASSO_DIR.'/bootstrap.php'); | |
| 37 | 37 | |
| 38 | 38 |  } else { | 
| 39 | 39 | |
| 40 | 40 |  	add_action('admin_head', 'lasso_fail_notice'); | 
| 41 | -	function lasso_fail_notice(){ | |
| 41 | +	function lasso_fail_notice() { | |
| 42 | 42 | |
| 43 | 43 |  		printf('<div class="error"><p>Lasso requires PHP 5.4 or higher.</p></div>'); | 
| 44 | 44 | |
| @@ -46,11 +46,11 @@ discard block | ||
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | 48 |  add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); | 
| 49 | -function lasso_show_in_rest($args, $post_type){ | |
| 49 | +function lasso_show_in_rest($args, $post_type) { | |
| 50 | 50 | |
| 51 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); | |
| 52 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); | |
| 53 | -	if (in_array( $post_type,$allowed_post_types)) { | |
| 51 | +    $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( )); | |
| 52 | +	$allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); | |
| 53 | +	if (in_array($post_type, $allowed_post_types)) { | |
| 54 | 54 | $args['show_in_rest'] = true; | 
| 55 | 55 |  		if ($post_type != 'post' && $post_type != 'page') { | 
| 56 | 56 | $args['rest_base'] = $post_type; | 
| @@ -61,21 +61,21 @@ discard block | ||
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | |
| 64 | -function lasso_editor_get_option( $option, $section, $default = '' ) { | |
| 64 | +function lasso_editor_get_option($option, $section, $default = '') { | |
| 65 | 65 | |
| 66 | - if ( empty( $option ) ) | |
| 66 | + if (empty($option)) | |
| 67 | 67 | return; | 
| 68 | 68 | |
| 69 | -	if ( function_exists( 'is_multisite' ) && is_multisite() ) { | |
| 69 | +	if (function_exists('is_multisite') && is_multisite()) { | |
| 70 | 70 | |
| 71 | - $options = get_site_option( $section ); | |
| 71 | + $options = get_site_option($section); | |
| 72 | 72 | |
| 73 | 73 |  	} else { | 
| 74 | 74 | |
| 75 | - $options = get_option( $section ); | |
| 75 | + $options = get_option($section); | |
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | -	if ( isset( $options[$option] ) ) { | |
| 78 | +	if (isset($options[$option])) { | |
| 79 | 79 | return $options[$option]; | 
| 80 | 80 | } | 
| 81 | 81 | |