Plugin Directory

Changeset 369298


Ignore:
Timestamp:
04/06/2011 12:36:14 AM (15 years ago)
Author:
jaredh123
Message:

accommodate new menu splitting paradigm, import from old method

File:
1 edited

Legend:

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

    r367960 r369298  
    55    Description: Facilitates beta-testing for future releases of the ProPhoto theme
    66    Author: Jared Henderson
    7     Version: 0.05
     7    Version: 0.06
    88    Author URI: http://www.prophotoblogs.com/beta-testing-plugin/
    99 */
     
    2626        add_action( 'post_pp_loaded', array( &$this, 'importP3Menu' ) );
    2727        add_action( 'post_pp_loaded', array( &$this, 'updateSeoTerms' ) );
     28        add_action( 'post_pp_loaded', array( &$this, 'fixMenuSplittage' ) );
     29    }
     30   
     31   
     32    function fixMenuSplittage() {
     33       
     34        if ( pp::site()->svn > 295 ) {
     35            ppOpt::delete( 'p3_menu_imported' );
     36            return;
     37        }
     38       
     39        // .foo { margin:0 } nav #toplevel #main_menu_link_17 { float:right; margin-right:0 }
     40        if ( !ppOpt::test( 'menu_align_beta_fixed' ) && pp::site()->svn < 285 ) {
     41
     42            if ( ppOpt::test( 'headerlayout', 'pptclassic' ) ) {
     43                ppOpt::update( 'nav_align', 'left' );
     44            }
     45           
     46            if ( ppOpt::test( 'nav_align', 'center || right' ) ) {
     47                return;
     48            }
     49           
     50            $css = ppOpt::id( 'override_css' );
     51           
     52            if ( preg_match( '/nav #toplevel #main_menu_([^ ]*) { float:right; margin-right:0 }/', $css, $match ) ) {
     53                $searchID = 'main_menu_' . $match[1];
     54                NrDump::it( $match );
     55                NrDump::it( $css );
     56                NrDump::it( $searchID );
     57                NrDump::it( str_replace( $match[0], '', $css ) );
     58               
     59                $menuItems = json_decode( ppOpt::id( 'main_menu_structure' ), true );
     60                $lastID = null;
     61                foreach ( $menuItems as $ID => $ignore ) {
     62                    if ( $ID == $searchID ) {
     63                        NrDump::it( 'set split_id to ' . $lastID );
     64                        ppOpt::update( 'nav_split_after_id', $lastID );
     65                    }
     66                    $lastID = $ID;
     67                }
     68                ppOpt::update( 'override_css', str_replace( $match[0], '', $css ) );
     69                ppOpt::update( 'menu_align_beta_fixed', 'true' );
     70                ppOpt::update( 'nav_align', 'split' );
     71            }
     72        }
    2873    }
    2974   
    3075   
    3176    function importP3Menu() {
    32         if ( pp::site()->svn > 280 ) {
     77        if ( pp::site()->svn > 290 ) {
     78            ppOpt::delete( 'p3_menu_imported' );
    3379            return;
    3480        }
     
    58104        $contactText = ppOpt::id( 'contactform_link_text' ) ? ppOpt::id( 'contactform_link_text' ) : 'Contact';
    59105       
     106        if ( method_exists( 'ppUtil', 'logVar' ) ) {
     107            ppUtil::logVar( 'importing menu from beta testing plugin', 'importing menu from beta plugin' );
     108        }
    60109        $imported = ppImportP3Menu::importMenu( $design, $contactText );
    61110        $imported['options']['p3_menu_imported'] = 'yes_imported';
Note: See TracChangeset for help on using the changeset viewer.