コード例 #1
0
ファイル: mpm-field-set.php プロジェクト: verbazend/AWFA
  public function manage_url() {
    
    $url = "";
    
    switch ($this->type) {
      
      case "p" : // Post type
        $pt = MPM_PostType::find_by_name($this->vis("post_types"));

        if (!$pt) {
          return '';
        }

        $url = MasterPress::admin_url("post-types", "manage-field-sets", array("parent" => $pt->id) )."&from=edit-field-set";
        break;

      case "t" : // Template
        $url = MasterPress::admin_url("templates", "manage-field-sets", array("parent" => $this->vis("templates")) )."&from=edit-field-set";
        break;

      case "x" : // taXonomy
        
        $tax = MPM_Taxonomy::find_by_name($this->vis("taxonomies"));
        
        if (!$tax) {
          return '';
        }

        $url = MasterPress::admin_url("taxonomies", "manage-field-sets", array("parent" => $tax->id) )."&from=edit-field-set";
        break;

      case "s" : // Shared
        $url = MasterPress::admin_url("shared-field-sets", "manage" )."&from=edit";
        break;

      case "r" : // Role
      $url = MasterPress::admin_url("roles", "manage-field-sets", array("parent" => $this->vis("roles")) )."&from=edit-field-set";
        break;

      case "w" : // site-Wide
        $url = MasterPress::admin_url("site-field-sets", "manage" )."&from=edit";
        break;

    } 
    
    $url .= "&show=".$this->id;
    
    return $url;
  }
コード例 #2
0
ファイル: mpc-term.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;
    
  }
