コード例 #1
0
ファイル: masterpress.php プロジェクト: verbazend/AWFA
  public static function inline_scripts() {

    ?>
    <script type="text/javascript">
    
    jQuery("html").addClass(jQuery.client.os).addClass(jQuery.client.browser);

    var mp_wp_upload_url = '<?php echo esc_url( get_upload_iframe_src("media") ) ?>';
    var mp_wp_media_library_url = '<?php echo esc_url( str_replace("TB_iframe", "mp-media-library=1&TB_iframe", get_upload_iframe_src("media")) ) ?>';
    var mp_ajax_url = '<?php echo get_admin_url() ?>admin-ajax.php', mp_controller = '<?php echo MasterPress::$controller_key ?>', mp_action = '<?php echo MasterPress::$action ?>', mp_nonce = "<?php echo esc_js( wp_create_nonce( 'mp-ajax-nonce' ) ); ?>";
    
    jQuery.mp.lang['confirm_go'] = '<?php echo esc_js( __("There are unsaved changes which will be lost if you manage this item now. Are you sure you wish to navigate away from this page?", MASTERPRESS_DOMAIN) ) ?>';
    
    
    jQuery(document).ready( function($) {
      // update the first menu item to "Masterplan"
      $('#toplevel_page_masterpress .wp-submenu-wrap a[href$=masterpress]').html('<span class="mpv-options-menu mpv-options-menu-overview"><?php echo __("Masterplan", MASTERPRESS_DOMAIN); ?></span>');
    });
    
    </script>

    <script id="mp-field-label-tooltip-template" type="text/html">
    <div class="mptt">
    <div class="mptt-bubble">
    <div class="nub"></div>
    <div class="nub-border"></div>
    <div class="mptt-text">
    {{text}}
    </div>
    </div>
    </div>
    </script>



    <?php if (self::is_media_library()) : ?>
    
    <style type="text/css">

    /* Add styles for a simple "read-only" mode for the media library. It's very difficult to patch the ML to insert correctly into the field from all tabs */

    tr.align, 
    tr.url, 
    tr.post_content, 
    tr.post_excerpt, 
    tr.image_alt, 
    tr.image-size, 
    tr.post_title, 
    .media-item-info input.button, 
    .media-item-info img.imgedit-wait-spin, 
    .del-link, 
    li#tab-gallery, 
    #media-upload-header {
      display: none !important;
    }    
    
    .button-select {
      margin-left: 10px;
    }
    
    </style>
    
    <script>

      jQuery(function($) { 
        
        // make sure the search form retains the "MasterPress-mode"
        $('#filter').append('<input type="hidden" name="mp-media-library" value="1" />');
        
        $('.del-link').each(function() {
          var $button = $('<button type="button" class="button button-select"><?php echo __("Select", MASTERPRESS_DOMAIN) ?></a>');
          $(this).before($button);
          $(this).parent().find("input:submit").remove();  
          
          $button.click( function() {
            var $media_item = $(this).closest(".media-item");
            var id = $media_item.attr("id").replace("media-item-", "");
            
            window.parent.mp_media_library_set_field(id);
            window.parent.tb_remove();
            
            return false;                        
          });
          
        });

      });

    </script>
      
    <?php endif; 
  
    if (self::is_post_editor()) { 
      MPC_Post::inline_head();  
    }    

    if (self::is_user_editor()) { 
      MPC_User::inline_head();  
    }    

    if (self::is_term_editor() || self::is_term_manage()) { 
      MPC::incl("term");
      MPC_Term::inline_head();  
    }    

    if (self::is_site_content_editor()) { 
      MPC_SiteContent::inline_head();  
    }    


    ?>
    
    <?php
  }
コード例 #2
0
ファイル: mpc-post.php プロジェクト: verbazend/AWFA
  public static function manage_post_type() {
    
    $post_type = "post";
    
    if (!isset(self::$manage_post_type)) {
      if (isset($_GET["post_type"])) {
        $post_type = $_GET["post_type"];
      }

      self::$manage_post_type = MPM_PostType::find_by_name($post_type);

    }
    
    return self::$manage_post_type;
    
  }