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