Plugin Directory

Changeset 365888


Ignore:
Timestamp:
03/28/2011 04:26:14 PM (15 years ago)
Author:
jaredh123
Message:

add func to import p3 menus into new schema

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prophoto-beta-tester/trunk/pp-beta-tester.php

    r351153 r365888  
    55    Description: Facilitates beta-testing for future releases of the ProPhoto theme
    66    Author: Jared Henderson
    7     Version: 0.02
     7    Version: 0.03
    88    Author URI: http://www.prophotoblogs.com/beta-testing-plugin/
    99 */
     
    2424        }
    2525       
     26        add_action( 'post_pp_loaded', array( &$this, 'importP3Menu' ) );
    2627        add_action( 'post_pp_loaded', array( &$this, 'updateSeoTerms' ) );
     28    }
     29   
     30   
     31    function importP3Menu() {
     32        if ( pp::site()->svn > 280 ) {
     33            return;
     34        }
     35       
     36        if ( ppOpt::test( 'p3_menu_imported', 'yes_imported' ) ) {
     37            return;
     38        }
     39       
     40        $conf = ppUtil::loadConfig( 'options' );
     41        if ( ppOpt::id( 'main_menu_structure' ) != $conf['main_menu_structure'] && is_array( json_decode( ppOpt::id( 'main_menu_structure' ) ) ) ) {
     42            return;
     43        }
     44        if ( pp::site()->svn < 264 ) {
     45            return;
     46        }
     47       
     48       
     49        if ( is_admin() ) {
     50            if ( NrUtil::GET( 'page', 'p4-customize' ) && NrUtil::GET( 'pp_tab', 'menu' ) ) {
     51                // run the import in admin only if on the menu page
     52            } else {
     53                return;
     54            }
     55        }
     56       
     57        $design = array( 'options' => ppActiveDesign::options(), 'images' => ppActiveDesign::imgs() );
     58        $contactText = ppOpt::id( 'contactform_link_text' ) ? ppOpt::id( 'contactform_link_text' ) : 'Contact';
     59       
     60        $imported = ppImportP3Menu::importMenu( $design, $contactText );
     61        $imported['options']['p3_menu_imported'] = 'yes_imported';
     62        ppOpt::updateMultiple( $imported['options'] );
     63        ppOpt::updateMultiple( $imported['images'] );
     64       
     65        foreach ( ppImportP3Menu::eliminatedOptions() as $eliminatedOptionID ) {
     66            ppOpt::delete( $eliminatedOptionID );
     67        }
    2768    }
    2869   
Note: See TracChangeset for help on using the changeset viewer.