| @@ -64,7 +64,7 @@ | ||
| 64 | 64 | * @uses api_request() | 
| 65 | 65 | * | 
| 66 | 66 | * @param array $_transient_data Update array build by WordPress. | 
| 67 | - * @return array Modified update array with custom plugin data. | |
| 67 | + * @return stdClass Modified update array with custom plugin data. | |
| 68 | 68 | */ | 
| 69 | 69 |  	function check_update( $_transient_data ) { | 
| 70 | 70 | |
| @@ -270,11 +270,13 @@ | ||
| 270 | 270 | |
| 271 | 271 | $data = array_merge( $this->api_data, $_data ); | 
| 272 | 272 | |
| 273 | - if ( $data['slug'] != $this->slug ) | |
| 274 | - return; | |
| 273 | +		if ( $data['slug'] != $this->slug ) { | |
| 274 | + return; | |
| 275 | + } | |
| 275 | 276 | |
| 276 | - if ( empty( $data['license'] ) ) | |
| 277 | - return; | |
| 277 | +		if ( empty( $data['license'] ) ) { | |
| 278 | + return; | |
| 279 | + } | |
| 278 | 280 | |
| 279 | 281 |  		if ( $this->api_url == home_url() ) { | 
| 280 | 282 | return false; // Don't allow a plugin to ping itself | 
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | * Loads the class file for a given class name. | 
| 63 | 63 | * | 
| 64 | 64 | * @param string $class The fully-qualified class name. | 
| 65 | - * @return mixed The mapped file name on success, or boolean false on | |
| 65 | + * @return string|false The mapped file name on success, or boolean false on | |
| 66 | 66 | * failure. | 
| 67 | 67 | */ | 
| 68 | 68 |  	public function loadClass($class) { | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | * | 
| 100 | 100 | * @param string $prefix The namespace prefix. | 
| 101 | 101 | * @param string $relative_class The relative class name. | 
| 102 | - * @return mixed Boolean false if no mapped file can be loaded, or the | |
| 102 | + * @return false|string Boolean false if no mapped file can be loaded, or the | |
| 103 | 103 | * name of the mapped file that was loaded. | 
| 104 | 104 | */ | 
| 105 | 105 |  	protected function loadMappedFile($prefix, $relative_class) { | 
| @@ -49,7 +49,6 @@ discard block | ||
| 49 | 49 | * | 
| 50 | 50 | * @param string $action The AJAX action we are processing. | 
| 51 | 51 | * @param string|object $callback_class The class to use for the callback. Either the name of the class or an instance of that class. | 
| 52 | - * @param string $method The name of the callback method. | |
| 53 | 52 | |
| 54 | 53 | */ | 
| 55 | 54 |  	public function __construct( $action, $callback_class) { | 
| @@ -123,7 +122,7 @@ discard block | ||
| 123 | 122 | * | 
| 124 | 123 | * @access protected | 
| 125 | 124 | * | 
| 126 | - * @return bool | |
| 125 | + * @return boolean|null | |
| 127 | 126 | */ | 
| 128 | 127 |  	protected function if_implements() { | 
| 129 | 128 | |
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 |  	public function __construct( $action, $callback_class) { | 
| 56 | 56 |  		if ( ! is_object( $callback_class ) ) { | 
| 57 | 57 | $this->callback_instance = new $callback_class; | 
| 58 | -		}else{ | |
| 58 | +		} else{ | |
| 59 | 59 | $this->callback_instance = $callback_class; | 
| 60 | 60 | } | 
| 61 | 61 | |
| @@ -149,7 +149,7 @@ discard block | ||
| 149 | 149 |  	protected function check_nonce() { | 
| 150 | 150 |  		if ( isset( $this->callback_instance->nonce_action ) ) { | 
| 151 | 151 | $nonce = $this->callback_instance->nonce_action; | 
| 152 | -		}else{ | |
| 152 | +		} else{ | |
| 153 | 153 | $nonce = 'lasso_editor'; | 
| 154 | 154 | } | 
| 155 | 155 | |
| @@ -97,6 +97,7 @@ | ||
| 97 | 97 | * | 
| 98 | 98 | * @access protected | 
| 99 | 99 | * | 
| 100 | + * @param string $action | |
| 100 | 101 | * @return array | 
| 101 | 102 | */ | 
| 102 | 103 |  	protected static function find_callback( $action ) { | 
| @@ -36,9 +36,9 @@ discard block | ||
| 36 | 36 | $callback = self::find_callback( strip_tags( $action ) ); | 
| 37 | 37 |  				if ( is_int( $callback )  ) { | 
| 38 | 38 | $code = $callback; | 
| 39 | -				}elseif( ! class_exists( $callback['class'] ) ) { | |
| 39 | +				} elseif( ! class_exists( $callback['class'] ) ) { | |
| 40 | 40 | $code = 415; | 
| 41 | -				}else { | |
| 41 | +				} else { | |
| 42 | 42 | $action = str_replace( '-', '_', $action ); | 
| 43 | 43 | $callback_instance = new $callback['class']; | 
| 44 | 44 | $auth = self::auth( $action, $callback_instance, $callback['method'] ); | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | -			}else{ | |
| 64 | +			} else{ | |
| 65 | 65 | $code = 401; | 
| 66 | 66 | $response = __( 'Nonce not set.', 'lasso' ); | 
| 67 | 67 | } | 
| @@ -167,9 +167,9 @@ discard block | ||
| 167 | 167 | |
| 168 | 168 |  		if ( is_string( $response ) ) { | 
| 169 | 169 | $data[] = $response; | 
| 170 | -		}elseif( is_array( $response ) ) { | |
| 170 | +		} elseif( is_array( $response ) ) { | |
| 171 | 171 | $data = $response; | 
| 172 | -		}else{ | |
| 172 | +		} else{ | |
| 173 | 173 | $data[] = $code; | 
| 174 | 174 | } | 
| 175 | 175 | |
| @@ -177,7 +177,7 @@ discard block | ||
| 177 | 177 | nocache_headers(); | 
| 178 | 178 |  		if ( 200 == $code ) { | 
| 179 | 179 | wp_send_json_success( $data ); | 
| 180 | -		}else{ | |
| 180 | +		} else{ | |
| 181 | 181 | wp_send_json_error( $data ); | 
| 182 | 182 | } | 
| 183 | 183 | |
| @@ -106,8 +106,10 @@ discard block | ||
| 106 | 106 |  		if ( isset( $_POST['edd_license_activate'] ) ) { | 
| 107 | 107 | |
| 108 | 108 | // run a quick security check | 
| 109 | - if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) | |
| 110 | - return; // get out if we didn't click the Activate button | |
| 109 | +			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) { | |
| 110 | + return; | |
| 111 | + } | |
| 112 | + // get out if we didn't click the Activate button | |
| 111 | 113 | |
| 112 | 114 | // retrieve the license from the database | 
| 113 | 115 | $license = trim( get_option( 'lasso_license_key' ) ); | 
| @@ -124,8 +126,9 @@ discard block | ||
| 124 | 126 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); | 
| 125 | 127 | |
| 126 | 128 | // make sure the response came back okay | 
| 127 | - if ( is_wp_error( $response ) ) | |
| 128 | - return false; | |
| 129 | +			if ( is_wp_error( $response ) ) { | |
| 130 | + return false; | |
| 131 | + } | |
| 129 | 132 | |
| 130 | 133 | // decode the license data | 
| 131 | 134 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); | 
| @@ -143,8 +146,10 @@ discard block | ||
| 143 | 146 |  		if ( isset( $_POST['edd_license_deactivate'] ) ) { | 
| 144 | 147 | |
| 145 | 148 | // run a quick security check | 
| 146 | - if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) | |
| 147 | - return; // get out if we didn't click the Activate button | |
| 149 | +			if ( ! check_admin_referer( 'lasso_license_nonce', 'lasso_license_nonce' ) ) { | |
| 150 | + return; | |
| 151 | + } | |
| 152 | + // get out if we didn't click the Activate button | |
| 148 | 153 | |
| 149 | 154 | // retrieve the license from the database | 
| 150 | 155 | $license = trim( get_option( 'lasso_license_key' ) ); | 
| @@ -162,15 +167,17 @@ discard block | ||
| 162 | 167 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); | 
| 163 | 168 | |
| 164 | 169 | // make sure the response came back okay | 
| 165 | - if ( is_wp_error( $response ) ) | |
| 166 | - return false; | |
| 170 | +			if ( is_wp_error( $response ) ) { | |
| 171 | + return false; | |
| 172 | + } | |
| 167 | 173 | |
| 168 | 174 | // decode the license data | 
| 169 | 175 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); | 
| 170 | 176 | |
| 171 | 177 | // $license_data->license will be either "deactivated" or "failed" | 
| 172 | - if ( $license_data->license == 'deactivated' ) | |
| 173 | - delete_option( 'lasso_license_status' ); | |
| 178 | +			if ( $license_data->license == 'deactivated' ) { | |
| 179 | + delete_option( 'lasso_license_status' ); | |
| 180 | + } | |
| 174 | 181 | |
| 175 | 182 | } | 
| 176 | 183 | } | 
| @@ -192,8 +199,9 @@ discard block | ||
| 192 | 199 | // Call the custom API. | 
| 193 | 200 | $response = wp_remote_post( LASSO_STORE_URL, array( 'body' => $api_params, 'timeout' => 15, 'sslverify' => false ) ); | 
| 194 | 201 | |
| 195 | - if ( is_wp_error( $response ) ) | |
| 196 | - return false; | |
| 202 | +		if ( is_wp_error( $response ) ) { | |
| 203 | + return false; | |
| 204 | + } | |
| 197 | 205 | |
| 198 | 206 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); | 
| 199 | 207 | |
| @@ -30,8 +30,9 @@ | ||
| 30 | 30 | $postid = isset( $data['postid'] ) ? $data['postid'] : false; | 
| 31 | 31 | |
| 32 | 32 | // bail out if teh current user can't publish posts | 
| 33 | - if ( !lasso_user_can( 'delete_post', $postid ) ) | |
| 34 | - return; | |
| 33 | +		if ( !lasso_user_can( 'delete_post', $postid ) ) { | |
| 34 | + return; | |
| 35 | + } | |
| 35 | 36 | |
| 36 | 37 | $args = array( | 
| 37 | 38 | 'ID' => (int) $postid, | 
| @@ -119,9 +119,9 @@ discard block | ||
| 119 | 119 | $gallery_ids = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false; | 
| 120 | 120 |  		if ( ! empty( $data ) && $data[ 'gallery_type' ] ) { | 
| 121 | 121 | $type = $data[ 'gallery_type' ]; | 
| 122 | -		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { | |
| 122 | +		} elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) { | |
| 123 | 123 | $type = $options[ 'galleryType' ]; | 
| 124 | -		}else{ | |
| 124 | +		} else{ | |
| 125 | 125 | $type = false; | 
| 126 | 126 | } | 
| 127 | 127 | |
| @@ -173,8 +173,9 @@ discard block | ||
| 173 | 173 | */ | 
| 174 | 174 |  	private function get_the_images( $image_ids = '' ) { | 
| 175 | 175 | |
| 176 | - if ( empty( $image_ids ) ) | |
| 177 | - return; | |
| 176 | +		if ( empty( $image_ids ) ) { | |
| 177 | + return; | |
| 178 | + } | |
| 178 | 179 | |
| 179 | 180 | $image_ids = array_map( 'intval', explode( ',', $image_ids ) ); | 
| 180 | 181 | |
| @@ -31,7 +31,7 @@ | ||
| 31 | 31 | $args = array(); | 
| 32 | 32 |  		if ( isset( $data[ 'limit' ] ) ) { | 
| 33 | 33 | $args[ 'posts_per_page' ] = $data[ 'limit' ]; | 
| 34 | -		}else{ | |
| 34 | +		} else{ | |
| 35 | 35 | $args[ 'posts_per_page' ] = 6; // we start at revision 0 | 
| 36 | 36 | } | 
| 37 | 37 | |
| @@ -47,8 +47,7 @@ discard block | ||
| 47 | 47 | $defaults[ 'type' ] = $params; | 
| 48 | 48 | |
| 49 | 49 | $params = $defaults; | 
| 50 | - } | |
| 51 | -		else { | |
| 50 | +		} else { | |
| 52 | 51 | $params = array_merge( $defaults, (array) $params ); | 
| 53 | 52 | } | 
| 54 | 53 | |
| @@ -63,24 +62,21 @@ discard block | ||
| 63 | 62 | } | 
| 64 | 63 | |
| 65 | 64 | $output = (object) $output; | 
| 66 | - } | |
| 67 | -		elseif ( is_array( $input ) ) { | |
| 65 | +		} elseif ( is_array( $input ) ) { | |
| 68 | 66 | $n_params = $params; | 
| 69 | 67 | $n_params[ 'nested' ] = true; | 
| 70 | 68 | |
| 71 | 69 |  			foreach ( $input as $key => $val ) { | 
| 72 | 70 | $output[ self::do_sanitize( $key ) ] = self::do_sanitize( $val, $n_params ); | 
| 73 | 71 | } | 
| 74 | - } | |
| 75 | -		elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) { | |
| 72 | +		} elseif ( !empty( $params[ 'type' ] ) && false !== strpos( $params[ 'type' ], '%' ) ) { | |
| 76 | 73 | /** | 
| 77 | 74 | * @var $wpdb wpdb | 
| 78 | 75 | */ | 
| 79 | 76 | global $wpdb; | 
| 80 | 77 | |
| 81 | 78 | $output = $wpdb->prepare( $params[ 'type' ], $output ); | 
| 82 | - } | |
| 83 | -		else { | |
| 79 | +		} else { | |
| 84 | 80 | $output = wp_slash( $input ); | 
| 85 | 81 | } | 
| 86 | 82 | |
| @@ -115,20 +111,17 @@ discard block | ||
| 115 | 111 | } | 
| 116 | 112 | |
| 117 | 113 | $output = (object) $output; | 
| 118 | - } | |
| 119 | -		elseif ( is_array( $input ) ) { | |
| 114 | +		} elseif ( is_array( $input ) ) { | |
| 120 | 115 |  			foreach ( $input as $key => $val ) { | 
| 121 | 116 | $output[ $key ] = self::sanitize_like( $val ); | 
| 122 | 117 | } | 
| 123 | - } | |
| 124 | -		else { | |
| 118 | +		} else { | |
| 125 | 119 | global $wpdb; | 
| 126 | 120 | |
| 127 | 121 | //backwords-compat check for pre WP4.0 | 
| 128 | 122 |  			if ( method_exists( 'wpdb', 'esc_like' ) ) { | 
| 129 | 123 | $output = $wpdb->esc_like( self::do_sanitize( $input ) ); | 
| 130 | - } | |
| 131 | -			else { | |
| 124 | +			} else { | |
| 132 | 125 | // like_escape is deprecated in WordPress 4.0 | 
| 133 | 126 | $output = like_escape( self::do_sanitize( $input ) ); | 
| 134 | 127 | } | 
| @@ -160,8 +153,7 @@ discard block | ||
| 160 | 153 | |
| 161 | 154 |  		if ( empty( $input ) ) { | 
| 162 | 155 | $output = $input; | 
| 163 | - } | |
| 164 | -		elseif ( is_object( $input ) ) { | |
| 156 | +		} elseif ( is_object( $input ) ) { | |
| 165 | 157 | $input = get_object_vars( $input ); | 
| 166 | 158 | |
| 167 | 159 |  			foreach ( $input as $key => $val ) { | 
| @@ -169,13 +161,11 @@ discard block | ||
| 169 | 161 | } | 
| 170 | 162 | |
| 171 | 163 | $output = (object) $output; | 
| 172 | - } | |
| 173 | -		elseif ( is_array( $input ) ) { | |
| 164 | +		} elseif ( is_array( $input ) ) { | |
| 174 | 165 |  			foreach ( $input as $key => $val ) { | 
| 175 | 166 | $output[ $key ] = self::unslash( $val ); | 
| 176 | 167 | } | 
| 177 | - } | |
| 178 | -		else { | |
| 168 | +		} else { | |
| 179 | 169 | $output = wp_unslash( $input ); | 
| 180 | 170 | |
| 181 | 171 | } |