Пример #1
0
  function manage() {
    
    global $wf;
    
    $info = MasterPress::$view;
    $site = $wf->site();

    if (isset($_GET["updated"])) {
      MPV::notify(__("Content Updated", MASTERPRESS_DOMAIN));
    }
    
    ?>
    
    <?php MPV::messages() ?>

    <?php MPV::form_open() ?>


    <div id="site-content">

    <button id="bt-save-changes-top" type="submit" class="simple-primary"><?php _e("Save Changes", MASTERPRESS_DOMAIN) ?></button>
      
    <?php foreach ($info->sets as $set) : ?>

    <?php if ($set->current_user_can_see()) : ?>

    <input type="hidden" name="mp_meta[__present]" value="1" />
      
    <div id="field-set-<?php echo $set->html_id() ?>" class="postbox nodrag">
      <h3 class="hndle"><em><?php echo $set->display_label() ?></em>
      <?php
      
      if (current_user_can("manage_options")) { ?>
        <a href="<?php echo $set->manage_url() ?>" class="mp-go" title="<?php _e("Manage Field Set") ?>">Manage</a>  
      <?php
      }
      
      ?>  
      </h3>
      <div class="inside">
      <?php MPV_Meta::set($site, $set); ?>
      </div>
    </div>
    
    <?php endif; ?>
  
    <?php endforeach; ?>
      
    </div>
  
    <button type="submit" class="button button-primary"><?php _e("Save Changes", MASTERPRESS_DOMAIN) ?></button>
    <?php MPV::form_close() ?>

    
    
    <?php
  }
Пример #2
0
  public static function get_version() {
    
    global $wpdb;
    
    if (isset($_GET["id"])) {
      
      $id = $_GET["id"];
      $version = $wpdb->get_row("SELECT * FROM `".MPU::site_table("versions")."` WHERE `version_id` = $id");
      
      if ($version) {
        
        $ret = array("value" => MPU::db_decode($version->value));
        
        if (isset($_GET["fetch_template"], $_GET["model_id"])) {

          $set = MPM_FieldSet::find_by_id($_GET["model_id"]);
          
          if ($set) {
            $template = MPV_Meta::get_preview_set_template($set);
            
            $ret["template"] = $template;
          }
          
          
        }
        
        self::ajax_success( $ret );
        
      } else {
        self::ajax_error(__("The version could not be found", MASTERPRESS_DOMAIN));
      }
      
    } else {
      
      self::ajax_error(__("Cannot fetch version. No version id was supplied", MASTERPRESS_DOMAIN));
      
    }
    
  }
Пример #3
0
 public static function inline_head() {
   global $wf;
   $site = $wf->site();
   MPV_Meta::inline_head(self::assigned_field_sets(), $site);
 }
Пример #4
0
  public static function get_preview_set_template($set) {

    $html = '';
    
    $meow_set = new MEOW_FieldSetCreator($set->name, null, $set);
    
    $id = "mpft_ui_preview_{$set->name}";
    $set_item_template_data = MPV_Meta::set_item_template_data($meow_set, array("preview" => true));
    
    if (!$set->allow_multiple) {
      $set_item_template_data["set_index"] = 1;
    }
  
    $html .= WOOF::render_template( MPV_Meta::set_item_template(), $set_item_template_data, true );
  
    return $html;

  }
Пример #5
0
  public static function field_sets($t) {
    
    global $wf;
    $term = self::get_term();
    $sets = self::assigned_field_sets();

    ?>
    
    <tr class="meta-boxes">
      <td colspan="2">
      
      
      <?php foreach ($sets as $set) : ?>

      <?php if ($set->current_user_can_see()) : ?>

      <div id="field-set-<?php echo $set->html_id() ?>" class="postbox nodrag">
        <h3 class="hndle">
          <em><?php echo $set->display_label() ?></em>
          <?php

          if ($set->current_user_can_manage()) { 
            $mu = $set->manage_url();
            
            if ($mu) { ?>
              <a href="<?php echo $mu ?>" class="mp-go with-mptt" data-tooltip="<?php _e("Manage Field Set", MASTERPRESS_DOMAIN) ?>"><?php _e("Manage", MASTERPRESS_DOMAIN) ?></a>  
            <?php
            }

          }
          ?>  
        </h3>
        <div class="inside">
        <?php MPV_Meta::set($term, $set); ?>
        </div>
      </div>
      
      <?php endif; ?>
      
      <?php endforeach; ?>
          
      </td>
    
    </tr>

    <?php

  }
Пример #6
0
  public static function field_set_meta_box_content($post, $r) {
    global $wf;
    
    $args = $r["args"];
    $set = $args["set"];

    $the_post = $wf->post($post->ID);

    MPV_Meta::set($the_post, $set);
  }