| Conditions | 9 |
| Paths | 48 |
| Total Lines | 625 |
| Code Lines | 431 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 142 | function build_new_settings( $foogallery ) { |
||
| 143 | $mappings = array( |
||
| 144 | array( |
||
| 145 | 'id' => 'border-style', |
||
| 146 | 'value' => 'border-style-square-white', |
||
| 147 | 'new' => array( |
||
| 148 | array ( 'id' => 'theme', 'value' => 'fg-light' ), |
||
| 149 | array ( 'id' => 'border_size', 'value' => 'fg-border-thin' ), |
||
| 150 | array ( 'id' => 'drop_shadow', 'value' => 'fg-shadow-small' ), |
||
| 151 | array ( 'id' => 'rounded_corners', 'value' => '' ), |
||
| 152 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 153 | ) |
||
| 154 | ), |
||
| 155 | array( |
||
| 156 | 'id' => 'border-style', |
||
| 157 | 'value' => 'border-style-circle-white', |
||
| 158 | 'new' => array( |
||
| 159 | array ( 'id' => 'theme', 'value' => 'fg-light' ), |
||
| 160 | array ( 'id' => 'border_size', 'value' => 'fg-border-thin' ), |
||
| 161 | array ( 'id' => 'drop_shadow', 'value' => 'fg-shadow-small' ), |
||
| 162 | array ( 'id' => 'rounded_corners', 'value' => 'fg-round-full' ), |
||
| 163 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 164 | ) |
||
| 165 | ), |
||
| 166 | array( |
||
| 167 | 'id' => 'border-style', |
||
| 168 | 'value' => 'border-style-square-black', |
||
| 169 | 'new' => array( |
||
| 170 | array ( 'id' => 'theme', 'value' => 'fg-dark' ), |
||
| 171 | array ( 'id' => 'border_size', 'value' => 'fg-border-thin' ), |
||
| 172 | array ( 'id' => 'drop_shadow', 'value' => 'fg-shadow-small' ), |
||
| 173 | array ( 'id' => 'rounded_corners', 'value' => '' ), |
||
| 174 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 175 | ) |
||
| 176 | ), |
||
| 177 | array( |
||
| 178 | 'id' => 'border-style', |
||
| 179 | 'value' => 'border-style-circle-black', |
||
| 180 | 'new' => array( |
||
| 181 | array ( 'id' => 'theme', 'value' => 'fg-dark' ), |
||
| 182 | array ( 'id' => 'border_size', 'value' => 'fg-border-thin' ), |
||
| 183 | array ( 'id' => 'drop_shadow', 'value' => 'fg-shadow-small' ), |
||
| 184 | array ( 'id' => 'rounded_corners', 'value' => 'fg-round-full' ), |
||
| 185 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 186 | ) |
||
| 187 | ), |
||
| 188 | array( |
||
| 189 | 'id' => 'border-style', |
||
| 190 | 'value' => 'border-style-inset', |
||
| 191 | 'new' => array( |
||
| 192 | array ( 'id' => 'theme', 'value' => 'fg-light' ), |
||
| 193 | array ( 'id' => 'border_size', 'value' => '' ), |
||
| 194 | array ( 'id' => 'drop_shadow', 'value' => 'fg-shadow-small' ), |
||
| 195 | array ( 'id' => 'rounded_corners', 'value' => '' ), |
||
| 196 | array ( 'id' => 'inner_shadow', 'value' => 'fg-shadow-inset-large' ), |
||
| 197 | ) |
||
| 198 | ), |
||
| 199 | array( |
||
| 200 | 'id' => 'border-style', |
||
| 201 | 'value' => 'border-style-rounded', |
||
| 202 | 'new' => array( |
||
| 203 | array ( 'id' => 'theme', 'value' => 'fg-light' ), |
||
| 204 | array ( 'id' => 'border_size', 'value' => '' ), |
||
| 205 | array ( 'id' => 'drop_shadow', 'value' => '' ), |
||
| 206 | array ( 'id' => 'rounded_corners', 'value' => 'fg-round-small' ), |
||
| 207 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 208 | ) |
||
| 209 | ), |
||
| 210 | array( |
||
| 211 | 'id' => 'border-style', |
||
| 212 | 'value' => '', |
||
| 213 | 'new' => array( |
||
| 214 | array ( 'id' => 'theme', 'value' => 'fg-light' ), |
||
| 215 | array ( 'id' => 'border_size', 'value' => '' ), |
||
| 216 | array ( 'id' => 'drop_shadow', 'value' => '' ), |
||
| 217 | array ( 'id' => 'rounded_corners', 'value' => '' ), |
||
| 218 | array ( 'id' => 'inner_shadow', 'value' => '' ), |
||
| 219 | ) |
||
| 220 | ), |
||
| 221 | |||
| 222 | array( |
||
| 223 | 'id' => 'spacing', |
||
| 224 | 'value' => 'spacing-width-0', |
||
| 225 | 'new' => array( |
||
| 226 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-0' ) |
||
| 227 | ) |
||
| 228 | ), |
||
| 229 | array( |
||
| 230 | 'id' => 'spacing', |
||
| 231 | 'value' => 'spacing-width-5', |
||
| 232 | 'new' => array( |
||
| 233 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-5' ) |
||
| 234 | ) |
||
| 235 | ), |
||
| 236 | array( |
||
| 237 | 'id' => 'spacing', |
||
| 238 | 'value' => 'spacing-width-10', |
||
| 239 | 'new' => array( |
||
| 240 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-10' ) |
||
| 241 | ) |
||
| 242 | ), |
||
| 243 | array( |
||
| 244 | 'id' => 'spacing', |
||
| 245 | 'value' => 'spacing-width-15', |
||
| 246 | 'new' => array( |
||
| 247 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-15' ) |
||
| 248 | ) |
||
| 249 | ), |
||
| 250 | array( |
||
| 251 | 'id' => 'spacing', |
||
| 252 | 'value' => 'spacing-width-20', |
||
| 253 | 'new' => array( |
||
| 254 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-20' ) |
||
| 255 | ) |
||
| 256 | ), |
||
| 257 | array( |
||
| 258 | 'id' => 'spacing', |
||
| 259 | 'value' => 'spacing-width-25', |
||
| 260 | 'new' => array( |
||
| 261 | array ( 'id' => 'spacing', 'value' => 'fg-gutter-25' ) |
||
| 262 | ) |
||
| 263 | ), |
||
| 264 | |||
| 265 | array( |
||
| 266 | 'id' => 'alignment', |
||
| 267 | 'value' => 'alignment-left', |
||
| 268 | 'new' => array( |
||
| 269 | array ( 'id' => 'alignment', 'value' => 'fg-left' ) |
||
| 270 | ) |
||
| 271 | ), |
||
| 272 | array( |
||
| 273 | 'id' => 'alignment', |
||
| 274 | 'value' => 'alignment-center', |
||
| 275 | 'new' => array( |
||
| 276 | array ( 'id' => 'alignment', 'value' => 'fg-center' ) |
||
| 277 | ) |
||
| 278 | ), |
||
| 279 | array( |
||
| 280 | 'id' => 'alignment', |
||
| 281 | 'value' => 'alignment-right', |
||
| 282 | 'new' => array( |
||
| 283 | array ( 'id' => 'alignment', 'value' => 'fg-right' ) |
||
| 284 | ) |
||
| 285 | ), |
||
| 286 | |||
| 287 | array( |
||
| 288 | 'id' => 'loading_animation', |
||
| 289 | 'value' => 'yes', |
||
| 290 | 'new' => array( |
||
| 291 | array ( 'id' => 'loading_icon', 'value' => 'fg-loading-default' ) |
||
| 292 | ) |
||
| 293 | ), |
||
| 294 | array( |
||
| 295 | 'id' => 'loading_animation', |
||
| 296 | 'value' => 'no', |
||
| 297 | 'new' => array( |
||
| 298 | array ( 'id' => 'loading_icon', 'value' => 'fg-loading-none' ) |
||
| 299 | ) |
||
| 300 | ), |
||
| 301 | |||
| 302 | |||
| 303 | array( |
||
| 304 | 'id' => 'hover-effect-type', |
||
| 305 | 'value' => '', //Icon |
||
| 306 | 'new' => array( |
||
| 307 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 308 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 309 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 310 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-zoom' ), |
||
| 311 | array ( 'id' => 'caption_title', 'value' => 'none' ), |
||
| 312 | array ( 'id' => 'caption_desc', 'value' => 'none' ) |
||
| 313 | ) |
||
| 314 | ), |
||
| 315 | |||
| 316 | array( |
||
| 317 | 'id' => 'hover-effect-type', |
||
| 318 | 'value' => 'hover-effect-tint', //Dark Tint |
||
| 319 | 'new' => array( |
||
| 320 | array ( 'id' => 'hover_effect_preset', 'value' => '' ), |
||
| 321 | array ( 'id' => 'hover_effect', 'value' => 'fg-hover-tint' ) |
||
| 322 | ) |
||
| 323 | ), |
||
| 324 | |||
| 325 | array( |
||
| 326 | 'id' => 'hover-effect-type', |
||
| 327 | 'value' => 'hover-effect-color', //Colorize |
||
| 328 | 'new' => array( |
||
| 329 | array ( 'id' => 'hover_effect_preset', 'value' => '' ), |
||
| 330 | array ( 'id' => 'hover_effect_color', 'value' => 'fg-hover-colorize' ) |
||
| 331 | ) |
||
| 332 | ), |
||
| 333 | |||
| 334 | array( |
||
| 335 | 'id' => 'hover-effect-type', |
||
| 336 | 'value' => 'hover-effect-none', //None |
||
| 337 | 'new' => array( |
||
| 338 | array ( 'id' => 'hover_effect_preset', 'value' => '' ) |
||
| 339 | ) |
||
| 340 | ), |
||
| 341 | |||
| 342 | array( |
||
| 343 | 'id' => 'hover-effect-type', |
||
| 344 | 'value' => 'hover-effect-caption', //Caption |
||
| 345 | 'new' => array( |
||
| 346 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 347 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 348 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 349 | ) |
||
| 350 | ), |
||
| 351 | |||
| 352 | array( |
||
| 353 | 'id' => 'hover-effect', |
||
| 354 | 'value' => 'hover-effect-zoom', |
||
| 355 | 'new' => array( |
||
| 356 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 357 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 358 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 359 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-zoom' ) |
||
| 360 | ) |
||
| 361 | ), |
||
| 362 | |||
| 363 | array( |
||
| 364 | 'id' => 'hover-effect', |
||
| 365 | 'value' => 'hover-effect-zoom2', |
||
| 366 | 'new' => array( |
||
| 367 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 368 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 369 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 370 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-zoom2' ) |
||
| 371 | ) |
||
| 372 | ), |
||
| 373 | |||
| 374 | array( |
||
| 375 | 'id' => 'hover-effect', |
||
| 376 | 'value' => 'hover-effect-zoom3', |
||
| 377 | 'new' => array( |
||
| 378 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 379 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 380 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 381 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-zoom3' ) |
||
| 382 | ) |
||
| 383 | ), |
||
| 384 | |||
| 385 | array( |
||
| 386 | 'id' => 'hover-effect', |
||
| 387 | 'value' => 'hover-effect-plus', |
||
| 388 | 'new' => array( |
||
| 389 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 390 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 391 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 392 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-plus' ) |
||
| 393 | ) |
||
| 394 | ), |
||
| 395 | |||
| 396 | array( |
||
| 397 | 'id' => 'hover-effect', |
||
| 398 | 'value' => 'hover-effect-circle-plus', |
||
| 399 | 'new' => array( |
||
| 400 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 401 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 402 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 403 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-circle-plus' ) |
||
| 404 | ) |
||
| 405 | ), |
||
| 406 | |||
| 407 | array( |
||
| 408 | 'id' => 'hover-effect', |
||
| 409 | 'value' => 'hover-effect-eye', |
||
| 410 | 'new' => array( |
||
| 411 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 412 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 413 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 414 | array ( 'id' => 'hover_effect_icon', 'value' => 'fg-hover-eye' ) |
||
| 415 | ) |
||
| 416 | ), |
||
| 417 | |||
| 418 | array( |
||
| 419 | 'id' => 'caption-hover-effect', |
||
| 420 | 'value' => 'hover-caption-simple', |
||
| 421 | 'new' => array( |
||
| 422 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 423 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 424 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 425 | array ( 'id' => 'hover_effect_icon', 'value' => '' ) |
||
| 426 | ) |
||
| 427 | ), |
||
| 428 | array( |
||
| 429 | 'id' => 'caption-hover-effect', |
||
| 430 | 'value' => 'hover-caption-full-drop', |
||
| 431 | 'new' => array( |
||
| 432 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 433 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 434 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-slide-down' ), |
||
| 435 | array ( 'id' => 'hover_effect_icon', 'value' => '' ) |
||
| 436 | ) |
||
| 437 | ), |
||
| 438 | array( |
||
| 439 | 'id' => 'caption-hover-effect', |
||
| 440 | 'value' => 'hover-caption-full-fade', |
||
| 441 | 'new' => array( |
||
| 442 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 443 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 444 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 445 | array ( 'id' => 'hover_effect_icon', 'value' => '' ) |
||
| 446 | ) |
||
| 447 | ), |
||
| 448 | array( |
||
| 449 | 'id' => 'caption-hover-effect', |
||
| 450 | 'value' => 'hover-caption-push', |
||
| 451 | 'new' => array( |
||
| 452 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 453 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 454 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-push' ), |
||
| 455 | array ( 'id' => 'hover_effect_icon', 'value' => '' ) |
||
| 456 | ) |
||
| 457 | ), |
||
| 458 | array( |
||
| 459 | 'id' => 'caption-hover-effect', |
||
| 460 | 'value' => 'hover-caption-simple-always', |
||
| 461 | 'new' => array( |
||
| 462 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 463 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-always' ), |
||
| 464 | array ( 'id' => 'hover_effect_icon', 'value' => '' ) |
||
| 465 | ) |
||
| 466 | ), |
||
| 467 | |||
| 468 | array( |
||
| 469 | 'id' => 'caption-content', |
||
| 470 | 'value' => 'title', |
||
| 471 | 'new' => array( |
||
| 472 | array ( 'id' => 'caption_title', 'value' => '' ), |
||
| 473 | array ( 'id' => 'caption_desc', 'value' => 'none' ) |
||
| 474 | ) |
||
| 475 | ), |
||
| 476 | array( |
||
| 477 | 'id' => 'caption-content', |
||
| 478 | 'value' => 'desc', |
||
| 479 | 'new' => array( |
||
| 480 | array ( 'id' => 'caption_title', 'value' => 'none' ), |
||
| 481 | array ( 'id' => 'caption_desc', 'value' => '' ) |
||
| 482 | ) |
||
| 483 | ), |
||
| 484 | array( |
||
| 485 | 'id' => 'caption-content', |
||
| 486 | 'value' => 'both', |
||
| 487 | 'new' => array( |
||
| 488 | array ( 'id' => 'caption_title', 'value' => '' ), |
||
| 489 | array ( 'id' => 'caption_desc', 'value' => '' ) |
||
| 490 | ) |
||
| 491 | ), |
||
| 492 | |||
| 493 | //masonry layout mappings |
||
| 494 | array( |
||
| 495 | 'id' => 'layout', |
||
| 496 | 'value' => '2col', |
||
| 497 | 'new' => array( |
||
| 498 | array ( 'id' => 'layout', 'value' => 'col2' ) |
||
| 499 | ) |
||
| 500 | ), |
||
| 501 | |||
| 502 | array( |
||
| 503 | 'id' => 'layout', |
||
| 504 | 'value' => '3col', |
||
| 505 | 'new' => array( |
||
| 506 | array ( 'id' => 'layout', 'value' => 'col3' ) |
||
| 507 | ) |
||
| 508 | ), |
||
| 509 | |||
| 510 | array( |
||
| 511 | 'id' => 'layout', |
||
| 512 | 'value' => '4col', |
||
| 513 | 'new' => array( |
||
| 514 | array ( 'id' => 'layout', 'value' => 'col4' ) |
||
| 515 | ) |
||
| 516 | ), |
||
| 517 | |||
| 518 | array( |
||
| 519 | 'id' => 'layout', |
||
| 520 | 'value' => '5col', |
||
| 521 | 'new' => array( |
||
| 522 | array ( 'id' => 'layout', 'value' => 'col5' ) |
||
| 523 | ) |
||
| 524 | ), |
||
| 525 | |||
| 526 | array( |
||
| 527 | 'id' => 'gutter_percent', |
||
| 528 | 'value' => 'no-gutter', |
||
| 529 | 'new' => array( |
||
| 530 | array ( 'id' => 'gutter_percent', 'value' => 'fg-gutter-none' ) |
||
| 531 | ) |
||
| 532 | ), |
||
| 533 | |||
| 534 | array( |
||
| 535 | 'id' => 'gutter_percent', |
||
| 536 | 'value' => 'large-gutter', |
||
| 537 | 'new' => array( |
||
| 538 | array ( 'id' => 'gutter_percent', 'value' => 'fg-gutter-large' ) |
||
| 539 | ) |
||
| 540 | ), |
||
| 541 | |||
| 542 | array( |
||
| 543 | 'id' => 'center_align', |
||
| 544 | 'value' => 'default', |
||
| 545 | 'new' => array( |
||
| 546 | array ( 'id' => 'alignment', 'value' => '' ) |
||
| 547 | ) |
||
| 548 | ), |
||
| 549 | |||
| 550 | array( |
||
| 551 | 'id' => 'center_align', |
||
| 552 | 'value' => 'center', |
||
| 553 | 'new' => array( |
||
| 554 | array ( 'id' => 'alignment', 'value' => 'fg-center' ) |
||
| 555 | ) |
||
| 556 | ), |
||
| 557 | |||
| 558 | array( |
||
| 559 | 'id' => 'hover_zoom', |
||
| 560 | 'value' => 'default', |
||
| 561 | 'new' => array( |
||
| 562 | array ( 'id' => 'hover_effect_scale', 'value' => 'fg-hover-scale' ) |
||
| 563 | ) |
||
| 564 | ), |
||
| 565 | |||
| 566 | array( |
||
| 567 | 'id' => 'hover_zoom', |
||
| 568 | 'value' => 'none', |
||
| 569 | 'new' => array( |
||
| 570 | array ( 'id' => 'hover_effect_scale', 'value' => '' ) |
||
| 571 | ) |
||
| 572 | ), |
||
| 573 | |||
| 574 | |||
| 575 | //image viewer upgrades |
||
| 576 | array( |
||
| 577 | 'id' => 'theme', |
||
| 578 | 'value' => 'fiv-dark', |
||
| 579 | 'new' => array( |
||
| 580 | array ( 'id' => 'theme', 'value' => 'fg-dark' ) |
||
| 581 | ) |
||
| 582 | ), |
||
| 583 | array( |
||
| 584 | 'id' => 'theme', |
||
| 585 | 'value' => '', |
||
| 586 | 'new' => array( |
||
| 587 | array ( 'id' => 'theme', 'value' => 'fg-light' ) |
||
| 588 | ) |
||
| 589 | ), |
||
| 590 | array( |
||
| 591 | 'id' => 'theme', |
||
| 592 | 'value' => 'fiv-custom', |
||
| 593 | 'new' => array( |
||
| 594 | array ( 'id' => 'theme', 'value' => 'fg-light' ) |
||
| 595 | ) |
||
| 596 | ), |
||
| 597 | |||
| 598 | array( |
||
| 599 | 'id' => 'alignment', |
||
| 600 | 'value' => 'alignment-left', |
||
| 601 | 'new' => array( |
||
| 602 | array ( 'id' => 'alignment', 'value' => 'fg-left' ) |
||
| 603 | ) |
||
| 604 | ), |
||
| 605 | array( |
||
| 606 | 'id' => 'alignment', |
||
| 607 | 'value' => 'alignment-center', |
||
| 608 | 'new' => array( |
||
| 609 | array ( 'id' => 'alignment', 'value' => 'fg-center' ) |
||
| 610 | ) |
||
| 611 | ), |
||
| 612 | array( |
||
| 613 | 'id' => 'alignment', |
||
| 614 | 'value' => 'alignment-right', |
||
| 615 | 'new' => array( |
||
| 616 | array ( 'id' => 'alignment', 'value' => 'fg-right' ) |
||
| 617 | ) |
||
| 618 | ), |
||
| 619 | |||
| 620 | //simple portfolio |
||
| 621 | array( |
||
| 622 | 'id' => 'caption_position', |
||
| 623 | 'value' => 'bf-captions-above', |
||
| 624 | 'new' => array( |
||
| 625 | array ( 'id' => 'caption_position', 'value' => 'fg-captions-top' ) |
||
| 626 | ) |
||
| 627 | ), |
||
| 628 | |||
| 629 | //single thumbnail |
||
| 630 | array( |
||
| 631 | 'id' => 'caption_style', |
||
| 632 | 'value' => 'caption-simple', |
||
| 633 | 'new' => array( |
||
| 634 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 635 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-always' ) |
||
| 636 | ) |
||
| 637 | ), |
||
| 638 | array( |
||
| 639 | 'id' => 'caption_style', |
||
| 640 | 'value' => 'caption-slideup', |
||
| 641 | 'new' => array( |
||
| 642 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 643 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 644 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-slide-up' ), |
||
| 645 | ) |
||
| 646 | ), |
||
| 647 | |||
| 648 | array( |
||
| 649 | 'id' => 'caption_style', |
||
| 650 | 'value' => 'caption-fall', |
||
| 651 | 'new' => array( |
||
| 652 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 653 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 654 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-slide-down' ), |
||
| 655 | ) |
||
| 656 | ), |
||
| 657 | array( |
||
| 658 | 'id' => 'caption_style', |
||
| 659 | 'value' => 'caption-fade', |
||
| 660 | 'new' => array( |
||
| 661 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 662 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 663 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-fade' ), |
||
| 664 | ) |
||
| 665 | ), |
||
| 666 | array( |
||
| 667 | 'id' => 'caption_style', |
||
| 668 | 'value' => 'caption-push', |
||
| 669 | 'new' => array( |
||
| 670 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 671 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 672 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-push' ), |
||
| 673 | ) |
||
| 674 | ), |
||
| 675 | array( |
||
| 676 | 'id' => 'caption_style', |
||
| 677 | 'value' => 'caption-scale', |
||
| 678 | 'new' => array( |
||
| 679 | array ( 'id' => 'hover_effect_preset', 'value' => 'fg-custom' ), |
||
| 680 | array ( 'id' => 'hover_effect_caption_visibility', 'value' => 'fg-caption-hover' ), |
||
| 681 | array ( 'id' => 'hover_effect_transition', 'value' => 'fg-hover-slide-left' ), |
||
| 682 | ) |
||
| 683 | ), |
||
| 684 | |||
| 685 | //single thumbnail gallery |
||
| 686 | array( |
||
| 687 | 'id' => 'position', |
||
| 688 | 'value' => 'position-block', |
||
| 689 | 'new' => array( |
||
| 690 | array ( 'id' => 'position', 'value' => 'fg-center' ), |
||
| 691 | ) |
||
| 692 | ), |
||
| 693 | array( |
||
| 694 | 'id' => 'position', |
||
| 695 | 'value' => 'position-float-left', |
||
| 696 | 'new' => array( |
||
| 697 | array ( 'id' => 'position', 'value' => 'fg-left' ), |
||
| 698 | ) |
||
| 699 | ), |
||
| 700 | array( |
||
| 701 | 'id' => 'position', |
||
| 702 | 'value' => 'position-float-right', |
||
| 703 | 'new' => array( |
||
| 704 | array ( 'id' => 'position', 'value' => 'fg-right' ), |
||
| 705 | ) |
||
| 706 | ), |
||
| 707 | |||
| 708 | ); |
||
| 709 | |||
| 710 | $old_settings = get_post_meta( $foogallery->ID, FOOGALLERY_META_SETTINGS_OLD, true ); |
||
| 711 | |||
| 712 | //start with the old settings |
||
| 713 | $new_settings = $old_settings; |
||
| 714 | |||
| 715 | //upgrade all template settings |
||
| 716 | foreach ( foogallery_gallery_templates() as $template ) { |
||
| 717 | |||
| 718 | foreach ( $mappings as $mapping ) { |
||
| 719 | |||
| 720 | $settings_key = "{$template['slug']}_{$mapping['id']}"; |
||
| 721 | |||
| 722 | //check if the settings exists |
||
| 723 | if ( array_key_exists( $settings_key, $old_settings ) ) { |
||
| 724 | |||
| 725 | $old_settings_value = $old_settings[$settings_key]; |
||
| 726 | |||
| 727 | if ( $mapping['value'] === $old_settings_value ) { |
||
| 728 | //we have found a match! |
||
| 729 | |||
| 730 | foreach ( $mapping['new'] as $setting_to_create ) { |
||
| 731 | $new_setting_key = "{$template['slug']}_{$setting_to_create['id']}"; |
||
| 732 | $new_setting_value = $setting_to_create['value']; |
||
| 733 | $new_settings[$new_setting_key] = $new_setting_value; |
||
| 734 | } |
||
| 735 | } |
||
| 736 | } |
||
| 737 | } |
||
| 738 | } |
||
| 739 | |||
| 740 | //template specific settings overrides |
||
| 741 | if ( 'image-viewer' === $foogallery->gallery_template ) { |
||
| 742 | $new_settings['image-viewer_theme'] = 'fg-light'; |
||
| 743 | $new_settings['image-viewer_border_size'] = ''; |
||
| 744 | $new_settings['image-viewer_drop_shadow'] = ''; |
||
| 745 | $new_settings['image-viewer_rounded_corners'] = ''; |
||
| 746 | $new_settings['image-viewer_inner_shadow'] = ''; |
||
| 747 | } |
||
| 748 | |||
| 749 | if ( 'justified' === $foogallery->gallery_template ) { |
||
| 750 | $new_settings['image-viewer_theme'] = 'fg-light'; |
||
| 751 | $new_settings['image-viewer_border_size'] = ''; |
||
| 752 | $new_settings['image-viewer_drop_shadow'] = ''; |
||
| 753 | $new_settings['image-viewer_rounded_corners'] = ''; |
||
| 754 | $new_settings['image-viewer_inner_shadow'] = ''; |
||
| 755 | } |
||
| 756 | |||
| 757 | if ( 'masonry' === $foogallery->gallery_template ) { |
||
| 758 | $new_settings['image-viewer_theme'] = 'fg-light'; |
||
| 759 | $new_settings['image-viewer_border_size'] = ''; |
||
| 760 | $new_settings['image-viewer_drop_shadow'] = ''; |
||
| 761 | $new_settings['image-viewer_rounded_corners'] = ''; |
||
| 762 | $new_settings['image-viewer_inner_shadow'] = ''; |
||
| 763 | } |
||
| 764 | |||
| 765 | return $new_settings; |
||
| 766 | } |
||
| 767 | } |
||
| 768 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.