コード例 #3
0
ファイル: mpv-post-types.php プロジェクト: verbazend/AWFA
  public function form($type) {
    global $wf, $meow_provider;
    $model = MasterPress::$model;
  ?>

    <?php MPV::messages(); ?>
  
    <input type="hidden" name="_builtin" value="<?php echo $model->_builtin ? "true" : "false" ?>" />
    <input type="hidden" name="_external" value="<?php echo $model->_external ? "true" : "false" ?>" />
    
    <div class="f">
      <label for="name" class="icon"><i class="script-php"></i><?php _e("<strong>Singular</strong> Name", MASTERPRESS_DOMAIN)?>:</label>
      <div class="fw">
        <input id="name_original" name="name_original" type="hidden" class="text mono key" maxlength="20" value="<?php echo $model->name ?>" />
        <input id="name_last" name="name_last" type="hidden" class="text mono key" maxlength="20" value="<?php echo $model->name ?>" />
        <input id="name" name="name" type="text" <?php echo MPV::read_only_attr($model->_builtin || MPC::is_edit()) ?> class="<?php echo MPV::read_only_class($model->_builtin || $model->_external) ?> text mono key" maxlength="20" value="<?php echo $model->name ?>" /><?php if (!$model->_builtin && !$model->_external) { ?><em class="required"><?php _e("(required)", MASTERPRESS_DOMAIN) ?></em><?php } ?>
        <p>
          <?php _e("This is a unique identifier for the custom post type in the WordPress and MasterPress APIs. It is not displayed, and by convention it <strong>must</strong> be a singular form, lowercase string with underscores to separate words.", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
      
      <p id="name_warning" class="warning">
        <i class="error-circle"></i><?php _e("Note: check that you have definitely entered a <strong>singular word</strong> here, as the singular form of <em>Plural Name</em> is currently different to this value.", MASTERPRESS_DOMAIN) ?>
      </p>

    </div>
    <!-- /.f -->
    
    <div class="f">
      <label for="plural_name" class="icon"><i class="script-php"></i><?php _e("<strong>Plural</strong> Name", MASTERPRESS_DOMAIN)?>:</label>
      <div class="fw">
        <input id="plural_name" name="plural_name" <?php echo MPV::read_only_attr($model->_builtin || MPC::is_edit()) ?> type="text" value="<?php echo $model->plural_name ?>" class="<?php echo MPV::read_only_class($model->_builtin || $model->_external) ?> text mono key" />
        <?php if (!$model->_builtin && !$model->_external) { ?><em class="required">(required)</em><?php } ?>
        <?php if (MPC::is_edit() && !$model->_builtin && !$model->_external) : ?>
        <button id="plural_name_suggest" type="button" class="button button-small"><?php _e("Suggest", MASTERPRESS_DOMAIN) ?></button>
        <?php endif; ?>
        <p>
          <?php _e("The plural form of <em>Singular Name</em>, following the same naming conventions", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    
    <div class="f clearfix">
      <label id="label-menu_icon" for="menu_icon" class="icon"><i class="image-small"></i><?php _e("Icon (16 x 16)", MASTERPRESS_DOMAIN) ?>:</label>
      <div class="fw">

        <div id="icon-file-uploader" class="icon-uploader file-uploader { ids: { drop: 'menu_icon_drop_area' }, input: '#menu_icon', inputName: 'menu_icon_ul', base_url: '<?php echo MASTERPRESS_GLOBAL_CONTENT_URL ?>', params: { dir: 'menu-icons/' }, limit: 1, lang: { buttonChoose: '<?php _e("Choose from Computer&hellip;", MASTERPRESS_DOMAIN) ?>', buttonReplace: '<?php _e("Replace file&hellip;", MASTERPRESS_DOMAIN) ?>' } }">
          
          <div id="menu_icon_drop_area" class="drop-area"><?php _e("Drop file here to upload", MASTERPRESS_DOMAIN) ?></div>

          <?php 
          
          $file_name = $model->menu_icon;
          $file_class = "";
          $clear_class = "";
          
          if ($file_name == "") {
            $file_name = __("( None )", MASTERPRESS_DOMAIN);
            $file_class = "name-none";
            $clear_class = "hidden";
          }
          
          ?>
          
          <div class="file">
            <span class="preview" style="background-image: url('<?php echo MPU::menu_icon_url($model->menu_icon, true, "post_type", true) ?>');"></span><span data-none="<?php echo __("( None )", MASTERPRESS_DOMAIN) ?>" class="name <?php echo $file_class ?>"><?php echo $file_name ?></span>
            <button type="button" class="<?php echo $clear_class ?> clear ir" title="<?php _e("Clear", MASTERPRESS_DOMAIN) ?>">Clear</button>
          </div>
          
          <input id="menu_icon" name="menu_icon" value="<?php echo $model->menu_icon ?>" type="hidden" />
          <div class="uploader-ui"></div>
          
        </div>
        <!-- /.file-uploader -->
        
        <?php MPV::icon_select($model->menu_icon, "menu-icon-select", "menu_icon_select", "icon-file-uploader"); ?>
        
      </div>
    </div>
    <!-- /.f -->
    
    <?php if (!$model->_external) : ?>
  
    <div class="f">
      <label for="disabled" class="icon"><i class="slash"></i><?php _e("Disabled", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="disabled" name="disabled" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->disabled ) ?> class="checkbox" />
        <p class="checkbox-alt-label { for_el: '#disabled' }">
          <?php 
          if ($model->_builtin) :
            _e("Since this post type is built-in, disabling it may render some WordPress themes unusable.<br />This is only recommended for sites that are highly customised.", MASTERPRESS_DOMAIN);
          else: 
            _e("disabling a post type will keep its definition in the database but it will not be registered in WordPress, which will often be <strong>preferable to deleting it</strong> entirely.", MASTERPRESS_DOMAIN);
          endif;
          ?>
        </p>
      </div>
    </div>
    <!-- /.f -->
    
    <?php endif; ?>
    
    
    
    <?php if (!$model->_builtin && !$model->_external) : ?>
    
    <div class="f">
      <label for="description" class="icon"><i class="metabox-text"></i><?php _e("Description", MASTERPRESS_DOMAIN)?>:</label>
      <div class="fw">
        <textarea id="description" name="description" rows="4" cols="100"><?php echo $model->description ?></textarea>
      </div>
    </div>
    <!-- /.f -->


    <div class="f">
      <label for="hierarchical" class="icon"><i class="hierarchy"></i><?php _e("Hierarchical", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="hierarchical" name="hierarchical" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->hierarchical ) ?> class="checkbox" />
        <p class="checkbox-alt-label { for_el: '#hierarchical' }">
          <?php _e("hierarchical post types behave like <strong>pages</strong> in WordPress, where each post can have parent and child posts", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

   


    <div class="f">
      <label for="show_ui" class="icon"><i class="metabox-menu"></i><?php _e("Show UI", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_ui" name="show_ui" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_ui ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_ui' }">
          <?php _e("uncheck this to internalize this post type, which will cause many other features to be unsupported", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    <div class="f">
      <label for="show_in_nav_menus" class="icon"><i class="menu-gray"></i><?php _e("Show in Nav Menus", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_in_nav_menus" name="show_in_nav_menus" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_in_nav_menus ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_in_nav_menus' }">
          <?php _e("allow selection of posts of this type in WordPress custom menus", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>
    </div>
    <!-- /.f -->

      
    <div class="f">
      <label for="show_in_menu" class="icon"><i class="menu-icon"></i><?php _e("Show in Admin Menu", MASTERPRESS_DOMAIN) ?>?</label>

      <div class="fw">
        <input id="show_in_menu" name="show_in_menu" type="checkbox" <?php echo WOOF_HTML::checked_attr( $model->show_in_menu ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_in_menu' }">
          <?php _e("show this post type in the WordPress admin menu", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>  
    <!-- /.fw -->
    </div>

    <div class="f">
      <label for="manage_sort_order" class="icon"><i class="sort-a-z"></i><?php _e("Default Manage Order", MASTERPRESS_DOMAIN) ?></label>

      <div class="fw">
        
        <?php
        
        $options = array(
          "post_date|desc" => "Post Date, Descending",
          "title|asc" => "Title, Ascending",
          "menu_order|asc" => "Menu Order, Ascending",
          "post_date|asc" => "Post Date, Ascending",
          "title|desc" => "Title, Descending",
          "menu_order|desc" => "Menu Order, Descending"
        );
        
        ?>
        
        <select id="manage_sort_order" name="manage_sort_order">
        <?php foreach ($options as $value => $text) : ?>
          <option <?php echo WOOF_HTML::selected_attr($value == $model->manage_sort_order) ?> value="<?php echo $value ?>"><?php echo $text ?></option>  
        <?php endforeach; ?>
        </select>
        
        <p class="note">
          <?php _e("Specify the default sort order in the manage post screen (for when the user hasn't yet clicked on a table header to manually sort). For chronological types (such as blog posts) a descending date order is appropriate, but for other post types a title or menu order (user-defined) sort might be better.", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>  
    <!-- /.fw -->
    </div>
    
    <?php endif; ?>

    
    
    <?php
    
    if (is_multisite() && MASTERPRESS_MULTISITE_SHARING) {
    
      $args["supports"] = array("multisite");
      
      $args["labels"] = array(
        "title" =>  __("control the visibility of this Post Type within WordPress", MASTERPRESS_DOMAIN),   
        "title_multisite" =>  __("specify the sites in the multisite network that this Post Type is available in", MASTERPRESS_DOMAIN),   
        "multisite_all" => __( "All Sites" )
      );

      MPV::fs_visibility( $model, $args ); 
    
    }
    
    ?>

    
    <?php if (!$model->_external) : ?>

    <div class="fs fs-taxonomies">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="tags"></i><strong><?php _e("Taxonomies", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("attach taxonomies to this post type", MASTERPRESS_DOMAIN) ?></h3>
        <div class="buttons">
          <button class="button button-small button-select-all" type="button"><?php _e('Select <strong class="all">All</strong>', MASTERPRESS_DOMAIN)  ?></button>
          <button class="button button-small button-select-none" type="button"><?php _e('Select <strong class="none">None</strong>', MASTERPRESS_DOMAIN) ?></button>
        </div>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
        
        <?php $taxonomies = MPM_Taxonomy::find(array("orderby" => "name ASC")); ?>
        
        <?php foreach ($taxonomies as $tax) : $disabled = $tax->disabled ? ' disabled' : ''; $disabled_title = $tax->disabled ? __("This taxonomy is disabled", MASTERPRESS_DOMAIN) : ''; $builtin = $tax->_builtin ? '&nbsp;'.__('(Built-in)', MASTERPRESS_DOMAIN) : ''; ?>
          
        <?php if ($tax->still_registered()) : ?>
          
        <div class="fw">
          <input id="taxonomies_<?php echo $tax->name ?>" data-builtin="<?php echo $tax->_builtin ?>" data-title="<?php echo $tax->display_label() ?>" name="taxonomies[]" value="<?php echo $tax->name ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $tax->linked_to_post_type($model) || MPV::in_post_array("taxonomies", $tax->name) ) ?> class="checkbox" />
          <label for="taxonomies_<?php echo $tax->name ?>" class="checkbox <?php echo $disabled ?>" title="<?php echo $disabled_title ?>"><?php echo $tax->labels["name"] ?><span><?php echo $builtin ?></span></label>
        </div>
        <!-- /.fw -->
        
        <?php endif; ?>
      
        <?php endforeach; ?>
        
        
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <div class="fs fs-supports">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="gear"></i><strong><?php _e("Supports", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("controls the user interface for creating and editing posts of this type", MASTERPRESS_DOMAIN) ?></h3>
        <div class="buttons">
          <button class="button button-small button-select-all" type="button"><?php _e('Select <strong class="all">All</strong>', MASTERPRESS_DOMAIN) ?></button>
          <button class="button button-small button-select-none" type="button"><?php _e('Select <strong class="none">None</strong>', MASTERPRESS_DOMAIN) ?></button>
        </div>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
        
        <input id="supports_pb" name="supports_pb" type="hidden" value="true" />
        
        <div id="fs-supports-1">
          
					<?php
						
					$title_disabled = !($model->_builtin || $model->_external);
					$title_title = "";
					
					$title_suffix = "";
					
					if ($title_disabled) {
						$title_title = ' title="'.__("The title feature must be enabled", MASTERPRESS_DOMAIN).'" ';
					}

					
					$dis = WOOF_HTML::disabled_attr($title_disabled);
					
					if (!($model->_builtin || $model->_external)) {
						$checked = WOOF_HTML::checked_attr( true );
					} else {
						$checked = WOOF_HTML::checked_attr( MPV::in_csv("title", $model->supports) );
					}
					
					?>

          <div class="fw">
            <input id="supports_title" name="supports[]" value="title" <?php echo $dis ?> <?php echo $title_title ?> <?php echo $checked ?> type="checkbox" class="checkbox { tags: ['title'] }" />
						
						<?php if ($title_disabled) : ?> 
	          <input id="supports_title_val" name="supports[]" value="title" type="hidden" />
						<?php endif; ?>
							 
            <label for="supports_title" class="checkbox"><?php _e("Title", MASTERPRESS_DOMAIN); ?><span> - <?php _e("show a text input to edit the post title", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_editor" name="supports[]" value="editor" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("editor", $model->supports) ) ?> type="checkbox" class="checkbox { tags: ['auto_excerpt'] }" />
            <label for="supports_editor" class="checkbox"><?php _e("Editor", MASTERPRESS_DOMAIN); ?><span> - <?php _e("show the main content box", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_comments" name="supports[]" value="comments" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("comments", $model->supports) ) ?> type="checkbox" class="checkbox { tags: ['comment_count'] }" />
            <label for="supports_comments" class="checkbox"><?php _e("Comments", MASTERPRESS_DOMAIN); ?><span> - <?php _e("the <em>ability</em> to allow / disallow comments on posts of this type", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_trackbacks" name="supports[]" value="trackbacks" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("trackbacks", $model->supports) ) ?> type="checkbox" class="checkbox { tags: ['trackback_count'] }" />
            <label for="supports_trackbacks" class="checkbox"><?php _e("Trackbacks", MASTERPRESS_DOMAIN); ?><span> - <?php _e("the <em>ability</em> to allow / disallow trackbacks to posts of this type", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_post_formats" name="supports[]" value="post-formats" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("post-formats", $model->supports)) ?> type="checkbox" class="checkbox { tags: ['post_format'] }" />
            <label for="supports_post_formats" class="checkbox"><?php _e("Post Formats", MASTERPRESS_DOMAIN); ?><span> - <?php _e("used by themes to change the display of posts of this type", MASTERPRESS_DOMAIN); ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_front_page" name="supports[]" value="front-page" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("front-page", $model->supports)) ?> type="checkbox" class="checkbox { tags: ['front_page'] }" />
            <label for="supports_front_page" class="checkbox"><?php _e("Front Page", MASTERPRESS_DOMAIN); ?><span> - <?php _e("allow posts of this type to be selected as the front page", MASTERPRESS_DOMAIN); ?></span></label>
          </div>
          <!-- /.fw -->
          
        </div>
        <!-- /.fs-supports-1 -->


        <div id="fs-supports-2">

          <div class="fw">
            <input id="supports_revisions" name="supports[]" value="revisions" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("revisions", $model->supports)) ?> type="checkbox" class="checkbox" />
            <label for="supports_revisions" class="checkbox"><?php _e("Revisions", MASTERPRESS_DOMAIN); ?><span> - <?php _e("allow revisions for posts of this type", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_author" name="supports[]" value="author" type="checkbox" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("author", $model->supports)) ?> class="checkbox" />
            <label for="supports_author" class="checkbox"><?php _e("Author", MASTERPRESS_DOMAIN); ?><span> - <?php _e("show a select box for changing the author", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_excerpt" name="supports[]" value="excerpt" type="checkbox" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("excerpt", $model->supports)) ?> class="checkbox { tags: ['excerpt'] }" />
            <label for="supports_excerpt" class="checkbox"><?php _e("Excerpt", MASTERPRESS_DOMAIN); ?><span> - <?php _e("show a text area for writing a custom excerpt", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_page_attributes" name="supports[]" value="page-attributes" type="checkbox" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("page-attributes", $model->supports) ) ?> class="checkbox" />
            <label for="supports_page_attributes" class="checkbox"><?php _e("Type Attributes", MASTERPRESS_DOMAIN); ?><span> - <?php _e("Show the UI for editing Template, Menu Order and Parent", MASTERPRESS_DOMAIN); ?></span></label>
          </div>
          <!-- /.fw -->

          <div class="fw">
            <input id="supports_thumbnail" name="supports[]" value="thumbnail" type="checkbox" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("thumbnail", $model->supports) ) ?> class="checkbox { tags: ['thumbnail'] }" />
            <label for="supports_thumbnail" class="checkbox"><?php _e("Thumbnail", MASTERPRESS_DOMAIN); ?><span> - <?php _e("show the <em>standard</em> thumbnail upload for posts of this type", MASTERPRESS_DOMAIN) ?></span></label>
          </div>
          <!-- /.fw -->

          
        </div>
        <!-- /.fs-supports-2 -->

      
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <?php else : ?>
    
    
    
    <?php endif; ?>
  
    <script id="custom-column-template" type="text/html">
    <li class="column clearfix">
      <div class="head">
        <input name="columns[{{index}}][title]" value="Column" type="text" class="text" />
        <input name="columns[{{index}}][disabled]" value="" type="hidden" class="disabled" />
        <span class="handle"></span>
      </div>
  
      <div class="body">
        <textarea name="columns[{{index}}][content]" class="column-content mono editable"></textarea>
      </div>
      
      <div class="foot">
      <div>
        <button class="text remove"><i></i><?php _e("Remove") ?></button>
      </div>
      </div>

    </li>
    
    </script>
    
    <script id="tax-add-button-template" type="text/html">

    <div class="control taxonomy-control {{taxonomy}}">
      <button data-taxonomy="{{taxonomy}}" data-title="{{title}}" type="button" class="text add taxonomy taxonomy-{{taxonomy}}"><?php printf( __('<em class="create">Add</em> <b>%s</b> Column', MASTERPRESS_DOMAIN ), "{{title}}" ) ?></button>
    </div>
    
    </script>
    
    
    <?php if ($model->show_ui) : ?>
      
    <div class="fs fs-column-builder clearfix">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="grid"></i><strong><?php _e("Columns") ?></strong> - <?php _e("specify the columns shown in the manage listing for posts of this type") ?></h3>
      </div>
      </div>
    
      <div class="fsc clearfix">
      <div class="fscb clearfix">

        
        <div class="columns-clip">
        
        <div class="columns-wrap clearfix">
        
        <ul class="columns clearfix">
        
          <?php 
          
          $count = 0; 
          $core_enabled = array(); 
          
          ?>
          
          <?php foreach ($model->columns() as $column) : ?>
          <?php
            
            $class = array("column clearfix");
            
            $disabled = "";
            
            $core = "";
            $title = isset($column["title"]) ? $column["title"] : "";
            $content = "";
            
            if (isset($column["content"])) {
              $content = stripslashes($column["content"]);
            }
            
            if (isset($column["core"])) {
              $core = $column["core"];
              $content = "{{col.".$core."}}";
            }
            
            if (isset($column["disabled"])) {
              $disabled = $column["disabled"];
            }
            
            if ($core != "") {
              $class[] = "core";
              $class[] = $core;
              
              $data_core = ' data-core="'.$core.'" ';
            }
            
            if ($core == "cb") {
              $class[] = "checkbox nosort";
            } 
            
            if ($disabled == "yes") {
              $class[] = "disabled";
            } else {
              if ($core != "") {
                $core_enabled[] = $core;
              }
            }
            
            
          
          ?>
          
          
          <li <?php echo $data_core ?> class="<?php echo implode(" ", $class) ?>">
            <div class="head">
              <?php if ($core == "cb") : ?>
              <input type="checkbox" />
              <input name="columns[<?php echo $count ?>][core]" value="cb" type="hidden" />
              <?php else: ?>
                
                <?php if ($core == "comments") : ?>
                <span class="icon"></span>
                <input name="columns[<?php echo $count ?>][title]" value="<?php echo $title ?>" type="text" class="text hidden" />
                <?php else: ?>
                <input name="columns[<?php echo $count ?>][title]" value="<?php echo $title ?>" type="text" class="text" />
                <?php endif; ?>
              
                <?php if ($core != "") : ?>
                <input name="columns[<?php echo $count ?>][core]" value="<?php echo $core ?>" type="hidden" />
                <?php endif; ?>
                
                <input name="columns[<?php echo $count ?>][disabled]" value="<?php echo $disabled ?>" type="hidden" class="disabled" />
                <span class="handle"></span>
  
              <?php endif; ?>
            </div>
            <!-- /.head -->

            <div class="body clearfix">
              <?php if ($core == "cb") : ?>
              <input type="checkbox" />
              <?php else: ?>
                
                <?php if ($core == "comments") : ?>
                <span class="icon"></span>
                <textarea name="columns[<?php echo $count ?>][content]" readonly="true" class="content mono readonly hidden"></textarea>
                <?php elseif ($core != "") : ?>
                <textarea name="columns[<?php echo $count ?>][content]" title="<?php _e("Content cannot be changed as this is a built-in column") ?>" readonly="true" class="content mono readonly"><?php echo $content ?></textarea>
                <?php else : ?>
                <textarea name="columns[<?php echo $count ?>][content]" class="content mono editable" style="z-index: <?php echo 200 - $count ?>"><?php echo $content ?></textarea>
                <?php endif; ?>
              
              <?php endif; ?>
            </div>
            
            <div class="foot">
            <div>
              <?php if ($core != "cb" && $core != "title") : ?>
              <button type="button" class="text remove"><i></i><?php _e("Remove") ?></button>
              <?php endif; ?>
            </div>
            </div>

          </li>
          
          <?php $count++; ?>

          <?php endforeach; ?>

        </ul>
      
        </div>
        <!-- /.columns-wrap -->

        <div class="core-columns">
          <div class="f">
            <p class="label"><i class="wall"></i><?php _e("Built-in columns:", MASTERPRESS_DOMAIN) ?></p>
            
            <?php
              
              $core_columns = array(
                "Author" => "author",
                "Categories" => "categories",
                "Tags" => "tags",
                "Comments" => "comments",
                "Date" => "date"
              );
                
            ?>
            
            <?php foreach ($core_columns as $label => $key) : ?>
              
            <?php
          
            $checked_attr = WOOF_HTML::checked_attr(in_array($key, $core_enabled)); 
            $style = "";
            
            $supports = explode(",", $model->supports);
            
            if ($key == "categories" && !$model->linked_to_taxonomy_name("category")) {
              $style = 'style="display: none" ';
            } else if ($key == "tags" && !$model->linked_to_taxonomy_name("post_tag")) {
              $style = 'style="display: none" ';
            } else if ($key == "author" && !in_array("author", $supports)) {
              $style = 'style="display: none" ';
            } else if ($key == "comments" && !in_array("comments", $supports)) {
              $style = 'style="display: none" ';
            }
            
            
            ?>
              
            <div <?php echo $style ?> id="fw-core-column-<?php echo $key ?>" class="fw">
              
              <input id="core-column-<?php echo $key ?>" <?php echo $checked_attr ?> value="<?php echo $key ?>" type="checkbox" class="checkbox" />
              <label for="core-column-<?php echo $key ?>" class="checkbox"><?php echo $label ?></label>
              
            </div>
            <!-- /.fw -->
            
            <?php endforeach; ?>
          
          </div>
        
        </div>
        <!-- /.core-columns -->
        
        <?php if (MPC::is_edit()) : ?>

        <style type="text/css">
        <?php foreach (MPFT::type_keys() as $key) : ?>
        .select2-results .field-type-<?php echo $key ?>, .select2-container .field-type-<?php echo $key ?> { background-repeat: no-repeat; background-image: url(<?php echo MPU::type_icon_url($key) ?>); }
        <?php endforeach; ?>
        </style>

          
        <div id="dialog-fields" data-title="<?php _e("Select a Field to Display in the Column", MASTERPRESS_DOMAIN) ?>">
          <?php
          
          $fs = $meow_provider->post_type_field_sets($model->name);

          $field_options = array();
          $field_options[""] = "";

          $field_options_attr = array("");
          
          foreach ($fs as $set) {
            
            $fo = array();
            $fo_attr = array();
            
            foreach ($set->fields() as $field) {
              $fo[$field->display_label()] = $set->name.".".$field->name;
              $fo_attr[] = $field_options_attr[] = array("data-icon" => "mp-icon field-type-".$field->type);
            }

            $field_options[$set->display_label()] = array("options" => $fo, "options_attr" => $fo_attr);
          } 
                    
          echo WOOF_HTML::select(array("id" => "add-field-column-field-sets", "name" => "add-field-column-field-sets", "class" => "with-icons select2-source", "data-placeholder" => __("-- Select a Field --", MASTERPRESS_DOMAIN)), $field_options, "", $field_options_attr);

          ?>
        </div>
        <!-- /#dialog-fields -->
        
        <?php endif; ?>
        
        <div class="custom-columns">
          <?php if (MPC::is_edit() && count($field_options) > 1) : ?>
          
          <div class="control">
            <button id="add-field-column" type="button" class="text add field"><i></i><?php _e('<em class="create">Add</em> <b>Field</b> Column', MASTERPRESS_DOMAIN) ?></button>
          </div>

          <?php endif; ?>

          <div class="control">
            <button id="add-custom-column" type="button" class="text add"><i></i><?php _e('<em class="create">Add</em> <b>Custom</b> Column', MASTERPRESS_DOMAIN) ?></button>
          </div>
          
          <?php
          
          $taxonomies = $model->taxonomies();            
             
          ?>
          
          <?php foreach ($model->taxonomies() as $tax) : ?>
          <div class="control taxonomy-control <?php echo $tax->name ?>">
            <button data-taxonomy="<?php echo $tax->name ?>" data-title="<?php echo $tax->display_label() ?>" type="button" class="text add taxonomy taxonomy-<?php echo $tax->name ?>"><i></i><?php printf( __('<em class="create">Add</em> <b>%s</b> Column', MASTERPRESS_DOMAIN ), $tax->display_label() ) ?></button>
          </div>
          <?php endforeach; ?>
          
        </div>
        <!-- /.custom-columns -->
        
        </div>
        <!-- /.columns-clip -->

      </div>
      </div>

    </div>
    <!-- /.fs -->
      
    <?php endif; ?>
    
    <?php if (!$model->_builtin && !$model->_external) : ?>
      
    <div class="fs fs-menu-options clearfix">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="menu-icon"></i><strong><?php _e("Admin Menu", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("controls where your post type appears in the WordPress administration menu", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
  
      <div class="fsc clearfix">
      <div class="fscb clearfix">
        
        
        <div class="f clearfix">
          <label for="menu_position" class="label-sortable-list"><?php _e("Position", MASTERPRESS_DOMAIN) ?>:</label>
          <div class="fw">
            
            <?php 
              // Build a menu, which we'll co-populate with info from the post types and then sort by menu position and sub position
              
              $post_post_type = MPM_PostType::find_by_name("post");
              $page_post_type = MPM_PostType::find_by_name("page");
              
              $menus = array(
                array( "label" => __("Posts", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-post", "disabled" => ( (bool) $post_post_type->disabled ), "built_in" => true, "position" => 5, "sub_position" => 0 ),
                array( "label" => __("Media", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-media", "built_in" => true, "position" => 10, "sub_position" => 0 ),
                array( "label" => __("Links", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-links", "built_in" => true, "position" => 15, "sub_position" => 0 ),
                array( "label" => __("Pages", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-page", "disabled" => ( (bool) $page_post_type->disabled ), "built_in" => true, "position" => 20, "sub_position" => 0 ),
                array( "label" => __("Comments", MASTERPRESS_DOMAIN), "class" => "icon16 icon-comments", "built_in" => true, "position" => 25, "sub_position" => 0 ),
                array( "divider" => true, "position" => 64, "sub_position" => 0 ),
                array( "label" => __("Plugins", MASTERPRESS_DOMAIN),  "class" => "icon16 icon-plugins", "built_in" => true, "position" => 65, "sub_position" => 0 ),
                array( "label" => __("Users", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-users", "built_in" => true, "position" => 70, "sub_position" => 0 ),
                array( "label" => __("Tools", MASTERPRESS_DOMAIN),    "class" => "icon16 icon-tools", "built_in" => true, "position" => 75, "sub_position" => 0 ),
                array( "label" => __("Settings", MASTERPRESS_DOMAIN), "class" => "icon16 icon-settings", "built_in" => true, "position" => 80, "sub_position" => 0 ),
                array( "divider" => true, "position" => 100, "sub_position" => 0 )
              );

              // Splice with post-types data (non built-in)
              
              $post_types = MPM_PostType::find( array( "where" => "_builtin = 0 AND name <> '{$model->name}'", "orderby" => "menu_position,menu_sub_position") );
              
              foreach ($post_types as $post_type) {
                if ($post_type->show_in_menu) {
                  
                  if (!$post_type->_external) {
                    
                  // if post variables are set for these positions, use those instead of the DB values -->

                  $position = $post_type->menu_position;
                  $sub_position = $post_type->menu_sub_position;
                
                  if (isset($_POST["other_menu_position"]) && isset($_POST["other_menu_position"][$post_type->name])) {
                    $position = $_POST["other_menu_position"][$post_type->name];
                  }

                  if (isset($_POST["other_menu_sub_position"]) && isset($_POST["other_menu_sub_position"][$post_type->name])) {
                    $sub_position = $_POST["other_menu_sub_position"][$post_type->name];
                  }

                  $bi = false;
                  
                  $menus[] = array( "name" => $post_type->name, "label" => $post_type->labels["menu_name"], "disabled" => $post_type->disabled, "icon" => MPU::menu_icon_url($post_type->menu_icon, true, "post_type", true), "built_in" => $bi, "position" => (int) $position, "sub_position" => (int) $sub_position );
                  
                  }
                
                } 
              }
              
              // Finally, add the post type currently being created / edited
              
              $menus[] = array( "disabled" => $model->disabled, "current" => true, "name" => $model->name == "" ? "?" : $model->name, "label" => $model->labels["menu_name"], "icon" => $model->menu_icon == "" ? MPU::img_url("icon-no-icon.png") : MPU::menu_icon_url($model->menu_icon), "built_in" => false, "position" => (int) $model->menu_position, "sub_position" => (int) $model->menu_sub_position ); 
              
              
              // MPU::img_url("icon-no-icon.png")
              
              function mp_menu_sort($a, $b) {

                if ($a["position"] == $b["position"]) {
                  if ($a["sub_position"] == $b["sub_position"]) {
                    return 0;
                  } else {
                    return $a["sub_position"] > $b["sub_position"] ? 1 : -1;
                  }
                } else if ($a["position"] > $b["position"]) {
                  return 1;
                } else {
                  return -1;
                }
                    
                return 0;
              }
              
              usort($menus, "mp_menu_sort");
            
              // MPV::dump($menus);
              
              $count = 0;
            ?>
                
            <div class="sortable-list sortable-list-menu">
              <span class="arrow"></span>
              
              <div class="lists clearfix">

              <ul>
                <?php foreach ($menus as $menu) : $count++; $first = $count == 1 ? "first " : ""; ?>
                
                <?php
                  
                  $disabled = '';
                  $disabled_title = '';
                  
                  if (isset($menu["disabled"]) && $menu["disabled"]) {
                    $disabled = 'disabled';
                    $disabled_title = __("This post type is disabled", MASTERPRESS_DOMAIN);
                  }
                
                ?>
                
                <?php 
                if (isset($menu["divider"])) : 
                ?>
                  <li class="divide nomove"></li>  
                <?php 
                elseif (isset($menu["built_in"]) && $menu["built_in"]) : 
                  ?>
                  <li class="<?php echo $first ?> <?php echo $disabled ?> bi nomove { base_pos: <?php echo $menu["position"] ?>}" title="<?php echo $disabled_title ?>">
                    <span class="icon <?php echo $menu["class"] ?>"></span>
                    <span><?php echo $menu["label"] ?></span>
                  </li>
                <?php 
                elseif (isset($menu["current"])) :
                ?>
                <li class="current <?php echo $disabled ?>" title="<?php echo $disabled_title ?>">
                  <input id="menu_position" name="menu_position" value="<?php echo $menu["position"] ?>" type="hidden" class="pos" />
                  <input id="menu_sub_position" name="menu_sub_position" value="<?php echo $menu["sub_position"] ?>" type="hidden" class="sub_pos" />
                  <span class="icon mp-icon mp-icon-post-type mp-icon-post-type-<?php echo $menu["name"] ?>"></span>
                  <span class="fill { src: '#label_menu_name' }">?</span>
                </li>
                <?php
                else: 
                ?>
                <li class="<?php echo $disabled ?>" title="<?php echo $disabled_title ?>">
                  <input id="other_menu_position_<?php echo $menu["name"] ?>" name="other_menu_position[<?php echo $menu["name"] ?>]" value="<?php echo $menu["position"] ?>" type="hidden" class="pos" />
                  <input id="other_menu_sub_position_<?php echo $menu["name"] ?>" name="other_menu_sub_position[<?php echo $menu["name"] ?>]" value="<?php echo $menu["sub_position"] ?>" type="hidden" class="sub_pos" />
                  <span class="icon mp-icon mp-icon-post-type mp-icon-post-type-<?php echo $menu["name"] ?>"></span>
                  <span><?php echo $menu["label"] ?></span>
                </li>
                <?php
                endif; 
                ?>
              
                <?php endforeach; ?>
                
                        
                <li class="nomove holder"></li>
              </ul>
              
              </div>
              <!-- /.lists -->
              
              <div class="help">
              <p>
                <?php _e("Drag post type to the desired position in the admin menu.", MASTERPRESS_DOMAIN) ?>
              </p>

              <p>
                <?php _e("Note: You cannot adjust the positions of the built-in menus, but you can position items before and after them (with the exception that items must be positioned after <em>Posts</em>).", MASTERPRESS_DOMAIN); ?> 
              </p>

              <p>
                <em><?php _e("The menu presented here is a representation only, and does not include other menus registered by your theme and other plug-ins.", MASTERPRESS_DOMAIN); ?></em> 
              </p>
              </div>
            
            </div>
            <!-- /.sortable-list -->
            
          </div>
        </div>
        <!-- /.f -->        

      
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <?php endif; ?>
    
      
      
    
    <?php if (!$model->_builtin && !$model->_external) : ?>
    
    <div class="fs fs-url-options clearfix">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="globe"></i><strong><?php _e("URL Options", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("controls how your post type is accessible via URLs in your site", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
  
    
      <div class="fsc clearfix">
      <div class="fscb clearfix">
      
      <div class="f">
        <label for="rewrite_slug" class="text"><?php _e("Rewrite Slug", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          <input id="rewrite_slug" name="rewrite[slug]" type="text" value="<?php echo $model->rewrite["slug"] ?>" class="text mono" />
          <p>
            <?php _e("The slug your post types will sit underneath in the URL structure.", MASTERPRESS_DOMAIN); ?><br />
            <?php _e("The default value follows the popular convention of using the lowercase sanitized version of <em>Plural Name</em>.", MASTERPRESS_DOMAIN); ?>
          </p>
        </div>
      </div>
      <!-- /.f -->


      <div class="fw clearfix">
        <input id="has_archive" name="has_archive" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->has_archive ) ?> class="checkbox" />
        <label for="has_archive" class="checkbox"><?php printf( __("Has Archive Page? - <span>allows an archive page for this post type, using the template named %s", MASTERPRESS_DOMAIN ), 'archive-<em class="post-type-name fill { src: \'#name\', format: \'dasherize\' }\">'.$model->name.'</em>.php</span>') ?></label>
      </div>
    
      <div class="fw clearfix">
        <input id="rewrite_with_front" name="rewrite[with_front]" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->rewrite["with_front"] ) ?> class="checkbox" />
        <label for="rewrite_with_front" class="checkbox"><?php _e("With Front? - <span>Append the above slug to the top level URL set in your permalink settings.</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->

      <div class="fw">
        <input id="rewrite_feeds" name="rewrite[feeds]" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->rewrite["feeds"] ) ?> class="checkbox" />
        <label for="rewrite_feeds" class="checkbox"><?php _e("Has Feeds? - <span>Create RSS / ATOM feeds for this post type.</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->

      <div class="f clearfix">
        <label for="permalink_epmask" class="text"><?php _e("Permalink End-Point Mask", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          
          <?php
          
          //$options = array("EP_PERMALINK", "EP_ATTACHMENT", "EP_DATE", "EP_YEAR", "EP_MONTH", "EP_DAY", "EP_ROOT", "EP_COMMENTS", "EP_SEARCH", "EP_CATEGORIES", "EP_TAGS", "EP_AUTHORS", "EP_PAGES", "EP_ALL");
          //echo WOOF_HTML::select( array("multiple" => "multiple", "id" => "permalink_epmask", "name" => "permalink_epmask"), $options, $model->permalink_epmask );

          ?>
          
          <input id="permalink_epmask" name="permalink_epmask" type="text" value="<?php echo $model->permalink_epmask ?>" class="text mono" />
          <p>
            <?php _e('Separate multiple end-point constants with a pipe. e.g. <span class="tt">EP_PAGES | EP_TAGS</span>', MASTERPRESS_DOMAIN); ?>
          </p>
        </div>
      </div>
      <!-- /.f -->
              
                    
      <div class="fw clearfix">
        <input id="supports_top_level_slugs" name="supports[]" value="top-level-slugs" <?php echo WOOF_HTML::checked_attr( MPV::in_csv("top-level-slugs", $model->supports) ) ?> type="checkbox" class="checkbox" />
        <label for="supports_top_level_slugs" class="checkbox"><?php _e("Allow Rewrite Slug to be ommitted?", MASTERPRESS_DOMAIN); ?><span> - <?php _e("allows you to also access posts of this type <em>without</em> the rewrite slug in the URL.<br/>Be careful with this setting - it may affect site performance, and pages with the same slug as a post of this type will no longer be accessible.", MASTERPRESS_DOMAIN) ?></span></label>
      </div>
      <!-- /.fw -->

      </div>
      </div>

    </div>
    <!-- /.fs -->

    <div class="fs fs-query-data-options">
      
      <div class="fst">
      <div class="fstb">
        <h3><i class="database"></i><strong><?php _e("Query &amp; Data Options", MASTERPRESS_DOMAIN) ?></strong> - <?php _e(" controls the visibility of this post type in database queries and site searches, and exportability", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
      
      <div class="fw fw">
        <input id="publicly_queryable" name="publicly_queryable" value="true" <?php echo WOOF_HTML::checked_attr( $model->publicly_queryable ) ?> type="checkbox" class="checkbox" />
        <label for="publicly_queryable" class="checkbox"><?php _e("Publicly Queryable? - <span>Allow queries on this post type from the front-end WordPress API</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->


      <div class="f">
        <label for="query_var" class="text"><?php _e("Query Variable", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          <input id="query_var" name="query_var" type="text" value="<?php echo $model->query_var ?>" class="text mono" />
          <p>
            <?php _e('Enter the query variable used to query posts of this type with <span class="tt">query_posts</span> or <span class="tt">WP_Query</span>. Generally this should simply be the default value of the <em>Singular Name</em>, unless you have a good reason to change it.', MASTERPRESS_DOMAIN) ?>
          </p>
        </div>
      </div>
      <!-- /.f -->
      
      
      <div class="fw">
        <input id="exclude_from_search" name="exclude_from_search" value="true" <?php echo WOOF_HTML::checked_attr( $model->exclude_from_search ) ?> type="checkbox" class="checkbox" />
        <label for="exclude_from_search" class="checkbox"><?php _e("Exclude from Search? - <span>Hide items of this post type in site search results</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->

      
      <div class="fw">
        <input id="can_export" name="can_export" value="true" <?php echo WOOF_HTML::checked_attr( $model->can_export ) ?> type="checkbox" class="checkbox" />
        <label for="can_export" class="checkbox"><?php _e("Exportable? - <span>Allow this post type to be exported via the WordPress Export Tool</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->

      
      </div>
      </div>

    </div>
    <!-- /.fs -->
        
    <?php endif; ?>
    
    <?php if (!$model->_external) : ?>
    
    <div class="fs fs-labels">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="label-string"></i><strong><?php _e("Labels", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("displayed throughout the WordPress administration UI", MASTERPRESS_DOMAIN) ?></h3>

        <div class="buttons">
          <button id="autofill-labels" class="button button-autofill" type="button"><?php _e('<strong>Auto-Fill</strong> Labels', MASTERPRESS_DOMAIN) ?></button>
        </div>

      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
      
        <div class="f">
          <label for="label_singular_name"><?php _e("<em>Singular</em> Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_singular_name" name="labels[singular_name]" value="<?php echo $model->labels["singular_name"] ?>" type="text" class="text { tmpl: '{{singular_name}}' }" />
            <em class="recommended">(<?php _e("recommended", MASTERPRESS_DOMAIN) ?>)</em>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_name"><?php _e("<em>Plural</em> Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_name" name="labels[name]" value="<?php echo $model->labels["name"] ?>"  type="text" class="text { tmpl: '{{plural_name}}' }" />
            <em class="recommended">(<?php _e("recommended", MASTERPRESS_DOMAIN) ?>)</em>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_menu_name"><?php _e("Menu Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_menu_name" name="labels[menu_name]" value="<?php echo $model->labels["menu_name"] ?>" type="text" class="text { tmpl: '<?php _e("{{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("The name to give menu items", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->


        <div class="f">
          <label for="label_add_new"><?php _e("Add New:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_add_new" name="labels[add_new]" value="<?php echo $model->labels["add_new"] ?>"  type="text" class="text { tmpl: '<?php _e("Add New", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Menu label for creating a post of this type", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_all_items"><?php _e("All Items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_all_items" name="labels[all_items]" value="<?php echo $model->label("all_items") ?>"  type="text" class="text { tmpl: '<?php _e("All {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("The all items text used in the menu", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->
        
        <div class="f">
          <label for="label_add_new_item"><?php _e("Add New Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_add_new_item" name="labels[add_new_item]" value="<?php echo $model->labels["add_new_item"] ?>" type="text" class="text { tmpl: '<?php _e("Add New {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }"  />
            <span class="fdesc"><?php _e("Header shown when creating a new item of this type", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_edit"><?php _e("Edit:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_edit" name="labels[edit]" value="<?php echo $model->labels["edit"] ?>" type="text" class="text { tmpl: '<?php _e("Edit", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Menu label for editing posts of this type", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_edit_item"><?php _e("Edit Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_edit_item" name="labels[edit_item]" value="<?php echo $model->labels["edit_item"] ?>" type="text" class="text { tmpl: '<?php _e("Edit {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Header shown when editing posts of this type", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_new_item"><?php _e("New Item Label:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_new_item" name="labels[new_item]" value="<?php echo $model->labels["new_item"] ?>" type="text" class="text { tmpl: '<?php _e("New {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Shown in the favorites menu in the admin header", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_view"><?php _e("View:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_view" name="labels[view]" value="<?php echo $model->labels["view"] ?>" type="text" class="text { tmpl: '<?php _e("View {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Used as text in links to view posts of this type", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_view_item"><?php _e("View Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_view_item" name="labels[view_item]" value="<?php echo $model->labels["view_item"] ?>" type="text" class="text { tmpl: '<?php _e("View {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Text for the button alongside the permalink on the edit post screen", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_search_items"><?php _e("Search Items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_search_items" name="labels[search_items]" value="<?php echo $model->labels["search_items"] ?>" type="text" class="text { tmpl: '<?php _e("Search {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Button text for the search box on the edit post screen", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_not_found"><?php _e("Not Found:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_not_found" name="labels[not_found]" value="<?php echo $model->labels["not_found"] ?>" type="text" class="text { lowercase: true, tmpl: '<?php _e("No {{plural_name}} found", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Text to display when no posts of this type are found through search in the admin", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_not_found_in_trash"><?php _e("Not Found In Trash:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_not_found_in_trash" name="labels[not_found_in_trash]" value="<?php echo $model->labels["not_found_in_trash"] ?>" type="text" class="text { lowercase: true, tmpl: '<?php _e("No {{plural_name}} found in Trash", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Text to display when no posts of this type are in the trash", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f hierarchical-only">
          <label for="label_parent_item_colon"><?php _e("Parent Item (Colon):", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_parent_item_colon" name="labels[parent_item_colon]" value="<?php echo $model->labels["parent_item_colon"] ?>" type="text" class="text { tmpl: '<?php _e("Parent {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("The label for the parent selector on the edit posts screen (hierarchical only)", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_no_posts"><?php _e("No Posts:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_no_posts" name="labels[no_posts]" value="<?php echo $model->label("no_posts") ?>" type="text" class="text { tmpl: '<?php _e("No {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Used when listing posts in a master-detail relationship", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_one_post"><?php _e("One Post:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_one_post" name="labels[one_post]" value="<?php echo $model->label("one_post") ?>" type="text" class="text { tmpl: '<?php _e("1 {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Used when listing posts in a master-detail relationship", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->
        
        <div class="f">
          <label for="label_n_posts"><?php _e("n Posts:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_n_posts" name="labels[n_posts]" value="<?php echo $model->label("n_posts") ?>" type="text" class="text { tmpl: '<?php _e("%d {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Used when listing posts in a master-detail relationship", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_remove_post"><?php _e("Remove Post:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_remove_post" name="labels[remove_post]" value="<?php echo $model->label("remove_post") ?>" type="text" class="text { tmpl: '<?php _e("Remove {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
            <span class="fdesc"><?php _e("Used when listing posts in a master-detail relationship", MASTERPRESS_DOMAIN); ?></span>
          </div>
        </div>
        <!-- /.f -->

      
      </div>
      </div>

    </div>
    <!-- /.fs -->
    <?php endif; ?>
  
    <?php if (!$model->_builtin && !$model->_external) : ?>

    <div class="fs fs-capability-keys">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="key"></i><strong><?php _e("Capabilities", MASTERPRESS_DOMAIN) ?></strong> - <?php _e('the keys used to control access to this post type.', MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
      
        <div class="fw fwl">
          <input id="capability_type_post" name="capability_type" value="post" <?php echo WOOF_HTML::checked_attr( $model->capability_type == "post" ) ?> type="radio" class="radio" />
          <label for="capability_type_post" class="radio"><?php _e('<em>Post</em> style, based on the partial key <span class="tt">post</span>', MASTERPRESS_DOMAIN) ?></label>
          
          <div class="eg">
            <p><strong><?php _e("primitive capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_posts, edit_others_posts, publish_posts, read_private_posts</span></p>
            <p><strong><?php _e("meta capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_post, read_post, delete_post, read, delete_posts, delete_private_posts, delete_published_posts, delete_others_posts, edit_private_posts, edit_published_posts</span></p>          
          </div>
        </div>
        <!-- /.fw -->

        <div class="fw fwl">
          <input id="capability_type_page" name="capability_type" value="page" <?php echo WOOF_HTML::checked_attr( $model->capability_type == "page" ) ?> type="radio" class="radio" />
          <label for="capability_type_page" class="radio"><?php _e('<em>Page</em> style, based on the partial key <span class="tt">page</span>', MASTERPRESS_DOMAIN) ?></label>

          <div class="eg">
            <p><strong><?php _e("primitive capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_pages, edit_others_pages, publish_pages, read_private_pages</span></p>
            <p><strong><?php _e("meta capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_page, read_page, delete_page, read, delete_pages, delete_private_pages, delete_published_pages, delete_others_pages, edit_private_pages, edit_published_pages</span></p>          
          </div>

        </div>
        <!-- /.fw -->

        <div class="fw fwl">
          <input id="capability_type_specific" name="capability_type" value="specific" <?php echo WOOF_HTML::checked_attr( $model->capability_type == "specific" || $model->capability_type == $model->name ) ?> type="radio" class="radio" />
          <label for="capability_type_specific" class="radio"><?php _e("<em>Specific</em>, based on <em>Singular Name</em>", MASTERPRESS_DOMAIN) ?></label>

          <div class="eg">
            <p><strong><?php _e("primitive capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_<span class="fill { src: '#name' }">?</span>s, edit_others_<span class="fill { src: '#name' }">?</span>s, publish_<span class="fill { src: '#name' }">?</span>s, read_private_<span class="fill { src: '#name' }">?</span>s</span></p>
            <p><strong><?php _e("meta capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_<span class="fill { src: '#name' }">?</span>, read_<span class="fill { src: '#name' }">?</span>, delete_<span class="fill { src: '#name' }">?</span>, read, delete_<span class="fill { src: '#name' }">?</span>s, delete_private_<span class="fill { src: '#name' }">?</span>s, delete_published_<span class="fill { src: '#name' }">?</span>s, delete_others_<span class="fill { src: '#name' }">?</span>s, edit_private_<span class="fill { src: '#name' }">?</span>s, edit_published_<span class="fill { src: '#name' }">?</span>s</span></p>          
          </div>

        </div>
        <!-- /.fw -->

        <div id="fw_capability_type_custom" class="fw fwl">
          
          <?php
          
          $custom_value = "";
          $custom_checked = false;
          
          if ($model->capability_type != $model->name && $model->capability_type != "post" && $model->capability_type != "page") {
            $custom_checked = true;
            $custom_value = $model->capability_type;
          }
          
          
          ?>
          <input id="capability_type_custom" name="capability_type" value="custom" <?php echo WOOF_HTML::checked_attr( $custom_checked ) ?> type="radio" class="radio" />
          <label id="label-capability_custom_value" for="capability_type_custom" class="radio"><?php _e("<em>Custom</em>, based on the partial key (singular)", MASTERPRESS_DOMAIN) ?>:</label>

          
          <input id="capability_type_custom_value" name="capability_type_custom_value" value="<?php echo $custom_value ?>" type="text" class="text mono" />
          
          <div class="eg">
          <p><strong><?php _e("primitive capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, edit_others_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, publish_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, read_private_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span></span></p>
          <p><strong><?php _e("meta capabilities", MASTERPRESS_DOMAIN) ?>:</strong> <span class="tt">edit_<span class="custom-fill { src: '#capability_type_custom_value' }">?</span>, read_<span class="custom-fill { src: '#capability_type_custom_value' }">?</span>, delete_<span class="custom-fill { src: '#capability_type_custom_value' }">?</span>, read, delete_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, delete_private_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, delete_published_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, delete_others_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, edit_private_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span>, edit_published_<span class="custom-fill { src: '#capability_type_custom_value', format: 'pluralize' }">?</span></span></p>          
          </div>
          

        </div>
        <!-- /.fw -->
                 
        <div class="fw">
          <input id="map_meta_cap" name="map_meta_cap" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->map_meta_cap ) ?> class="checkbox" />
          <label for="map_meta_cap" class="checkbox"><?php printf( __('Map Meta Capabilities? - <span>whether to use the internal default meta capability handling. See the section on the <span class="tt">capabilities</span> argument %s</span>', MASTERPRESS_DOMAIN ), '<a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments" target="_blank">'.__(" here", MASTERPRESS_DOMAIN).'</a>') ?></label>
        </div>
     
      
      </div>
      </div>

    </div>
    <!-- /.fs -->

    
    <?php endif; // !$model->_builtin ?>

    

    <?php
  } // end form
コード例 #4
0
ファイル: mpc-masterplan.php プロジェクト: verbazend/AWFA
  protected function export_rep($export) {
    global $wf;
    
    // create the associative array representation
    
    $rep = array(
      "created" => date("c"),
      "masterpress_version" => MasterPress::$version,
      "icons" => array()
    );
    
    $types = array();

    if (isset($export["post_types"])) {
      
      $rep["post_types"] = array();
      
      foreach (array_keys($export["post_types"]) as $post_type_name) {
        $post_type = MPM_PostType::find_by_name($post_type_name);
        
        $r = $post_type->rep();
        $rep["post_types"][] = $r;
        
        self::add_icon($rep["icons"], $r, "menu_icon");

        if (isset($r["field_sets"])) {
          
          foreach ($r["field_sets"] as $set) {
            self::add_icon($rep["icons"], $set);

            foreach ($set["fields"] as $field) {

              self::add_icon($rep["icons"], $field);
              $types[$field["type"]] = true;

            }
          }
        
        }
      
      }
      
    }    

    if (isset($export["taxonomies"])) {
      
      $rep["taxonomies"] = array();
      
      foreach (array_keys($export["taxonomies"]) as $tax_name) {
        $tax = MPM_Taxonomy::find_by_name($tax_name);
        $r = $tax->rep();
        $rep["taxonomies"][] = $r;

        self::add_icon($rep["icons"], $r, "title_icon");

        if (isset($r["field_sets"])) {
          foreach ($r["field_sets"] as $set) {
            self::add_icon($rep["icons"], $set);

            foreach ($set["fields"] as $field) {
              self::add_icon($rep["icons"], $field);
              $types[$field["type"]] = true;
            }
          }
        }
          
      }
      
    } 

    if (isset($export["shared_field_sets"])) {
      
      $rep["shared_field_sets"] = array();
      
      foreach (array_keys($export["shared_field_sets"]) as $id) {
        $set = MPM_FieldSet::find_by_id($id);
        $r = $set->rep();

        self::add_icon($rep["icons"], $r);

        $rep["shared_field_sets"][] = $r;
        
        if (isset($r["fields"])) {

          foreach ($r["fields"] as $field) {
            self::add_icon($rep["icons"], $field);
            $types[$field["type"]] = true;
          }
        
        }
      
      }
      
    } 

    if (isset($export["site_field_sets"])) {
      
      $rep["site_field_sets"] = array();
      
      foreach (array_keys($export["site_field_sets"]) as $id) {
        $set = MPM_FieldSet::find_by_id($id);
        $r = $set->rep();
        $rep["site_field_sets"][] = $r;

        self::add_icon($rep["icons"], $r);

        if (isset($r["fields"])) {

          foreach ($r["fields"] as $field) {
            self::add_icon($rep["icons"], $field);
            $types[$field["type"]] = true;
          }
        
        }
      
      }
      
    } 

    if (isset($export["templates"])) {
      
      $rep["templates"] = array();
      
      foreach (array_keys($export["templates"]) as $template) {

        $template = MPM_Template::find_by_id($template);
        
        $r = $template->rep();
        $rep["templates"][] = $r;

        if (isset($r["field_sets"])) {

          foreach ($r["field_sets"] as $set) {
            self::add_icon($rep["icons"], $set);

            foreach ($set["fields"] as $field) {
              self::add_icon($rep["icons"], $field);
              $types[$field["type"]] = true;
            }
          }

        }
      

      }
      
    } 
    
    
    if (isset($export["roles"])) {
      
      $rep["roles"] = array();
      
      foreach (array_keys($export["roles"]) as $role) {
        
        $wr = $wf->role($role);
        
        $rr = array("id" => $role, "name" => $wr->name, "capabilities" => $wr->capabilities, "field_sets" => array());

        foreach (MPM_RoleFieldSet::find_by_role($role, "id ASC") as $set) {
          $r = $set->rep();

          self::add_icon($rep["icons"], $r);
          
          if (isset($r["fields"])) {

            foreach ($r["fields"] as $field) {
              $types[$field["type"]] = true;
              self::add_icon($rep["icons"], $field);
            }
          
          }
        
          $rr["field_sets"][] = $r;

        }
        
        $rep["roles"][] = $rr;

      }
      
    } 
    
    $rep["field_types"] = array_keys($types);
    
    return $rep;
    
  }
コード例 #5
0
ファイル: mpc-post-types.php プロジェクト: verbazend/AWFA
  public function submit() {
    
    global $wpdb;
    
    $action = MasterPress::$action;
    
    if ($action == "create" || $action == "edit") {

      $builtin = $_POST["_builtin"] == "true";
      $external = $_POST["_external"] == "true";
      
      if ($builtin) {

        $post_type = MPM_PostType::find_by_name($_POST["name"]);
        $post_type->supports = implode(",", $_POST["supports"]);
        $post_type->disabled = isset($_POST["disabled"]);
        $post_type->visibility = $this->get_visibility_val("sites");
        $post_type->columns = $_POST["columns"];
        $post_type->labels = $_POST["labels"];
        
        $post_type->menu_icon = self::handle_icon("menu_icon", "menu_icon_select");
        
        if ($_POST["name"] == "page" && $post_type->menu_icon == "") {
          $post_type->menu_icon = "menu-icon-pages.png"; // restore default icon
        }

        if ($_POST["name"] == "post" && $post_type->menu_icon == "") {
          $post_type->menu_icon = "menu-icon-posts.png"; // restore default icon
        }
        
        if ($action == "edit") {
          $post_type->update(MasterPress::$id);
        }
        

      } else if ($external) {

        $post_type = MPM_PostType::find_by_name($_POST["name"]);
        $post_type->columns = $_POST["columns"];
        $post_type->menu_icon = self::handle_icon("menu_icon", "menu_icon_select");
        
        if ($action == "edit") {
          $post_type->update(MasterPress::$id);
        }
        
      } else {


        $post_type = new MPM_PostType(true);
    
        // consume the post data
        $post_type->name = $_POST["name"];
        $post_type->plural_name = $_POST["plural_name"];
        $post_type->disabled = isset($_POST["disabled"]);
        $post_type->labels = $_POST["labels"];
        $post_type->description = $_POST["description"];
        $post_type->publicly_queryable = isset($_POST["publicly_queryable"]);
        $post_type->exclude_from_search = isset($_POST["exclude_from_search"]);
        $post_type->show_ui = isset($_POST["show_ui"]);
        $post_type->show_in_menu = isset($_POST["show_in_menu"]);
        $post_type->hierarchical = isset($_POST["hierarchical"]);
        $post_type->menu_position = $_POST["menu_position"];
        $post_type->menu_sub_position = $_POST["menu_sub_position"];
        
        $post_type->menu_icon = self::handle_icon("menu_icon", "menu_icon_select");
        
        $post_type->manage_sort_order = $_POST["manage_sort_order"];
        
        $cap_type = $_POST["capability_type"];
        
        if ($cap_type == "specific") {
          $post_type->capability_type = $_POST["name"];
        } else if ($cap_type == "custom" && trim($_POST["capability_type_custom_value"]) != "") {
          $post_type->capability_type = $_POST["capability_type_custom_value"];
        } else {
          $post_type->capability_type = $cap_type;
        }
      
        $post_type->capabilities = MPC::post_val("capabilities");
        
        $post_type->map_meta_cap = isset($_POST["map_meta_cap"]);
        $post_type->hierarchical = isset($_POST["hierarchical"]);
        $post_type->supports = MPC::post_implode_val("supports");
        $post_type->permalink_epmask = $_POST["permalink_epmask"];
        $post_type->has_archive = isset($_POST["has_archive"]);
        $post_type->visibility = $this->get_visibility_val("sites,post_types");

        $post_type->show_in_menu = isset($_POST["show_in_menu"]);

        $rewrite = array(
          "slug" => $_POST["rewrite"]["slug"],
          "with_front" => isset($_POST["rewrite"]["with_front"]),
          "feeds" => isset($_POST["rewrite"]["feeds"])
        );
        
        $post_type->rewrite = $rewrite;
      
        $post_type->query_var = $_POST["query_var"];
        $post_type->can_export = isset($_POST["can_export"]);
        $post_type->show_in_nav_menus = isset($_POST["show_in_nav_menus"]);
        $post_type->_builtin = false;
        $post_type->_external = $_POST["_external"] == "true";
        $post_type->columns = $_POST["columns"];

        if ($action == "create") {
          $post_type->insert();
        } else if ($action == "edit") {
          $post_type->update(MasterPress::$id);

          if ($post_type->is_valid()) {
            global $meow_provider;
            $meow_provider->migrate_post_type($post_type, $_POST["name_original"]);
          }

        }
        
        
      }
      
      if ($post_type->is_valid() && !$external) {

        // auto-generate a sprite icon
        MPU::create_icon_sprite($post_type->menu_icon, "", true);

        // attach any taxonomies and shared field sets
        
        $post_type->unlink_taxonomies();
        
        if (MPC::post_val("taxonomies") != "" && count(MPC::post_val("taxonomies"))) {
          $post_type->link_taxonomies( MPM_Taxonomy::find_by_name_in( $_POST["taxonomies"] ) );
        }
        
        // update the menu positions of other post types
        
        $omp = MPC::post_val("other_menu_position");
        $omsp = MPC::post_val("other_menu_sub_position");
        
        if (isset($omp) && is_array($omp)) {
          foreach ($omp as $name => $position) {
            $wpdb->update(MPM::table("post-types"), array( "menu_position" => $position, "menu_sub_position" => $omsp[$name] ), array( "name" => $name ), "%d", "%s" ); 
          }
        }

        MasterPress::flag_for_rewrite();

      } 
    
      return $post_type;
      
      
    } else if ($action == "delete") {

      
      $pt = MPM_PostType::find_by_id(MasterPress::$id);
      $pt->delete(
        array(
          "posts" => $_POST["posts"],
          "posts_reassign_type" => $_POST["posts_reassign_type"],
          "field_sets" => $_POST["field_sets"],
          "field_data" => $_POST["field_data"]
        )
      );
      
      MasterPress::flag_for_rewrite();

      return true;
      
    } else if ($action == "create-field-set" || $action == "edit-field-set") {

      $field_set = new MPM_FieldSet();
      // consume the post data
      
      $field_set->name = $_POST["name"];
      $field_set->singular_name = $_POST["singular_name"];
      $field_set->disabled = isset($_POST["disabled"]);
      $field_set->labels = $_POST["labels"];
      $field_set->allow_multiple = isset($_POST["allow_multiple"]);
      $field_set->visibility = $_POST["visibility"];
      $field_set->capabilities = self::handle_capabilities();
      $field_set->type = "p"; // p = shared
      $field_set->position = $_POST["position"];
      $field_set->icon = self::handle_icon("icon", "icon_select");
      $field_set->expanded = isset($_POST["expanded"]);
      $field_set->sidebar = isset($_POST["sidebar"]);
      $field_set->versions = $_POST["versions"];
      $field_set->visibility = $this->get_visibility_val("sites,templates,post_types");
      
      $post_type = MPM_PostType::find_by_id(MasterPress::$parent);
      
      // inform the validation of the post type
      $field_set->meta("post_type", $post_type);
      
      if (MPC::is_create()) {
        $field_set->insert();
      } else if (MPC::is_edit()) {
        $field_set->update(MasterPress::$id);
      }

      if ($field_set->is_valid()) {

        if (MPC::is_edit()) {
          global $meow_provider;
          $meow_provider->migrate_field_set_meta($field_set, $_POST["name_original"]);
        }

        // update other menu positions
        
				if (isset($_POST["other_position"])) {
	        $op = $_POST["other_position"];
        
	        if (isset($op) && is_array($op)) {
	          foreach ($op as $id => $position) {
	            $wpdb->update(MPM::table("field-sets"), array( "position" => $position ), array( "id" => $id ), "%d", "%d" ); 
	          }
          
	        }
        }
        
      }        
      
      return $field_set;
      

    } else if ($action == "delete-field-set") {
      
      $fg = MPM_FieldSet::find_by_id(MasterPress::$id);
      
      if ($fg) {
        $field_data_action = $_POST["field_data"];
        if ($field_data_action == "delete") {
          $fg->delete_meta();
        }
      }
      
      $fg->delete();
      
      return true;
      
    } else if ($action == "delete-field") {
      
      $f = MPM_Field::find_by_id(MasterPress::$id);
      
      if ($f) {

        $field_data_action = $_POST["field_data"];
        
        if ($field_data_action == "delete") {
          $f->delete_meta();
        }

      }
      
      $f->delete();
      
      return true;
      
    } else if ($action == "create-field" || $action == "edit-field") {
      
      // FIELD OPERATIONS (NOT FIELD GROUPS!)
       
      $field = new MPM_Field();
      // consume the post data
      
      $field->field_set_id = $_POST["parent"];
      $field->name = $_POST["name"];
      $field->disabled = isset($_POST["disabled"]);
      $field->summary_options = $_POST["summary_options"];
      $field->required = isset($_POST["required"]);
      $field->labels = $_POST["labels"];
      $field->type = $_POST["type"]; 
      $field->icon = self::handle_icon("icon", "icon_select");
      
      if (isset($_POST["type_options"])) {
        $field->type_options = $_POST["type_options"];
      }
    
      $field->position = $_POST["position"];
      $field->visibility = $this->get_visibility_val("sites,templates,post_types");
      $field->capabilities = self::handle_capabilities();

      $fg = MPM_FieldSet::find_by_id($_POST["parent"]);
        
        
      if (MPC::is_create()) {
        $field->insert();
      } else if (MPC::is_edit()) {
        $field->update(MasterPress::$id);
      }

      if ($field->is_valid()) {

        // update other menu positions

        if (MPC::is_edit()) {
          global $meow_provider;
          $meow_provider->migrate_field_meta($field, $_POST["name_original"]);
        }
        
        if (isset($_POST["other_position"])) {
          $op = $_POST["other_position"];
        
          if (isset($op) && is_array($op)) {
            foreach ($op as $id => $position) {
              $wpdb->update(MPM::table("fields"), array( "position" => $position ), array( "id" => $id ), "%d", "%d" ); 
            }
          
          }
        }
        
        
      }     
      
      
      
      return $field;
      
      
    } 
    
    return false;
  }
コード例 #6
0
ファイル: mpft-related-post.php プロジェクト: verbazend/AWFA
  public static function options_form( $options ) {

    global $meow_provider;
    
    $p = self::type_prefix(__CLASS__);

    $defaults = array();

    if (MPC::is_create()) {
      $defaults = array("maxwidth" => 580, "height" => 300, "control_style" => "drop_down_list", "orderby" => "title,asc", "exclude_current" => "yes");
    }

    $options = wp_parse_args( $options, $defaults );

    
    // setup variables to insert into the heredoc string
    // (this is required where we cannot call functions within heredoc strings)

    $post_types_label = __("Available Post Types:", MASTERPRESS_DOMAIN);
    $post_types_items = array();

    MPM::incl("post-type");

    $post_types = MPM_PostType::find("orderby=disabled,name ASC");

    $post_types_selected = array();
    
    foreach ($post_types as $post_type) {
      if (!$post_type->disabled && $post_type->show_ui && $post_type->still_registered()) {
        $post_types_selected[] = $post_type->name;
        $post_types_items[$post_type->display_label()] = $post_type->name;
      }

    }

    if (!MPC::is_create()) {
      $post_types_selected = self::option_value($options, "post_types");
    }
  
    $post_types_checkboxes = '';
        
    if (!is_array($post_types_selected)) {
      $post_types_selected = explode(",", $post_types_selected);
    }
  
    $id = $p."post-types-";
    
    foreach ($post_types as $post_type) {

      
      if (!$post_type->disabled && $post_type->show_ui && $post_type->still_registered()) {
        
        $value = $post_type->name;
        $label = $post_type->display_label();
      
        $id_suffix = WOOF::sanitize($value);
      
        $attr = array( "id" => $id."_".$id_suffix, "class" => "checkbox", "type" => "checkbox", "name" => "type_options[post_types][]", "value" => $value );
      
        if (in_array($value, $post_types_selected)) {
          $attr["checked"] = "checked";
        }
      
        $post_types_checkboxes .= WOOF_HTML::open("div", "class=fwi");
        $post_types_checkboxes .= WOOF_HTML::tag("input", $attr );
        $post_types_checkboxes .= WOOF_HTML::tag("label", array( "for" => $id."_".$id_suffix, "class" => "checkbox mp-icon-post-type mp-icon-post-type-".$value ), $label );
        $post_types_checkboxes .= WOOF_HTML::close("div");

      }
      
    }


    $basic = MPFT::options_select_basic( $p, $options );
    $exclude_current = MPFT::options_exclude_current( $p, $options, __('Excludes the current post being edited from the results', MASTERPRESS_DOMAIN) );
    $multi_layout = MPFT::options_select_multi_layout( $p, $options );
    $control_style = MPFT::options_select_control_style( $p, $options );

    $maxwidth = MPFT::options_maxwidth( $p, $options );
    $height = MPFT::options_height( $p, $options );
    $grouping = MPFT::options_select_grouping( $p, $options, __("Post Type", MASTERPRESS_DOMAIN) );
    $placeholder = MPFT::options_placeholder($p, $options);

    $results_input_length = MPFT::options_input_text( $p, $options, "results_input_length", __("Minimum Input Length", MASTERPRESS_DOMAIN), __("Enter the number of characters required before any results are displayed.<br />This is useful for large numbers of posts, where performance may become poor.", MASTERPRESS_DOMAIN));

    $orderby = MPFT::options_post_orderby( $p, $options);
    
    $post_count = MPFT::options_input_text( $p, $options, "post_count", __("Post Limit:", MASTERPRESS_DOMAIN), __("The latest <em>n</em> posts will be retrieved, where <em>n</em> is the number provided here.<br />Leave empty to retrieve all posts.", MASTERPRESS_DOMAIN));
    
    $results_row_style = MPFT::options_select_results_row_style( $p, $options );

    $taxonomy_query = MPFT::options_textarea( $p, $options, "taxonomy_query", __("Taxonomy Filter:", MASTERPRESS_DOMAIN) );
    
    
    $data_source_label = __("Query Options - <span>further specify the posts available for selection</span>", MASTERPRESS_DOMAIN); 
    $control_results_label = __("Results Display - <span>settings for the display of the available posts</span>", MASTERPRESS_DOMAIN); 
    $control_selections_label = __("Selection Display - <span>settings for the display of the selected posts</span>", MASTERPRESS_DOMAIN); 
    
    
    
    // build a post types grid
    
    $results_row_item_prop_label = __("Row Item Properties:", MASTERPRESS_DOMAIN);
    $results_row_item_prop_note = __("Defines the post properties used to derive the info shown in result rows.<br /><b>Note: </b>Excerpts and images will be truncated / resized automatically.", MASTERPRESS_DOMAIN);
    
    $row_style = self::option_value($options, "row_style", "icon_title");

    $grid  = WOOF_HTML::open("table", "class=grid mini not-selectable grid-row-item-prop&cellspacing=0");
      $grid .= WOOF_HTML::open("thead");
      
        $grid .= WOOF_HTML::tag("th", "class=post-type", WOOF_HTML::tag("i", "class=pins", "") . WOOF_HTML::tag("span", null, __("Post Type", MASTERPRESS_DOMAIN)));
        $grid .= WOOF_HTML::tag("th", "class=title", WOOF_HTML::tag("i", "class=title-bar", "") . WOOF_HTML::tag("span", null, __("Title", MASTERPRESS_DOMAIN)));
        $grid .= WOOF_HTML::tag("th", "class=".(($row_style == "icon_title" || $row_style == "image_title") ? "disabled " : "")."icon excerpt", WOOF_HTML::tag("i", "class=content-bar", "") . WOOF_HTML::tag("span", null, __("Excerpt", MASTERPRESS_DOMAIN)));
        $grid .= WOOF_HTML::tag("th", "class=".(($row_style == "icon_title" || $row_style == "icon_title_excerpt") ? "disabled " : "")."icon image", WOOF_HTML::tag("i", "class=image", "") . WOOF_HTML::tag("span", null, __("Image", MASTERPRESS_DOMAIN)));

      $grid .= WOOF_HTML::close("thead");

      $grid .= WOOF_HTML::open("tbody");
      
      $count = 1;
      
      
      foreach ($post_types as $post_type) {
        if (!$post_type->disabled && $post_type->show_ui) {
          
          $classes = array("post-type-".$post_type->name);
          
          if ($count == 1) {
            $classes[] = "first";
          }
          
          $attr = array("class" => implode(" ", $classes));
          
          if (!in_array($post_type->name, $post_types_selected)) {
            $attr["style"] = "display: none;";
          }

  
          $grid .= WOOF_HTML::open("tr", $attr);

          $count++;
            
            $span = WOOF_HTML::tag("span", array("class" => "mp-icon-post-type mp-icon-post-type-".$post_type->name ), $post_type->display_label());
            
            $grid .= WOOF_HTML::tag("td", "class=first post-type", $span);
            $grid .= WOOF_HTML::open("td", "class=title");
            
              $default = "title";
              $value = isset($options["result_row_prop"][$post_type->name]["title"]) ? $options["result_row_prop"][$post_type->name]["title"] : $default;
              
              if ($value == "") {
                $value = $default;
              }
              
              $grid .= WOOF_HTML::open("div");
              
              $input_attr = array(
                "type" => "text",
                "name" => "type_options[result_row_prop][".$post_type->name."][title]",
                "class" => "text",
                "value" => $value
              );

              $grid .= WOOF_HTML::tag("input", $input_attr);

              $grid .= WOOF_HTML::tag(
                "button", 
                array(
                  "type" => "button",
                  "class" => "ir",
                  "data-dialog" => "dialog-post-type-".$post_type->name,
                  "data-filter" => "text",
                  "title" => __("Select Field", MASTERPRESS_DOMAIN)
                ),
                "select"
              );
              
              $grid .= WOOF_HTML::close("div");
              
            $grid .= WOOF_HTML::close("td");
            $grid .= WOOF_HTML::open("td", "class=excerpt".(($row_style == "icon_title" || $row_style == "image_title") ? " disabled " : ""));

              $default = "excerpt";
              $value = isset($options["result_row_prop"][$post_type->name]["excerpt"]) ? $options["result_row_prop"][$post_type->name]["excerpt"] : $default;
              
              if ($value == "") {
                $value = $default;
              }

              $input_attr = array(
                "type" => "text",
                "name" => "type_options[result_row_prop][".$post_type->name."][excerpt]",
                "class" => "text",
                "value" => $value
              );

              $grid .= WOOF_HTML::open("div");

              $grid .= WOOF_HTML::tag("input", $input_attr);

              $grid .= WOOF_HTML::tag(
                "button", 
                array(
                  "type" => "button",
                  "class" => "ir",
                  "data-dialog" => "dialog-post-type-".$post_type->name,
                  "data-filter" => "text",
                  "title" => __("Select Field", MASTERPRESS_DOMAIN)
                ),
                "select"
              );
            
              $grid .= WOOF_HTML::close("div");

            $grid .= WOOF_HTML::close("td");
            $grid .= WOOF_HTML::open("td", "class=image".(($row_style == "icon_title" || $row_style == "icon_title_excerpt") ? " disabled" : ""));

              $default = "featured_image";
              $value = isset($options["result_row_prop"][$post_type->name]["image"]) ? $options["result_row_prop"][$post_type->name]["image"] : $default;
              
              if ($value == "") {
                $value = $default;
              }
              
              $input_attr = array(
                "type" => "text",
                "name" => "type_options[result_row_prop][".$post_type->name."][image]",
                "class" => "text",
                "value" => $value
              );
              
              $grid .= WOOF_HTML::open("div");

              $grid .= WOOF_HTML::tag("input", $input_attr);

              $grid .= WOOF_HTML::tag(
                "button", 
                array(
                  "type" => "button",
                  "class" => "ir",
                  "data-dialog" => "dialog-post-type-".$post_type->name,
                  "data-filter" => "image",
                  "title" => __("Select Field", MASTERPRESS_DOMAIN)
                ),
                "select"
              );
              
              $grid .= WOOF_HTML::close("div");

            
            $grid .= WOOF_HTML::close("td");

          $grid .= WOOF_HTML::close("tr");
          
        }
      }

      $grid .= WOOF_HTML::close("tbody");
    $grid .= WOOF_HTML::close("table");


    // build dialogs for selecting row properties in the grid
    
    $dialogs = "";
    
    foreach ($post_types as $post_type) {
      
      if (!$post_type->disabled && $post_type->show_ui) {
      
        $dialogs .= WOOF_HTML::open(
          "div", 
          array(
            "class" => "dialog dialog-fields",
            "id" => "dialog-post-type-".$post_type->name,
            "data-title" => __("Select a Field", MASTERPRESS_DOMAIN)
          )
        );
      
        $fs = $meow_provider->post_type_field_sets($post_type->name);

        $field_options = array();
        $field_options[""] = "";

        $field_options_attr = array("");

        $field_options[__("( Built-in Fields )", MASTERPRESS_DOMAIN)] = array(
          
          "options" => array(
            __("Title", MASTERPRESS_DOMAIN) => "title",
            __("Excerpt", MASTERPRESS_DOMAIN) => "excerpt",
            __("Feature Image", MASTERPRESS_DOMAIN) => "feature_image"
          ),
          "options_attr" => array(
            array("data-icon" => "mp-icon mp-icon-field-type-text-box", "class" => "text"),
            array("data-icon" => "mp-icon mp-icon-field-type-text-box-multiline", "class" => "text"),
            array("data-icon" => "mp-icon mp-icon-field-type-image", "class" => "image")
          )

        );
          
        foreach ($fs as $set) {
        
          $fo = array();
          $fo_attr = array();
          
          foreach ($set->fields() as $field) {

            if ($type_class = MPFT::type_class($field->type)) {
              $image = call_user_func( array($type_class, "supports_image") ) ? " image" : "";
              $text = call_user_func( array($type_class, "supports_text") ) ? " text" : "";

              $fo[$field->display_label()] = $set->name.".".$field->name;
              $fo_attr[] = $field_options_attr[] = array("class" => $image.$text, "data-icon" => "mp-icon mp-icon-field-type-".$field->type);
            } 

            $field_options[$set->display_label()] = array("options" => $fo, "options_attr" => $fo_attr);

          }

        } 
                
        $dialogs .= WOOF_HTML::select(array("name" => "add-field-column-field-sets", "class" => "with-icons select2-source", "data-placeholder" => __("-- Select a Field --", MASTERPRESS_DOMAIN)), $field_options, "", $field_options_attr);
        $dialogs .= WOOF_HTML::close("div");
      
      }
      
    }
    

    
$html = <<<HTML

    {$dialogs}
    
    <div class="pull-up">
    {$control_style}


    <div class="f f-post-types">
      <p class="label">{$post_types_label}</p>
      <div class="fw">

      <div id="{$p}post-types-wrap" class="clearfix">
      {$post_types_checkboxes}
      </div>

      <div id="{$p}post-types-controls" class="controls">
        <button type="button" class="button button-small select-all">Select All</button>
        <button type="button" class="button button-small select-none">Select None</button>
      </div>
      <!-- /.controls -->

      </div>
    </div>
    <!-- /.f -->
    
    {$placeholder}
    {$basic}
    {$maxwidth}
    </div>

    <div class="source-wrap divider">
    <h4><i class="database"></i>{$data_source_label}</h4>  
    {$exclude_current}
    {$orderby}
    {$post_count}
    {$taxonomy_query}
    </div>
    
    <div class="divider">
    <h4><i class="menu-gray"></i>{$control_results_label}</h4>  
    {$grouping}
    {$results_input_length}
    {$results_row_style}
    
    <div id="{$p}results-row-item-prop-f" class="results-row-item-prop-f f">
    <p class="label">{$results_row_item_prop_label}</p> 
    
    <div class="fw">
      {$grid}
      <p class="note">{$results_row_item_prop_note}</p> 
    </div>
    
    </div>
    <!-- /.f -->
    
    </div>
  
    <div id="{$p}control-selections-wrap" class="divider">
    <h4><i class="buttons"></i>{$control_selections_label}</h4>  
    {$multi_layout}
    </div>

  
  
HTML;

    return $html;

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

    global $wpdb;

    require_once(ABSPATH . '/wp-admin/includes/upgrade.php');

    if ( !empty($wpdb->charset) )
        $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";

    if ( !empty($wpdb->collate) )
        $charset_collate .= " COLLATE $wpdb->collate";

    MPU::combine_type_styles();
    MPU::combine_type_scripts();

  
    // create database tables
    
    $table_name = MPU::table("post_types");
    
    $sql = "CREATE TABLE $table_name (
      id int(11) NOT NULL AUTO_INCREMENT,
      name varchar(100),
      plural_name varchar(100),
      disabled tinyint(1),
      labels text,
      description text,
      publicly_queryable tinyint(1),
      exclude_from_search tinyint(1),
      show_ui tinyint(1),
      show_in_menu tinyint(1),
      menu_position tinyint,
      menu_sub_position tinyint,
      menu_icon text, 
      menu_icon_2x text, 
      manage_sort_order varchar(255) DEFAULT 'post_date|desc', 
      capability_type varchar(100), 
      capabilities text, 
      map_meta_cap tinyint(1), 
      hierarchical tinyint(1),
      supports text,
      columns text,
      permalink_epmask varchar(255),
      has_archive tinyint(1), 
      rewrite text,
      query_var varchar(100),
      can_export tinyint(1), 
      show_in_nav_menus tinyint(1),
      visibility text,
      _builtin tinyint(1),
      _external tinyint(1),
      PRIMARY KEY  (name),
      KEY id (id)
    ) $charset_collate;";
  
    dbDelta($sql);


    // create database tables
    
    $table_name = MPU::table("templates");
    
    $sql = "CREATE TABLE $table_name (
      id varchar(255),
      supports text,
      visibility text,
      PRIMARY KEY  (id)
    ) $charset_collate;";
  
    dbDelta($sql);
        
    $table_name = MPU::table("taxonomies");
    
    $sql = "CREATE TABLE $table_name (
      id int(11) NOT NULL AUTO_INCREMENT,
      name varchar(100),
      plural_name varchar(100),
      object_type text,
      labels text, 
      disabled tinyint(1),
      show_in_nav_menus tinyint(1),
      show_manage_filter tinyint(1),
      show_ui tinyint(1),
      show_tagcloud tinyint(1),
      hide_term_ui tinyint(1),
      hierarchical tinyint(1),
      rewrite text, 
      query_var varchar(100),
      capabilities text, 
      columns text, 
      update_count_callback varchar(100),
      visibility text,
      title_icon text,
      title_icon_2x text,
      _builtin tinyint(1),
      _external tinyint(1),
      PRIMARY KEY  (name), 
      KEY id (id)
    ) $charset_collate;";
  
    dbDelta($sql);
    
    // remove "another_field" if it exists

    $row = $wpdb->get_row("SHOW COLUMNS FROM `" . $table_name . "` LIKE '_another_field'");

    if ($row) { 
      $wpdb->query( "ALTER TABLE $table_name DROP COLUMN `_another_field`" );
    } 


    $table_name = MPU::table("fields");

    $sql = "CREATE TABLE $table_name (
      id int(11) NOT NULL AUTO_INCREMENT,
      field_set_id int(11) NOT NULL,
      name varchar(255) NOT NULL,
      labels text,
      disabled tinyint(1),
      summary_options text,
      required tinyint(1) NOT NULL DEFAULT 0,
      allow_multiple tinyint(1) NOT NULL DEFAULT 0,
      visibility text, 
      icon text, 
      type varchar(100) NOT NULL, 
      type_options text,
      position int(11),
      capabilities text NULL,
      PRIMARY KEY  (id)
    ) $charset_collate;";

    dbDelta($sql);

    $table_name = MPU::table("field_sets");
    
    $sql = "CREATE TABLE $table_name (
      id int(11) NOT NULL AUTO_INCREMENT,
      name varchar(255) NOT NULL, 
      singular_name varchar(255) NOT NULL,
      disabled tinyint(1),
      position smallint, 
      allow_multiple BOOLEAN NOT NULL DEFAULT 1,
      visibility text, 
      icon text, 
      labels text, 
      expanded tinyint(1),
      sidebar tinyint(1),
      type varchar(20),
      versions int(11) NOT NULL DEFAULT 10,
      capabilities text NULL,
      PRIMARY KEY  (id)
    ) $charset_collate;";

    dbDelta($sql);
    
    
   
    // a site-specific custom table to store metadata for taxonomy terms
 
    $table_name = MPU::table("termmeta", "mp_", false);
    
    $sql = "CREATE TABLE $table_name (
      tmeta_id int(11) NOT NULL AUTO_INCREMENT,
      term_id bigint(20) NOT NULL,
      taxonomy varchar(50) DEFAULT NULL,
      meta_key varchar(255) DEFAULT NULL,
      meta_value LONGTEXT,
      PRIMARY KEY  (tmeta_id),
      KEY term_id (term_id),
      KEY meta_key (meta_key)
    ) $charset_collate;";
  
    dbDelta($sql);

    // a site-specific custom table to store metadata for the site
 
    $table_name = MPU::table("sitemeta");
    
    $sql = "CREATE TABLE $table_name (
      smeta_id int(11) NOT NULL AUTO_INCREMENT,
      site_id int(11) NOT NULL,
      meta_key varchar(255) DEFAULT NULL,
      meta_value LONGTEXT,
      PRIMARY KEY  (smeta_id),
      KEY meta_key (meta_key)
    ) $charset_collate;";
  
    dbDelta($sql);
    
    
    $table_name = MPU::table("versions", "mp_", false);
    
    $sql = "CREATE TABLE $table_name (
      version_id int(11) NOT NULL AUTO_INCREMENT,
      date DATETIME NOT NULL,
      user_id int(11) NOT NULL,
      object_id bigint(20) NOT NULL,
      object_type varchar(50) NOT NULL,
      object_type_meta varchar(50) DEFAULT NULL,
      field_set_name varchar(255) NOT NULL,
      field_set_count int(11) NOT NULL,
      value LONGTEXT,
      PRIMARY KEY  (version_id),
      KEY field_set_name (field_set_name)
    ) $charset_collate;";
  
    dbDelta($sql);
    
    MPM_Taxonomy::insert_builtin();
    MPM_PostType::insert_builtin();
   
  }
コード例 #8
0
ファイル: mpv-taxonomies.php プロジェクト: verbazend/AWFA
  public function form($type) {
    $model = MasterPress::$model;
    
    global $meow_provider;
    
  ?>

    <?php MPV::messages(); ?>
  
    <input type="hidden" name="_builtin" value="<?php echo $model->_builtin ? "true" : "false" ?>" />
    <input type="hidden" name="_external" value="<?php echo $model->_external ? "true" : "false" ?>" />
    
    <div class="f">
      <label for="name" class="icon"><i class="script-php"></i><?php _e("<strong>Singular</strong> Name", MASTERPRESS_DOMAIN)?>:</label>
      <div class="fw">
        <input id="name_original" name="name_original" type="hidden" class="text mono key" maxlength="20" value="<?php echo $model->name ?>" />
        <input id="name_last" name="name_last" type="hidden" class="text mono key" maxlength="20" value="<?php echo $model->name ?>" />
        <input id="name" name="name" <?php MPV::read_only_attr($model->_builtin || $model->_external || MPC::is_edit()) ?> type="text" class="text mono key <?php echo MPV::read_only_class($model->_builtin || $model->_external) ?>" maxlength="20" value="<?php echo $model->name ?>" /><?php if (!$model->_builtin && !$model->_external) { ?><em class="required">(required)</em><?php } ?>
        <p>
          <?php _e("This is a unique identifier for the taxonomy in the WordPress API. It is not displayed, and by convention it <strong>must</strong> be a singular form, lowercase string with underscores to separate words.", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
      
      <p id="name_warning" class="warning">
		<i class="error-circle"></i>
        <?php _e("Note: check that you have definitely entered a <strong>singular word</strong> here, as the singular form of <em>Plural Name</em> is currently different to this value.", MASTERPRESS_DOMAIN) ?>
      </p>

    </div>
    <!-- /.f -->
    
    <div class="f">
      <label for="plural_name" class="icon"><i class="script-php"></i><?php _e("<strong>Plural</strong> Name", MASTERPRESS_DOMAIN)?>:</label>
      <div class="fw">
        <input id="plural_name" name="plural_name" <?php MPV::read_only_attr($model->_builtin || $model->_external || MPC::is_edit()) ?> type="text" value="<?php echo $model->plural_name ?>" class="text mono key <?php echo MPV::read_only_class($model->_builtin || $model->_external) ?>" /><?php if (!$model->_builtin && !$model->_external) { ?><em class="required">(required)</em><?php } ?>
        <p>
          <?php _e("The plural form of <em>Singular Name</em>, following the same naming conventions", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    
    <div class="f clearfix">
      <label id="label-title_icon" for="title_icon" class="icon"><i class="image-small"></i><?php _e("Icon", MASTERPRESS_DOMAIN) ?>:</label>
      <div class="fw">
        <div id="icon-file-uploader" class="icon-uploader file-uploader { ids: { drop: 'menu_icon_drop_area' }, input: '#title_icon', inputName: 'title_icon_ul', base_url: '<?php echo MASTERPRESS_GLOBAL_CONTENT_URL ?>', params: { dir: 'menu-icons/' }, limit: 1, lang: { buttonChoose: '<?php _e("Choose From Computer&hellip;", MASTERPRESS_DOMAIN) ?>', buttonReplace: '<?php _e("Replace file&hellip;", MASTERPRESS_DOMAIN) ?>' } }">

          <div id="menu_icon_drop_area" class="drop-area"><?php _e("Drop file here to upload", MASTERPRESS_DOMAIN) ?></div>

          <?php 
              
          $file_name = $model->title_icon;
          $file_class = "";
          $clear_class = "";
          
          if ($file_name == "") {
            $file_name = __("( None )", MASTERPRESS_DOMAIN);
            $file_class = "name-none";
            $clear_class = "hidden";
          }
          
          ?>
              
          <div class="file">
            <span class="preview" style="background-image: url('<?php echo MPU::menu_icon_url($model->title_icon, true, "taxonomy") ?>');"></span><span data-none="<?php echo __("( None )", MASTERPRESS_DOMAIN) ?>" class="name <?php echo $file_class ?>"><?php echo $file_name ?></span>
            <button type="button" class="<?php echo $clear_class ?> clear ir" title="<?php _e("Clear", MASTERPRESS_DOMAIN) ?>">Clear</button>
          </div>
                            
          <input id="title_icon" name="title_icon" value="<?php echo $model->title_icon ?>" type="hidden" />
          <div class="uploader-ui"></div>

        </div>
        <!-- /.file-uploader -->
		
		    
		    <?php MPV::icon_select($model->title_icon, "title-icon-select", "title_icon_select", "icon-file-uploader"); ?>
	      
		
      </div>
    </div>
    <!-- /.f -->
    
    <?php if (!$model->_external) : ?>

    <div class="f">
      <label for="disabled" class="icon"><i class="slash"></i><?php _e("Disabled", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="disabled" name="disabled" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->disabled ) ?> class="checkbox" />
        <p class="checkbox-alt-label { for_el: '#disabled' }">
          <?php _e("disabling a taxonomy will keep its definition in the database but it will not be registered in WordPress, which will often be <strong>preferable to deleting it</strong> entirely.", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    <?php endif; ?>
    

    <?php if (!$model->_builtin && !$model->_external) : ?>

    <div class="f">
      <label for="hierarchical" class="icon"><i class="hierarchy"></i><?php _e("Hierarchical", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="hierarchical" name="hierarchical" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->hierarchical ) ?> class="checkbox" />
        <p class="checkbox-alt-label { for_el: '#hierarchical' }">
          <?php _e("hierarchical taxonomies are like WordPress <em>Categories</em>, whereas non-hierarchical taxonomies are like WordPress <em>Tags</em>.", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

   
    <div class="f">
      <label for="show_ui" class="icon"><i class="metabox-menu"></i><?php _e("Show UI", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_ui" name="show_ui" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_ui ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_ui' }">
          <?php _e("unchecking this will internalize this taxonomy, hiding it from both the admin menus and the edit post interface", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    <div class="f">
      <label for="hide_term_ui" class="icon"><i class="metabox-tags-small"></i><?php _e("Hide Standard Terms UI", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="hide_term_ui" name="hide_term_ui" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->hide_term_ui ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#hide_term_ui' }">
          <?php _e("hides the standard interface for assigning terms from this taxonomy to posts.<br>This may be useful if you are solely using this taxonomy to provide the values<br>for a <em>Related Terms</em> field.", MASTERPRESS_DOMAIN); ?>
        </p>
      </div>
    </div>
    <!-- /.f -->

    <div class="f">
      <label for="show_in_nav_menus" class="icon"><i class="menu-gray"></i><?php _e("Show in Nav Menus", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_in_nav_menus" name="show_in_nav_menus" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_in_nav_menus ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_in_nav_menus' }">
          <?php _e("allows this taxonomy to be selected in navigation menus", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>
    </div>
    <!-- /.f -->

    <div class="f">
      <label for="show_tagcloud" class="icon"><i class="tag-cloud size-20"></i><?php _e("Show Tag Cloud", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_tagcloud" name="show_tagcloud" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_tagcloud ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_tagcloud' }">
          <?php _e("check to allow the Tag Cloud widget to use this taxonomy", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>
    </div>
    <!-- /.f -->

    
    <div class="f">
      <label for="show_manage_filter" class="icon"><i class="funnel"></i><?php _e("Show Manage Filter", MASTERPRESS_DOMAIN) ?>?</label>
      <div class="fw">
        <input id="show_manage_filter" name="show_manage_filter" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->show_manage_filter ) ?> class="checkbox" />

        <p class="checkbox-alt-label { for_el: '#show_manage_filter' }">
          <?php _e("show a drop-down filter list of terms above post listings attached to this taxonomy", MASTERPRESS_DOMAIN); ?> 
        </p>
      </div>
    </div>
    <!-- /.f -->

    <?php endif; // !$model->_builtin ?>

    
	

  
    <?php if (!$model->_external) : ?>

    <div class="fs fs-post-types">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="pins"></i><strong><?php _e("Post Types", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("associate post types with this taxonomy", MASTERPRESS_DOMAIN) ?></h3>
        <div class="buttons">
          <button class="button button-small button-select-all" type="button"><?php _e('Select <strong class="all">All</strong>', MASTERPRESS_DOMAIN) ?></button>
          <button class="button button-small button-select-none" type="button"><?php _e('Select <strong class="none">None</strong>', MASTERPRESS_DOMAIN) ?></button>
        </div>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
        
        <?php $post_types = MPM_PostType::find(array("orderby" => "name ASC")); ?>
        
        <?php foreach ($post_types as $post_type) : $disabled = $post_type->disabled ? ' disabled' : ''; $disabled_title = $post_type->disabled ? __("This post type is disabled", MASTERPRESS_DOMAIN) : ''; $builtin = $post_type->_builtin ? '&nbsp;'.__('(Built-in)', MASTERPRESS_DOMAIN) : ''; ?>
        <div class="fw">
          <input id="post_types_<?php echo $post_type->name ?>" name="post_types[]" value="<?php echo $post_type->name ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $model->linked_to_post_type($post_type) || MPV::in_post_array("post_types", $post_type->name) ) ?> class="checkbox" />
          <label for="post_types_<?php echo $post_type->name ?>" class="checkbox <?php echo $disabled ?>" title="<?php echo $disabled_title ?>"><?php echo $post_type->labels["name"] ?><span><?php echo $builtin ?></span></label>
        </div>
        <!-- /.fw -->
        
        <?php endforeach; ?>
        
        
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <?php endif; ?>

    <script id="custom-column-template" type="text/html">
    <li class="column clearfix">
      <div class="head">
        <input name="columns[{{index}}][title]" value="Column" type="text" class="text" />
        <input name="columns[{{index}}][disabled]" value="" type="hidden" class="disabled" />
        <span class="handle"></span>
      </div>
  
      <div class="body">
        <textarea name="columns[{{index}}][content]" class="column-content mono editable"></textarea>
      </div>
      
      <div class="foot">
      <div>
        <button class="text remove"><i></i><?php _e("Remove") ?></button>
      </div>
      </div>

    </li>
    
    </script>
    

    <div class="fs fs-column-builder">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="grid"></i><strong><?php _e("Columns") ?></strong> - <?php _e("specify the columns shown in the manage listing for terms in this taxonomy") ?></h3>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">

        
        <div class="columns-clip">
        
        <div class="columns-wrap clearfix">
        
        <ul class="columns clearfix">
        
          <?php 
          
          $count = 0; 
          $core_enabled = array(); 
          
          ?>
          
          <?php foreach ($model->columns() as $column) : ?>
          <?php
            
            $class = array("column clearfix");
            
            $disabled = "";
            
            $core = "";
            $title = "";
            
						$title_readonly = "";

            if (isset($column["title"])) {
              $title = $column["title"];
            }
          
            $content = "";
            
            if (isset($column["title_readonly"])) {
              $title_readonly = ' readonly="true" title="'.__("This title cannot be changed, as it dynamically displays the active post type").'" ';
            }
            
            if (isset($column["content"])) {
              $content = stripslashes($column["content"]);
            }
            
            
            
            if (isset($column["core"])) {
              $core = $column["core"];
              $content = "{{col.".$core."}}";
            }
            
            if (isset($column["disabled"])) {
              $disabled = $column["disabled"];
            }
            
            if ($core != "") {
              $class[] = "core";
              $class[] = $core;
              
              $data_core = ' data-core="'.$core.'" ';
            }
            
            if ($core == "cb") {
              $class[] = "checkbox nosort";
            } 
            
            if ($disabled == "yes") {
              $class[] = "disabled";
            } else {
              if ($core != "") {
                $core_enabled[] = $core;
              }
            }
            
            
            
          
          ?>
          
          
          <li <?php echo $data_core ?> class="<?php echo implode(" ", $class) ?>">
            <div class="head">
              <?php if ($core == "cb") : ?>
              <input type="checkbox" />
              <input name="columns[<?php echo $count ?>][core]" value="cb" type="hidden" />
              <?php else: ?>
                
                <input name="columns[<?php echo $count ?>][title]" <?php echo $title_readonly ?> value="<?php echo $title ?>" type="text" class="text" />
                
                <?php if ($core != "") : ?>
                <input name="columns[<?php echo $count ?>][core]" value="<?php echo $core ?>" type="hidden" />
                <?php endif; ?>
                
                <input name="columns[<?php echo $count ?>][disabled]" value="<?php echo $disabled ?>" type="hidden" class="disabled" />
                <span class="handle"></span>
  
              <?php endif; ?>
            </div>
            <!-- /.head -->

            <div class="body clearfix">
              <?php if ($core == "cb") : ?>
              <input type="checkbox" />
              <?php else: ?>
                
                <?php if ($core == "comments") : ?>
                <span class="icon"></span>
                <textarea name="columns[<?php echo $count ?>][content]" readonly="true" class="content mono readonly hidden"></textarea>
                <?php elseif ($core != "") : ?>
                <textarea name="columns[<?php echo $count ?>][content]" title="<?php _e("Content cannot be changed as this is a built-in column") ?>" readonly="true" class="content mono readonly"><?php echo $content ?></textarea>
                <?php else : ?>
                <textarea name="columns[<?php echo $count ?>][content]" class="content mono editable" style="z-index: <?php echo 200 - $count ?>"><?php echo $content ?></textarea>
                <?php endif; ?>
              
              <?php endif; ?>
            </div>
            
            <div class="foot">
            <div>
              <?php if ($core != "cb" && $core != "title") : ?>
              <button type="button" class="text remove"><i></i><?php _e("Remove") ?></button>
              <?php endif; ?>
            </div>
            </div>

          </li>
          
          <?php $count++; ?>

          <?php endforeach; ?>

        </ul>
      
        </div>
        <!-- /.columns-wrap -->

        <div class="core-columns">
          <div class="f">
            <p class="label"><i class="wall"></i><?php _e("Built-in columns:", MASTERPRESS_DOMAIN) ?></p>
            
            <?php
              
              $core_columns = array(
                "Name" => "name",
                "Description" => "description",
                "Slug" => "slug",
                "[Post Type]" => "posts",
              );
                
            ?>
            
            <?php foreach ($core_columns as $label => $key) : ?>
              
            <?php
          
            $checked_attr = WOOF_HTML::checked_attr(in_array($key, $core_enabled)); 
            $style = "";
            
            $supports = explode(",", $model->supports);
            
            if ($key == "categories" && !$model->linked_to_taxonomy_name("category")) {
              $style = 'style="display: none" ';
            } else if ($key == "tags" && !$model->linked_to_taxonomy_name("post_tag")) {
              $style = 'style="display: none" ';
            } else if ($key == "author" && !in_array("author", $supports)) {
              $style = 'style="display: none" ';
            } else if ($key == "comments" && !in_array("comments", $supports)) {
              $style = 'style="display: none" ';
            }
            
            
            ?>
              
            <div <?php echo $style ?> id="fw-core-column-<?php echo $key ?>" class="fw">
              
              <input id="core-column-<?php echo $key ?>" <?php echo $checked_attr ?> value="<?php echo $key ?>" type="checkbox" class="checkbox" />
              <label for="core-column-<?php echo $key ?>" class="checkbox"><?php echo $label ?></label>
              
            </div>
            <!-- /.fw -->
            
            <?php endforeach; ?>
          
          </div>
        
        </div>
        <!-- /.core-columns -->


        <?php if (MPC::is_edit()) : ?>

        <style type="text/css">
        <?php foreach (MPFT::type_keys() as $key) : ?>
        .select2-results .field-type-<?php echo $key ?>, .select2-container .field-type-<?php echo $key ?> { background-repeat: no-repeat; background-image: url(<?php echo MPU::type_icon_url($key) ?>); }
        <?php endforeach; ?>
        </style>

          
        <div id="dialog-fields" data-title="<?php _e("Select a Field to Display in the Column", MASTERPRESS_DOMAIN) ?>">
          <?php
          
          $fs = $meow_provider->taxonomy_field_sets($model->name);

          $field_options = array();
          $field_options[""] = "";

          $field_options_attr = array("");
          
          foreach ($fs as $set) {
            
            $fo = array();
            $fo_attr = array();
            
            foreach ($set->fields() as $field) {
              $fo[$field->display_label()] = $set->name.".".$field->name;
              $fo_attr[] = $field_options_attr[] = array("data-icon" => "mp-icon field-type-".$field->type);
            }

            $field_options[$set->display_label()] = array("options" => $fo, "options_attr" => $fo_attr);
          } 
                    
          echo WOOF_HTML::select(array("id" => "add-field-column-field-sets", "name" => "add-field-column-field-sets", "class" => "with-icons select2-source", "data-placeholder" => __("-- Select a Field --", MASTERPRESS_DOMAIN)), $field_options, "", $field_options_attr);

          ?>
        </div>
        <!-- /#dialog-fields -->
        
        <?php endif; ?>
                
        <div class="custom-columns">
          <?php if (MPC::is_edit() && count($field_options) > 1) : ?>
          
          <div class="control">
            <button id="add-field-column" type="button" class="text add field"><i></i><?php _e('<em class="create">Add</em> <b>Field</b> Column', MASTERPRESS_DOMAIN) ?></button>
          </div>

          <?php endif; ?>

          <div class="control">
            <button id="add-custom-column" type="button" class="text add"><i></i><?php _e('<em class="create">Add</em> Custom Column', MASTERPRESS_DOMAIN) ?></button>
          </div>
        </div>
        <!-- /.custom-columns -->
        
        </div>
        <!-- /.columns-clip -->

      </div>
      </div>

    </div>
    <!-- /.fs -->
    
    
    <?php
    
    if (is_multisite() && MASTERPRESS_MULTISITE_SHARING) {
    
      $args["supports"] = array("multisite");
      
      $args["labels"] = array(
        "title" =>  __("control the visibility of this Taxonomy within WordPress", MASTERPRESS_DOMAIN),   
        "title_multisite" =>  __("specify the sites in the multisite network that this Taxonomy is available in", MASTERPRESS_DOMAIN),   
        "multisite_all" => __( "All Sites" )
      );

      MPV::fs_visibility( $model, $args ); 
    
    }
    
    ?>
    
    
    <?php if (!$model->_builtin && !$model->_external) : ?>

    <div class="fs fs-url-options">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="globe"></i><strong><?php _e("URL Options", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("controls how your taxonomy is accessible via URLs in your site", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
  
    
      <div class="fsc">
      <div class="fscb">
      
      <div class="f">
        <label for="rewrite_slug" class="text"><?php _e("Rewrite Slug", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          <input id="rewrite_slug" name="rewrite[slug]" type="text" value="<?php echo $model->rewrite["slug"] ?>" class="text mono" />
          <p>
            <?php _e("The slug prepended to posts attached to this taxonomy in the URL structure.", MASTERPRESS_DOMAIN); ?><br />
            <?php _e("The default value follows the WordPress of using the lowercase sanitized version of <em>Singular Name</em>.", MASTERPRESS_DOMAIN); ?>
          </p>
        </div>
      </div>
      <!-- /.f -->
    
      <div class="fw">
        <input id="rewrite_with_front" name="rewrite[with_front]" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->rewrite["with_front"] ) ?> class="checkbox" />
        <label for="rewrite_with_front" class="checkbox"><?php _e("With Front? - <span>Append the above slug to the top level URL set in your permalink settings.</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->

      <div class="fw hierarchical-only">
        <input id="rewrite_hierarchical" name="rewrite[hierarchical]" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->rewrite["hierarchical"] ) ?> class="checkbox" />
        <label for="rewrite_hierarchical" class="checkbox"><?php _e("Hierarchical? - <span>Allow hierarchical urls, mirroring the hierarchy of the taxonomy.</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->
              
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <div class="fs fs-query-data-options">
      
      <div class="fst">
      <div class="fstb">
        <h3><i class="database"></i><strong><?php _e("Query &amp; Data Options", MASTERPRESS_DOMAIN) ?></strong> - <?php _e(" controls API access to this taxonomy in database queries and site searches", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>

      <div class="fsc">
      <div class="fscb">

      <div class="fw">
        
        <input id="query_allowed" name="query_allowed" type="checkbox" value="true" <?php echo WOOF_HTML::checked_attr( $model->meta("query_allowed") ) ?> class="checkbox" />
        <label for="query_allowed" class="checkbox"><?php _e("Allow Queries? - <span>Allow this taxonomy to be queried in the database.</span>", MASTERPRESS_DOMAIN); ?></label>
      </div>  
      <!-- /.fw -->
      
      <div class="f">
        <label for="query_var" class="text"><?php _e("Query Variable", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          <input id="query_var" name="query_var" type="text" value="<?php echo $model->query_var ?>" class="text mono" />
          <p>
            <?php _e('Enter the query variable used to query this taxonomy with <span class="tt">query_posts</span> or <span class="tt">WP_Query</span>. Generally this should simply be the default value of the <em>Singular Name</em>, unless you have a good reason to change it.', MASTERPRESS_DOMAIN) ?>
          </p>
        </div>
      </div>
      <!-- /.f -->

      <div class="f">
        <label for="update_count_callback" class="text"><?php _e("Update Count Callback", MASTERPRESS_DOMAIN) ?>:</label>
        <div class="fw">
          <input id="update_count_callback" name="update_count_callback" type="text" value="<?php echo $model->update_count_callback ?>" class="text mono" />
          <p>
            <?php _e("The name of a function that will be called to update the count of an associated post type.", MASTERPRESS_DOMAIN) ?>
          </p>
        </div>
      </div>
      <!-- /.f -->
      
      
      </div>
      </div>

    </div>
    <!-- /.fs -->
        
    <div class="fs fs-labels">
    
      <div class="fst">
      <div class="fstb">
        <h3><i class="label-string"></i><strong><?php _e("Labels", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("displayed throughout the WordPress administration UI", MASTERPRESS_DOMAIN) ?></h3>

        <div class="buttons">
          <button id="autofill-labels" class="button button-autofill" type="button"><?php _e('<strong>Auto-Fill</strong> Labels', MASTERPRESS_DOMAIN) ?></button>
        </div>
        
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
      
        <div class="f">
          <label for="label_singular_name"><?php _e("<em>Singular</em> Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_singular_name" name="labels[singular_name]" value="<?php echo $model->labels["singular_name"] ?>" type="text" class="text { tmpl: '{{singular_name}}' }" />
            <em class="recommended">(<?php _e("recommended", MASTERPRESS_DOMAIN) ?>)</em>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_name"><?php _e("<em>Plural</em> Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_name" name="labels[name]" value="<?php echo $model->labels["name"] ?>"  type="text" class="text { tmpl: '{{plural_name}}' }" />
            <em class="recommended">(<?php _e("recommended", MASTERPRESS_DOMAIN) ?>)</em>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_menu_name"><?php _e("Menu Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_menu_name" name="labels[menu_name]" value="<?php echo $model->labels["menu_name"] ?>" type="text" class="text { tmpl: '<?php _e("{{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_add_new"><?php _e("Search Items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_search_items" name="labels[search_items]" value="<?php echo $model->labels["search_items"] ?>"  type="text" class="text { tmpl: '<?php _e("Search {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_popular_items"><?php _e("Popular Items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_popular_items" name="labels[popular_items]" value="<?php echo $model->labels["popular_items"] ?>" type="text" class="text { tmpl: '<?php _e("Popular {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }"  />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_all_items"><?php _e("All Items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_all_items" name="labels[all_items]" value="<?php echo $model->labels["all_items"] ?>" type="text" class="text { tmpl: '<?php _e("All {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f hierarchical-only">
          <label for="label_parent_item"><?php _e("Parent Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_parent_item" name="labels[parent_item]" value="<?php echo $model->labels["parent_item"] ?>" type="text" class="text { tmpl: '<?php _e("Parent {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f hierarchical-only">
          <label for="label_parent_item_colon"><?php _e("Parent Item Colon:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_parent_item_colon" name="labels[parent_item_colon]" value="<?php echo $model->labels["parent_item_colon"] ?>" type="text" class="text { tmpl: '<?php _e("Parent {{singular_name}}:", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_edit_item"><?php _e("Edit Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_edit_item" name="labels[edit_item]" value="<?php echo $model->labels["edit_item"] ?>" type="text" class="text { tmpl: '<?php _e("Edit {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_update_item"><?php _e("Update Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_update_item" name="labels[update_item]" value="<?php echo $model->labels["update_item"] ?>" type="text" class="text { tmpl: '<?php _e("Update {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_add_new_item"><?php _e("Add New Item:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_add_new_item" name="labels[add_new_item]" value="<?php echo $model->labels["add_new_item"] ?>" type="text" class="text { tmpl: '<?php _e("Add New {{singular_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_new_item_name"><?php _e("New Item Name:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_new_item_name" name="labels[new_item_name]" value="<?php echo $model->labels["new_item_name"] ?>" type="text" class="text { tmpl: '<?php _e("New {{singular_name}} Name", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_separate_items_with_commas"><?php _e("Separate Items With Commas:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_separate_items_with_commas" name="labels[separate_items_with_commas]" value="<?php echo $model->labels["separate_items_with_commas"] ?>" type="text" class="text { tmpl: '<?php _e("Separate {{plural_name}} with commas", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_add_or_remove_items"><?php _e("Add or remove items:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_add_or_remove_items" name="labels[add_or_remove_items]" value="<?php echo $model->labels["add_or_remove_items"] ?>" type="text" class="text { tmpl: '<?php _e("Add or remove {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="label_choose_from_most_used"><?php _e("Choose from most used:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="label_choose_from_most_used" name="labels[choose_from_most_used]" value="<?php echo $model->labels["choose_from_most_used"] ?>" type="text" class="text { tmpl: '<?php _e("Choose from most used {{plural_name}}", MASTERPRESS_DOMAIN) ?>' }" />
          </div>
        </div>
        <!-- /.f -->
      
      </div>
      </div>

    </div>
    <!-- /.fs -->

    <div class="fs fs-capability-keys">

    
    <div class="fst">
      <div class="fstb">
        <h3><i class="key"></i><strong><?php _e("Capabilities", MASTERPRESS_DOMAIN) ?></strong> - <?php _e("the keys used to control access to this taxonomy", MASTERPRESS_DOMAIN) ?></h3>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb">
      
        <div class="f">
          <label for="capability_manage_terms"><?php _e("Manage Terms:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="capability_manage_terms" name="capabilities[manage_terms]" value="<?php echo $model->capabilities["manage_terms"] ?>" type="text" class="text mono" />
            <p class="note">
              <?php _e('<span class="tt">manage_categories</span> is the typical value', MASTERPRESS_DOMAIN) ?> 
            </p>
            
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="capability_edit_terms"><?php _e("Edit Terms:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="capability_edit_terms" name="capabilities[edit_terms]" value="<?php echo $model->capabilities["edit_terms"] ?>"  type="text" class="text mono" />
            <p class="note">
              <?php _e('<span class="tt">manage_categories</span> is the typical value', MASTERPRESS_DOMAIN) ?> 
            </p>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="capability_delete_terms"><?php _e("Delete Terms:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="capability_delete_terms" name="capabilities[delete_terms]" value="<?php echo $model->capabilities["delete_terms"] ?>"  type="text" class="text mono" />
            <p class="note">
              <?php _e('<span class="tt">manage_categories</span> is the typical value', MASTERPRESS_DOMAIN) ?> 
            </p>
          </div>
        </div>
        <!-- /.f -->

        <div class="f">
          <label for="capability_assign_terms"><?php _e("Assign Terms:", MASTERPRESS_DOMAIN); ?></label>
          <div class="fw">
            <input id="capability_assign_terms" name="capabilities[assign_terms]" value="<?php echo $model->capabilities["assign_terms"] ?>"  type="text" class="text mono" />
            <p class="note">
              <?php _e('<span class="tt">edit_posts</span> is the typical value', MASTERPRESS_DOMAIN) ?> 
            </p>
          </div>
        </div>
        <!-- /.f -->

      
      </div>
      </div>
      
      

    </div>
    <!-- /.fs -->

    
    <?php endif; // !$model->_builtin ?>

    

    <?php
  } // end form
コード例 #9
0
ファイル: mpc-post.php プロジェクト: verbazend/AWFA
  public static function request($vars) {

    global $typenow;

    
    if (!isset($vars["orderby"]) && isset($typenow)) {
    
      // there is currently no sort order applied
      $post_type = MPM_PostType::find_by_name($typenow);

      if ($post_type) {

        if (!$post_type->_external) {
          list($sort_field, $sort_order) = explode("|", $post_type->manage_sort_order);
          $vars["orderby"] = $sort_field;
          $vars["order"] = $sort_order;
        }
    
      }
    
    }

    return $vars;
  }
コード例 #10
0
ファイル: mpv.php プロジェクト: verbazend/AWFA
  public static function fs_visibility($model, $args = array()) {
  
    global $wf;
    
    $first = true;
    
    $r = array(
      "sites" => null,
      "templates" => null,
      "post_types" => null,
      "taxonomies" => null,
      "fields" => null,
      "roles" => null      
    );
    
    $r["labels"] = wp_parse_args(
      
      $args["labels"], 
      array(
          "title" => __("control the visibility of this object in your site", MASTERPRESS_DOMAIN),
          "title_multisite" => __("specify the network sites that this object is available in", MASTERPRESS_DOMAIN),   
          "title_post_types" => __("specify the post types that this object is available in", MASTERPRESS_DOMAIN),   
          "title_templates" => __("specify the templates that this object is available in", MASTERPRESS_DOMAIN),   
          "title_roles" => __("specify the user roles that this object is available in", MASTERPRESS_DOMAIN),   
          "title_taxonomies" => __("specify the taxonomies that this object is available in", MASTERPRESS_DOMAIN),   
          "title_fields" => __("control display of this field based on the value of another field in the set", MASTERPRESS_DOMAIN),   

          "radio_multisite" => __("Make avalable in:", MASTERPRESS_DOMAIN),

          "multisite_all" => __('<em class="all">All</em> sites in the network', MASTERPRESS_DOMAIN),   
          "multisite_allow" => __( '<em class="allow">Include</em> only in specific Sites'),
          "multisite_deny" => __( '<em class="deny">Exclude</em> from specific Sites'),
          "multisite_allow_note" => "",       
          "multisite_deny_note" => "",        

          "post_types_all" => __('<em class="all">All</em> Post Types', MASTERPRESS_DOMAIN),
          "post_types_none" => __('<em class="none">No</em> Post Types', MASTERPRESS_DOMAIN),
          "post_types_allow" => __('<em class="allow">Include</em> only in specific Post Types', MASTERPRESS_DOMAIN),
          "post_types_deny" => __('<em class="deny">Exclude</em> from specific Post Types', MASTERPRESS_DOMAIN),

          "templates_all" => __('<em class="all">All</em> Templates', MASTERPRESS_DOMAIN),
          "templates_allow" => __('<em class="allow">Include</em> only in specific Templates', MASTERPRESS_DOMAIN),
          "templates_deny" => __('<em class="deny">Exclude</em> from specific Templates', MASTERPRESS_DOMAIN),

          "roles_all" => __('<em class="all">All</em> User Roles', MASTERPRESS_DOMAIN),
          "roles_none" => __('<em class="none">No</em> User Roles', MASTERPRESS_DOMAIN),
          "roles_allow" => __('<em class="allow">Include</em> only in specific Roles', MASTERPRESS_DOMAIN),
          "roles_deny" => __('<em class="deny">Exclude</em> from specific Roles', MASTERPRESS_DOMAIN),
          
          "taxonomies_all" => __('<em class="all">All</em> Taxonomies', MASTERPRESS_DOMAIN),
          "taxonomies_none" => __('<em class="none">No</em> Taxonomies', MASTERPRESS_DOMAIN),
          "taxonomies_allow" => __('<em class="allow">Include</em> only in specific Taxonomies', MASTERPRESS_DOMAIN),
          "taxonomies_deny" => __('<em class="deny">Exclude</em> from specific Taxonomies', MASTERPRESS_DOMAIN),
          
          "fields_all" => __('No conditions', MASTERPRESS_DOMAIN),
          "fields_allow" => __('When another field <em class="allow">has a specific value</em>', MASTERPRESS_DOMAIN),
          "fields_deny" => __('When another field <em class="deny">does not have a specific value</em>', MASTERPRESS_DOMAIN)

      )
    );
    
    $r["supports"] = wp_parse_args($args["supports"], array());
    
    $r["defaults"] = wp_parse_args(
      $args["defaults"], 
      array(
        "multisite"   => "all",
        "post_types"  => "none",
        "templates"   => "all",
        "roles"       => "none",
        "taxonomies"  => "none",
        "fields"      => "all"
      )
    );

    
    if (isset($args["sites"])) {
      $r["sites"] = $args["sites"];
    }
    
    if (isset($args["templates"])) {
      $r["templates"] = $args["templates"];
    }
    
    if (isset($args["post_types"])) {
      $r["post_types"] = $args["post_types"];
    }
    
    if (isset($args["taxonomies"])) {
      $r["taxonomies"] = $args["taxonomies"];
    }
  
    if (isset($args["roles"])) {
      $r["roles"] = $args["roles"];
    }
    
    if (isset($args["fields"])) {
      $r["fields"] = $args["fields"];
    }
    
    if (is_array($r["sites"])) {
      $r["sites"] = implode(",", $r["sites"]);
    }

    if (is_array($r["templates"])) {
      //$r["templates"] = implode(",", $r["templates"]);
    }

    $supports = $r["supports"];
    $labels = $r["labels"];
    
    if ($r["supports"] && count($r["supports"])) :
  ?>
  
    <div class="fs fs-visibility clearfix">
      
      <div class="fst">
      <div class="fstb">
        <h3><i class="light-globe"></i><strong><?php _e("Availability", MASTERPRESS_DOMAIN) ?></strong> - <?php echo $labels["title"] ?></h3>
      </div>
      </div>
    
      <div class="fsc">
      <div class="fscb clearfix">

        <?php if (in_array("fields", $supports)) : ?>
        
        <?php $mode = self::visibility_mode($model->visibility, "fields", $r["defaults"]["fields"]); ?>
        
        <?php
        
        $fo = array("");
        $fo_attr = array(array());
        
        foreach ($r["fields"] as $field) {

          if ($type_class = MPFT::type_class($field->type)) {
            $fo[$field->display_label()] = $field->name;
            $fo_attr[] = array("class" => "mp-icon field-type-".$field->type);
          } 

        }
        
        $fields_select = WOOF_HTML::select(array("style" => "max-width: 280px", "id" => "visibility-fields", "name" => "visibility_fields", "class" => "with-icons select2-source", "data-placeholder" => __("-- Select a Field --", MASTERPRESS_DOMAIN)), $fo, "", $fo_attr);

        ?>

        <div class="fsg fsg-fields <?php echo $first ? "" : "divider" ?>">
              
          <h4><i class="question-octagon"></i><?php _e("Conditional Display", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_fields"] ?></span></h4>

          <div class="f clearfix">
            
            <div class="fsg-radios">
              
            <div class="fw fwl fw-all">
              <input id="visibility-type-fields-all" name="visibility_type[fields]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-fields-all" class="radio"><?php echo $labels["fields_all"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl fw-none">
              <input id="visibility-type-fields-allow" name="visibility_type[fields]" type="radio" value="none" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-fields-allow" class="radio"><?php echo $labels["fields_allow"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl fw-none">
              <input id="visibility-type-fields-deny" name="visibility_type[fields]" type="radio" value="none" <?php echo WOOF_HTML::checked_attr( $mode == "deny" ) ?> class="radio" />
              <label for="visibility-type-fields-deny" class="radio"><?php echo $labels["fields_deny"] ?></label>
            </div>
            <!-- /.fw -->

            </div>
            <!-- /.fsg-radios -->
          
            <div id="visibility-fields-options">
            
              <div id="fw-field" class="fw">
                <label for="visibility-fields" class="select2"><?php _e("Field:", MASTERPRESS_DOMAIN) ?></label>
                <?php echo $fields_select ?>
              </div>

              <div id="fw-value" class="fw">
                <label for="visibility-fields-value"><?php _e("Value:", MASTERPRESS_DOMAIN) ?></label>
                <textarea name="visibility_fields_value" class="mono"></textarea>
              </div> 
               
            
            </div>
            
          </div>
          <!-- /.f -->
        
        </div>
        <!-- /.fsg -->
        
        
        
        
        <?php $first = false; ?>
        
        <?php endif; ?>
        
        <?php if (in_array("post_types", $supports)) : ?>

          <?php
          
          if (is_null($r["post_types"])) {
            $available_post_types = MPM_PostType::find(array("orderby" => "name ASC"));
          } else {
            $available_post_types = $r["post_types"];
          }
          
          $mode = self::visibility_mode($model->visibility, "post_types", $r["defaults"]["post_types"]);
          
          ?>
          
          <div class="fsg fsg-post-types <?php echo $first ? "" : "divider" ?>">
              
          <h4><i class="pins"></i><?php _e("Post Types", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_post_types"] ?></span></h4>

          <div class="f clearfix">
            
            <div class="fsg-radios">
              
            <div class="fw fwl fw-all">
              <input id="visibility-type-post-types-all" name="visibility_type[post_types]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-post-types-all" class="radio"><?php echo $labels["post_types_all"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl fw-none">
              <input id="visibility-type-post-types-none" name="visibility_type[post_types]" type="radio" value="none" <?php echo WOOF_HTML::checked_attr( $mode == "none" ) ?> class="radio" />
              <label for="visibility-type-post-types-none" class="radio"><?php echo $labels["post_types_none"] ?></label>
            </div>
            <!-- /.fw -->
            
            <?php if (count($available_post_types)) : ?>
        

            <div class="fw fwl">
              <input id="visibility-type-post-types-allow" name="visibility_type[post_types]" type="radio" value="allow" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-post-types-allow" class="radio"><?php echo $labels["post_types_allow"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-post-types-deny" name="visibility_type[post_types]" type="radio" value="deny" <?php echo WOOF_HTML::checked_attr( $mode == "deny"  ) ?> class="radio" />
              <label for="visibility-type-post-types-deny" class="radio"><?php echo $labels["post_types_deny"] ?></label>
            </div>
            <!-- /.fw -->

            </div>
            <!-- /.fsg-radios -->

            
            <div id="visibility-post-types-list" class="list checkbox-list">
          
              
              <div class="items">
              <?php foreach ($available_post_types as $post_type) : $disabled = $post_type->disabled ? ' disabled' : ''; $disabled_title = $post_type->disabled ? __("This post type is disabled", MASTERPRESS_DOMAIN) : ''; $builtin = $post_type->_builtin ? '&nbsp;'.__('(Built-in)', MASTERPRESS_DOMAIN) : ''; ?>
              <?php
      
                $linked_to_post_type = false;

                // todo, update this code to use visibility

                if (MPC::is_edit()) {
                  $linked_to_post_type = $model->linked_to_post_type($post_type);
                }

                $checked = $linked_to_post_type;


                if ($mode == "deny") {
                  $checked = !$checked;
                } 
                
              ?>
            
              <?php if ($post_type->still_registered()) : ?>
            
              <div class="fw">
                <input id="visibility-post-types-<?php echo $post_type->name ?>" name="visibility_post_types[]" value="<?php echo $post_type->name ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $checked || MPV::in_post_array("post_types", $post_type->name) ) ?> class="checkbox" />
                <label for="visibility-post-types-<?php echo $post_type->name ?>" class="checkbox <?php echo $disabled ?>" title="<?php echo $disabled_title ?>"><?php echo $post_type->labels["name"] ?><span><?php echo $builtin ?></span></label>
              </div>
              <!-- /.fw -->
              
              <?php endif; ?>
            
              <?php endforeach; ?>
      
              </div>
              <!-- /.items -->
              

              <div class="controls">
                <button type="button" class="button list-select-all"><?php _e("Select All", MASTERPRESS_DOMAIN) ?></button>
                <button type="button" class="button list-select-none"><?php _e("Select None", MASTERPRESS_DOMAIN) ?></button>
              </div>
              <!-- /.controls -->
      
          
            </div>
            <!-- /#visibility-post-types -->
              
            <?php endif; ?>
          
          </div>
          <!-- /.f -->
          
          </div>
          <!-- /#fsg-post-types --> 
                  
        <?php $first = false; ?>
          
        
        <?php endif; // supports post_types ?>
        
        
        <?php if (in_array("templates", $supports)) : ?>
          
          <?php
          
          if (is_null($r["templates"])) {
            $available_templates = array_merge( array("Page" => "page.php"), get_page_templates() ); 
          } else {
            $available_templates = $r["templates"];
          }
          
          $mode = self::visibility_mode($model->visibility, "templates", $r["defaults"]["templates"]);
          
          ?>
          
          <div class="fsg fsg-templates <?php echo $first ? "" : "divider" ?>">
              
          <h4><i class="template"></i><?php _e("Templates", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_templates"] ?></span></h4>

          <div class="f clearfix">

            <div class="fsg-radios">

            <div class="fw fwl fw-all">
              <input id="visibility-type-templates-all" name="visibility_type[templates]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-templates-all" class="radio"><?php echo $labels["templates_all"] ?></label>
            </div>
            <!-- /.fw -->
            
            <div class="fw fwl">
              <input id="visibility-type-templates-allow" name="visibility_type[templates]" type="radio" value="allow" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-templates-allow" class="radio"><?php echo $labels["templates_allow"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-templates-deny" name="visibility_type[templates]" type="radio" value="deny" <?php echo WOOF_HTML::checked_attr( $mode == "deny" ) ?> class="radio" />
              <label for="visibility-type-templates-deny" class="radio"><?php echo $labels["templates_deny"] ?></label>
            </div>
            <!-- /.fw -->

            </div>
            <!-- /.fsg-radios -->
            
            <div id="visibility-templates-list" class="list checkbox-list">
          
              <?php if (count($available_templates)) : ?>

              <div class="items">
                
              <?php
              $templates = $model->vis("templates");
              $not_templates = $model->vis("not_templates");
              ?>
                
              <?php foreach ($available_templates as $name => $file) : ?>
                
              <?php 
                

              if ($mode == "deny") {
                $checked = MPV::in_csv($file, $not_templates);
              } else {
                $checked = MPV::in_csv($file, $templates);
              }
              
              ?>
              
              <div class="fw">
                <input id="templates_<?php echo WOOF_Inflector::underscore($file) ?>" name="visibility_templates[]" value="<?php echo $file ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $checked ) ?> class="checkbox" />
                <label for="templates_<?php echo WOOF_Inflector::underscore($file) ?>" class="checkbox"><span class="tt"><?php echo $file ?></span></label>
              </div>
              <?php endforeach; ?>
      
              </div>
              <!-- /.items -->
              

              <div class="controls">
                <button type="button" class="button list-select-all"><?php _e("Select All", MASTERPRESS_DOMAIN) ?></button>
                <button type="button" class="button list-select-none"><?php _e("Select None", MASTERPRESS_DOMAIN) ?></button>
              </div>
              <!-- /.controls -->
              
              <?php else: ?>
            
              <span class="soft-warning"><i class="warning-triangle"></i><?php sprintf( __("The Field Set <em>%s</em> is not yet associated with <em>any</em> field types, so this option is not yet available", MASTERPRESS_DOMAIN), $parent->display_label() ); ?></span>
            
              <?php endif; ?>
          
            </div>
            <!-- /#visibility-templates -->
          
          </div>
          <!-- /.f -->
          
          </div>
          <!-- /#fsg-templates --> 
                  
        <?php $first = false; ?>
        <?php endif; // supports templates ?>
        
        
        <?php if (in_array("taxonomies", $supports)) : ?>

          <?php
          
          if (is_null($r["taxonomies"])) {
            $available_taxonomies = MPM_Taxonomy::find();
          } else {
            $available_taxonomies = $r["taxonomies"];
          }
          
          $mode = self::visibility_mode($model->visibility, "taxonomies", $r["defaults"]["taxonomies"]);
          
          ?>
          
          <div class="fsg fsg-taxonomies <?php echo $first ? "" : "divider" ?>">
              
          <h4><i class="tags"></i><?php _e("Taxonomies", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_taxonomies"] ?></span></h4>

          <div class="f clearfix">

            <div class="fsg-radios">

            <div class="fw fwl fw-all">
              <input id="visibility-type-taxonomies-all" name="visibility_type[taxonomies]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-taxonomies-all" class="radio"><?php echo $labels["taxonomies_all"] ?></label>
            </div>
            <!-- /.fw -->
            
            <div class="fw fwl fw-all">
              <input id="visibility-type-taxonomies-none" name="visibility_type[taxonomies]" type="radio" value="none" <?php echo WOOF_HTML::checked_attr( $mode == "none" ) ?> class="radio" />
              <label for="visibility-type-taxonomies-none" class="radio"><?php echo $labels["taxonomies_none"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-taxonomies-allow" name="visibility_type[taxonomies]" type="radio" value="allow" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-taxonomies-allow" class="radio"><?php echo $labels["taxonomies_allow"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-taxonomies-deny" name="visibility_type[taxonomies]" type="radio" value="deny" <?php echo WOOF_HTML::checked_attr( $mode == "deny" ) ?> class="radio" />
              <label for="visibility-type-taxonomies-deny" class="radio"><?php echo $labels["taxonomies_deny"] ?></label>
            </div>
            <!-- /.fw -->

            </div>
            <!-- /.fsg-radios -->
            
            <div id="visibility-taxonomies-list" class="list checkbox-list">

              <?php if (count($available_taxonomies)) : ?>

              <?php
              
              $taxonomies = $model->vis("taxonomies");
              $not_taxonomies = $model->vis("not_taxonomies");
              
              ?>
              
              <div class="items">

              <?php foreach ($available_taxonomies as $tax) : ?>
                
              <?php 
              
              $tax_name = $tax->name;
              
              if ($mode == "deny") {
                $checked = MPV::in_csv($tax_name, $not_taxonomies);
              } else {
                $checked = MPV::in_csv($tax_name, $taxonomies);
              }
              
              ?>
              
              <?php if ($tax->still_registered()) : ?>

              <div class="fw">
                <input id="taxonomies_<?php echo WOOF_Inflector::underscore($tax_name) ?>" name="visibility_taxonomies[]" value="<?php echo $tax_name ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $checked ) ?> class="checkbox" />
                <label for="taxonomies_<?php echo WOOF_Inflector::underscore($tax_name) ?>" class="checkbox"><span class="tt"><?php echo $tax->display_label() ?></span></label>
              </div>

              <?php endif; ?>
              
              <?php endforeach; ?>
          
              </div>
              <!-- /.items -->
              

              <div class="controls">
                <button type="button" class="button list-select-all"><?php _e("Select All", MASTERPRESS_DOMAIN) ?></button>
                <button type="button" class="button list-select-none"><?php _e("Select None", MASTERPRESS_DOMAIN) ?></button>
              </div>
              <!-- /.controls -->
                
              <?php endif; ?>
          
            </div>
            <!-- /#visibility-taxonomies -->
          
          </div>
          <!-- /.f -->
          
          </div>
          <!-- /#fsg-taxonomies --> 
                  
        <?php $first = false; ?>
        <?php endif; // supports taxonomies ?>
        
        
        <?php if (in_array("roles", $supports)) : ?>

          <?php
          
          if (is_null($r["roles"])) {
            $available_roles = $wf->roles(); 
          } else {
            $available_roles = $r["roles"];
          }
          
          $mode = self::visibility_mode($model->visibility, "roles", $r["defaults"]["roles"]);
          
          ?>
          
          <div class="fsg fsg-roles <?php echo $first ? "" : "divider" ?>">
              
          <h4><i class="user-role"></i><?php _e("User Profiles", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_roles"] ?></span></h4>

          <div class="f clearfix">

            <div class="fsg-radios">

            <div class="fw fwl fw-all">
              <input id="visibility-type-roles-all" name="visibility_type[roles]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-roles-all" class="radio"><?php echo $labels["roles_all"] ?></label>
            </div>
            <!-- /.fw -->
            
            <div class="fw fwl fw-none">
              <input id="visibility-type-roles-none" name="visibility_type[roles]" type="radio" value="none" <?php echo WOOF_HTML::checked_attr( $mode == "none" ) ?> class="radio" />
              <label for="visibility-type-roles-none" class="radio"><?php echo $labels["roles_none"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-roles-allow" name="visibility_type[roles]" type="radio" value="allow" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-roles-allow" class="radio"><?php echo $labels["roles_allow"] ?></label>
            </div>
            <!-- /.fw -->

            <div class="fw fwl">
              <input id="visibility-type-roles-deny" name="visibility_type[roles]" type="radio" value="deny" <?php echo WOOF_HTML::checked_attr( $mode == "deny" ) ?> class="radio" />
              <label for="visibility-type-roles-deny" class="radio"><?php echo $labels["roles_deny"] ?></label>
            </div>
            <!-- /.fw -->

            </div>
            <!-- /.fsg-radios -->
            
            <div id="visibility-roles-list" class="list checkbox-list">
            
              <div class="items">

              <?php if (count($available_roles)) : ?>
                
              <?php
              
              $roles = $model->vis("roles");
              $not_roles = $model->vis("not_roles");
              
              ?>
              
              <?php foreach ($available_roles as $role) : ?>
                
              <?php 
              
              $role_name = $role->id();
              
              if ($mode == "deny") {
                $checked = MPV::in_csv($role_name, $not_roles);
              } else {
                $checked = MPV::in_csv($role_name, $roles);
              }
              
              ?>
              
              <div class="fw">
                <input id="roles_<?php echo WOOF_Inflector::underscore($role_name) ?>" name="visibility_roles[]" value="<?php echo $role_name ?>" type="checkbox" <?php echo WOOF_HTML::checked_attr( $checked ) ?> class="checkbox" />
                <label for="roles_<?php echo WOOF_Inflector::underscore($role_name) ?>" class="checkbox"><span class="tt"><?php echo $role_name ?></span></label>
              </div>
              <?php endforeach; ?>
            
              </div>
              <!-- /.items -->
              

              <div class="controls">
                <button type="button" class="button list-select-all"><?php _e("Select All", MASTERPRESS_DOMAIN) ?></button>
                <button type="button" class="button list-select-none"><?php _e("Select None", MASTERPRESS_DOMAIN) ?></button>
              </div>
              <!-- /.controls -->
            
              <?php endif; ?>
          
            </div>
            <!-- /#visibility-roles -->
          
          </div>
          <!-- /.f -->
          
          </div>
          <!-- /#fsg-roles --> 
                  
        <?php $first = false; ?>
        <?php endif; // supports roles ?>
        
        
        
        
        <?php if (in_array("multisite", $supports) && is_multisite() && MASTERPRESS_MULTISITE_SHARING ) : ?>
          
          <?php $sites = $model->vis("sites"); ?>
          <?php $not_sites = $model->vis("not_sites"); ?>
          
          <?php 
        
            $mode = self::visibility_mode($model->visibility, "sites", $r["defaults"]["multisite"]);
    
            global $blog_id;
        
            $sites_args = array("public_only" => false);
          
            if (!is_null($r["sites"])) {
              $sites_args["include_id"] = $r["sites"];
            }
          
            $sites_options = array();
            $sites_options_attr = array();
          
            $the_site = $wf->site();
          
          
            // build the sites options
            foreach ($wf->sites( $sites_args ) as $site) {
            
              $attr = array();
            
              if ($site->id() == $the_site->id()) {
                $attr["class"] = "hl";
                $attr["title"] = __("This is the current site", MASTERPRESS_DOMAIN);
              }
            
              $sites_options_attr[] = $attr;
            
              $sites_options[$site->full_path()] = $site->id();
            }
      
          ?>
            
          <div class="fsg fsg-multisite <?php echo $first ? "" : "divider" ?>">
                
          <h4><i class="globe"></i><?php _e("Multi-site", MASTERPRESS_DOMAIN) ?><span>&nbsp;&nbsp;-&nbsp;&nbsp;<?php echo $labels["title_multisite"] ?></span></h4>

          <div class="f clearfix">

            <div class="fsg-radios">

            <div class="fw fw-all">
              <input id="visibility-type-sites-all" name="visibility_type[sites]" type="radio" value="all" <?php echo WOOF_HTML::checked_attr( $mode == "all" ) ?> class="radio" />
              <label for="visibility-type-sites-all" class="radio"><?php echo $labels["multisite_all"] ?></label>
            </div>
            
            <div class="fw">
              <input id="visibility-type-sites-allow" name="visibility_type[sites]" type="radio" value="allow" <?php echo WOOF_HTML::checked_attr( $mode == "allow" ) ?> class="radio" />
              <label for="visibility-type-sites-allow" class="radio"><?php echo $labels["multisite_allow"] ?></label>
            </div>
            
            <div class="fw">
              <input id="visibility-type-sites-deny" name="visibility_type[sites]" type="radio" value="deny" <?php echo WOOF_HTML::checked_attr( $mode == "deny" ) ?> class="radio" />
              <label for="visibility-type-sites-deny" class="radio"><?php echo $labels["multisite_deny"] ?></label>
            </div>
            
            </div>
            <!-- /.fsg-radios -->
            
            <div id="visibility-sites-list" class="sites-list">
          
            <?php 
          
              if ($mode == "allow") {
                $selected_sites = explode(",", $sites);
              } else if ($mode == "deny") {
                $selected_sites = explode(",", $not_sites);
              } else {
                $selected_site_objects = $wf->sites(array("public_only" => false));
                $selected_sites = $selected_site_objects->extract("id");
              }

            
              echo WOOF_HTML::select( 
                array("multiple" => "multiple", "id" => "visibility-sites", "name" => "visibility_sites[]"),
                $sites_options,
                $selected_sites,
                $sites_options_attr
              );

            ?>

            <?php if ($labels["multisite_allow_note"] != "") : ?>
            <p class="note"><?php echo $labels["multisite_allow_note"] ?></p>  
            <?php endif; ?>

            </div>
            <!-- /#visibility-sites-list -->

          
          </div>
          <!-- /.f -->
        
          </div>
          <!-- /#fsg-multisite --> 
          
        <?php $first = false; ?>
        <?php endif; // supports multisite ?>
        
        
        

      
      </div>
      </div>

    </div>
    <!-- /.fs -->
    
  <?php
    endif; // count support
  } 
コード例 #11
0
  public static function options_form( $options ) {

    $p = self::type_prefix(__CLASS__);

    $defaults = array();

    if (MPC::is_create()) {
      $defaults = array("maxwidth" => 580, "height" => 300, "control_style" => "drop_down_list");
    }

    $options = wp_parse_args( $options, $defaults );

    if (MPC::is_create()) {
      $options["post_types"] = array();
    }


    // setup variables to insert into the heredoc string
    // (this is required where we cannot call functions within heredoc strings)

    $post_types_label = __("Available Post Types:", MASTERPRESS_DOMAIN);

    $post_types_note = __("Select the post types available for selection in the field control", MASTERPRESS_DOMAIN);

    $post_types_items = array();

    MPM::incl("post-type");

    $post_types = MPM_PostType::find("orderby=disabled,name ASC");

    $post_types_selected = self::option_value($options, "post_types", array());

    foreach ($post_types as $post_type) {

      if (!$post_type->disabled && $post_type->show_ui && $post_type->still_registered()) {
        $post_types_items[$post_type->display_label()] = $post_type->name;
      }

    }

    $post_types_checkboxes = '';
        
    if (!is_array($post_types_selected)) {
      $post_types_selected = explode(",", $post_types_selected);
    }
  
    $id = $p."post-types-";
    
    foreach ($post_types as $post_type) {


      if (!$post_type->disabled && $post_type->show_ui && $post_type->still_registered()) {
      
        $value = $post_type->name;
        $label = $post_type->display_label();
      
        $id_suffix = WOOF::sanitize($value);
      
        $attr = array( "id" => $id."_".$id_suffix, "class" => "checkbox", "type" => "checkbox", "name" => "type_options[post_types][]", "value" => $value );
      
        if (in_array($value, $post_types_selected)) {
          $attr["checked"] = "checked";
        }
      
        $post_types_checkboxes .= WOOF_HTML::open("div", "class=fwi");
      
        $post_types_checkboxes .= WOOF_HTML::tag("input", $attr );
      
        $post_types_checkboxes .= WOOF_HTML::tag("label", array( "for" => $id."_".$id_suffix, "class" => "checkbox mp-icon-post-type-".$value ), $label );

        $post_types_checkboxes .= WOOF_HTML::close("div");

      }

    }
    


    $basic = MPFT::options_select_basic( $p, $options );
    $multi_layout = MPFT::options_select_multi_layout( $p, $options );
    $control_style = MPFT::options_select_control_style( $p, $options );
    $maxwidth = MPFT::options_maxwidth( $p, $options );
    $height = MPFT::options_height( $p, $options );
    $placeholder = MPFT::options_placeholder($p, $options);


    $control_selections_label = __("Selection Display - <span>settings for the display of the selected post types</span>", MASTERPRESS_DOMAIN); 



$html = <<<HTML

    {$control_style}

    <div class="f f-post-types">
      <p class="label">{$post_types_label}</p>
      <div class="fw">

      <div id="{$p}post-types-wrap">
      {$post_types_checkboxes}
      </div>

      <div id="{$p}post-types-controls" class="controls">
        <button type="button" class="button button-small select-all">Select All</button>
        <button type="button" class="button button-small select-none">Select None</button>
      </div>
      <!-- /.controls -->

      <p class="note">{$post_types_note}</p>
      </div>
    </div>
    <!-- /.f -->
    
    {$placeholder}
    {$basic}
    {$maxwidth}

    <div id="{$p}control-selections-wrap" class="divider">
    <h4><i class="buttons"></i>{$control_selections_label}</h4>  
    {$multi_layout}
    </div>
HTML;

    return $html;

  }
コード例 #12
0
ファイル: mpm-post-type.php プロジェクト: verbazend/AWFA
  public static function insert_builtin() {

    // add the appropriate built-in post types (page and post) if required
    // we'll ignore menu item, attachment, and revision since there's no MasterPress tweaks applicable to those  

    $post_type_post = MPM_PostType::find_by_name("post");

    if (!$post_type_post) {

      $post_type_post = new MPM_PostType();
    
      $post_type_post->set(      
        array( 
          "name" => "post",
          "plural_name" => "posts",
          "disabled" => false,
          "labels" => array(
            "name" => __("Posts", MASTERPRESS_DOMAIN),
            "singular_name" => __("Post", MASTERPRESS_DOMAIN),
            "add_new" => __("Add New", MASTERPRESS_DOMAIN),
            "add_new_item" => __("Add New Post", MASTERPRESS_DOMAIN),
            "edit" => __("Edit Post", MASTERPRESS_DOMAIN),
            "edit_item" => __("Edit Post", MASTERPRESS_DOMAIN),
            "new_item" => __("New Post", MASTERPRESS_DOMAIN),
            "view" => __("View Post", MASTERPRESS_DOMAIN),
            "view_item" => __("View Post", MASTERPRESS_DOMAIN),
            "search_items" => __("Search Posts", MASTERPRESS_DOMAIN),
            "not_found" => __("No posts found.", MASTERPRESS_DOMAIN),
            "not_found_in_trash" => __("No posts found in Trash.", MASTERPRESS_DOMAIN),
            "parent_item_colon" => "", 
            "menu_name" => __("Posts", MASTERPRESS_DOMAIN)
          ),
        
          "description" => "",
          "publicly_queryable" => true,
          "exclude_from_search" => false,
          "show_ui" => true,
          "show_in_menu" => true,
          "menu_position" => 5,
          "menu_sub_position" => 0,
          "menu_icon" => "menu-icon-posts.png",
          "manage_sort_order" => "post_date|desc",
          "capability_type" => "post",
          "capabilities" => array(),
          "map_meta_cap" => true,
          "hierarchical" => false,
          "supports" => "title,editor,author,thumbnail,excerpt,trackbacks,custom-fields,comments,revisions,page-attributes,post-formats",
          "permalink_epmask" => "EP_PERMALINK",
          "has_archive" => true,
          "rewrite" => array( "slug" => "", "with_front" => true, "feeds" => true, "pages" => false ),
          "query_var" => "post",
          "can_export" => true,
          "show_in_nav_menus" => true,
          "_builtin" => true,
          "_external" => false
        )
      );
    
      $post_type_post->insert();
    
    }
      
    $tax_post_tag = MPM_Taxonomy::find_by_name("post_tag");
    $tax_category = MPM_Taxonomy::find_by_name("category");
    
    if ( !$post_type_post->linked_to_taxonomy( $tax_post_tag ) ) {
      $post_type_post->link_taxonomy( $tax_post_tag );
    }

    if ( !$post_type_post->linked_to_taxonomy( $tax_category ) ) {
      $post_type_post->link_taxonomy( $tax_category );
    }

    
    $post_type_page = MPM_PostType::find_by_name("page");
    
    if (!$post_type_page) {

      $post_type_page = new MPM_PostType();
    
      $post_type_page->set(      
        array( 
          "name" => "page",
          "plural_name" => "pages",
          "disabled" => false,
          "labels" => array(
            "name" => __("Pages", MASTERPRESS_DOMAIN),
            "singular_name" => __("Page", MASTERPRESS_DOMAIN),
            "add_new" => __("Add New", MASTERPRESS_DOMAIN),
            "add_new_item" => __("Add New Page", MASTERPRESS_DOMAIN),
            "edit" => __("Edit Page", MASTERPRESS_DOMAIN),
            "edit_item" => __("Edit Page", MASTERPRESS_DOMAIN),
            "new_item" => __("New Page", MASTERPRESS_DOMAIN),
            "view" => __("View Page", MASTERPRESS_DOMAIN),
            "view_item" => __("View Page", MASTERPRESS_DOMAIN),
            "search_items" => __("Search Pages", MASTERPRESS_DOMAIN),
            "not_found" => __("No pages found.", MASTERPRESS_DOMAIN),
            "not_found_in_trash" => __("No pages found in Trash.", MASTERPRESS_DOMAIN),
            "parent_item_colon" => __("Parent Page", MASTERPRESS_DOMAIN), 
            "menu_name" => __("Pages", MASTERPRESS_DOMAIN)
          ),
        
          "description" => "",
          "publicly_queryable" => true,
          "exclude_from_search" => false,
          "show_ui" => true,
          "show_in_menu" => true,
          "menu_position" => 20,
          "menu_sub_position" => 0,
          "menu_icon" => "menu-icon-pages.png",
          "manage_sort_order" => "menu_order|asc",
          "capability_type" => "page",
          "capabilities" => array(),
          "map_meta_cap" => true,
          "hierarchical" => true,
          "supports" => "title,editor,author,thumbnail,excerpt,trackbacks,custom-fields,comments,revisions,page-attributes,post-formats",
          "permalink_epmask" => "1",
          "has_archive" => true,
          "rewrite" => array( "slug" => "", "with_front" => false, "feeds" => false, "pages" => true ),
          "query_var" => "page",
          "can_export" => true,
          "show_in_nav_menus" => true,
          "_builtin" => true,
          "_external" => false
        )
      );
      
      $post_type_page->insert();

    }
      

	$post_type_attachment = MPM_PostType::find_by_name("attachment");
    
    if (!$post_type_attachment) {

      $post_type_attachment = new MPM_PostType();
    
      $post_type_attachment->set(      
        array( 
          "name" => "attachment",
          "plural_name" => "attachments",
          "disabled" => false,
          "labels" => array(
            "name" => __("Media", MASTERPRESS_DOMAIN),
            "singular_name" => __("Media", MASTERPRESS_DOMAIN),
            "add_new" => __("Add New", MASTERPRESS_DOMAIN),
            "add_new_item" => __("Add New Post", MASTERPRESS_DOMAIN),
            "edit" => __("Edit Media", MASTERPRESS_DOMAIN),
            "edit_item" => __("Edit Media", MASTERPRESS_DOMAIN),
            "new_item" => __("New Post", MASTERPRESS_DOMAIN),
            "view" => __("View Media", MASTERPRESS_DOMAIN),
            "view_item" => __("View Media", MASTERPRESS_DOMAIN),
            "search_items" => __("Search Media", MASTERPRESS_DOMAIN),
            "not_found" => __("No media found.", MASTERPRESS_DOMAIN),
            "not_found_in_trash" => __("No media found in Trash.", MASTERPRESS_DOMAIN),
            "parent_item_colon" => __("Parent Post", MASTERPRESS_DOMAIN), 
            "menu_name" => __("Media", MASTERPRESS_DOMAIN)
          ),
        
          "description" => "",
          "publicly_queryable" => true,
          "exclude_from_search" => false,
          "show_ui" => true,
          "show_in_menu" => true,
          "menu_position" => 20,
          "menu_sub_position" => 0,
          "menu_icon" => "menu-icon-media.png",
          "manage_sort_order" => "menu_order|asc",
          "capability_type" => "post",
          "capabilities" => array(),
          "map_meta_cap" => true,
          "hierarchical" => true,
          "supports" => "title,editor,author,thumbnail,excerpt,trackbacks,custom-fields,comments,revisions,page-attributes,post-formats",
          "permalink_epmask" => "1",
          "has_archive" => true,
          "rewrite" => array( "slug" => "", "with_front" => false, "feeds" => false, "pages" => true ),
          "query_var" => "page",
          "can_export" => true,
          "show_in_nav_menus" => true,
          "_builtin" => true,
          "_external" => false
        )
      );
      
      $post_type_attachment->insert();

    }

	
  }
コード例 #13
0
ファイル: mpm-taxonomy.php プロジェクト: verbazend/AWFA
 public function post_types() {
   return MPM_PostType::find_by_in("name", $this->object_type(), "%s");
 }
コード例 #14
0
ファイル: mpv-masterplan.php プロジェクト: verbazend/AWFA
  function manage() {
    
    global $wf;
    
    ?>

    <?php MPV::messages() ?>
  
    <?php

    MPV::incl("post-types");
    MPV::incl("shared-field-sets");
    MPV::incl("templates");
    MPV::incl("taxonomies");
    MPV::incl("roles");
  
    $disabled = "";
  
    $view = MasterPress::$view;
    
    $post_types = MPM_PostType::find("orderby=disabled,name ASC");
    $taxonomies = MPM_Taxonomy::find("orderby=disabled,name ASC");
    $shared_field_sets = MPM_SharedFieldSet::find("orderby=disabled,name ASC");
    $templates = get_page_templates();
    $site_field_sets = MPM_SiteFieldSet::find("orderby=disabled,name ASC"); 
    $roles = $wf->roles(); 

    ?>

    <div class="fs fs-masterplan fs-with-tabs">
    
        
      <div class="fsc">
      <div class="fscb">
        
        <?php
            $tab = "";
            
            if (isset($_REQUEST["tab"])) {
              $tab = $_REQUEST["tab"];
            }
          ?>

          <?php 
            
            // check for restoreable backups

            
            $backups = array();
            
            if (file_exists(MASTERPRESS_CONTENT_MASTERPLANS_DIR)) {

            $iterator = new DirectoryIterator(MASTERPRESS_CONTENT_MASTERPLANS_DIR);
            
            foreach ($iterator as $file) {

              $file_name = $file->getFileName();
    
              if (substr($file_name, 0, 1) == ".") {
                continue;
              }
              
              if (preg_match("/\_backup\.(?:(.*)\.)?([0-9]+)\.masterplan\.zip/", $file_name, $matches)) {
                
                $tag = $matches[1];
                $date = $matches[2];
                
                $fdate = $wf->date_format("[date-time-long]", strtotime($date));
                
                $label = $fdate;
                
                if ($tag != "") {
                  $label = $fdate." ( ".$tag." )";
                }
                
                $backups[] = array("file" => $file_name, "label" => $label);
                
                
              }
              
            }
            
            }
          
          ?>
          
        <ul class="fs-tabs">
          <li><a href="#masterplan-overview" class="<?php echo $tab != '' ? '' : 'current' ?>"><span><i class="info"></i>Overview</span></a></li>
          <?php if (MasterPress::current_user_can("export_masterplan")) : ?>
          <li><a href="#masterplan-export" class="<?php echo $tab == "export" ? 'current' : '' ?>"><span><i class="arrow-curve-right"></i>Export</span></a></li>
          <?php endif; ?>
          <?php if (MasterPress::current_user_can("import_masterplan")) : ?>
          <li><a href="#masterplan-import" class="<?php echo $tab == "import" ? 'current' : '' ?>"><span class="import"><i class="arrow-curve-left"></i>Import</span></a></li>
          <?php endif; ?>
          <?php if (MasterPress::current_user_can("backup_masterplan")) : ?>
          <li><a href="#masterplan-backup" class="<?php echo $tab == "backup" ? 'current' : '' ?>"><span class="backup"><i class="buoy"></i>Backup</span></a></li>
          <?php endif; ?>
          <?php if (count($backups)) : ?>
          <?php if (MasterPress::current_user_can("restore_masterplan")) : ?>
          <li><a href="#masterplan-restore" class="<?php echo $tab == "restore" ? 'current' : '' ?>"><span class="restore"><i class="clock-history"></i>Restore</span></a></li>
          <?php endif; ?>
          <?php endif; ?>
        </ul>
    
<!-- OVERVIEW -->


        <div id="masterplan-overview" class="tab-panel <?php echo $tab != '' ? '' : 'current' ?>">
          
          <?php if (isset($_GET["import-complete"])) : ?>
          
          <ul class="mp-messages">
            <li class="success"><?php _e("Import Complete - your new site Masterplan is shown below.", MASTERPRESS_DOMAIN) ?></li>
          </ul>
          
          <?php endif; ?>

          <?php if (isset($_GET["restore-complete"])) : ?>
          
          <ul class="mp-messages">
            <li class="success"><?php _e("Restore Complete - your site Masterplan is shown below.", MASTERPRESS_DOMAIN) ?></li>
          </ul>
          
          <?php endif; ?>
        
          <div class="row first-row">
          
            <div class="col post-types">
            
              <?php 
              
              $count = 0;
              
              foreach ($post_types as $post_type) { 
                if ($post_type->still_registered()) {
                  $count++;
                }
              }
              
              ?>
                
              <h4><i class="pin"></i>
              <?php if (MasterPress::current_user_can("manage_post_types")) : ?>
              <a href="<?php echo MasterPress::admin_url("post-types", "manage") ?>" title="<?php _e("Manage Post Types", MASTERPRESS_DOMAIN) ?>" class="icon">
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>
              
              <?php echo WOOF::items_number( $count, __("<em>No</em> Post Types", MASTERPRESS_DOMAIN), __("<b>%d</b> Post Type", MASTERPRESS_DOMAIN), __("<b>%d</b> Post Types", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_post_types")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
            
              <div class="body">
              
                <ul class="count-<?php echo $count ?>">
                <?php foreach ($post_types as $post_type) : $default_icon = $post_type->menu_icon_exists() ? "" : "default-icon"; $field_sets = $post_type->post_type_field_sets(); $fsc = count($field_sets); $disabled = $post_type->disabled ? 'disabled ' : ''; $disabled_title = $post_type->disabled ? __('This post type is currently disabled', MASTERPRESS_DOMAIN) : ''; ?>
                  
                <?php if ($post_type->still_registered()) : ?>
                <li class="<?php echo $disabled ?>post-type-<?php echo $post_type->name ?> <?php echo $default_icon ?> linkify" data-name="<?php echo $post_type->name ?>" title="<?php echo $disabled_title ?>">
                  
                  <?php if (MasterPress::current_user_can("manage_post_types+edit_post_types")) : ?>
                  <a href="<?php echo MasterPress::admin_url("post-types", "edit", "id=".$post_type->id) ?>" class="item mp-icon-post-type mp-icon-post-type-<?php echo $post_type->name ?>">
                  <?php else: ?>
                  <div class="item mp-icon-post-type mp-icon-post-type-<?php echo $post_type->name ?>">  
                  <?php endif; ?>
                  
                  <?php echo WOOF::truncate($post_type->display_label(), "length=15&words=0") ?>

                  <?php if (MasterPress::current_user_can("manage_post_types+edit_post_types")) : ?>
                  </a>
                  <?php else: ?>
                  </div>  
                  <?php endif; ?>
                  
                  <?php if (MasterPress::current_user_can("manage_post_types+manage_post_type_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("post-types", "manage-field-sets", "parent=".$post_type->id) ?>" title="<?php _e("Manage Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></a>
                  <?php else : ?>
                  <div title="<?php _e("Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></div>
                  <?php endif; ?>
                    
                  <?php foreach ($post_type->taxonomies() as $tax) : ?> 
                  <span class="tax-link-<?php echo $tax->name ?> related-link asterisk"></span>
                  <?php endforeach; ?>

                  <?php foreach ($post_type->field_sets() as $fs) : ?>
                  <?php if ($fs->is_shared()) : ?>
                  <span class="shared-field-set-link-<?php echo $fs->name ?> related-link asterisk"></span>
                  <?php endif; ?>
                  <?php endforeach; ?>


                </li>
                <?php endif; ?>

                <?php endforeach; ?>
                
                <?php if (MasterPress::current_user_can("create_post_types")) : ?>
                <li class="divide"><a href="<?php echo MasterPress::admin_url("post-types", "create") ?>" class="create-link"><i></i><?php echo MPV::__create( MPV_PostTypes::__s() ) ?></a></li>
                <?php endif; ?>

                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->
          
          
            <div class="col taxonomies">
            
              <?php 
              
              $count = 0;
              
              foreach ($taxonomies as $tax) { 
                if ($tax->still_registered()) {
                  $count++;
                }
              }
              
              ?>
              
              <h4><i class="tag"></i>
              <?php if (MasterPress::current_user_can("manage_taxonomies")) : ?>
              <a href="<?php echo MasterPress::admin_url("taxonomies", "manage") ?>" title="<?php _e("Manage Taxonomies", MASTERPRESS_DOMAIN) ?>" class="icon">              
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>
              
              <?php echo WOOF::items_number( $count, __("<em>No</em> Taxonomies", MASTERPRESS_DOMAIN), __("<b>%d</b> Taxonomy", MASTERPRESS_DOMAIN), __("<b>%d</b> Taxonomies", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_taxonomies")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
              
              <div class="body">
              
                <ul class="count-<?php $count ?>">
                <?php foreach ($taxonomies as $tax) : $field_sets = $tax->taxonomy_field_sets(); $fsc = count($field_sets); $disabled = $tax->disabled ? 'disabled ' : ''; $disabled_title = $tax->disabled ? __('This taxonomy is currently disabled', MASTERPRESS_DOMAIN) : ''; ?>
                
                <?php if ($tax->still_registered()) : ?>

                <li class="<?php echo $disabled ?> linkify" data-name="<?php echo $tax->name ?>" title="<?php echo $disabled_title ?>">
                  
                  <?php if (MasterPress::current_user_can("manage_taxonomies+edit_taxonomies")) : ?>
                  <a href="<?php echo MasterPress::admin_url("taxonomies", "edit", "id=".$tax->id) ?>" class="item mp-icon-taxonomy mp-icon-taxonomy-<?php echo $tax->name ?>">
                  <?php else: ?>
                  <div class="item mp-icon-taxonomy mp-icon-taxonomy-<?php echo $tax->name ?>">  
                  <?php endif; ?>
                  
                  <?php echo WOOF::truncate($tax->display_label(), "length=15&words=0") ?>
                  
                  <?php if (MasterPress::current_user_can("manage_taxonomies+edit_taxonomies")) : ?>
                  </a>
                  <?php else: ?>
                  </div>  
                  <?php endif; ?>
                  
                  
                  <?php if (MasterPress::current_user_can("manage_taxonomies+manage_taxonomy_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("taxonomies", "manage-field-sets", "parent=".$tax->id) ?>" title="<?php _e("Manage Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></a>
                  <?php else : ?>
                  <div title="<?php _e("Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></div>
                  <?php endif; ?>


                  <?php foreach ($tax->post_types() as $pt) : ?> 
                  <span class="post-type-link-<?php echo $pt->name ?> related-link asterisk"></span>
                  <?php endforeach; ?>

                  <?php foreach ($tax->field_sets() as $fs) : ?>
                  <?php if ($fs->is_shared()) : ?>
                  <span class="shared-field-set-link-<?php echo $fs->name ?> related-link asterisk"></span>
                  <?php endif; ?>
                  <?php endforeach; ?>
                
                </li>
                
                <?php endif; ?>

                <?php endforeach; ?>
                
                <?php if (MasterPress::current_user_can("create_taxonomies")) : ?>
                <li class="divide"><a href="<?php echo MasterPress::admin_url("taxonomies", "create") ?>" class="create-link"><i></i><?php echo MPV::__create( MPV_Taxonomies::__s() ) ?></a></li>
                <?php endif; ?>
                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->
          
            <div class="col field-sets shared-field-sets">
            
            
              <h4><i class="metabox-share"></i>
              <?php if (MasterPress::current_user_can("manage_shared_field_sets")) : ?>
              <a href="<?php echo MasterPress::admin_url("shared-field-sets", "manage") ?>" title="<?php _e("Manage Shared Field Sets", MASTERPRESS_DOMAIN) ?>" class="icon">              
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>
              
              <?php echo WOOF::items_number( count($shared_field_sets), __("<em>No</em> Shared Field Sets", MASTERPRESS_DOMAIN), __("<b>%d</b> Shared Field Set", MASTERPRESS_DOMAIN), __("<b>%d</b> Shared Field Sets", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_shared_field_sets")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
            
              <div class="body">
              
                <ul class="count-<?php echo count($shared_field_sets) ?>">
                <?php foreach ($shared_field_sets as $field_set) : $multiple = $field_set->allow_multiple ? "allow-multiple" : ''; $disabled = $field_set->disabled ? 'disabled ' : ''; $disabled_title = $field_set->disabled ? __('This shared field set is currently disabled', MASTERPRESS_DOMAIN) : ''; ?>
                <li class="<?php echo $disabled ?>shared-field-set-<?php echo $field_set->name ?> linkify" data-name="<?php echo $field_set->name ?>" title="<?php echo $disabled_title ?>">



                  <?php if (MasterPress::current_user_can("manage_shared_field_sets+edit_shared_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("shared-field-sets", "edit", "id=".$field_set->id) ?>" title="<?php _e("Edit Shared Field Set", MASTERPRESS_DOMAIN) ?>" class="item <?php echo $multiple ?>">
                  <?php else: ?>
                  <div class="item <?php echo $multiple ?>">  
                  <?php endif; ?>

                  <?php if ($multiple) : ?>
                  <i class="metabox-add-remove"></i>
                  <?php else : ?>
                  <i class="metabox"></i>
                  <?php endif; ?>
                  
                  <?php echo $field_set->display_label() ?></a>
                  
                  <?php if (MasterPress::current_user_can("manage_shared_field_sets+edit_shared_field_sets")) : ?>
                  </a>
                  <?php else: ?>
                  </div>
                  <?php endif; ?>
                
                  <?php foreach ($field_set->post_types() as $post_type) : ?> 
                  <span class="post-type-link-<?php echo $post_type->name ?> related-link asterisk"></span>
                  <?php endforeach; ?>

                  <?php foreach ($field_set->taxonomies() as $tax) : ?> 
                  <span class="tax-link-<?php echo $tax->name ?> related-link asterisk"></span>
                  <?php endforeach; ?>
                
                  <?php foreach ($field_set->roles() as $role) : ?> 
                  <span class="role-link-<?php echo $role->id ?> related-link asterisk"></span>
                  <?php endforeach; ?>
                
                </li>
                <?php endforeach; ?>
                
                <?php if (MasterPress::current_user_can("create_shared_field_sets")) : ?>
                <li class="divide"><a href="<?php echo MasterPress::admin_url("shared-field-sets", "create") ?>" class="create-link"><i></i><?php echo MPV::__create( MPV_SharedFieldSets::__s() ) ?></a></li>
                <?php endif; ?>

                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->
          
          
          </div>
          <!-- /.row -->
        
          <div class="row">
          
          
          
            <div class="col templates">

              <h4><i class="template"></i>
              <?php if (MasterPress::current_user_can("manage_templates")) : ?>
              <a href="<?php echo MasterPress::admin_url("templates", "manage") ?>" title="<?php _e("Manage Templates", MASTERPRESS_DOMAIN) ?>" class="icon">              
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>
              
              <?php echo WOOF::items_number( count($templates), __("<em>No</em> Templates", MASTERPRESS_DOMAIN), __("<b>%d</b> Template", MASTERPRESS_DOMAIN), __("<b>%d</b> Templates", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_templates")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
              
              
              <div class="body">
              
                <ul class="count-<?php echo count($templates) ?>">
                <?php $count = 0; ?>
                <?php foreach ($templates as $template => $file) : $count++; 
              
                $fsc = count(MPM_TemplateFieldSet::find_by_template( $file ));
              
                ?>
                <li class="linkify" data-name="<?php echo $file ?>">

                  <?php if (MasterPress::current_user_can("manage_templates+edit_templates")) : ?>
                  <a href="<?php echo MasterPress::admin_url("templates", "edit", "id=".$file) ?>" class="item">
                  <?php else: ?>
                  <div class="item">  
                  <?php endif; ?>
                  
                  <?php echo WOOF::truncate($template, "length=20&words=0") ?>
                  
                  <?php if (MasterPress::current_user_can("manage_templates+edit_templates")) : ?>
                  </a>
                  <?php else: ?>
                  </div>  
                  <?php endif; ?>
                  
                  
                  <?php if (MasterPress::current_user_can("manage_templates+manage_template_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("templates", "manage-field-sets", "parent=".$file) ?>" title="<?php _e("Manage Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></a>
                  <?php else : ?>
                  <div title="<?php _e("Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></div>
                  <?php endif; ?>
                  
                </li>
                <?php endforeach; ?>
                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->
          
            <div class="col field-sets site-field-sets">
            
              <h4><i class="sitemap"></i>
              <?php if (MasterPress::current_user_can("manage_site_field_sets")) : ?>
              <a href="<?php echo MasterPress::admin_url("site-field-sets", "manage") ?>" title="<?php _e("Manage Site Field Sets", MASTERPRESS_DOMAIN) ?>" class="icon">
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>
              
              <?php echo WOOF::items_number( count($site_field_sets), __("<em>No</em> Site Field Sets", MASTERPRESS_DOMAIN), __("<b>%d</b> site Field Set", MASTERPRESS_DOMAIN), __("<b>%d</b> site Field Sets", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_site_field_sets")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
              
              <div class="body">
              
                <ul class="count-<?php echo count($site_field_sets) ?>">
                <?php foreach ($site_field_sets as $field_set) : $multiple = $field_set->allow_multiple ? "allow-multiple" : '';  $disabled = $field_set->disabled ? 'disabled ' : ''; $disabled_title = $field_set->disabled ? __('This site field set is currently disabled', MASTERPRESS_DOMAIN) : ''; ?>
                <li class="<?php echo $disabled ?>site-field-set-<?php echo $field_set->name ?> linkify" data-name="<?php echo $field_set->name ?>" title="<?php echo $disabled_title ?>">

                  <?php if (MasterPress::current_user_can("manage_site_field_sets+edit_site_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("site-field-sets", "edit", "id=".$field_set->id) ?>" title="<?php _e("Edit Site Field Set", MASTERPRESS_DOMAIN) ?>" class="item <?php echo $multiple ?>">
                  <?php else: ?>
                  <div class="item <?php echo $multiple ?>">  
                  <?php endif; ?>

                  <?php if ($multiple) : ?>
                  <i class="metabox-add-remove"></i>
                  <?php else : ?>
                  <i class="metabox"></i>
                  <?php endif; ?>

                  <?php echo $field_set->display_label() ?></a>
                  
                  <?php if (MasterPress::current_user_can("manage_site_field_sets+edit_site_field_sets")) : ?>
                  </a>
                  <?php else: ?>
                  </div>
                  <?php endif; ?>
                  

                </li>
                <?php endforeach; ?>
                <?php if (MasterPress::current_user_can("create_site_field_sets")) : ?>
                <li class="divide"><a href="<?php echo MasterPress::admin_url("site-field-sets", "create") ?>" class="create-link"><i></i><?php echo MPV::__create( __("Site Field Set", MASTERPRESS_DOMAIN) ) ?></a></li>
                <?php endif; ?>
                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->

            <div class="col roles">

              <h4><i class="user"></i>
              <?php if (MasterPress::current_user_can("manage_user_roles")) : ?>
              <a href="<?php echo MasterPress::admin_url("roles", "manage") ?>" title="<?php _e("Manage User Roles", MASTERPRESS_DOMAIN) ?>" class="icon">              
              <?php else : ?>
              <span class="icon">
              <?php endif; ?>

              <?php echo WOOF::items_number( count($roles), __("<em>No</em> User Roles", MASTERPRESS_DOMAIN), __("<b>%d</b> User Role", MASTERPRESS_DOMAIN), __("<b>%d</b> User Roles", MASTERPRESS_DOMAIN) ) ?>
              
              <?php if (MasterPress::current_user_can("manage_user_roles")) : ?>
              </a>
              <?php else : ?>
              </span>
              <?php endif; ?>
              </h4>
              
              
              <div class="body">
                
                <?php
                
                // cap checking has side-effects to the roles collection, causing an infinite loop. We need to cache the info here
                
                $role_cache = array();
                
                foreach ($roles as $role) {
                  $role_cache[] = array("name" => $role->name(), "id" => $role->id());
                  
                
                }
                
                ?>
                
                <ul class="count-<?php echo count($roles) ?>">
                <?php foreach ($role_cache as $role) : $count++; 
                $fsc = count(MPM_RoleFieldSet::find_by_role( $role["id"] ));
                ?>
                <li class="linkify" data-name="<?php echo $role["id"] ?>">
                  
                  <?php if (MasterPress::current_user_can("manage_user_roles+edit_user_roles")) : ?>
                  <a href="<?php echo MasterPress::admin_url("roles", "edit", "id=".$role["id"]) ?>" class="item">
                  <?php else: ?>
                  <div class="item">  
                  <?php endif; ?>
                                
                  <i class="user-role"></i>

                  <?php echo WOOF::truncate($role["name"], "length=20&words=0") ?>
                  
                  <?php if (MasterPress::current_user_can("manage_user_roles+edit_user_roles")) : ?>
                  </a>
                  <?php else: ?>
                  </div>  
                  <?php endif; ?>
                  
                  
                  <?php if (MasterPress::current_user_can("manage_user_roles+manage_user_role_field_sets")) : ?>
                  <a href="<?php echo MasterPress::admin_url("roles", "manage-field-sets", "parent=".$role["id"]) ?>" title="<?php _e("Manage Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></a>
                  <?php else : ?>
                  <div title="<?php _e("Field Sets", MASTERPRESS_DOMAIN) ?>" class="field-sets count-<?php echo $fsc ?>"><?php echo $fsc ?></div>
                  <?php endif; ?>
                  
                  
                  <?php foreach ($shared_field_sets as $fs) : ?>
                  <?php if ($fs->visible_in("roles", $role["id"])) : ?>
                  <span class="shared-field-set-link-<?php echo $fs->name ?> related-link asterisk"></span>
                  <?php endif; ?>
                  <?php endforeach; ?>
                
                </li>
                <?php endforeach; ?>
                <?php if (MasterPress::current_user_can("create_user_roles")) : ?>
                <li class="divide"><a href="<?php echo MasterPress::admin_url("roles", "create") ?>" class="create-link"><i></i><?php echo MPV::__create( __("User Role", MASTERPRESS_DOMAIN) ) ?></a></li>
                <?php endif; ?>
                </ul>
            
              </div>
              <!-- /.body -->
            
            </div>
            <!-- /.col -->
                    
          </div>
          <!-- /.row -->
        
        </div>
        <!-- /#masterplan-overview -->


<!-- EXPORT -->

      <?php if (MasterPress::current_user_can("export_masterplan")) : ?>

        <div id="masterplan-export" class="masterplan-export tab-panel <?php echo $tab == "export" ? 'current' : '' ?>">

        <?php MPV::form_open() ?>

          <div id="export-progress" class="progress">
            <?php _e("Exporting Masterplan. Please wait&hellip;", MASTERPRESS_DOMAIN) ?>
          </div>
          <!-- /#export-progress -->
          
          <div id="export-summary" class="summary">
            
            <div id="export-download">

              <p><?php _e("Export completed successfully", MASTERPRESS_DOMAIN) ?></p>
              <a id="export-file-download" href="#" data-message="<?php _e( "Download %s", MASTERPRESS_DOMAIN) ?>"><?php printf( __( "Download %s", MASTERPRESS_DOMAIN ), "file.zip" ) ?></a>
              
            </div>
            <!-- /#export-download -->
            
            
            <div id="extras-summary" class="extras-summary">
              
              <p>
                <?php _e("Note: the following dependent files were included in the Masterplan package", MASTERPRESS_DOMAIN) ?>
              </p>
                
              <div id="extras-icons">
                <h4><?php _e("Icons", MASTERPRESS_DOMAIN); ?></h4>
                
                <ul>
                  
                </ul>
              </div>
              <!-- /#extras-icons -->

              <div id="extras-types">
                <h4><?php _e("Field Types", MASTERPRESS_DOMAIN); ?></h4>
                
                <ul>
                  
                </ul>
              </div>
              <!-- /#extras-field-types -->
              
              
            </div>
            
          </div>
          <!-- /#export-summary -->

          <div id="export-ui">
            
          <div id="export-package">
            
            <div class="title">
              <h4 class="package-file"><i class="zip"></i><?php _e("Package File", MASTERPRESS_DOMAIN) ?></h4>
              <button id="button-export" type="submit" class="button-export simple-primary">Export</button>
            </div>
            <!-- /.title -->
            
            <div id="f-export-filename" class="f">
            
              <label for="export_filename"><?php _e("Name:", MASTERPRESS_DOMAIN) ?></label>
            
              <div class="fw">
                <input id="export_filename" spellcheck="false" name="export_filename" type="text" value="<?php echo $wf->sanitize( $wf->site_name() ) ?>" class="text" />
                <span id="export_filename_extension" class="note"><?php echo ".".$wf->format_date("[date-time-sortable]") ?>.masterplan.zip</span>
              </div>
              <!-- /.fw -->
            
            </div>
            <!-- /.f -->

          </div>
          <!-- /#export-package -->
          
          <div id="export-readme">
            
            <h4 class="readme"><i class="document-text"></i><?php _e('Read Me<span> - this Markdown-formatted text will be stored in <span class="tt">README.markdown</span> inside the Masterplan package</span>', MASTERPRESS_DOMAIN); ?></h4>
            
            <div id="f-export_readme">
<textarea id="export_readme" name="export_readme">
# Masterplan for <?php echo $wf->sites()->first()->name ?> #

+ By: <?php echo $wf->the_user()->fullname() ?>

+ Created: <?php echo $wf->format_date("[date-time-long]") ?>


-------------------------------------------------

</textarea>
          </div>
          
          </div>
          <!-- /#export-readme -->
          
          <div id="export-items">
            
            <div class="title-buttons">
              <h4 class="export-items"><i class="hand-point"></i><?php _e("Export Items<span> - check the items you wish to include in the Masterplan package</span>", MASTERPRESS_DOMAIN); ?></h4>
              <div class="buttons">
                <button id="export-select-all" type="button" class="button">Select <span class="all">All</span></button>
                <button id="export-select-none" type="button" class="button">Select <span class="none">None</span></button>
              </div>
              
            </div>
            <!-- /.title-buttons -->
            
            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="post-types"><i class="pin"></i><?php _e("Post Types", MASTERPRESS_DOMAIN) ?></h4>
                <input id="post-types-check" name="post-types-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                <ul class="object-tree post-types">
                <?php foreach ($post_types as $post_type) : ?>
                  
                <?php if ($post_type->still_registered()) : ?>

                <li class="post-type-<?php echo $post_type->name ?>">
                  <input id="ref-post-type-<?php echo $post_type->name ?>" name="ref[post_types][<?php echo $post_type->name ?>][selected]" checked="checked" value="true" type="hidden" />
                  <input id="export-post-type-<?php echo $post_type->name ?>" name="export[post_types][<?php echo $post_type->name ?>][selected]" checked="checked" value="true" type="checkbox" class="checkbox" />
                  <label for="export-post-type-<?php echo $post_type->name ?>" class="mp-icon-post-type mp-icon-post-type-<?php echo $post_type->name ?>"><?php echo $post_type->display_label() ?></label>

                <?php $field_sets = $post_type->post_type_field_sets() ?>
                
                <?php if (count($field_sets)) : ?>
                  <ul class="field-sets">
                  <?php foreach ($field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                  <li class="field-set<?php echo $class ?>">
                    <input id="export-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>" checked="checked" name="export[post_types][<?php echo $post_type->name ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="checkbox" class="checkbox" />
                    <input id="ref-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>" name="ref[post_types][<?php echo $post_type->name ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                    <label for="export-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>
                    
                    <?php $fields = $field_set->fields() ?>
                
                    <?php if (count($fields)) : ?>
                      <ul class="fields">
                      <?php foreach ($fields as $field) : ?>
                      <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                      <li class="field">
                        <input id="export-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[post_types][<?php echo $post_type->name ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                        <input id="ref-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="ref[post_types][<?php echo $post_type->name ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                        <label for="export-post-type-<?php echo $post_type->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                      </li>  
                      <?php endif; ?>
                      <?php endforeach; ?>
                      </ul>
                    <?php endif; ?>
                
                  </li>  
                  <?php endforeach; ?>
                  </ul>
                <?php endif; ?>
                
                </li>
                
                <?php endif; ?>
                
                <?php endforeach; ?>  
                </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
            
            
            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="taxonomies"><i class="tag"></i><?php _e("Taxonomies", MASTERPRESS_DOMAIN) ?></h4>
                <input id="taxonomies-check" name="taxonomies-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                <ul class="object-tree taxonomies">
                <?php foreach ($taxonomies as $tax) : ?>

                <?php if ($tax->still_registered()) : ?>

                <li>
                  <input id="ref-taxonomy-<?php echo $tax->name ?>" name="ref[taxonomies][<?php echo $tax->name ?>][selected]" value="true" type="hidden" />
                  <input id="export-taxonomy-<?php echo $tax->name ?>" name="export[taxonomies][<?php echo $tax->name ?>][selected]" checked="checked" value="true" type="checkbox" class="checkbox" />
                  <label for="export-taxonomy-<?php echo $tax->name ?>" class="mp-icon-taxonomy mp-icon-taxonomy-<?php echo $tax->name ?>"><?php echo $tax->display_label() ?></label>

                <?php $field_sets = $tax->taxonomy_field_sets() ?>
                
                <?php if (count($field_sets)) : ?>
                  <ul class="field-sets">
                  <?php foreach ($field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                  <li class="field-set<?php echo $class ?>">
                    <input id="ref-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>" name="ref[taxonomies][<?php echo $tax->name ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                    <input id="export-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>" name="export[taxonomies][<?php echo $tax->name ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" checked="checked" type="checkbox" class="checkbox" />
                    <label for="export-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>

                    <?php $fields = $field_set->fields() ?>
                
                    <?php if (count($fields)) : ?>
                      <ul class="fields">
                      <?php foreach ($fields as $field) : ?>
                      <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                      <li class="field">
                        <input id="ref-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" name="ref[taxonomies][<?php echo $tax->name ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                        <input id="export-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[taxonomies][<?php echo $tax->name ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                        <label for="export-taxonomy-<?php echo $tax->name ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>"  class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                      </li>  
                      <?php endif; ?>
                      <?php endforeach; ?>
                      </ul>
                    <?php endif; ?>
                
                  </li>  
                  <?php endforeach; ?>
                  </ul>
                <?php endif; ?>
                
                </li>
                <?php endif; ?>

                <?php endforeach; ?>  
                </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
            <?php if (count($shared_field_sets)) : ?>

            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="shared-field-sets"><i class="metabox-share"></i><?php _e("Shared Field Sets", MASTERPRESS_DOMAIN) ?></h4>
                <input id="shared-field-sets-check" name="shared-field-sets-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                <ul class="object-tree shared-field-sets field-sets">
                <?php foreach ($shared_field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                <li class="field-set<?php echo $class ?>">
                  <input id="ref-shared-field-set-<?php echo $field_set->id ?>" name="ref[shared_field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                  <input id="export-shared-field-set-<?php echo $field_set->id ?>" name="export[shared_field_sets][<?php echo $field_set->id ?>][selected]" value="true" checked="checked" type="checkbox" class="checkbox" />
                  <label for="export-shared-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>

                  <?php $fields = $field_set->fields() ?>
              
                  <?php if (count($fields)) : ?>
                    <ul class="fields">
                    <?php foreach ($fields as $field) : ?>
                    <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                    <li class="field">
                      <input id="ref-shared-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="ref[shared_field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                      <input id="export-shared-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[shared_field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                      <label for="export-shared-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                    </li>  
                    <?php endif; ?>
                    <?php endforeach; ?>
                    </ul>
                  <?php endif; ?>
              
                </li>  
                <?php endforeach; ?>
                </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
            <?php endif; ?>
          
          
            <?php if (count($site_field_sets)) : ?>

            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="site-field-sets"><i class="sitemap"></i><?php _e("Site Field Sets", MASTERPRESS_DOMAIN) ?></h4>
                <input id="site-field-sets-check" name="site-field-sets-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                  <ul class="object-tree site-field-sets field-sets">
                  <?php foreach ($site_field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                  <li class="field-set<?php echo $class ?>">
                    <input id="ref-site-field-set-<?php echo $field_set->id ?>" name="ref[site_field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                    <input id="export-site-field-set-<?php echo $field_set->id ?>" name="export[site_field_sets][<?php echo $field_set->id ?>][selected]" value="true" checked="checked" type="checkbox" class="checkbox" />
                    <label for="export-site-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>

                    <?php $fields = $field_set->fields() ?>
                
                    <?php if (count($fields)) : ?>
                      <ul class="fields">
                      <?php foreach ($fields as $field) : ?>
                      <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                      <li class="field">
                        <input id="ref-site-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="ref[site_field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                        <input id="export-site-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[site_field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                        <label for="export-site-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                      </li>  
                      <?php endif; ?>
                      <?php endforeach; ?>
                      </ul>
                    <?php endif; ?>
                
                  </li>  
                  <?php endforeach; ?>
                  </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
            <?php endif; ?>
            
          
          
            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="templates"><i class="template"></i><?php _e("Templates", MASTERPRESS_DOMAIN) ?></h4>
                <input id="templates-check" name="templates-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                <ul class="object-tree">
              

                <?php foreach ($templates as $template => $file) : $id = $wf->sanitize($file); ?>
                <li class="template-<?php echo $id ?>">

                  <input id="ref-template-<?php echo $wf->sanitize($file) ?>" name="ref[templates][<?php echo $file ?>][selected]" checked="checked" value="true" type="hidden" />
                  <input id="export-template-<?php echo $wf->sanitize($file) ?>" name="export[templates][<?php echo $file ?>][selected]" checked="checked" value="true" type="checkbox" class="checkbox" />
                  <label for="export-template-<?php echo $wf->sanitize($file) ?>" class="template"><i class="template"></i><?php echo $template ?></label>


                  <?php $field_sets = MPM_TemplateFieldSet::find_by_template( $file ); ?>

                <?php if (count($field_sets)) : ?>
                  <ul class="field-sets">
                  <?php foreach ($field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                  <li class="field-set<?php echo $class ?>">
                    <input id="ref-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" name="ref[templates][<?php echo $file ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                    <input id="export-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" checked="checked" name="export[templates][<?php echo $file ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="checkbox" class="checkbox" />
                    <label for="export-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>
                    
                    <?php $fields = $field_set->fields(); ?>
                
                    <?php if (count($fields)) : ?>
                      <ul class="fields">
                      <?php foreach ($fields as $field) : ?>
                      <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                      <li class="field">
                        <input id="ref-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" name="ref[templates][<?php echo $file ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                        <input id="export-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[templates][<?php echo $file ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                        <label for="export-template-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                      </li>  
                      <?php endif; ?>
                      <?php endforeach; ?>
                      </ul>
                    <?php endif; ?>
                
                  </li>  
                  <?php endforeach; ?>
                  </ul>
                <?php endif; ?>
                
                </li>

                <?php endforeach; ?>  

                </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
            
            
            <div class="fsi">
            <div class="fsibv">
              <div class="fsit">
                <h4 class="roles"><i class="user-role"></i><?php _e("User Roles", MASTERPRESS_DOMAIN) ?></h4>
                <input id="roles-check" name="roles-all" type="checkbox" class="checkbox" checked="checked" />
              </div>
              
              <div class="fsic">
                
                <ul class="object-tree">
              

                <?php foreach ($roles as $role) : $id = $role->id() ?>
                <li>
                  <input id="ref-role-<?php echo $id ?>" name="ref[roles][<?php echo $id ?>][selected]" checked="checked" value="true" type="hidden" />
                  <input id="export-role-<?php echo $id ?>" name="export[roles][<?php echo $id ?>][selected]" checked="checked" value="true" type="checkbox" class="checkbox" />
                  <label for="export-role-<?php echo $id ?>" class="role"><i class="user-role"></i><?php echo $role->name ?></label>


                <?php $field_sets = MPM_RoleFieldSet::find_by_role( $id ) ?>

                <?php if (count($field_sets)) : ?>
                  <ul class="field-sets">
                  <?php foreach ($field_sets as $field_set) : $class = $field_set->allow_multiple ? 'metabox-add-remove-large' : 'metabox-large'; ?>
                  <li class="field-set<?php echo $class ?>">
                    <input id="ref-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" checked="checked" name="ref[roles][<?php echo $id ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="hidden" />
                    <input id="export-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" checked="checked" name="export[roles][<?php echo $id ?>][field_sets][<?php echo $field_set->id ?>][selected]" value="true" type="checkbox" class="checkbox" />
                    <label for="export-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>" class="field-set"><i class="<?php echo $class ?>"></i><?php echo $field_set->display_label() ?></label>
                    
                    <?php $fields = $field_set->fields(); ?>
                
                    <?php if (count($fields)) : ?>
                      <ul class="fields">
                      <?php foreach ($fields as $field) : ?>
                      <?php if ($type_class = MPFT::type_class($field->type)) : ?>
                      <li class="field">
                        <input id="ref-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" name="ref[roles][<?php echo $id ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="hidden" />
                        <input id="export-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" checked="checked" name="export[roles][<?php echo $id ?>][field_sets][<?php echo $field_set->id ?>][fields][<?php echo $field->id ?>]" value="true" type="checkbox" class="checkbox" />
                        <label for="export-role-<?php echo $id ?>-field-set-<?php echo $field_set->id ?>-field-<?php echo $field->id ?>" class="mp-icon-field-type-<?php echo $field->type ?>"><?php echo $field->display_label() ?></label>
                      </li>  
                      <?php endif; ?>
                      <?php endforeach; ?>
                      </ul>
                    <?php endif; ?>
                
                  </li>  
                  <?php endforeach; ?>
                  </ul>
                <?php endif; ?>
                
                </li>

                <?php endforeach; ?>  

                </ul>
                
                
              </div>
              <!-- /.fsic -->
              
            </div>
            </div>
            <!-- /.fsi -->
            
          
          
            
          </div>
          <!-- /#export-items -->
          
          
          </div>
          <!-- /#export-ui -->

          
          
        <?php MPV::form_close() ?>

              
        </div>
        <!-- /#masterplan-export -->
        
      <?php endif; ?>


      <?php if (MasterPress::current_user_can("import_masterplan")) : ?>

        <div id="masterplan-import" class="tab-panel <?php echo $tab == "import" ? 'current' : '' ?>">

          <?php if (!MPV::is_postback()) : ?>

          <?php MPV::form_open() ?>
            
          <div id="import-file-wrap">
            
            <div class="title">
              <h4 class="upload"><i class="upload"></i><?php _e("Package Upload", MASTERPRESS_DOMAIN) ?></h4>
            </div>
            <!-- /.title -->

            
            <label id="label-import_file" for="import_file"><?php _e("Upload a Masterplan zip package to begin.<br  /><b>Note:</b> you will be able to review the contents of the package before going ahead with the import.") ?></label>
          
            <div id="import-file-uploader" class="file-uploader { allowedExtensions: ['zip'], ids: { drop: 'import_file_drop_area' }, input: '#import_file', inputName: 'import_file_ul', base_url: '<?php echo MASTERPRESS_GLOBAL_CONTENT_URL ?>', params: { dir: 'tmp/' }, limit: 1, lang: { buttonReplace: '<?php _e("Select a Different File&hellip;") ?>', buttonChoose: '<?php _e("Choose from Computer&hellip;", MASTERPRESS_DOMAIN) ?>'} }">
            
              <div id="import_file_drop_area" class="drop-area"><?php _e("Drop file here to upload", MASTERPRESS_DOMAIN) ?></div>

              <?php 
            
              $file_name = __("( None )", MASTERPRESS_DOMAIN);
              $file_class = "name-none";

              ?>
            
              <div class="file">
                <span class="preview"></span><span data-none="<?php echo __("( None )", MASTERPRESS_DOMAIN) ?>" class="name <?php echo $file_class ?>"><?php echo $file_name ?></span>
              </div>
            
              <input id="import_file" name="import_file" value="" type="hidden" />
              <div class="uploader-ui"></div>
            
            </div>
            <!-- /.file-uploader -->
          
          </div>
          <!-- /#import-file-wrap -->
          
          <p id="import-fetching-summary"><?php _e("Fetching Masterplan info - Please wait&hellip;", MASTERPRESS_DOMAIN); ?></p>
          

          <div id="import-confirmation">
            
            <div class="title">
              <h4 class="upload"><i class="tick-circle"></i><?php _e("Confirmation", MASTERPRESS_DOMAIN) ?> - <span><?php _e("select import options and review the uploaded package", MASTERPRESS_DOMAIN) ?></span></h4>
              <button id="button-import" type="submit" class="button-import simple-primary">Import</button>
            </div>
            <!-- /.title -->
                
            <div class="content">
                        
              <div class="f">
                <div class="fw">
                  <input id="import-backup" name="import_backup" value="yes" checked="checked" type="checkbox" class="checkbox" />
                  <label for="import-backup" class="checkbox"><?php _e("<strong>Backup the existing setup</strong> before importing ( highly recommended )", MASTERPRESS_DOMAIN); ?></label>
                </div>
              </div>
              <!-- /.f -->

              <div id="f-types-overwrite" class="f">
                <div class="fw">
                  <input id="import-types-overwrite" name="import_types_overwrite" value="yes" checked="checked" type="checkbox" class="checkbox" />
                  <label for="import-types-overwrite" class="checkbox"><?php _e("<strong>Overwrite</strong> existing field type extensions with those included in the imported package", MASTERPRESS_DOMAIN); ?></label>
                </div>
              </div>
              <!-- /.f -->
            
              <div class="f f-mode">
                <p>
                  <?php _e("When items are present in the existing setup, but not in the imported Masterplan:", MASTERPRESS_DOMAIN) ?>
                </p>
                
                <div class="fw">
                  <input id="import-mode-replace" name="import_mode" value="replace" checked="checked" type="radio" class="radio" />
                  <label for="import-mode-replace" class="radio"><?php _e('Remove the items from the existing setup ( <strong class="replace">completely replace</strong> the existing setup )', MASTERPRESS_DOMAIN); ?></label>
                </div>

                <div class="fw">
                  <input id="import-mode-append" name="import_mode" value="append" type="radio" class="radio" />
                  <label for="import-mode-append" class="radio"><?php _e('Keep the items in the existing setup ( <strong class="append">append to</strong> the existing setup )', MASTERPRESS_DOMAIN); ?></label>
                </div>

                
              </div>
              <!-- /.f -->
            
            
            </div>
            <!-- /.content -->
            
          </div>
                  

          
          <div id="import-preview" class="import-preview">

            <input type="hidden" name="tab" value="import" />
            <input id="import-masterplan" type="hidden" name="import_masterplan" value="" />
            
            
            <?php
            
            // build a template list for the importer, since get_page_templates() is not available early in execution
            
            foreach (get_page_templates() as $template => $file) :
              ?>
              <input name="templates[<?php echo $file ?>]" type="hidden" value="<?php echo $template ?>" />
            <?php endforeach; ?>
            
            <div id="import-rep">
              
              <div class="fsi post-types">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="post-types"><i class="pin"></i><?php _e("Post Types", MASTERPRESS_DOMAIN) ?></h4>
                </div>
              
                <div class="fsic">
                
                  <ul class="object-tree post-types">
                 
                  </ul>
                
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
            
            
            
              <div class="fsi taxonomies">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="taxonomies"><i class="tag"></i><?php _e("Taxonomies", MASTERPRESS_DOMAIN) ?></h4>
                </div>
              
                <div class="fsic">
                
                  <ul class="object-tree taxonomies">
                
                  </ul>
                
                
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
            
              <div class="fsi shared-field-sets">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="shared-field-sets"><i class="metabox-share"></i><?php _e("Shared Field Sets", MASTERPRESS_DOMAIN) ?></h4>
                </div>
              
                <div class="fsic">
                  <ul class="object-tree shared-field-sets field-sets">
                  </ul>
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
          
              <div class="fsi site-field-sets">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="site-field-sets"><i class="sitemap"></i><?php _e("Site Field Sets", MASTERPRESS_DOMAIN) ?></h4>
                </div>
              
                <div class="fsic">
                
                    <ul class="object-tree site-field-sets field-sets">
                    </ul>
                
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
          
          
              <div class="fsi templates">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="templates"><i class="template"></i><?php _e("Templates", MASTERPRESS_DOMAIN) ?></h4>
                </div>
              
                <div class="fsic">
                
                  <ul class="object-tree">
                  </ul>
                
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
            
            
            
              <div class="fsi roles">
              <div class="fsibv">
                <div class="fsit">
                  <h4 class="roles"><i class="user-role"></i><?php _e("User Roles", MASTERPRESS_DOMAIN) ?></h4>
                </div>
                
                <div class="fsic">
                
                  <ul class="object-tree">
                  </ul>
                
                </div>
                <!-- /.fsic -->
              
              </div>
              </div>
              <!-- /.fsi -->
            
              
            </div>
            <!-- /#import-rep -->
              

          </div>
          <!-- /#import-summary -->

          <?php MPV::form_close() ?>
          
          <?php else: ?>
          
          
          
          <?php endif; ?>
        
        </div>
        <!-- /#masterplan-import -->
        
      <?php endif; ?>

      <?php if (MasterPress::current_user_can("backup_masterplan")) : ?>
        
        <div id="masterplan-backup" class="masterplan-export tab-panel" style="display: none;">
          
          <ul class="mp-messages">
            <li class="notification"><?php _e("Note - this utility does <b>not</b> backup your WordPress content.", MASTERPRESS_DOMAIN) ?></li>
          </ul>
          
          
          <?php MPV::form_open() ?>

            <div id="backup-progress" class="progress">
              <?php _e("Backing up Masterplan. Please wait&hellip;", MASTERPRESS_DOMAIN) ?>
            </div>
            <!-- /#backup-progress -->

            <div id="backup-summary" class="summary">

              <div id="backup-message">
                <p><?php _e("Backup created successfully", MASTERPRESS_DOMAIN) ?></p>
              </div>
              <!-- /#backup-message -->


              <div id="backup-extras-summary" class="extras-summary">
                <p>
                  <?php _e("Note: the following dependent files were included in the Masterplan package", MASTERPRESS_DOMAIN) ?>
                </p>

                <div id="backup-extras-icons">
                  <h4><?php _e("Icons", MASTERPRESS_DOMAIN); ?></h4>

                  <ul>

                  </ul>
                </div>
                <!-- /#backup-extras-icons -->

                <div id="backup-extras-types">
                  <h4><?php _e("Field Types", MASTERPRESS_DOMAIN); ?></h4>

                  <ul>

                  </ul>
                </div>
                <!-- /#backup-extras-field-types -->

              </div>
              <!-- /#backup-extras-summary -->

            </div>

            <div id="backup-ui">

            <div class="title">
              <h4 class="package-file"><i class="zip"></i><?php _e("Package File", MASTERPRESS_DOMAIN) ?></h4>
              <button id="button-backup" type="submit" class="button-export simple-primary">Backup</button>
            </div>
            <!-- /.title -->

            <div id="f-backup-filename" class="f">
              
              <label for="backup_filename"><?php _e("Name:", MASTERPRESS_DOMAIN) ?></label>

              <div class="fw">
                <span id="backup_filename_prefix" class="note">_backup.</span>
                <input id="backup_filename" spellcheck="false" name="backup_filename" type="text" value="" class="text" />
                <input id="backup_filename_suffix" spellcheck="false" name="backup_filename_suffix" type="hidden" value="<?php echo ".".$wf->format_date("[date-time-sortable]") ?>.masterplan.zip" class="text" />
                <span id="backup_filename_extension" class="note"><?php echo ".".$wf->format_date("[date-time-sortable]") ?>.masterplan.zip</span>
              </div>
              <!-- /.fw -->

              <p id="backup_note"><?php _e("Use the editable field as a way to tag the backup for reference later ( optional )") ?></p>

            </div>
            <!-- /.f -->


            <div id="backup-readme">

              <h4 class="readme"><i class="document-text"></i><?php _e('Read Me<span> - this Markdown-formatted text will be stored in <span class="tt">README.markdown</span> inside the Masterplan backup</span>', MASTERPRESS_DOMAIN); ?></h4>

              <div id="f-backup_readme">
<textarea id="backup_readme" name="backup_readme">
# Masterplan Backup for <?php echo $wf->sites()->first()->name ?> #

+ By: <?php echo $wf->the_user()->fullname() ?>

+ Created: <?php echo $wf->format_date("[date-time-long]") ?>


-------------------------------------------------

</textarea>
            </div>

            </div>
            <!-- /#backup-readme -->
          
          </div>
          
          <?php MPV::form_close() ?>
          
        </div>
        <!-- /#masterplan-backup -->

      <?php endif; ?>

      <?php if (MasterPress::current_user_can("restore_masterplan")) : ?>
        
        <?php if (count($backups)) : ?>

        <div id="masterplan-restore" class="tab-panel <?php echo $tab == "restore" ? 'current' : '' ?>">

        <?php MPV::form_open() ?>

          <div class="title">
            <h4 class="package-file"><i class="zip"></i><?php _e("Package Selection", MASTERPRESS_DOMAIN) ?> - <span><?php _e("select a backup package to restore from", MASTERPRESS_DOMAIN) ?></span></h4>
            <button id="button-restore" type="submit" class="button-restore simple-primary">Restore</button>
          </div>
          <!-- /.title -->

          <div id="f-restore-file" class="f">
           
          <label for="restore-masterplan" class="select"><?php _e("File:", MASTERPRESS_DOMAIN) ?></label>
          
          <div class="fw">
          
          <select id="restore-masterplan" data-empty="<?php _e("Please Select a Masterplan to restore", MASTERPRESS_DOMAIN) ?>" name="restore_masterplan">
            <option value=""><?php _e("Select a backup package") ?></option>
            <?php foreach ( $backups as $backup ) : ?>
            <option value="<?php echo $backup["file"] ?>"><?php echo $backup["label"] ?></option>
            <?php endforeach; ?>
          </select>
               
                   
          </div>
                 
        
          <?php MPV::form_close() ?>
  
        </div>
        <!-- /#masterplan-restore -->
        
        <?php endif; ?>
      
      <?php endif; ?>
      
      </div>
      </div>

    </div>
    <!-- /.fs .fs-masterplan -->
    


  <?php
  }