Beispiel #1
0
  public static function term_column_content( $out, $key, $term) {

    global $taxonomy, $wf;
    
    $mode = "list";
    
    if (isset($_GET["mode"])) {
      $mode = $_GET["mode"];
    } 

    $the_term = $wf->term_by_id($term, $taxonomy);

    $tax = self::manage_taxonomy();
    
    $columns = $tax->columns_by_key();
    $column = $columns[$key];
    
    if (!isset($column["core"])) {
      
      // we only need to output custom columns
      
      if (isset($column["content"])) {
        $content = stripslashes($column["content"]);
        MasterPress::$context = "col";
        $out = WOOF::eval_expression($content, $the_term);
        MasterPress::$context = "";
        echo $out;
      }
      
    }
    
  }
Beispiel #2
0
  public function json($fields) {
    
    global $wf;
    
    $type = $this->type_name();

    $json = array();
    
    if ( apply_filters("mp_rest_post_href_field", true ) ) {
      $json["href"] = $this->json_href();
    }

    if (!is_array($fields)) {
      $fields = $wf->parse_field_list( $fields );
    } 
    
    if (!isset($fields)) {
      $fields = $wf->parse_field_list( self::json_fields() );
    }
    
    MasterPress::$context = "json";
    
    foreach ($fields as $name => $sub_fields) {
      
      $val = null;

      switch ($name) {

        case "id" : 
        
          $val = (int) $this->id();
          break;
        
        case "author" :

          $val = $this->author->json();

          break;
        case "type" :

          $val = $this->type_name;
          break;

        case "date" :

          $val = $this->date("c");
          break;

        case "modified" :

          $val = $this->item->post_modified;
          
          if ($val == 0) {
            $val = null;
          } else {
            $val = $this->modified("c");
          }
          break;

        case "comments_open" :

          $val = $this->comment_status == "open";
          break;

        case "pings_open" :

          $val = $this->ping_status == "open";
          break;

        case "comment_count" : 
        
          $val = (int) $this->comment_count();
          break;
         
        default: {
          $val = $this->eval_json_field($name, $sub_fields); 
        }

      }

      $json[$name] = $val;
    }
    
    MasterPress::$context = "string";
    
    return $json;
    
  }
Beispiel #3
0
  public static function post_column_content($key) {

    global $wf;
    
    $mode = "list";
    $post_type = "post";
    
    if (isset($_GET["mode"])) {
      $mode = $_GET["mode"];
    } 
    
    $pt = self::manage_post_type();

    if ($pt) {
      $columns = $pt->columns_by_key();
      if (isset($columns[$key])) {
        $column = $columns[$key];
    
        if (!isset($column["core"])) {
      
          // we only need to output custom columns
        
          if (isset($column["content"])) {
            $content = stripslashes($column["content"]);
            MasterPress::$context = "col";
            $out = WOOF::eval_expression($content, $wf->the);
            MasterPress::$context = "";
            echo $out;
          }
        }
      }
    }
    
  }