Example #1
0
  public function init() {
    
    $action = MasterPress::$action;
    
    // inform the view what to render in the info panel
    MasterPress::$view->is_role_set = true;

    if ($action == "edit-field" || $action == "create-field") {
      // inform the view what to render in the info panel
      MasterPress::$view->parent = MPM_FieldSet::find_by_id(MasterPress::$parent);

      // enqueue the field type CSS
      $type = MasterPress::$model->type;
      
      MPFT::options_admin_head($type);

      // enqueue dependent scripts for all field types (could improve this in the future)
      foreach (MPFT::type_keys() as $type) {
        if ($ftc = MPFT::type_class($type)) {
          call_user_func( array($ftc, "enqueue") );
        }
      }


    }

    if ($action == "create-field") {
      MasterPress::$model->field_set_id = MasterPress::$parent;
      MasterPress::$model->infer_position();
    }

  }
Example #2
0
  public function init() {
    
    global $wf;
    
    // check if we're in a child theme
    
    $template_dir = get_template_directory();
    $stylesheet_dir = get_stylesheet_directory();
    
    
    // check if there are any templates that have the same name, which can cause confusion

    $names = array(); 
    $dupes = array();
    
    self::get_names($template_dir, $names, $dupes);
    
    if ($stylesheet_dir != $template_dir) {
      self::get_names($stylesheet_dir, $names, $dupes);
    }
    
    
    if (count($dupes)) {
      
      $msg  = WOOF_HTML::tag("p", array(), __("<strong>Warning:</strong> your theme appears to contain multiple template files with the same <b>Template Name</b>.<br />This may cause some templates to become invisible to both WordPress and MasterPress.<br />Please verify the following, and make changes to your template files as necessary:", MASTERPRESS_DOMAIN)); 
      $msg .= WOOF_HTML::open("ul");
      
      foreach ($dupes as $template_name => $file_name) {
        $msg .= WOOF_HTML::tag("li", array(), sprintf( __('<span class="tt">%s</span> is called <b>%s</b>, which is already used by <span class="tt">%s</span>', MASTEPRESS_DOMAIN), $file_name, $template_name, $names[$template_name]) );
      }
         
      $msg .= WOOF_HTML::close("ul");

      MPV::warn($msg);
      
    }
  
    $action = MasterPress::$action;
    
    // inform the view what to render in the info panel
    MasterPress::$view->is_template_set = true;

    
    
    if ($action == "edit-field" || $action == "create-field") {
      // inform the view what to render in the info panel
      MasterPress::$view->parent = MPM_FieldSet::find_by_id(MasterPress::$parent);

      // enqueue the field type CSS
      $type = MasterPress::$model->type;
      
      MPFT::options_admin_head($type);

      // enqueue dependent scripts for all field types (could improve this in the future)
      foreach (MPFT::type_keys() as $type) {
        if ($ftc = MPFT::type_class($type)) {
          call_user_func( array($ftc, "enqueue") );
        }
      }


    }

    if ($action == "create-field") {
      MasterPress::$model->field_set_id = MasterPress::$parent;
      MasterPress::$model->infer_position();
    }

  }