Completed
Push — master ( 48e484...cedfdf )
by
unknown
03:10
created
public/includes/wrap-shortcodes.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
  * Wraps shortcodes of other Plugins in prep for later replacement on save to preserve the shortcodes
4 4
  */
5 5
 
6
-if ( lasso_user_can( 'edit_posts' ) && ! is_admin() ) {
7
-	add_filter( 'the_content', 'lasso_wrap_shortcodes', 9 );
6
+if (lasso_user_can('edit_posts') && !is_admin()) {
7
+	add_filter('the_content', 'lasso_wrap_shortcodes', 9);
8 8
 }
9 9
 
10 10
 /**
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string
19 19
  */
20
-function lasso_wrap_shortcodes( $content ) {
20
+function lasso_wrap_shortcodes($content) {
21 21
 	global $shortcode_tags;
22 22
 
23
-	if ( false === strpos( $content, '[' ) ) {
23
+	if (false === strpos($content, '[')) {
24 24
 		return $content;
25 25
 	}
26 26
 
27
-	if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
27
+	if (empty($shortcode_tags) || !is_array($shortcode_tags)) {
28 28
 		return $content;
29 29
 	}
30 30
 
31
-	$tagnames  = array_keys( $shortcode_tags );
32
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
31
+	$tagnames  = array_keys($shortcode_tags);
32
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
33 33
 	$pattern   = "/\\[($tagregexp)/s";
34 34
 
35
-	if ( 1 !== preg_match( $pattern, $content ) ) {
35
+	if (1 !== preg_match($pattern, $content)) {
36 36
 		// Avoids parsing HTML when there are no shortcodes or embeds anyway.
37 37
 		return $content;
38 38
 	}
39 39
 
40
-	$content = do_shortcodes_in_html_tags( $content, true ,$tagnames);
40
+	$content = do_shortcodes_in_html_tags($content, true, $tagnames);
41 41
 
42 42
 	$pattern = get_shortcode_regex();
43
-	$content = preg_replace_callback( "/$pattern/s", 'lasso_wrap_shortcode_tag', $content );
43
+	$content = preg_replace_callback("/$pattern/s", 'lasso_wrap_shortcode_tag', $content);
44 44
 
45 45
 	// Always restore square braces so we don't break things like <!--[if IE ]>
46
-	$content = unescape_invalid_shortcodes( $content );
46
+	$content = unescape_invalid_shortcodes($content);
47 47
 
48 48
 	return $content;
49 49
 }
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string
59 59
  */
60
-function lasso_wrap_shortcode_tag( $m ) {
60
+function lasso_wrap_shortcode_tag($m) {
61 61
 	// allow [[foo]] syntax for escaping a tag
62
-	if ( $m[1] == '[' && $m[6] == ']' ) {
63
-		return substr( $m[0], 1, - 1 );
62
+	if ($m[1] == '[' && $m[6] == ']') {
63
+		return substr($m[0], 1, - 1);
64 64
 	}
65 65
 	//array('aesop_quote','aesop_gallery','aesop_chapter','aesop_timeline_stop','aesop_video','aesop_collection','aesop_character','aesop_document','aesop_audio','aesop_content','aesop_map')
66 66
 
67
-	if ( strpos( $m[2],'aesop_'  ) === 0 ) {
67
+	if (strpos($m[2], 'aesop_') === 0) {
68 68
 		// check against the exceptions
69
-		if (strpos_arr($m[2],array('aesop_gallery_pop','aesop_character_carousel'))===false) {
69
+		if (strpos_arr($m[2], array('aesop_gallery_pop', 'aesop_character_carousel')) === false) {
70 70
 		    return $m[0];
71 71
 		}
72 72
 	}
73 73
 
74
-	return '<!--EDITUS_OTHER_SHORTCODE_START|[' . $m[0] . ']-->' . $m[0] . '<!--EDITUS_OTHER_SHORTCODE_END-->';
74
+	return '<!--EDITUS_OTHER_SHORTCODE_START|['.$m[0].']-->'.$m[0].'<!--EDITUS_OTHER_SHORTCODE_END-->';
75 75
 }
76 76
 
77 77
 /* a helper function */
78 78
 function strpos_arr($haystack, $needle) {
79
-    if(!is_array($needle)) $needle = array($needle);
80
-    foreach($needle as $what) {
81
-        if(($pos = strpos($haystack, $what))!==false) return $pos;
79
+    if (!is_array($needle)) $needle = array($needle);
80
+    foreach ($needle as $what) {
81
+        if (($pos = strpos($haystack, $what)) !== false) return $pos;
82 82
     }
83 83
     return false;
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
public/includes/assets.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
 
11 11
 class assets {
12 12
 
13
-	public function __construct(){
13
+	public function __construct() {
14 14
 
15
-		add_action('wp_enqueue_scripts', array($this,'scripts'));
15
+		add_action('wp_enqueue_scripts', array($this, 'scripts'));
16 16
 	}
17 17
 
18
-	public function scripts(){
18
+	public function scripts() {
19 19
 
20 20
 	
21
-		if ( lasso_user_can('edit_posts') ) {
21
+		if (lasso_user_can('edit_posts')) {
22 22
 
23 23
 			wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true);
24 24
 
@@ -33,82 +33,82 @@  discard block
 block discarded – undo
33 33
 			// url for json api
34 34
 			$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false;
35 35
 
36
-			$article_object 	= lasso_editor_get_option('article_class','lasso_editor');
36
+			$article_object 	= lasso_editor_get_option('article_class', 'lasso_editor');
37 37
 
38
-			$article_object 	= empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
38
+			$article_object 	= empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
39 39
 
40
-			$featImgClass 		= lasso_editor_get_option('featimg_class','lasso_editor');
41
-			if (empty( $featImgClass )) {
40
+			$featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor');
41
+			if (empty($featImgClass)) {
42 42
 				$featImgClass = lasso_get_supported_theme_featured_image_class();
43 43
 			}
44
-			$titleClass 		= lasso_editor_get_option('title_class','lasso_editor');
45
-			if (empty( $titleClass )) {
44
+			$titleClass = lasso_editor_get_option('title_class', 'lasso_editor');
45
+			if (empty($titleClass)) {
46 46
 				$titleClass = lasso_get_supported_theme_title_class();
47 47
 			}
48
-			$toolbar_headings  	= lasso_editor_get_option('toolbar_headings', 'lasso_editor');
49
-			$objectsNoSave  	= lasso_editor_get_option('dont_save', 'lasso_editor');
48
+			$toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor');
49
+			$objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor');
50 50
 
51 51
 			// post id reference
52
-			$postid 			= get_the_ID();
52
+			$postid = get_the_ID();
53 53
 
54 54
 			$strings = array(
55
-				'save' 				=> __('Save','lasso'),
56
-				'saving' 			=> __('Saving...','lasso'),
57
-				'saved'				=> __('Saved!','lasso'),
58
-				'adding' 			=> __('Adding...','lasso'),
59
-				'added'				=> __('Added!','lasso'),
60
-				'loading' 			=> __('Loading...','lasso'),
61
-				'loadMore'			=> __('Load More','lasso'),
62
-				'noPostsFound'		=> __('No more posts found','lasso'),
63
-				'fetchFail'	    	=> __('Fetching failed. REST API plugin may not have been installed or configured correctly.','lasso'),
64
-				'galleryCreated' 	=> __('Gallery Created!','lasso'),
65
-				'galleryUpdated' 	=> __('Gallery Updated!','lasso'),
66
-				'justWrite'			=> __('Just write...','lasso'),
67
-				'chooseImage'		=> __('Choose an image','lasso'),
68
-				'updateImage'		=> __('Update Image','lasso'),
69
-				'insertImage'		=> __('Insert Image','lasso'),
70
-				'selectImage'		=> __('Select Image','lasso'),
71
-				'removeFeatImg'     => __('Remove featured image?','lasso'),
72
-				'updateSelectedImg' => __('Update Selected Image','lasso'),
73
-				'chooseImages'		=> __('Choose images','lasso'),
74
-				'editImage'			=> __('Edit Image','lasso'),
75
-				'addImages'			=> __('Add Images','lasso'),
76
-				'addNewGallery'		=> __('Add New Gallery','lasso'),
77
-				'selectGallery'		=> __('Select Lasso Gallery Image','lasso'),
78
-				'useSelectedImages' => __('Use Selected Images','lasso'),
79
-				'publishPost'		=> __('Publish Post?','lasso'),
80
-				'publishYes'		=> __('Yes, publish it!','lasso'),
81
-				'deletePost'		=> __('Trash Post?','lasso'),
82
-				'deleteYes'			=> __('Yes, trash it!','lasso'),
83
-				'warning'			=> __('Oh snap!','laso'),
84
-				'cancelText'		=> __('O.K. got it!','lasso'),
85
-				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.','lasso'),
55
+				'save' 				=> __('Save', 'lasso'),
56
+				'saving' 			=> __('Saving...', 'lasso'),
57
+				'saved'				=> __('Saved!', 'lasso'),
58
+				'adding' 			=> __('Adding...', 'lasso'),
59
+				'added'				=> __('Added!', 'lasso'),
60
+				'loading' 			=> __('Loading...', 'lasso'),
61
+				'loadMore'			=> __('Load More', 'lasso'),
62
+				'noPostsFound'		=> __('No more posts found', 'lasso'),
63
+				'fetchFail'	    	=> __('Fetching failed. REST API plugin may not have been installed or configured correctly.', 'lasso'),
64
+				'galleryCreated' 	=> __('Gallery Created!', 'lasso'),
65
+				'galleryUpdated' 	=> __('Gallery Updated!', 'lasso'),
66
+				'justWrite'			=> __('Just write...', 'lasso'),
67
+				'chooseImage'		=> __('Choose an image', 'lasso'),
68
+				'updateImage'		=> __('Update Image', 'lasso'),
69
+				'insertImage'		=> __('Insert Image', 'lasso'),
70
+				'selectImage'		=> __('Select Image', 'lasso'),
71
+				'removeFeatImg'     => __('Remove featured image?', 'lasso'),
72
+				'updateSelectedImg' => __('Update Selected Image', 'lasso'),
73
+				'chooseImages'		=> __('Choose images', 'lasso'),
74
+				'editImage'			=> __('Edit Image', 'lasso'),
75
+				'addImages'			=> __('Add Images', 'lasso'),
76
+				'addNewGallery'		=> __('Add New Gallery', 'lasso'),
77
+				'selectGallery'		=> __('Select Lasso Gallery Image', 'lasso'),
78
+				'useSelectedImages' => __('Use Selected Images', 'lasso'),
79
+				'publishPost'		=> __('Publish Post?', 'lasso'),
80
+				'publishYes'		=> __('Yes, publish it!', 'lasso'),
81
+				'deletePost'		=> __('Trash Post?', 'lasso'),
82
+				'deleteYes'			=> __('Yes, trash it!', 'lasso'),
83
+				'warning'			=> __('Oh snap!', 'laso'),
84
+				'cancelText'		=> __('O.K. got it!', 'lasso'),
85
+				'missingClass'		=> __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.', 'lasso'),
86 86
 				'missingConfirm'	=> __('Update Settings', 'lasso'),
87
-				'helperText'		=> __('one more letter','lasso'),
87
+				'helperText'		=> __('one more letter', 'lasso'),
88 88
 				'editingBackup'  	=> __('You are currently editing a backup copy of this post.')
89 89
 			);
90 90
 
91
-			$api_url = trailingslashit( home_url() ) . 'lasso-internal-api';
91
+			$api_url = trailingslashit(home_url()).'lasso-internal-api';
92 92
 
93 93
 			$gallery_class = new gallery();
94 94
 			$gallery_nonce_action = $gallery_class->nonce_action;
95
-			$gallery_nonce = wp_create_nonce( $gallery_nonce_action );
95
+			$gallery_nonce = wp_create_nonce($gallery_nonce_action);
96 96
 
97 97
 			// localized objects
98 98
 			$objects = array(
99
-				'ajaxurl' 			=> esc_url( $api_url ),
99
+				'ajaxurl' 			=> esc_url($api_url),
100 100
 				'editor' 			=> 'lasso--content', // ID of editable content (without #) DONT CHANGE
101 101
 				'article_object'	=> $article_object,
102 102
 				'featImgClass'		=> $featImgClass,
103 103
 				'titleClass'		=> $titleClass,
104 104
 				'strings'			=> $strings,
105
-				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ),
106
-				'post_status'		=> get_post_status( $postid ),
105
+				'settingsLink'		=> function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'),
106
+				'post_status'		=> get_post_status($postid),
107 107
 				'postid'			=> $postid,
108 108
 				'permalink'			=> get_permalink(),
109 109
 				'edit_others_pages'	=> current_user_can('edit_others_pages') ? 'true' : 'false',
110 110
 				'edit_others_posts'	=> current_user_can('edit_others_posts') ? 'true' : 'false',
111
-				'userCanEdit'		=> current_user_can('edit_post', $postid ),
111
+				'userCanEdit'		=> current_user_can('edit_post', $postid),
112 112
 				'can_publish_posts'	=> current_user_can('publish_posts'),
113 113
 				'can_publish_pages'	=> current_user_can('publish_pages'),
114 114
 				'author'			=> is_user_logged_in() ? get_current_user_ID() : false,
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
 				'postTags'    		=> lasso_get_objects('tag'),
141 141
 				'noResultsDiv'		=> lasso_editor_empty_results(),
142 142
 				'noRevisionsDiv'	=> lasso_editor_empty_results('revision'),
143
-				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false,
144
-				'mapLocations'		=> get_post_meta( $postid, 'ase_map_component_locations' ),
145
-				'mapStart'			=> get_post_meta( $postid, 'ase_map_component_start_point', true ),
146
-				'mapZoom'			=> get_post_meta( $postid, 'ase_map_component_zoom', true ),
143
+				'mapTileProvider'   => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false,
144
+				'mapLocations'		=> get_post_meta($postid, 'ase_map_component_locations'),
145
+				'mapStart'			=> get_post_meta($postid, 'ase_map_component_start_point', true),
146
+				'mapZoom'			=> get_post_meta($postid, 'ase_map_component_zoom', true),
147 147
 				'revisionModal' 	=> lasso_editor_revision_modal()
148 148
 			);
149 149
 
150 150
 
151 151
 			// wp api client
152
-			wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true );
153
-				$settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) );
154
-				wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings );
152
+			wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true);
153
+				$settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json'));
154
+				wp_localize_script('wp-api-js', 'WP_API_Settings', $settings);
155 155
 
156
-				$postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';
157
-				wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true);
158
-				wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) );
156
+				$postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min';
157
+				wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true);
158
+				wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects));
159 159
 
160 160
 
161 161
 		}
Please login to merge, or discard this patch.
lasso.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@
 block discarded – undo
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.9.9.10' );
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.9.9.10');
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
 
Please login to merge, or discard this patch.