Changeset 2961404
- Timestamp:
- 09/01/2023 01:14:59 AM (2 years ago)
- Location:
- meta-optimizer
- Files:
-
- 21 added
- 5 edited
-
tags/1.2.1 (added)
-
tags/1.2.1/WPMetaOptimizer.php (added)
-
tags/1.2.1/assets (added)
-
tags/1.2.1/assets/style.min.css (added)
-
tags/1.2.1/assets/wpmo.js (added)
-
tags/1.2.1/inc (added)
-
tags/1.2.1/inc/Actions.php (added)
-
tags/1.2.1/inc/Base.php (added)
-
tags/1.2.1/inc/CommentQueries.php (added)
-
tags/1.2.1/inc/Helpers.php (added)
-
tags/1.2.1/inc/Install.php (added)
-
tags/1.2.1/inc/Integration.php (added)
-
tags/1.2.1/inc/MetaQuery.php (added)
-
tags/1.2.1/inc/Options.php (added)
-
tags/1.2.1/inc/PostQueries.php (added)
-
tags/1.2.1/inc/Queries.php (added)
-
tags/1.2.1/inc/TermQueries.php (added)
-
tags/1.2.1/inc/UserQueries.php (added)
-
tags/1.2.1/inc/index.php (added)
-
tags/1.2.1/index.php (added)
-
tags/1.2.1/readme.txt (added)
-
trunk/WPMetaOptimizer.php (modified) (1 diff)
-
trunk/inc/Actions.php (modified) (1 diff)
-
trunk/inc/Helpers.php (modified) (2 diffs)
-
trunk/inc/Install.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
meta-optimizer/trunk/WPMetaOptimizer.php
r2961342 r2961404 3 3 /*! 4 4 * Plugin Name: Meta Optimizer 5 * Version: 1.2 5 * Version: 1.2.1 6 6 * Plugin URI: https://parsakafi.github.io/wp-meta-optimizer 7 7 * Description: You can use Meta Optimizer to make your WordPress website load faster if you use meta information, for example Post/Comment/User/Term metas. -
meta-optimizer/trunk/inc/Actions.php
r2961342 r2961404 220 220 $objectMetas = get_metadata( $type, $objectID ); 221 221 222 foreach ( $objectMetas as $metaKey => $metaValue ) {222 foreach ( $objectMetas as $metaKey => $metaValues ) { 223 223 if ( $this->Helpers->checkInBlackWhiteList( $type, $metaKey, 'black_list' ) === true || $this->Helpers->checkInBlackWhiteList( $type, $metaKey, 'white_list' ) === false ) 224 224 continue; 225 225 226 $metaKey = $this->Helpers->translateColumnName( $type, $metaKey ); 227 $metaValue = maybe_unserialize( $metaValue ); 228 229 if ( is_array( $metaValue ) && count( $metaValue ) === 1 && isset( $metaValue[0] ) ) 230 $metaValue = maybe_unserialize( current( $metaValue ) ); 231 232 if ( is_array( $metaValue ) ) { 233 $metaValue = [ $metaValue ]; 234 $metaValue = array_map( 'maybe_unserialize', $metaValue ); 235 $metaValue = $this->Helpers->reIndexMetaValue( $metaValue ); 226 $metaKey = $this->Helpers->translateColumnName( $type, $metaKey ); 227 $metaValues = array_map( 'maybe_unserialize', $metaValues ); 228 229 if ( count( $metaValues ) === 1 && ! is_array( $metaValues[0] ) ) { 230 $metaValue = current( $metaValues ); 231 } else { 232 $metaValue = $this->Helpers->reIndexMetaValue( $metaValues ); 236 233 } 237 234 238 235 $this->Helpers->insertMeta( 239 236 [ 240 'metaType' => $type, 241 'objectID' => $objectID, 242 'metaKey' => $metaKey, 243 'metaValue' => $metaValue, 244 'checkCurrentValue' => false 237 'metaType' => $type, 238 'objectID' => $objectID, 239 'metaKey' => $metaKey, 240 'metaValue' => $metaValue, 245 241 ] 246 242 ); -
meta-optimizer/trunk/inc/Helpers.php
r2961342 r2961404 229 229 230 230 $value = maybe_serialize( $metaValue ); 231 $value = $this->numericVal( $value ); 231 232 $columnType = $this->getFieldType( $value ); 232 233 $valueLength = mb_strlen( $value ); … … 260 261 261 262 return $addTableColumn; 263 } 264 265 /** 266 * Get the numeric (integer, float) value of a variable 267 * 268 * @param mixed $value The scalar value being converted to an integer or float 269 * 270 * @return float|int|mixed|string 271 */ 272 public function numericVal( $value ) { 273 if ( is_numeric( $value ) ) 274 if ( intval( $value ) == $value ) 275 return intval( $value ); 276 elseif ( floatval( $value ) == $value ) 277 return floatval( $value ); 278 279 return $value; 262 280 } 263 281 -
meta-optimizer/trunk/inc/Install.php
r2961342 r2961404 72 72 $oldVersion = get_option( 'wp_meta_optimizer_version', '1.0' ); 73 73 74 if ( version_compare( $oldVersion, '1.2 ', '<' ) ) {74 if ( version_compare( $oldVersion, '1.2.1', '<' ) ) { 75 75 $newPluginOptions['import'] = [ 76 76 'post' => 1, -
meta-optimizer/trunk/readme.txt
r2961342 r2961404 5 5 Requires at least: 5.0 6 6 Tested up to: 6.3.1 7 Stable tag: 1.2 7 Stable tag: 1.2.1 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 98 98 == Changelog == 99 99 100 = 1.2.1 = 101 * NumericVal meta value & change field type when create db table field 102 100 103 = 1.2 = 101 104 * Fix bugs effected on save meta array value
Note: See TracChangeset
for help on using the changeset viewer.