Completed
Push — master ( 04699f...c3ddbb )
by
unknown
01:50
created

lasso.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 *
4
 *
5
 * @package   Editus
6
 * @author    Hyun Supul <[email protected]>, Nick Haskins <[email protected]>
7
 * @link      http://edituswp.com
8
 * @copyright 2015-2017 Aesopinteractive 
9
 *
10
 * Plugin Name:       Editus
11
 * Plugin URI:        http://edituswp.com
12
 * Description:       Front-end editor and story builder.
13
 * Version:           0.9.15.2
14
 * Author:            Aesopinteractive 
15
 * Author URI:        http://aesopinteractive.com
16
 * Text Domain:       lasso
17
 * Domain Path:       /languages
18
 */
19
20
// If this file is called directly, abort.
21
if ( ! defined( 'WPINC' ) ) {
22
	die;
23
}
24
25
// Set some constants
26
define( 'LASSO_VERSION', '0.9.15.2' );
27
define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) );
28
define( 'LASSO_URL', plugins_url( '', __FILE__ ) );
29
define( 'LASSO_FILE', __FILE__ );
30
31
/**
32
 * Load plugin if PHP version is 5.4 or later.
33
 */
34
if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
35
36
	include_once( LASSO_DIR . '/bootstrap.php' );
37
38
} else {
39
40
	add_action('admin_head', 'lasso_fail_notice');
41
	function lasso_fail_notice(){
42
43
		printf('<div class="error"><p>Lasso requires PHP 5.4 or higher.</p></div>');
44
45
	}
46
}
47
48
function lasso_show_in_rest() {
49
	global $wp_post_types;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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
	
54
	foreach( $allowed_post_types as $key ) {
55
	    
56
		// If the post type doesn't exist, skip it
57
		if( !$wp_post_types[$key] )
58
			continue;
59
	    	
60
    	$wp_post_types[$key]->show_in_rest = true;
61
    }
62
}
63
64
 add_action( 'init', 'lasso_show_in_rest' );
65
66