WordPress.org

Plugin Directory

Changeset 806946


Ignore:
Timestamp:
11/19/13 17:49:05 (5 months ago)
Author:
donncha
Message:
  • Make the super admin settings page better by making remote login checkbox active depending on admin redirect checkbox.
  • Add option to map siteurl and home in wp-admin/ - will be the default from release after next.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wordpress-mu-domain-mapping/trunk/domain_mapping.php

    r775577 r806946  
    296296            update_site_option( 'dm_user_settings', isset( $_POST[ 'dm_user_settings' ] ) ? intval( $_POST[ 'dm_user_settings' ] ) : 0 ); 
    297297            update_site_option( 'dm_no_primary_domain', isset( $_POST[ 'dm_no_primary_domain' ] ) ? intval( $_POST[ 'dm_no_primary_domain' ] ) : 0 ); 
     298            update_site_option( 'dm_map_in_admin', isset( $_POST[ 'dm_map_in_admin' ] ) ? intval( $_POST[ 'dm_map_in_admin' ] ) : 0 ); 
    298299        } 
    299300    } 
     
    315316 
    316317    echo "<h3>" . __( 'Domain Options', 'wordpress-mu-domain-mapping' ) . "</h3>"; 
    317     echo "<ol><li><input type='checkbox' name='dm_remote_login' value='1' "; 
     318    echo "<ol><li><input type='checkbox' name='always_redirect_admin' value='1' id='redirect_admin' "; 
     319    echo get_site_option( 'dm_redirect_admin' ) == 1 ? "checked='checked'" : ""; 
     320    echo " /> " . __( "Redirect administration pages to site's original domain (remote login disabled if this redirect is disabled)", 'wordpress-mu-domain-mapping' ) . "</li>"; 
     321    echo "<ul><li><input type='checkbox' name='dm_remote_login' value='1' class='redirect_admin' "; 
     322    if ( get_site_option( 'dm_redirect_admin' ) != 1 ) 
     323        echo "disabled='1'"; 
    318324    echo get_site_option( 'dm_remote_login' ) == 1 ? "checked='checked'" : ""; 
    319325    echo " /> " . __( 'Remote Login', 'wordpress-mu-domain-mapping' ) . "</li>"; 
     326    echo "<li><input type='checkbox' name='dm_map_in_admin' value='1' class='redirect_admin' "; 
     327    echo get_site_option( 'dm_map_in_admin' ) == 1 ? "checked='checked'" : ""; 
     328    if ( get_site_option( 'dm_redirect_admin' ) != 1 ) 
     329        echo "disabled='1'"; 
     330    echo " /> " . __( 'Map links in /wp-admin/. get_permalink() et al will use the domain mapped URL.', 'wordpress-mu-domain-mapping' ) . "</li></ul>"; 
    320331    echo "<li><input type='checkbox' name='permanent_redirect' value='1' "; 
    321332    echo get_site_option( 'dm_301_redirect' ) == 1 ? "checked='checked'" : ""; 
     
    323334    echo "<li><input type='checkbox' name='dm_user_settings' value='1' "; 
    324335    echo get_site_option( 'dm_user_settings' ) == 1 ? "checked='checked'" : ""; 
    325     echo " /> " . __( 'User domain mapping page', 'wordpress-mu-domain-mapping' ) . "</li> "; 
    326     echo "<li><input type='checkbox' name='always_redirect_admin' value='1' "; 
    327     echo get_site_option( 'dm_redirect_admin' ) == 1 ? "checked='checked'" : ""; 
    328     echo " /> " . __( "Redirect administration pages to site's original domain (remote login disabled if this redirect is disabled)", 'wordpress-mu-domain-mapping' ) . "</li>"; 
     336    echo " /> " . __( 'User domain mapping page. (Individual blogs can set their own domain)', 'wordpress-mu-domain-mapping' ) . "</li> "; 
    329337    echo "<li><input type='checkbox' name='dm_no_primary_domain' value='1' "; 
    330338    echo get_site_option( 'dm_no_primary_domain' ) == 1 ? "checked='checked'" : ""; 
     
    333341    echo "<p><input class='button-primary' type='submit' value='" . __( "Save", 'wordpress-mu-domain-mapping' ) . "' /></p>"; 
    334342    echo "</form><br />"; 
     343?> 
     344    <script type='text/javascript'> 
     345    jQuery(function() { 
     346        jQuery("#redirect_admin").click(enable_cb); 
     347    }); 
     348 
     349    function enable_cb() { 
     350        if (this.checked) { 
     351            jQuery("input.redirect_admin").removeAttr("disabled"); 
     352        } else { 
     353            jQuery("input.redirect_admin").attr("disabled", true); 
     354        } 
     355    } 
     356    </script> 
     357<?php 
    335358} 
    336359 
     
    558581    static $orig_urls = array(); 
    559582    if ( ! isset( $orig_urls[ $id ] ) ) { 
    560         if ( defined( 'DOMAIN_MAPPING' ) )  
     583        //if ( defined( 'DOMAIN_MAPPING' ) )  
    561584            remove_filter( 'pre_option_' . $url, 'domain_mapping_' . $url ); 
    562585        if ( $blog_id == 0 ) { 
     
    575598            $orig_urls[ $blog_id ] = $orig_url; 
    576599        } 
    577         if ( defined( 'DOMAIN_MAPPING' ) )  
     600        //if ( defined( 'DOMAIN_MAPPING' ) )  
    578601            add_filter( 'pre_option_' . $url, 'domain_mapping_' . $url ); 
    579602    } 
     
    649672} 
    650673 
     674if ( 1 == get_site_option( 'dm_map_in_admin' ) ) { 
     675    add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' ); 
     676    add_filter( 'pre_option_home', 'domain_mapping_siteurl' ); 
     677} 
     678 
    651679if ( defined( 'DOMAIN_MAPPING' ) ) { 
    652680    add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 ); 
    653681    add_filter( 'theme_root_uri', 'domain_mapping_themes_uri', 1 ); 
    654     add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' ); 
    655     add_filter( 'pre_option_home', 'domain_mapping_siteurl' ); 
    656682    add_filter( 'the_content', 'domain_mapping_post_content' ); 
    657683    add_action( 'wp_head', 'remote_login_js_loader' ); 
Note: See TracChangeset for help on using the changeset viewer.