| @@ 437-460 (lines=24) @@ | ||
| 434 | /** |
|
| 435 | * @return array |
|
| 436 | */ |
|
| 437 | function pods_2_alpha_migrate_helpers() { |
|
| 438 | ||
| 439 | $api = pods_api(); |
|
| 440 | ||
| 441 | $helper_rows = pods_query( "SELECT * FROM `@wp_pods_objects` WHERE `type` = 'helper'", false ); |
|
| 442 | ||
| 443 | $helper_ids = array(); |
|
| 444 | ||
| 445 | if ( empty( $helper_rows ) ) { |
|
| 446 | return $helper_ids; |
|
| 447 | } |
|
| 448 | ||
| 449 | foreach ( $helper_rows as $row ) { |
|
| 450 | $opts = json_decode( $row->options ); |
|
| 451 | ||
| 452 | $helper_params = array( |
|
| 453 | 'name' => $row->name, |
|
| 454 | 'type' => $opts->type, |
|
| 455 | 'phpcode' => $opts->phpcode, |
|
| 456 | ); |
|
| 457 | ||
| 458 | $helper_ids[] = $api->save_helper( $helper_params ); |
|
| 459 | } |
|
| 460 | ||
| 461 | return $helper_ids; |
|
| 462 | } |
|
| 463 | ||
| @@ 467-489 (lines=23) @@ | ||
| 464 | /** |
|
| 465 | * @return array |
|
| 466 | */ |
|
| 467 | function pods_2_alpha_migrate_pages() { |
|
| 468 | ||
| 469 | $api = pods_api(); |
|
| 470 | ||
| 471 | $page_rows = pods_query( "SELECT * FROM `@wp_pods_objects` WHERE `type` = 'page'", false ); |
|
| 472 | ||
| 473 | $page_ids = array(); |
|
| 474 | ||
| 475 | if ( empty( $page_rows ) ) { |
|
| 476 | return $page_ids; |
|
| 477 | } |
|
| 478 | ||
| 479 | foreach ( $page_rows as $row ) { |
|
| 480 | $opts = json_decode( $row->options ); |
|
| 481 | ||
| 482 | $page_params = array( |
|
| 483 | 'uri' => $row->name, |
|
| 484 | 'phpcode' => $opts->phpcode, |
|
| 485 | ); |
|
| 486 | ||
| 487 | $page_ids[] = $api->save_page( $page_params ); |
|
| 488 | } |
|
| 489 | ||
| 490 | return $page_ids; |
|
| 491 | } |
|
| 492 | ||
| @@ 496-518 (lines=23) @@ | ||
| 493 | /** |
|
| 494 | * @return array |
|
| 495 | */ |
|
| 496 | function pods_2_alpha_migrate_templates() { |
|
| 497 | ||
| 498 | $api = pods_api(); |
|
| 499 | ||
| 500 | $tpl_rows = pods_query( "SELECT * FROM `@wp_pods_objects` WHERE `type` = 'template'", false ); |
|
| 501 | ||
| 502 | $tpl_ids = array(); |
|
| 503 | ||
| 504 | if ( empty( $tpl_rows ) ) { |
|
| 505 | return $tpl_ids; |
|
| 506 | } |
|
| 507 | ||
| 508 | foreach ( $tpl_rows as $row ) { |
|
| 509 | $opts = json_decode( $row->options ); |
|
| 510 | ||
| 511 | $tpl_params = array( |
|
| 512 | 'name' => $row->name, |
|
| 513 | 'code' => $opts->code, |
|
| 514 | ); |
|
| 515 | ||
| 516 | $tpl_ids[] = $api->save_template( $tpl_params ); |
|
| 517 | } |
|
| 518 | ||
| 519 | return $tpl_ids; |
|
| 520 | } |
|
| 521 | ||