text:
package net.ghostrealms.lib;

import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.sql.*;
import java.util.ArrayList;

public class Database {

  public enum SQL {
    H2,
    MYSQL,
    SQLITE;
  }

  public static int test;

  private final JavaPlugin plugin;
  private final String db;
  private SQL mode;

  private Connection connection;

  private String mysql_user;
  private String mysql_pass;
  private String mysql_host;
  private String mysql_database;
  private int    mysql_port;

  private ArrayList<String> updateQueue = new ArrayList<String>();

  public Database(String db, JavaPlugin plugin, SQL mode) {
    this.db = db;
    this.plugin = plugin;
    this.mode = mode;

    //make sure config exists
    File configFile = new File(plugin.getDataFolder() + File.separator + "config.yml");
    if(!configFile.exists())
    {
      try {
        configFile.createNewFile();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }

    if(mode == SQL.MYSQL) {
      FileConfiguration config = plugin.getConfig();

        if(!config.contains("mysql.database"))
            config.set("mysql.database", "dbname");
        if(!config.contains("mysql.host"))
            config.set("mysql.host", "localhost");
        if(!config.contains("mysql.user"))
            config.set("mysql.user", "root");
        if(!config.contains("mysql.pass"))
            config.set("mysql.pass", "password");
        if(!config.contains("mysql.port"))
              config.set("mysql.port", 3306);

      try
      {
        config.save(configFile);
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }

      mysql_database = config.getString("mysql.database");
      mysql_host     = config.getString("mysql.host");
      mysql_user     = config.getString("mysql.user");
      mysql_pass     = config.getString("mysql.pass");
      mysql_port     = config.getInt("mysql.port");
    }

    setupConnection();
  }

  private void setupConnection() {

    switch(mode) {
      default:
      case H2:
        try {
          Class.forName("org.h2.Driver");
        } catch (ClassNotFoundException ex) {
          ex.printStackTrace();
          connection = null;
          break;
        }

        String url = "jdbc:h2:" + plugin.getDataFolder() + File.separator + db;

        try {
          connection = DriverManager.getConnection(url);
        } catch (SQLException ex) {
          ex.printStackTrace();
        }
        break;
      case MYSQL:
        try {
          Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException ex) {
          ex.printStackTrace();
          connection = null;
          break;
        }

        try {
          connection = DriverManager.getConnection("jdbc:mysql://" + mysql_host + ":" + mysql_port +
                                                   "/" + mysql_database,  mysql_user, mysql_pass);
        } catch (SQLException ex) {
          ex.printStackTrace();
          connection = null;
          break;
        }
        break;
      case SQLITE:
        try {
          Class.forName("org.sqlite.JDBC");
        } catch (ClassNotFoundException ex) {
          ex.printStackTrace();
          connection = null;
          break;
        }

        try {
          connection = DriverManager.getConnection("jdbc:sqlite:" + plugin.getDataFolder() +
                                                   File.separator + db);
        } catch (SQLException ex) {
          ex.printStackTrace();
          connection = null;
          break;
        }
        break;
    }
  }

  protected String getDatabase() {
    return db;
  }

  private String getDatabaseURL() {
    return "jdbc:h2:" + plugin.getDataFolder() + File.separator + db;
  }

  public void close() {
    try {
      if(!connection.isClosed()) {
        connection.close();
      }
    } catch (SQLException ex) {
      ex.printStackTrace();
    }
  }

  /**
   * This will add an Update SQL statement to the queue to be updated upon calling #runQueue*
   * @param statement
   */
  public void queue(String statement) {
    updateQueue.add(statement);
  }

  public void runQueue() {
    for(String sql : updateQueue) {
      update(sql);
      updateQueue.remove(sql);
    }
  }

  public boolean write(String sql, Object...args) {
    try {
      PreparedStatement stmt = connection.prepareStatement(sql);

      for(int i = 0; i < args.length; i++)
      {
        //+1 because the first parameter is 1, not 0
        stmt.setObject(i + 1, args[i]);
      }

      boolean status = stmt.execute();
      return status;
    } catch (SQLException ex) {
      ex.printStackTrace();
      return false;
    }
  }

  public int update(String sql, Object...args) {
    try {
      PreparedStatement stmt = connection.prepareStatement(sql);

      for(int i = 0; i < args.length; i++)
      {
        //+1 because the first parameter is 1, not 0
        stmt.setObject(i + 1, args[i]);
      }

      int status = stmt.executeUpdate();
      return status;
    } catch (SQLException ex) {
      ex.printStackTrace();
      return -1;
    }
  }

  public ResultSet read(String sql, Object...args) {
    try {
      PreparedStatement stmt = connection.prepareStatement(sql);

      for(int i = 0; i < args.length; i++)
      {
        //+1 because the first parameter is 1, not 0
        stmt.setObject(i + 1, args[i]);
      }

      ResultSet results = stmt.executeQuery();
      return results;
    } catch (SQLException ex) {
      ex.printStackTrace();
      return null;
    }
  }

  protected void setMode(SQL mode) {
    this.mode = mode;
  }

  protected SQL getMode() {
    return mode;
  }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>DistanceMatrix</title>
<meta name="date" content="2015-06-11">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

br.ufrn.imd.pitagoras.geneticz

Class DistanceMatrix

java.lang.Object

br.ufrn.imd.pitagoras.geneticz.DistanceMatrix

public class DistanceMatrix
extends java.lang.Object

Matrix de distancias utilizada para agrupar uma
 assinatura em um conjunto de clusters.

Author:

pitagoras

Constructor Summary

Constructors

Constructor and Description

DistanceMatrix(AVLTreeDouble[] signature)

Construtor da classe DistanceMatrix

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

boolean
clusterEnded()

ClusterNode[]
getClusters()

java.lang.Double[][]
getMatrix()

void
iterate0()

Agrupa e processa os clusters obtidos a partir
 da assinatura genica até obter um cluster final.

void
showDistanceMatrix(int x,
                  int y)

Exibe um dialogo com uma uma tabela que descreve o estado atual da matrix de distancias.

int
size()

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DistanceMatrix

public DistanceMatrix(AVLTreeDouble[] signature)

Construtor da classe DistanceMatrix

Parameters:

signature - Assinatura genica a partir da qual será gerado o cluster final.

Method Detail

size

public int size()

iterate0

public void iterate0()

Agrupa e processa os clusters obtidos a partir
 da assinatura genica até obter um cluster final.

showDistanceMatrix

public void showDistanceMatrix(int x,
                               int y)

Exibe um dialogo com uma uma tabela que descreve o estado atual da matrix de distancias.

Parameters:

x - Posição x em relação a janela principal.

y - Posição y em relação a janela principal.

clusterEnded

public boolean clusterEnded()

Returns:

Se o processo de agrupamento já acabou e resta apenas um cluster.

getClusters

public ClusterNode[] getClusters()

getMatrix

public java.lang.Double[][] getMatrix()

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

redpajama_set_name: RedPajamaGithub


text:
module ShareButtons
  class Twitter < ShareButtons::Base
    private

    def share_url
      'https://twitter.com/home'
    end

    def url_options
      { status: status }
    end

    def status
      url
    end
  end
end


text:
/* @(#)w_cosh.c 5.1 93/09/24 */
/*
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

#ifdef POK_NEEDS_LIBMATH

/*
 * wrapper cosh(x)
 */

#include <libm.h>
#include "namespace.h"
#include "math_private.h"

#ifdef __weak_alias
__weak_alias(cosh, _cosh)
#endif

double
cosh(double x)		/* wrapper cosh */
{
#ifdef _IEEE_LIBM
	return __ieee754_cosh(x);
#else
	double z;
	z = __ieee754_cosh(x);
	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
	if(fabs(x)>7.10475860073943863426e+02) {
	        return __kernel_standard(x,x,5); /* cosh overflow */
	} else
	    return z;
#endif
}

#endif


text:
package com.google.anoncoin.discovery;

import com.google.anoncoin.core.NetworkParameters;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;

/**
 * SeedPeers stores a pre-determined list of Anoncoin node addresses. These nodes are selected based on being
 * active on the network for a long period of time. The intention is to be a last resort way of finding a connection
 * to the network, in case IRC and DNS fail. The list comes from the Anoncoin C++ source code.
 */
public class SeedPeers implements PeerDiscovery {
    private NetworkParameters params;
    private int pnseedIndex;

    public SeedPeers(NetworkParameters params) {
        this.params = params;
    }

    /**
     * Acts as an iterator, returning the address of each node in the list sequentially.
     * Once all the list has been iterated, null will be returned for each subsequent query.
     *
     * @return InetSocketAddress - The address/port of the next node.
     * @throws PeerDiscoveryException
     */
    public InetSocketAddress getPeer() throws PeerDiscoveryException {
        try {
            return nextPeer();
        } catch (UnknownHostException e) {
            throw new PeerDiscoveryException(e);
        }
    }

    private InetSocketAddress nextPeer() throws UnknownHostException {
        if (pnseedIndex >= seedAddrs.length) return null;
        return new InetSocketAddress(convertAddress(seedAddrs[pnseedIndex++]),
                params.port);
    }

    /**
     * Returns an array containing all the Anoncoin nodes within the list.
     */
    public InetSocketAddress[] getPeers(long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException {
        try {
            return allPeers();
        } catch (UnknownHostException e) {
            throw new PeerDiscoveryException(e);
        }
    }

    private InetSocketAddress[] allPeers() throws UnknownHostException {
        InetSocketAddress[] addresses = new InetSocketAddress[seedAddrs.length];
        for (int i = 0; i < seedAddrs.length; ++i) {
            addresses[i] = new InetSocketAddress(convertAddress(seedAddrs[i]), params.port);
        }
        return addresses;
    }

    private InetAddress convertAddress(int seed) throws UnknownHostException {
        byte[] v4addr = new byte[4];
        v4addr[0] = (byte) (0xFF & (seed));
        v4addr[1] = (byte) (0xFF & (seed >> 8));
        v4addr[2] = (byte) (0xFF & (seed >> 16));
        v4addr[3] = (byte) (0xFF & (seed >> 24));
        return InetAddress.getByAddress(v4addr);
    }

    public static int[] seedAddrs =
            {
                    //0x2EFDCB71, 0xCC1B3AD6, 0xADA77149,
            };

    public void shutdown() {
    }
}


text:
[[Back to the questions]](../../08.%20Collections.md#exercise-1)

## 8. Collections - Solution to exercise 1.4

A `Range` will do the job:
```scala
5 to 100
```


text:
import assert from 'assert';
import shareLink from '../lib/helpers/share-links.js';

describe('Share-Links', function() {
  it('should have basic properties', function() {
    const share = shareLink(1, 2, 3, 4);

    assert.ok(share.twitter);
    assert.ok(share.facebook);
    assert.ok(share.gplus);
    assert.ok(share.whatsapp);
    assert.ok(share.email);
  });

  it('should have basic properties', function() {
    let testData = {
      title: 'Gollum',
      link: 'www.example.com',
      description: 'Mordor',
      siteName: 'MiddleEarth'
    };
    let share = shareLink(testData.title, testData.link, testData.description, testData.siteName);

    let testMatch = {
      title(str) {
        return str.match(new RegExp(testData.title));
      },
      link(str) {
        return str.match(new RegExp(testData.link));
      },
      description(str) {
        return str.match(new RegExp(testData.description));
      },
      siteName(str) {
        return str.match(new RegExp(testData.siteName));
      }
    };

    assert.ok(share.twitter);
    assert.ok(testMatch.link(share.twitter));
    assert.ok(testMatch.description(share.twitter));

    assert.ok(share.facebook);
    assert.ok(testMatch.link(share.facebook));

    assert.ok(share.gplus);
    assert.ok(testMatch.link(share.gplus));

    assert.ok(share.whatsapp);
    assert.ok(testMatch.link(share.whatsapp));
    assert.ok(testMatch.title(share.whatsapp));

    assert.ok(share.email);
    assert.ok(testMatch.link(share.email));
    assert.ok(testMatch.title(share.whatsapp));

    assert.ok(share.wordpress);
    assert.ok(testMatch.link(share.wordpress));

    assert.ok(share.tumblr);
    assert.ok(testMatch.link(share.tumblr));

    assert.ok(share.pocket);
    assert.ok(testMatch.link(share.pocket));
  });
});


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="discriminate">
        <note>
            Frames file for 'discriminate' based on sentences in wsj.  No
            Verbnet entry, Framenet entry Differentiation.
        </note>

        <roleset id="discriminate.01" name="tell the difference among" vncls="-">
            <roles>
                <role descr="agent, person with keen taste" n="0"/>
                <role descr="choices" n="1"/>
            </roles>

            <example name="usually adjectival">
                <inflection aspect="progressive" form="participle" person="ns" tense="ns" voice="active"/>
                <text>
                    John is a discriminating diner.
                </text>
                <rel>discriminating</rel>
                <arg n="0">diner</arg>
            </example>

            <note>
            </note>

        </roleset>

        <roleset id="discriminate.02" name="illegal preferences" vncls="71">
            <roles>
                <role descr="bigot, agent" n="0">
                    <vnrole vncls="71" vntheta="Actor1"/>
                </role>
                <role descr="victim" n="1">
                    <vnrole vncls="71" vntheta="Theme"/>
                </role>
            </roles>

            <example name="transitive">
                <inflection aspect="progressive" form="participle" person="ns" tense="present" voice="active"/>
                <text>
                    But that doesn't necessarily mean thrifts are discriminating
                    against blacks, the agency said.
                </text>
                <arg n="0">thrifts</arg>
                <rel>discriminating</rel>
                <arg n="1">against blacks</arg>
            </example>

            <example name="intransitive">
                <inflection aspect="progressive" form="participle" person="ns" tense="present" voice="active"/>
                <text>
                    But John LaWare, a Fed governor, told the subcommittee the
                    evidence is mixed and that the Fed's believes the vast majority of
                    banks aren't discriminating.
                </text>
                <arg n="0">the vast majority of banks</arg>
                <arg f="NEG" n="M">n't</arg>
                <rel>discriminating</rel>
            </example>

            <note>
            </note>

        </roleset>
    </predicate>
</frameset>


text:
<md-sidenav md-component-id="left" class="md-sidenav-left md-whiteframe-z2" >
    <md-content>
        <md-list>
            <md-subheader class="md-no-sticky">Fast Catalog samples</md-subheader>
            <md-list-item class="md-2-line" ng-click="actions.navigateTo('intro')">
                <md-icon md-svg-icon="action:description" style="width: 50px; height: 50px;"></md-icon>

Introduction

Why and How

            </md-list-item>
            <md-divider></md-divider>
            <md-list-item class="md-2-line" ng-click="actions.navigateTo('mongo')">

With MongoDb

Multi-attribute search with MongoDb API

            </md-list-item>
            <md-list-item class="md-2-line" ng-click="actions.navigateTo('elastic')" >

With ElasticSearch

Multi-attribute search with Elastic API

            </md-list-item>
        </md-list>
    </md-content>
</md-sidenav>


text:
Work with schedules

### Synopsis

Work with schedules

### Options

```
  -h, --help   help for schedule
```

### Options inherited from parent commands

```
      --alsologtostderr                  log to standard error as well as files
      --kubeconfig string                Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging
```

### SEE ALSO
* [ark](ark.md)	 - Back up and restore Kubernetes cluster resources.
* [ark schedule create](ark_schedule_create.md)	 - Create a schedule
* [ark schedule delete](ark_schedule_delete.md)	 - Delete a schedule
* [ark schedule describe](ark_schedule_describe.md)	 - Describe schedules
* [ark schedule get](ark_schedule_get.md)	 - Get schedules


text:
using PsISEProjectExplorer.Enums;
using PsISEProjectExplorer.Model.DocHierarchy.Nodes;
using System;
using System.Windows.Media;

namespace PsISEProjectExplorer.UI.ViewModel
{
    public class TreeViewEntryItemModel : BaseViewModel
    {
        public static object RootLockObject = new object();

        private IconProvider IconProvider { get; set; }

        private INode documentHierarchyNode;

        private INode DocumentHierarchyNode
        {
            get
            {
                return this.documentHierarchyNode;
            }
            set
            {
                if (value == null)
                {
                    throw new ArgumentNullException("node");
                }
                this.documentHierarchyNode = value;
                this.OnPropertyChanged("IsExpanded");
            }
        }

        public INode Node
        {
            get
            {
                var node = this.DocumentHierarchyNode as ViewNode;
                if (node != null)
                {
                    return node.Node;
                }
                return this.DocumentHierarchyNode;
            }
        }

        public ImageSource Image
        {
            get
            {
                if (this.IsBeingAdded || (this.NodeType != NodeType.Directory && this.NodeType != NodeType.File))
                {
                    return this.IconProvider.GetImageSourceBasingOnNodeType(this.NodeType.ToString());
                }
                return this.IconProvider.GetImageSourceForFileSystemEntry(this.Path, this.Node.IsExcluded, this.Node.IsValid);
            }
        }

        public string Name
        {
            get
            {
                return this.Node.Name;
            }
        }

        public string Path
        {
            get
            {
                return this.Node.Path;
            }
        }

        public bool IsExcluded
        {
            get
            {
                return this.Node.IsExcluded;
            }
        }

        public string Tooltip
        {
            get
            {
                return String.IsNullOrEmpty(this.Node.Metadata) ? null : this.Node.Metadata;
            }
        }

        public TreeViewEntryItemModel Parent { get; private set; }

        private TreeViewEntryItemModelState State { get; set; }

        public bool IsExpanded
        {
            get
            {
                return this.State.IsExpanded;
            }
            set
            {
                this.State.IsExpanded = value;
                this.OnPropertyChanged();
            }
        }

        public bool IsSelected
        {
            get
            {
                return this.State.IsSelected;
            }
            set
            {
                this.State.IsSelected = value;
                this.OnPropertyChanged();
            }
        }

        private bool isBeingEdited;

        public bool IsBeingEdited
        {
            get
            {
                return this.isBeingEdited;
            }
            set
            {
                this.isBeingEdited = value;
                this.OnPropertyChanged();
            }
        }

        private bool isBeingAdded;

        public bool IsBeingAdded
        {
            get
            {
                return this.isBeingAdded;
            }
            set
            {
                this.isBeingAdded = value;
                this.OnPropertyChanged();
            }
        }

        public NodeType NodeType
        {
            get
            {
                return this.Node.NodeType;
            }
        }

        public TreeViewEntryItemObservableSet Children { get; private set; }

        public TreeViewEntryItemModel(INode node, TreeViewEntryItemModel parent, bool isSelected, IconProvider iconProvider)
        {
            this.IconProvider = iconProvider;
            var lockObject = this.Parent == null ? RootLockObject : this.Parent;
            lock (lockObject)
            {
                this.State = new TreeViewEntryItemModelState(false, isSelected);
                this.DocumentHierarchyNode = node;
                this.Parent = parent;
                this.Children = new TreeViewEntryItemObservableSet();
                if (this.Parent != null)
                {
                    this.Parent.Children.Add(this);
                }
            }
        }

        public void Delete()
        {
            var lockObject = this.Parent == null ? RootLockObject : this.Parent;
            lock (lockObject)
            {
                if (this.Parent != null)
                {
                    this.Parent.Children.Remove(this);
                }
                this.Children.Clear();
                this.Parent = null;
            }
        }

        public void UpdateNode(INode node)
        {
            if (this.DocumentHierarchyNode != node)
            {
                this.DocumentHierarchyNode = node;
                this.RefreshNode();
            }
        }

        public void RefreshNode()
        {
            this.OnPropertyChanged(String.Empty);
        }

        public override bool Equals(object obj)
        {
            if (obj == null || this.GetType() != obj.GetType() || !(obj is TreeViewEntryItemModel))
            {
                return false;
            }
            var item = (TreeViewEntryItemModel)obj;
            return (this.Node == item.Node);
        }

        public override int GetHashCode()
        {
            return this.Node.GetHashCode();
        }
    }
}


text:
unless node["accounts"].nil?
  node["accounts"].each do |account|
    group account["groupname"] do
      gid account["gid"]
    end

    user account["username"] do
      gid account["gid"]
      uid account["uid"]
      password nil
    end

    directory %Q!/home/#{account["username"]}/.ssh! do
      mode 0700
      owner account["username"]
    end

    file %Q!/home/#{account["username"]}/.ssh/authorized_keys! do
      mode 0600
      owner account["username"]
      content account["ssh_pub_key"]
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProjectData;
using ProjectBLL;
using Tools;
using Approve.RuleCenter;

public partial class Government_NewAppMain_CertiList : System.Web.UI.Page
{
    ProjectDB db = new ProjectDB();
    RCenter rc = new RCenter();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ShowPostion();
            if (!string.IsNullOrEmpty(Request.QueryString["FManageTypeId"]))
            {
                int FManageTypeId = EConvert.ToInt(Request.QueryString["FManageTypeId"]);
                DG_List.Columns[4].HeaderText = (from m in db.CF_Sys_ManageType
                                                 join s in db.CF_Sys_SystemName on m.FSystemId equals s.FNumber
                                                 where m.FNumber == FManageTypeId
                                                 select s.FName).FirstOrDefault();

                if (FManageTypeId == 294)
                {
                    DG_List.Columns[4].HeaderText = "设计单位";
                }
            }
            ShowInfo();

        }
    }
    private void ShowPostion()
    {
        if (Request["fcol"] != null && Request["fcol"] != "")
        {
            lPostion.Text = rc.GetMenuName(Request["fcol"]);
        }

    }

    protected void btn_Click(object sender, EventArgs e)
    {
        ShowInfo();
    }

    private void ShowInfo()
    {
        var v = db.CF_Prj_Certi.Where(t => t.FIsValid == 1);
        if (txtFPrjName.Text.Trim() != "")
        {
            v = v.Where(t => t.FName.Contains(txtFPrjName.Text));
        }
        if (txtFEntName.Text.Trim() != "")
        {
            v = v.Where(t => t.FJSEntName.Contains(txtFEntName.Text));
        }
        if (txtFCertiNo.Text.Trim() != "")
        {
            v = v.Where(t => t.FJSEntName.Contains(txtFCertiNo.Text));
        }
        if (!string.IsNullOrEmpty(Request.QueryString["FStartTime"]))
        {
            txtFReportDate.Text = Request.QueryString["FStartTime"];

        }

        if (!string.IsNullOrEmpty(Request.QueryString["FEndTime"]))
        {
            txtFReportDate1.Text = Request.QueryString["FEndTime"];

        }
        if (txtFReportDate.Text.Trim() != "")
        {
            v = v.Where(t => t.FAppDate >= EConvert.ToDateTime(txtFReportDate.Text.Trim()));

        }
        if (txtFReportDate1.Text.Trim() != "")
        {
            v = v.Where(t => t.FAppDate <= EConvert.ToDateTime(txtFReportDate1.Text.Trim()));

        }
        if (string.IsNullOrEmpty(Request.QueryString["DeptId"]))
        {
            v = v.Where(t => t.FCityId.ToString().StartsWith(EConvert.ToString(Session["DFId"])));

        }
        else
        {
            v = v.Where(t => t.FCityId.ToString().StartsWith(Request.QueryString["DeptId"]));

        }
        if (!string.IsNullOrEmpty(Request.QueryString["FManageTypeId"]))
        {
            v = v.Where(t => t.FCertiTypeId == EConvert.ToInt(Request.QueryString["FManageTypeId"]));
        }

        Pager1.RecordCount = v.Count();
        DG_List.DataSource = v.Skip((Pager1.CurrentPageIndex - 1) * Pager1.PageSize).Take(Pager1.PageSize);
        DG_List.DataBind();
        Pager1.Visible = (Pager1.RecordCount > Pager1.PageSize);
    }
    //分页面控件翻页事件
    protected void Pager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        Pager1.CurrentPageIndex = e.NewPageIndex;
        ShowInfo();
    }
    protected void DG_List_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        if (e.Item.ItemIndex > -1)
        {
            e.Item.Cells[0].Text = (e.Item.ItemIndex + 1 + this.Pager1.PageSize * (this.Pager1.CurrentPageIndex - 1)).ToString();
            string fid = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FID"));
            int FManageTypeId = EConvert.ToInt(DataBinder.Eval(e.Item.DataItem, "FCertiTypeId"));

            string FBaseInfoId = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FBaseInfoId"));
            string FEntName = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FEntName"));
            string FAppId = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FAppId"));

            string fUrl = rc.getMTypeQurl(FManageTypeId.ToString());
            string sScript = "openWinNew('" + fUrl + "?fbid=" + FBaseInfoId + "&faid=" + FAppId + "&fmid=" + FManageTypeId + "&fly=1')";

            e.Item.Cells[1].Text = "" + e.Item.Cells[1].Text + "";

            string sUrl = rc.GetSignValue("select FDAQurl from cf_Sys_SystemName where fnumber=100 ");

            sUrl += "?fbid=" + EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FJSEntId"));

            e.Item.Cells[3].Text = "" + e.Item.Cells[3].Text + "";

            if (FManageTypeId == 294)
            {
                FBaseInfoId = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FSJEntId"));
                FEntName = EConvert.ToString(DataBinder.Eval(e.Item.DataItem, "FSJEntName"));
            }
            else
            {

            }
            e.Item.Cells[4].Text = FEntName;
            CF_Ent_BaseInfo ent = db.CF_Ent_BaseInfo.Where(t => t.FId == FBaseInfoId).FirstOrDefault();
            if (ent != null)
            {
                sUrl = rc.GetSignValue("select FDAQurl from cf_Sys_SystemName where fnumber=" + ent.FSystemId);

                sUrl += "?fbid=" + FBaseInfoId;

                e.Item.Cells[4].Text = "" + e.Item.Cells[4].Text + "";

            }
        }
    }

    protected void btnQuery_Click(object sender, EventArgs e)
    {
        ShowInfo();
    }
}


text:
{% extends 'base.html' %}

{% block content %}
    {% for obj in list  %}
        {% block content-objs %}
            <a href="{{obj.get_absolute_url}}">
                {{obj.name}}
            </a>
        {% endblock content-objs %}
    {% endfor %}
{% endblock content %}


text:
package org.sireum.$internal

import scala.collection.mutable.Map

object Trie {

  sealed trait Node[K, V]

  final case class InNode[K, V](children: Map[K, Node[K, V]]) extends Node[K, V]

  final case class Leaf[K, V](data: V) extends Node[K, V]

}


text:
<?php

namespace Timber;

use Timber\Core;
use Timber\CoreInterface;
use Timber\CommentThread;
use Timber\Term;
use Timber\User;
use Timber\Image;
use Timber\Helper;
use Timber\URLHelper;
use Timber\PostGetter;
use Timber\PostType;

use WP_Post;

/**
 * This is the object you use to access or extend WordPress posts. Think of it as Timber's (more accessible) version of WP_Post. This is used throughout Timber to represent posts retrieved from WordPress making them available to Twig templates. See the PHP and Twig examples for an example of what it's like to work with this object in your code.
 * @example
 * ```php
 * // single.php, see connected twig example
 * $context = Timber::context();
 * $context['post'] = new Timber\Post(); // It's a new Timber\Post object, but an existing post from WordPress.
 * Timber::render('single.twig', $context);
 * ?>
 * ```
 * ```twig
 * {# single.twig #}
 * <article>
 *     <h1 class="headline">{{post.title}}</h1>
 *     <div class="body">
 *         {{post.content}}
 *     </div>
 * </article>
 * ```
 *
 * ```html
 * <article>
 *     <h1 class="headline">The Empire Strikes Back</h1>
 *     <div class="body">
 *         It is a dark time for the Rebellion. Although the Death Star has been destroyed, Imperial troops have driven the Rebel forces from their hidden base and pursued them across the galaxy.
 *     </div>
 * </article>
 * ```
 *
 * @package Timber
 */
class Post extends Core implements CoreInterface {

	/**
	 * @var string $ImageClass the name of the class to handle images by default
	 */
	public $ImageClass = 'Timber\Image';

	/**
	 * @var string $PostClass the name of the class to handle posts by default
	 */
	public $PostClass = 'Timber\Post';

	/**
	 * @var string $TermClass the name of the class to handle terms by default
	 */
	public $TermClass = 'Timber\Term';

	/**
	 * @var string $object_type what does this class represent in WordPress terms?
	 */
	public $object_type = 'post';

	/**
	 * @var array $custom stores custom meta data
	 */
	public $custom = array();

	/**
	 * @var string $representation what does this class represent in WordPress terms?
	 */
	public static $representation = 'post';

	/**
	 * @internal
	 * @var string $___content stores the processed content internally
	 */
	protected $___content;

	/**
	 * @var string $_permalink the returned permalink from WP's get_permalink function
	 */
	protected $_permalink;

	/**
	 * @var array $_next stores the results of the next Timber\Post in a set inside an array (in order to manage by-taxonomy)
	 */
	protected $_next = array();

	/**
	 * @var array $_prev stores the results of the previous Timber\Post in a set inside an array (in order to manage by-taxonomy)
	 */
	protected $_prev = array();

	/**
	 * @var string $class stores the CSS classes for the post (ex: "post post-type-book post-123")
	 */
	protected $_css_class;

	/**
	 * @api
	 * @var int $id the numeric WordPress id of a post
	 */
	public $id;

	/**
	 * @var string 	$ID 			the numeric WordPress id of a post, capitalized to match WP usage
	 */
	public $ID;

	/**
	 * @var int 	$post_author 	the numeric ID of the a post's author corresponding to the wp_user dtable
	 */
	public $post_author;

	/**
	 * @var string 	$post_content 	the raw text of a WP post as stored in the database
	 */
	public $post_content;

	/**
	 * @var string 	$post_date 		the raw date string as stored in the WP database, ex: 2014-07-05 18:01:39
	 */
	public $post_date;

	/**
	 * @var string 	$post_excerpt 	the raw text of a manual post excerpt as stored in the database
	 */
	public $post_excerpt;

	/**
	 * @var int 		$post_parent 	the numeric ID of a post's parent post
	 */
	public $post_parent;

	/**
	 * @api
	 * @var string 		$post_status 	the status of a post ("draft", "publish", etc.)
	 */
	public $post_status;

	/**
	 * @var string 	$post_title 	the raw text of a post's title as stored in the database
	 */
	public $post_title;

	/**
	 * @api
	 * @var string 	$post_type 		the name of the post type, this is the machine name (so "my_custom_post_type" as opposed to "My Custom Post Type")
	 */
	public $post_type;

	/**
	 * @api
	 * @var string 	$slug 		the URL-safe slug, this corresponds to the poorly-named "post_name" in the WP database, ex: "hello-world"
	 */
	public $slug;

	/**
	 * @var PostType $_type stores the PostType object for the Post
	 */
	protected $__type;

	/**
	 * If you send the constructor nothing it will try to figure out the current post id based on being inside The_Loop
	 * @example
	 * ```php
	 * $post = new Timber\Post();
	 * $other_post = new Timber\Post($random_post_id);
	 * ```
	 * @param mixed $pid
	 */
	public function __construct( $pid = null ) {
		$pid = $this->determine_id($pid);
		$this->init($pid);
	}

	/**
	 * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2
	 * This is also here to ensure that {{ post.class }} remains usable
	 * @return mixed
	 */
	public function __get( $field ) {
		if ( 'class' === $field ) {
			return $this->css_class();
		}
		return parent::__get($field);
	}

	/**
	 * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2
	 * This is also here to ensure that {{ post.class }} remains usable
	 * @return mixed
	 */
	public function __call( $field, $args ) {
		if ( 'class' === $field ) {
			$class = isset($args[0]) ? $args[0] : '';
			return $this->css_class($class);
		}

		return parent::__call($field, $args);
	}

	/**
	 * Determine whether or not an admin/editor is looking at the post in "preview mode" via the
	 * WordPress admin
	 * @internal
	 * @return bool
	 */
	protected static function is_previewing() {
		global $wp_query;
		if ( isset($_GET['preview']) && isset($_GET['preview_nonce']) && wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$wp_query->queried_object_id) ) {
			return true;
		}
	}

	/**
	 * tries to figure out what post you want to get if not explictly defined (or if it is, allows it to be passed through)
	 * @internal
	 * @param mixed a value to test against
	 * @return int|null the numberic id we should be using for this post object, null when there's no ID (ex: 404 page)
	 */
	protected function determine_id( $pid ) {
		global $wp_query;
		if ( $pid === null &&
			isset($wp_query->queried_object_id)
			&& $wp_query->queried_object_id
			&& isset($wp_query->queried_object)
			&& is_object($wp_query->queried_object)
			&& get_class($wp_query->queried_object) == 'WP_Post'
		) {
			$pid = $wp_query->queried_object_id;
		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) {
			//hack for static page as home page
			$pid = $wp_query->queried_object_id;
		} else if ( $pid === null ) {
			$gtid = false;
			$maybe_post = get_post();
			if ( isset($maybe_post->ID) ) {
				$gtid = true;
			}
			if ( $gtid ) {
				$pid = get_the_ID();
			}
			if ( !$pid ) {
				global $wp_query;
				if ( isset($wp_query->query['p']) ) {
					$pid = $wp_query->query['p'];
				}
			}
		}
		if ( $pid === null && ($pid_from_loop = PostGetter::loop_to_id()) ) {
			$pid = $pid_from_loop;
		}
		return $pid;
	}

	/**
	 * Outputs the title of the post if you do something like `<h1>{{post}}</h1>`
	 * @return string
	 */
	public function __toString() {
		return $this->title();
	}

	protected function get_post_preview_object() {
		global $wp_query;
		if ( $this->is_previewing() ) {
			$revision_id = $this->get_post_preview_id( $wp_query );
			return new $this->PostClass( $revision_id );
		}
	}

	protected function get_post_preview_id( $query ) {
		$can = array(
			get_post_type_object($query->queried_object->post_type)->cap->edit_post,
		);

		if ( $query->queried_object->author_id !== get_current_user_id() ) {
			$can[] = get_post_type_object($query->queried_object->post_type)->cap->edit_others_posts;
		}

		$can_preview = array();

		foreach ( $can as $type ) {
			if ( current_user_can($type, $query->queried_object_id) ) {
				$can_preview[] = true;
			}
		}

		if ( count($can_preview) !== count($can) ) {
			return;
		}

		$revisions = wp_get_post_revisions($query->queried_object_id);

		if ( !empty($revisions) ) {
			$revision = reset($revisions);
			return $revision->ID;
		}

		return false;
	}

	/**
	 * Initializes a Post
	 * @internal
	 * @param integer $pid
	 */
	protected function init( $pid = false ) {
		if ( $pid === false ) {
			$pid = get_the_ID();
		}
		if ( is_numeric($pid) ) {
			$this->ID = $pid;
		}
		$post_info = $this->get_info($pid);
		$this->import($post_info);
	}

	/**
	 * Get the URL that will edit the current post/object
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @see Timber\Post::edit_link
	 * @return bool|string
	 */
	public function get_edit_url() {
		return $this->edit_link();
	}

	/**
	 * updates the post_meta of the current object with the given value
	 * @param string $field
	 * @param mixed $value
	 */
	public function update( $field, $value ) {
		if ( isset($this->ID) ) {
			update_post_meta($this->ID, $field, $value);
			$this->$field = $value;
		}
	}

	/**
	 * takes a mix of integer (post ID), string (post slug),
	 * or object to return a WordPress post object from WP's built-in get_post() function
	 * @internal
	 * @param integer $pid
	 * @return WP_Post on success
	 */
	protected function prepare_post_info( $pid = 0 ) {
		if ( is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0 ) {
			$pid = self::check_post_id($pid);
			$post = get_post($pid);
			if ( $post ) {
				return $post;
			}
		}
		//we can skip if already is WP_Post
		return $pid;
	}

	/**
	 * helps you find the post id regardless of whether you send a string or whatever
	 * @param integer $pid ;
	 * @internal
	 * @return integer ID number of a post
	 */
	protected function check_post_id( $pid ) {
		if ( is_numeric($pid) && $pid === 0 ) {
			$pid = get_the_ID();
			return $pid;
		}
		if ( !is_numeric($pid) && is_string($pid) ) {
			$pid = PostGetter::get_post_id_by_name($pid);
			return $pid;
		}
		if ( !$pid ) {
			return null;
		}
		return $pid;
	}

	/**
	 * get_post_id_by_name($post_name)
	 * @internal
	 * @deprecated since 1.5.0
	 * @param string $post_name
	 * @return int
	 */
	public static function get_post_id_by_name( $post_name ) {
		return PostGetter::get_post_id_by_name($post_name);
	}

	/**
	 * Gets a preview/excerpt of your post.
	 *
	 * If you have text defined in the excerpt textarea of your post, it will use that. Otherwise it
	 * will pull from the post_content. If there's a `<!-- more -->` tag, it will use that to mark
	 * where to pull through.
	 *
	 * This method returns a `Timber\PostPreview` object, which is a **chainable object**. This
	 * means that you can change the output of the preview by **adding more methods**. Refer to the
	 * [documentation of the `Timber\PostPreview` class](https://timber.github.io/docs/reference/timber-postpreview/)
	 * to get an overview of all the available methods.
	 *
	 * @example
	 * ```twig
     * {# Use default preview #}
	 * <p>{{ post.preview }}</p>
	 *
	 * {# Change the post preview text #}
	 * <p>{{ post.preview.read_more('Continue Reading') }}</p>
	 *
	 * {# Additionally restrict the length to 50 words #}
	 * <p>{{ post.preview.length(50).read_more('Continue Reading') }}</p>
	 * ```
	 * @see \Timber\PostPreview
	 * @return \Timber\PostPreview
	 */
	public function preview() {
		return new PostPreview($this);
	}

	/**
	 * get a preview of your post, if you have an excerpt it will use that,
	 * otherwise it will pull from the post_content.
	 * If there's a  tag it will use that to mark where to pull through.
	 * @deprecated since 1.3.1, use {{ post.preview }} instead
	 * @example
	 * ```twig
	 * <p>{{post.get_preview(50)}}</p>
	 * ```
	 * @param int $len The number of words that WP should use to make the tease. (Isn't this better than [this mess](http://wordpress.org/support/topic/changing-the-default-length-of-the_excerpt-1?replies=14)?). If you've set a post_excerpt on a post, we'll use that for the preview text; otherwise the first X words of the post_content
	 * @param bool $force What happens if your custom post excerpt is longer then the length requested? By default (`$force = false`) it will use the full `post_excerpt`. However, you can set this to true to *force* your excerpt to be of the desired length
	 * @param string $readmore The text you want to use on the 'readmore' link
	 * @param bool|string $strip true for default, false for none, string for list of custom attributes
	 * @param string $end The text to end the preview with (defaults to ...)
	 * @return string of the post preview
	 */
	public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true, $end = '…' ) {
		$text = '';
		$link = '';
		$trimmed = false;
		$last_p_tag = null;
		if ( isset($this->post_excerpt) && strlen(trim($this->post_excerpt)) ) {
			if ( $force ) {
				$text = TextHelper::trim_words($this->post_excerpt, $len, false);
				$trimmed = true;
			} else {
				$text = $this->post_excerpt;
			}
		}
		if ( !strlen($text) && preg_match('//', $this->post_content, $readmore_matches) ) {
			$pieces = explode($readmore_matches[0], $this->post_content);
			$text = $pieces[0];
			if ( $force ) {
				$text = TextHelper::trim_words($text, $len, false);
				$trimmed = true;
			}
			$text = do_shortcode($text);
		}
		if ( !strlen($text) ) {
			$text = $this->content();
			$text = TextHelper::remove_tags($text, array('script', 'style'));
			$text = TextHelper::trim_words($text, $len, false);
			$trimmed = true;
		}
		if ( !strlen(trim($text)) ) {
			return trim($text);
		}
		if ( $strip ) {
			$allowable_tags = (is_string($strip)) ? $strip : null;
			$text = trim(strip_tags($text, $allowable_tags));
		}
		if ( strlen($text) ) {
			$text = trim($text);
			$last = $text[strlen($text) - 1];
			if ( $last != '.' && $trimmed ) {
				$text .= $end;
			}
			if ( !$strip ) {
				$last_p_tag = strrpos($text, '
');
				if ( $last_p_tag !== false ) {
					$text = substr($text, 0, $last_p_tag);
				}
				if ( $last != '.' && $trimmed ) {
					$text .= $end.' ';
				}
			}
			$read_more_class = apply_filters('timber/post/get_preview/read_more_class', "read-more");
			if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) {
				$link = ' link().'" class="'.$read_more_class.'">'.trim($readmore_matches[1]).'';
			} elseif ( $readmore ) {
				$link = ' link().'" class="'.$read_more_class.'">'.trim($readmore).'';
			}
			$text .= apply_filters('timber/post/get_preview/read_more_link', $link);
			if ( !$strip && $last_p_tag && (strpos($text, '
') || strpos($text, 'get_post_custom($pid);
		$this->import($customs);
	}

	/**
	 * Used internally to fetch the metadata fields (wp_postmeta table)
	 * and attach them to our TimberPost object
	 * @internal
	 * @param int $pid
	 * @return array
	 */
	protected function get_post_custom( $pid ) {
		$post_meta = array();

		/**
		 * Filters post meta data before it is fetched from the database.
		 *
		 * Timber loads all meta values into the post object on initialization. With this filter,
		 * you can disable fetching the meta values through the default method, which uses
		 * `get_post_meta()`, by returning `false` or an non-empty array.
		 *
		 * @example
		 * ```php
		 * // Disable fetching meta values.
		 * add_filter( 'timber_post_get_meta_pre', '__return_false' );
		 *
		 * // Add your own meta data.
		 * add_filter( 'timber_post_get_meta_pre', function( $post_meta, $post_id, $post ) {
		 *     $post_meta = array(
		 *         'custom_data_1' => 73,
		 *         'custom_data_2' => 274,
		 *     );
		 *
		 *     return $post_meta;
		 * }, 10, 3 );
		 * ```
		 *
		 * @param array $post_meta        An array of custom meta values. Passing false or a
		 *                                non-empty array will skip fetching the values from the
		 *                                database and will use the filtered values instead. Default
		 *                                `array()`.
		 * @param int          $post_id   The post ID.
		 * @param \Timber\Post $post      The post object.
		 */
		$post_meta = apply_filters('timber_post_get_meta_pre', $post_meta, $pid, $this);

		// Load all meta data when it wasn't filtered before.
		if ( false !== $post_meta && empty( $post_meta ) ) {
			$post_meta = get_post_meta( $pid );
		}

		if ( !is_array($post_meta) ) {
			return array();
		}

		foreach ( $post_meta as $key => $value ) {
			if ( is_array($value) && count($value) == 1 && isset($value[0]) ) {
				$value = $value[0];
			}
			$post_meta[$key] = maybe_unserialize($value);
		}
		$post_meta = apply_filters('timber_post_get_meta', $post_meta, $pid, $this);
		return $post_meta;
	}

	/**
	 * @param int $i
	 * @return string
	 */
	protected static function get_wp_link_page( $i ) {
		$link = _wp_link_page($i);
		$link = new \SimpleXMLElement($link.'');
		if ( isset($link['href']) ) {
			return $link['href'];
		}
		return '';
	}

	/**
	 * Used internally by init, etc. to build TimberPost object
	 * @internal
	 * @param  int $pid
	 * @return null|object|WP_Post
	 */
	protected function get_info( $pid ) {
		$post = $this->prepare_post_info($pid);
		if ( !isset($post->post_status) ) {
			return null;
		}

		do_action_ref_array('the_post', array(&$post, &$GLOBALS['wp_query']));

		$post->status = $post->post_status;
		$post->id = $post->ID;
		$post->slug = $post->post_name;
		$customs = $this->get_post_custom($post->ID);
		if ( $this->is_previewing() ) {
			global $wp_query;
			$rev_id = $this->get_post_preview_id($wp_query);
			$customs = $this->get_post_custom($rev_id);
		}
		$post->custom = $customs;
		$post = (object) array_merge((array) $customs, (array) $post);
		return $post;
	}

	/**
	 *
	 * Gets the comment form for use on a single article page
	 * @param array This $args array thing is a mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)
	 * @return string of HTML for the form
	 */
	public function comment_form( $args = array() ) {
		return Helper::get_comment_form($this->ID, $args);
	}

	/**
	 * Gets the terms associated with the post.
	 *
	 * @api
	 * @todo Remove deprecated parameters in 2.x
	 * @example
	 * ```twig
	 * <section id="job-feed">
	 * {% for post in job %}
	 *     <div class="job">
	 *         <h2>{{ post.title }}</h2>
	 *         <p>{{ post.terms( {query:{taxonomy:'category', orderby:'name', order: 'ASC'}} )|join(', ') }}</p>
	 *     </div>
	 * {% endfor %}
	 * </section>
	 * ```
	 * ```html
	 * <section id="job-feed">
	 *     <div class="job">
	 *         <h2>Cheese Maker</h2>
	 *         <p>Cheese, Food, Fromage</p>
	 *     </div>
	 *     <div class="job">
	 *         <h2>Mime</h2>
	 *         <p>Performance, Silence</p>
	 *     </div>
	 * </section>
	 * ```
	 * ```php
	 * // Get all terms of a taxonomy.
	 * $terms = $post->terms( 'category' );
	 *
	 * // Get terms of multiple taxonomies.
	 * $terms = $post->terms( array( 'books', 'movies' ) );
	 *
	 * // Use custom arguments for taxonomy query and options.
	 * $terms = $post->terms( array(
     *     'query' => [
     *         'taxonomy' => 'custom_tax',
     *         'orderby'  => 'count',
     *     ],
     *     'merge'      => false,
     *     'term_class' => 'My_Term_Class'
     * ) );
	 * ```
	 *
	 * @param string|array $args {
	 *     Optional. Name of the taxonomy or array of arguments.
	 *
	 *     @type array $query       Any array of term query parameters for getting the terms. See
	 *                              `WP_Term_Query::__construct()` for supported arguments. Use the
	 *                              `taxonomy` argument to choose which taxonomies to get. Defaults
	 *                              to querying all registered taxonomies for the post type. You can
	 *                              use custom or built-in WordPress taxonomies (category, tag).
	 *                              Timber plays nice and figures out that `tag`, `tags` or
	 *                              `post_tag` are all the same (also for `categories` or
	 *                              `category`). For custom taxonomies you need to define the
	 *                              proper name.
	 *     @type bool $merge        Whether the resulting array should be one big one (`true`) or
	 *                              whether it should be an array of sub-arrays for each taxonomy
	 *                              (`false`). Default `true`.
	 *     @type string $term_class The Timber term class to use for the term objects.
	 * }
	 * @param bool   $merge      Deprecated. Optional. See `$merge` argument in `$args` parameter.
	 * @param string $term_class Deprecated. Optional. See `$term_class` argument in `$args`
	 *                           parameter.
	 * @return array An array of taxonomies.
	 */
	public function terms( $args = array(), $merge = true, $term_class = '' ) {
		// Ensure backwards compatibility.
		if ( ! is_array( $args ) || isset( $args[0] ) ) {
			$args = array(
				'query' => array(
					'taxonomy' => $args,
				),
				'merge' => $merge,
				'term_class' => $term_class,
			);

			if ( empty( $args['term_class']) ) {
				$args['term_class'] = $this->TermClass;
			}
		}

		// Defaults.
		$args = wp_parse_args( $args, array(
			'query' => array(
				'taxonomy' => 'all',
			),
			'merge' => true,
			'term_class' => $this->TermClass,
		) );

		$tax        = $args['query']['taxonomy'];
		$merge      = $args['merge'];
		$term_class = $args['term_class'];

		$taxonomies = array();

		// @todo: Remove in 2.x
		if ( is_string($merge) && class_exists($merge) ) {
			$term_class = $merge;
		}

		// Build an array of taxonomies.
		if ( is_array( $tax ) ) {
			$taxonomies = $tax;
		} elseif ( is_string( $tax ) ) {
			if ( in_array( $tax, array( 'all', 'any', '' ) ) ) {
				$taxonomies = get_object_taxonomies($this->post_type);
			} else {
				$taxonomies = array($tax);
			}
		}

		// @todo Remove in 2.x
		$taxonomies = array_map( function( $taxonomy ) {
			if ( in_array( $taxonomy, array( 'tag', 'tags' ), true ) ) {
				$taxonomy = 'post_tag';
			} elseif ( 'categories' === $taxonomy ) {
				$taxonomy = 'category';
			}

			return $taxonomy;
		}, $taxonomies );

		$terms = wp_get_post_terms( $this->ID, $taxonomies, $args['query'] );

		if ( is_wp_error( $terms ) ) {
			/**
			 * @var $terms \WP_Error
			 */
			Helper::error_log( "Error retrieving terms for taxonomies on a post in timber-post.php" );
			Helper::error_log( 'tax = ' . print_r( $tax, true ) );
			Helper::error_log( 'WP_Error: ' . $terms->get_error_message() );

			return $terms;
		}

		// Map over array of WordPress terms and transform them into instances of the chosen term class.
		$terms = array_map( function( $term ) use ( $term_class ) {
			return call_user_func( array( $term_class, 'from' ), $term->term_id, $term->taxonomy );
		}, $terms );

		if ( ! $merge ) {
			$terms_sorted = array();

			// Initialize sub-arrays.
			foreach ( $taxonomies as $taxonomy ) {
				$terms_sorted[ $taxonomy ] = array();
			}

			// Fill terms into arrays.
			foreach ( $terms as $term ) {
				$terms_sorted[ $term->taxonomy ][] = $term;
			}

			return $terms_sorted;
		}

		return $terms;
	}

	/**
	 * @param string|int $term_name_or_id
	 * @param string $taxonomy
	 * @return bool
	 */
	public function has_term( $term_name_or_id, $taxonomy = 'all' ) {
		if ( $taxonomy == 'all' || $taxonomy == 'any' ) {
			$taxes = get_object_taxonomies($this->post_type, 'names');
			$ret = false;
			foreach ( $taxes as $tax ) {
				if ( has_term($term_name_or_id, $tax, $this->ID) ) {
					$ret = true;
					break;
				}
			}
			return $ret;
		}
		return has_term($term_name_or_id, $taxonomy, $this->ID);
	}

	/**
	 * @return string
	 */
	public function get_paged_content() {
		return $this->paged_content();
	}

	/**
	 * Returns the post_type object with labels and other info
	 *
	 * @deprecated since 1.0.4
	 * @example
	 *
	 * ```twig
	 * This post is from <span>{{ post.get_post_type.labels.plural }}</span>
	 * ```
	 *
	 * ```html
	 * This post is from <span>Recipes</span>
	 * ```
	 * @return PostType
	 */
	public function get_post_type() {
		return $this->type();
	}

	/**
	 * @return int the number of comments on a post
	 */
	public function get_comment_count() {
		return get_comments_number($this->ID);
	}

	/**
	 * @param string $field_name
	 * @return boolean
	 */
	public function has_field( $field_name ) {
		return (!$this->get_field($field_name)) ? false : true;
	}

	/**
	 * Gets the field object data from Advanced Custom Fields.
	 * This includes metadata on the field like whether it's conditional or not.
	 *
	 * @since 1.6.0
	 * @param string $field_name of the field you want to lookup.
	 * @return mixed
	 */
	public function field_object( $field_name ) {
		$value = apply_filters('timber/post/meta_object_field', null, $this->ID, $field_name, $this);
		$value = $this->convert($value);
		return $value;
	}

	/**
	 * @param string $field_name
	 * @return mixed
	 */
	public function get_field( $field_name ) {
		if ( $rd = $this->get_revised_data_from_method('get_field', $field_name) ) {
			return $rd;
		}
		$value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this);
		if ( $value === null ) {
			$value = get_post_meta($this->ID, $field_name);
			if ( is_array($value) && count($value) == 1 ) {
				$value = $value[0];
			}
			if ( is_array($value) && count($value) == 0 ) {
				$value = null;
			}
		}
		$value = apply_filters('timber_post_get_meta_field', $value, $this->ID, $field_name, $this);
		$value = $this->convert($value);
		return $value;
	}

	/**
	 * @param string $field_name
	 */
	public function import_field( $field_name ) {
		$this->$field_name = $this->get_field($field_name);
	}

	/**
	 * Get the CSS classes for a post without cache. For usage you should use `{{post.class}}`
	 * @internal
	 * @param string $class additional classes you want to add
	 * @example
	 * ```twig
	 * <article class="{{ post.post_class }}">
	 *    {# Some stuff here #}
	 * </article>
	 * ```
	 *
	 * ```html
	 * <article class="post-2612 post type-post status-publish format-standard has-post-thumbnail hentry category-data tag-charleston-church-shooting tag-dylann-roof tag-gun-violence tag-hate-crimes tag-national-incident-based-reporting-system">
	 *    {# Some stuff here #}
	 * </article>
	 * ```
	 * @return string a space-seperated list of classes
	 */
	public function post_class( $class = '' ) {
		global $post;
		$old_global_post = $post;
		$post = $this;
		$class_array = get_post_class($class, $this->ID);
		if ( $this->is_previewing() ) {
			$class_array = get_post_class($class, $this->post_parent);
		}
		$post = $old_global_post;
		if ( is_array($class_array) ) {
			return implode(' ', $class_array);
		}
		return $class_array;
	}

	/**
	 * Get the CSS classes for a post, but with caching css post classes. For usage you should use `{{ post.class }}` instead of `{{post.css_class}}` or `{{post.post_class}}`
	 * @internal
	 * @param string $class additional classes you want to add
	 * @see Timber\Post::$_css_class
	 * @example
	 * ```twig
	 * <article class="{{ post.class }}">
	 *    {# Some stuff here #}
	 * </article>
	 * ```
	 *
	 * @return string a space-seperated list of classes
	 */
	public function css_class( $class = '' ) {
		if ( !$this->_css_class ) {
			$this->_css_class = $this->post_class();
		}

		return trim(sprintf('%s %s', $this->_css_class, $class));
	}

	// Docs

	/**
	 * @return array
	 * @codeCoverageIgnore
	 */
	public function get_method_values() {
		$ret = parent::get_method_values();
		$ret['author'] = $this->author();
		$ret['categories'] = $this->categories();
		$ret['category'] = $this->category();
		$ret['children'] = $this->children();
		$ret['comments'] = $this->comments();
		$ret['content'] = $this->content();
		$ret['edit_link'] = $this->edit_link();
		$ret['format'] = $this->format();
		$ret['link'] = $this->link();
		$ret['next'] = $this->next();
		$ret['pagination'] = $this->pagination();
		$ret['parent'] = $this->parent();
		$ret['path'] = $this->path();
		$ret['prev'] = $this->prev();
		$ret['terms'] = $this->terms();
		$ret['tags'] = $this->tags();
		$ret['thumbnail'] = $this->thumbnail();
		$ret['title'] = $this->title();
		return $ret;
	}

	/**
	 * Return the author of a post
	 * @api
	 * @example
	 * ```twig
	 * <h1>{{post.title}}</h1>
	 * <p class="byline">
	 *     <a href="{{post.author.link}}">{{post.author.name}}</a>
	 * </p>
	 * ```
	 * @return User|null A User object if found, false if not
	 */
	public function author() {
		if ( isset($this->post_author) ) {
			return new User($this->post_author);
		}
	}

	public function authors() {
		return apply_filters('timber/post/authors', array($this->author()), $this);
	}

	/**
	 * Get the author (WordPress user) who last modified the post
	 * @example
	 * ```twig
	 * Last updated by {{ post.modified_author.name }}
	 * ```
	 * ```html
	 * Last updated by Harper Lee
	 * ```
	 * @return User|null A User object if found, false if not
	 */
	public function modified_author() {
		$user_id = get_post_meta($this->ID, '_edit_last', true);
		return ($user_id ? new User($user_id) : $this->author());
	}

	/**
	 * Get the categoires on a particular post
	 * @api
	 * @return array of Timber\Terms
	 */
	public function categories() {
		return $this->terms('category');
	}

	/**
	 * Returns a category attached to a post
	 * @api
	 * If mulitpuile categories are set, it will return just the first one
	 * @return Timber\Term|null
	 */
	public function category() {
		return $this->get_category();
	}

	/**
	 * Returns an array of children on the post as Timber\Posts
	 * (or other claass as you define).
	 * @api
	 * @example
	 * ```twig
	 * {% if post.children %}
	 *     Here are the child pages:
	 *     {% for child in post.children %}
	 *         <a href="{{ child.link }}">{{ child.title }}</a>
	 *     {% endfor %}
	 * {% endif %}
	 * ```
	 * @param string|array $post_type _optional_ use to find children of a particular post type (attachment vs. page for example). You might want to restrict to certain types of children in case other stuff gets all mucked in there. You can use 'parent' to use the parent's post type or you can pass an array of post types.
	 * @param string|bool $childPostClass _optional_ a custom post class (ex: 'MyTimber\Post') to return the objects as. By default (false) it will use Timber\Post::$post_class value.
	 * @return array
	 */
	public function children( $post_type = 'any', $childPostClass = false ) {
		if ( $childPostClass === false ) {
			$childPostClass = $this->PostClass;
		}
		if ( $post_type == 'parent' ) {
			$post_type = $this->post_type;
		}
		if ( is_array($post_type) ) {
			$post_type = implode('&post_type[]=', $post_type);
		}
		$query = 'post_parent='.$this->ID.'&post_type[]='.$post_type.'&numberposts=-1&orderby=menu_order title&order=ASC&post_status[]=publish';
		if ( $this->post_status == 'publish' ) {
			$query .= '&post_status[]=inherit';
		}
		$children = get_children($query);
		foreach ( $children as &$child ) {
			$child = new $childPostClass($child->ID);
		}
		$children = array_values($children);
		return $children;
	}

	/**
	 * Gets the comments on a `Timber\Post` and returns them as a `Timber\CommentThread`: a PHP
	 * ArrayObject of [`Timber\Comment`](https://timber.github.io/docs/reference/timber-comment/)
	 * (or whatever comment class you set).
	 * @api
	 *
	 * @param int    $count        Set the number of comments you want to get. `0` is analogous to
	 *                             "all".
	 * @param string $order        Use ordering set in WordPress admin, or a different scheme.
	 * @param string $type         For when other plugins use the comments table for their own
	 *                             special purposes. Might be set to 'liveblog' or other, depending
	 *                             on what's stored in your comments table.
	 * @param string $status       Could be 'pending', etc.
	 * @param string $CommentClass What class to use when returning Comment objects. As you become a
	 *                             Timber Pro, you might find yourself extending `Timber\Comment`
	 *                             for your site or app (obviously, totally optional).
	 * @see \Timber\CommentThread for an example with nested comments
	 * @return bool|\Timber\CommentThread
	 *
	 * @example
	 *
	 * **single.twig**
	 *
	 * ```twig
	 * <div id="post-comments">
	 *   <h4>Comments on {{ post.title }}</h4>
	 *   <ul>
	 *     {% for comment in post.comments() %}
	 *       {% include 'comment.twig' %}
	 *     {% endfor %}
	 *   </ul>
	 *   <div class="comment-form">
	 *     {{ function('comment_form') }}
	 *   </div>
	 * </div>
	 * ```
	 *
	 * **comment.twig**
	 *
	 * ```twig
	 * {# comment.twig #}
	 * <li>
	 *   <p class="comment-author">{{ comment.author.name }} says:</p>
	 *   <div>{{ comment.content }}</div>
	 * </li>
	 * ```
	 */
	public function comments( $count = null, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'Timber\Comment' ) {
		global $overridden_cpage, $user_ID;
		$overridden_cpage = false;

		$commenter = wp_get_current_commenter();
		$comment_author_email = $commenter['comment_author_email'];

		$args = array('status' => $status, 'order' => $order, 'type' => $type);
		if ( $count > 0 ) {
			$args['number'] = $count;
		}
		if ( strtolower($order) == 'wp' || strtolower($order) == 'wordpress' ) {
			$args['order'] = get_option('comment_order');
		}
		if ( $user_ID ) {
			$args['include_unapproved'] = array($user_ID);
		} elseif ( !empty($comment_author_email) ) {
			$args['include_unapproved'] = array($comment_author_email);
		} elseif ( function_exists('wp_get_unapproved_comment_author_email') ) {
			$unapproved_email = wp_get_unapproved_comment_author_email();
			if ( $unapproved_email ) {
				$args['include_unapproved'] = array($unapproved_email);
			}
		}
		$ct = new CommentThread($this->ID, false);
		$ct->CommentClass = $CommentClass;
		$ct->init($args);
		return $ct;
	}

	/**
	 * If the Password form is to be shown, show it!
	 * @return string|void
	 */
	protected function maybe_show_password_form() {
		if ( $this->password_required() ) {
			$show_pw = false;
			$show_pw = apply_filters('timber/post/content/show_password_form_for_protected', $show_pw);
			if ( $show_pw ) {
				return apply_filters('timber/post/content/password_form', get_the_password_form($this->ID), $this);
			}
		}
	}

	/**
	 *
	 */
	protected function get_revised_data_from_method( $method, $args = false ) {
		if ( ! is_array($args) ) {
			$args = array($args);
		}
		$rev = $this->get_post_preview_object();
		if ( $rev && $this->ID == $rev->post_parent && $this->ID != $rev->ID ) {
			return call_user_func_array( array($rev, $method), $args );
		}
	}

	/**
	 * Gets the actual content of a WP Post, as opposed to post_content this will run the hooks/filters attached to the_content. \This guy will return your posts content with WordPress filters run on it (like for shortcodes and wpautop).
	 * @api
	 * @example
	 * ```twig
	 * <div class="article">
	 *     <h2>{{post.title}}</h2>
	 *     <div class="content">{{ post.content }}</div>
	 * </div>
	 * ```
	 * @param int $page
	 * @return string
	 */
	public function content( $page = 0, $len = -1 ) {
		if ( $rd = $this->get_revised_data_from_method('content', array($page, $len) ) ) {
			return $rd;
		}
		if ( $form = $this->maybe_show_password_form() ) {
			return $form;
		}
		if ( $len == -1 && $page == 0 && $this->___content ) {
			return $this->___content;
		}
		$content = $this->post_content;
		if ( $len > 0 ) {
			$content = wp_trim_words($content, $len);
		}
		if ( $page ) {
			$contents = explode('', $content);
			$page--;
			if ( count($contents) > $page ) {
				$content = $contents[$page];
			}
		}
		$content = $this->content_handle_no_teaser_block( $content );
		$content = apply_filters('the_content', ($content));
		if ( $len == -1 && $page == 0 ) {
			$this->___content = $content;
		}
		return $content;
	}

	/**
	 * Handles for an circumstance with the Block editor where a "more" block has an option to
	 * "Hide the excerpt on the full content page" which hides everything prior to the inserted
	 * "more" block
	 * @ticket #2218
	 * @param string $content
	 * @return string
	 */
	protected function content_handle_no_teaser_block( $content ) {
		if ( (strpos($content, 'noTeaser:true') !== false || strpos($content, '"noTeaser":true') !== false) && strpos($content, '') !== false) {
			$arr = explode('', $content);
			return trim($arr[1]);
		}
		return $content;
	}

	/**
	 * @return string
	 */
	public function paged_content() {
		global $page;
		return $this->content($page, -1);
	}

	/**
	 * Get the date to use in your template!
	 * @api
	 * @example
	 * ```twig
	 * Published on {{ post.date }} // Uses WP's formatting set in Admin
	 * OR
	 * Published on {{ post.date('F jS') }} // Jan 12th
	 * ```
	 *
	 * ```html
	 * Published on January 12, 2015
	 * OR
	 * Published on Jan 12th
	 * ```
	 * @param string $date_format
	 * @return string
	 */
	public function date( $date_format = '' ) {
		$df = $date_format ? $date_format : get_option('date_format');
		$the_date = date_i18n($df, strtotime($this->post_date));
		return apply_filters('get_the_date', $the_date, $df, $this->id);
	}

	/**
	 * Get the time to use in your template
	 * @api
	 * @example
	 * ```twig
	 * Published at {{ post.time }} // Uses WP's formatting set in Admin
	 * OR
	 * Published at {{ post.time | time('G:i') }} // 13:25
	 * ```
	 *
	 * ```html
	 * Published at 1:25 pm
	 * OR
	 * Published at 13:25
	 * ```
	 * @param string $time_format
	 * @return string
	 */
	public function time( $time_format = '' ) {
		$tf = $time_format ? $time_format : get_option('time_format');
		$the_time = date_i18n($tf, strtotime($this->post_date));
		return apply_filters('get_the_time', $the_time, $tf, $this->id);
	}

	/**
	 * Returns the post_type object with labels and other info
	 *
	 * @since 1.0.4
	 * @example
	 *
	 * ```twig
	 * This post is from <span>{{ post.type.labels.name }}</span>
	 * ```
	 *
	 * ```html
	 * This post is from <span>Recipes</span>
	 * ```
	 * @return PostType
	 */
	public function type() {
		if ( isset($this->custom['type']) ) {
			return $this->custom['type'];
		}
		if ( !$this->__type instanceof PostType ) {
			$this->__type = new PostType($this->post_type);
		}
		return $this->__type;
	}

	/**
	 * Returns the edit URL of a post if the user has access to it
	 * @return bool|string the edit URL of a post in the WordPress admin
	 */
	public function edit_link() {
		if ( $this->can_edit() ) {
			return get_edit_post_link($this->ID);
		}
	}

	/**
	 * @api
	 * @return mixed
	 */
	public function format() {
		return get_post_format($this->ID);
	}

	/**
	 * whether post requires password and correct password has been provided
	 * @api
	 * @return boolean
	 */
	public function password_required() {
		return post_password_required($this->ID);
	}

	/**
	 * get the permalink for a post object
	 * @api
	 * @example
	 * ```twig
	 * <a href="{{post.link}}">Read my post</a>
	 * ```
	 * @return string ex: http://example.org/2015/07/my-awesome-post
	 */
	public function link() {
		if ( isset($this->_permalink) ) {
			return $this->_permalink;
		}
		$this->_permalink = get_permalink($this->ID);
		return $this->_permalink;
	}

	/**
	 * @param string $field_name
	 * @return mixed
	 */
	public function meta( $field_name = null ) {
		if ( $field_name === null ) {
			//on the off-chance the field is actually named meta
			$field_name = 'meta';
		}
		return $this->get_field($field_name);
	}

	/**
	 * @return string
	 */
	public function name() {
		return $this->title();
	}

	/**
	 * @param string $date_format
	 * @return string
	 */
	public function modified_date( $date_format = '' ) {
		$df = $date_format ? $date_format : get_option('date_format');
		$the_time = $this->get_modified_time($df);
		return apply_filters('get_the_modified_date', $the_time, $date_format, get_post($this->id));
	}

	/**
	 * @param string $time_format
	 * @return string
	 */
	public function modified_time( $time_format = '' ) {
		return $this->get_modified_time($time_format);
	}

	/**
	 * @api
	 * @param bool $in_same_term
	 * @return mixed
	 */
	public function next( $in_same_term = false ) {
		if ( !isset($this->_next) || !isset($this->_next[$in_same_term]) ) {
			global $post;
			$this->_next = array();
			$old_global = $post;
			$post = $this;
			if ( $in_same_term ) {
				$adjacent = get_adjacent_post(true, '', false, $in_same_term);
			} else {
				$adjacent = get_adjacent_post(false, '', false);
			}

			if ( $adjacent ) {
				$this->_next[$in_same_term] = new $this->PostClass($adjacent);
			} else {
				$this->_next[$in_same_term] = false;
			}
			$post = $old_global;
		}
		return $this->_next[$in_same_term];
	}

	/**
	 * Get a data array of pagination so you can navigate to the previous/next for a paginated post
	 * @return array
	 */
	public function pagination() {
		global $post, $page, $numpages, $multipage;
		$post = $this;
		$ret = array();
		if ( $multipage ) {
			for ( $i = 1; $i <= $numpages; $i++ ) {
				$link = self::get_wp_link_page($i);
				$data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link);
				if ( $i == $page ) {
					$data['current'] = true;
				}
				$ret['pages'][] = $data;
			}
			$i = $page - 1;
			if ( $i ) {
				$link = self::get_wp_link_page($i);
				$ret['prev'] = array('link' => $link);
			}
			$i = $page + 1;
			if ( $i <= $numpages ) {
				$link = self::get_wp_link_page($i);
				$ret['next'] = array('link' => $link);
			}
		}
		return $ret;
	}

	/**
	 * Finds any WP_Post objects and converts them to Timber\Posts
	 * @param array|WP_Post $data
	 * @param string $class
	 */
	public function convert( $data ) {
		if ( is_object($data) ) {
			$data = Helper::convert_wp_object($data);
		} else if ( is_array($data) ) {
			$func = __FUNCTION__;
			foreach ( $data as &$ele ) {
				if ( is_array($ele) ) {
					$ele = $this->$func($ele);
				} else if ( is_object($ele) ) {
					$ele = Helper::convert_wp_object($ele);
				}
			}
		}
		return $data;
	}

	/**
	 * Gets the parent (if one exists) from a post as a Timber\Post object (or whatever is set in Timber\Post::$PostClass)
	 * @api
	 * @example
	 * ```twig
	 * Parent page: <a href="{{ post.parent.link }}">{{ post.parent.title }}</a>
	 * ```
	 * @return bool|Timber\Post
	 */
	public function parent() {
		if ( !$this->post_parent ) {
			return false;
		}
		return new $this->PostClass($this->post_parent);
	}

	/**
	 * Gets the relative path of a WP Post, so while link() will return http://example.org/2015/07/my-cool-post
	 * this will return just /2015/07/my-cool-post
	 * @api
	 * @example
	 * ```twig
	 * <a href="{{post.path}}">{{post.title}}</a>
	 * ```
	 * @return string
	 */
	public function path() {
		return URLHelper::get_rel_url($this->get_link());
	}

	/**
	 * Get the previous post in a set
	 * @api
	 * @example
	 * ```twig
	 * <h4>Prior Entry:</h4>
	 * <h3>{{post.prev.title}}</h3>
	 * <p>{{post.prev.get_preview(25)}}</p>
	 * ```
	 * @param bool $in_same_term
	 * @return mixed
	 */
	public function prev( $in_same_term = false ) {
		if ( isset($this->_prev) && isset($this->_prev[$in_same_term]) ) {
			return $this->_prev[$in_same_term];
		}
		global $post;
		$old_global = $post;
		$post = $this;
		$within_taxonomy = ($in_same_term) ? $in_same_term : 'category';
		$adjacent = get_adjacent_post(($in_same_term), '', true, $within_taxonomy);
		$prev_in_taxonomy = false;
		if ( $adjacent ) {
			$prev_in_taxonomy = new $this->PostClass($adjacent);
		}
		$this->_prev[$in_same_term] = $prev_in_taxonomy;
		$post = $old_global;
		return $this->_prev[$in_same_term];
	}

	/**
	 * Gets the tags on a post, uses WP's post_tag taxonomy
	 * @api
	 * @return array
	 */
	public function tags() {
		return $this->get_tags();
	}

	/**
	 * get the featured image as a Timber/Image
	 * @api
	 * @example
	 * ```twig
	 * <img src="{{ post.thumbnail.src }}" />
	 * ```
	 * @return Image|null of your thumbnail
	 */
	public function thumbnail() {
		$tid = get_post_thumbnail_id($this->ID);
		if ( $tid ) {
			//return new Image($tid);
			return new $this->ImageClass($tid);
		}
	}

	/**
	 * Returns the processed title to be used in templates. This returns the title of the post after WP's filters have run. This is analogous to `the_title()` in standard WP template tags.
	 * @api
	 * @example
	 * ```twig
	 * <h1>{{ post.title }}</h1>
	 * ```
	 * @return string
	 */
	public function title() {
		if ( $rd = $this->get_revised_data_from_method('title') ) {
			return $rd;
		}
		return apply_filters('the_title', $this->post_title, $this->ID);
	}

	/**
	 * Returns the gallery
	 * @api
	 * @example
	 * ```twig
	 * {{ post.gallery }}
	 * ```
	 * @return html
	 */
	public function gallery( $html = true ) {
		if ( isset($this->custom['gallery']) ) {
			return $this->custom['gallery'];
		}
		$galleries = get_post_galleries($this->ID, $html);
		$gallery = reset($galleries);

		return apply_filters('get_post_gallery', $gallery, $this->ID, $galleries);
	}

	/**
	 * Returns the audio
	 * @api
	 * @example
	 * ```twig
	 * {{ post.audio }}
	 * ```
	 * @return html
	 */
	public function audio() {
		if ( isset($this->custom['audio']) ) {
			return $this->custom['audio'];
		}
		$audio = false;

		// Only get audio from the content if a playlist isn't present.
		if ( false === strpos($this->get_content(), 'wp-playlist-script') ) {
			$audio = get_media_embedded_in_content($this->get_content(), array('audio'));
		}

		return $audio;
	}

	/**
	 * Returns the video
	 * @api
	 * @example
	 * ```twig
	 * {{ post.video }}
	 * ```
	 * @return html
	 */
	public function video() {
		if ( isset($this->custom['video']) ) {
			return $this->custom['video'];
		}
		$video = false;

		// Only get video from the content if a playlist isn't present.
		if ( false === strpos($this->get_content(), 'wp-playlist-script') ) {
			$video = get_media_embedded_in_content($this->get_content(), array('video', 'object', 'embed', 'iframe'));
		}

		return $video;
	}

	/**
	 *
	 * ===================================
	 * DEPRECATED FUNCTIONS LIVE DOWN HERE
	 * ===================================
	 *
	 */

	/**
	 * Get the categories for a post
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @see Timber\Post::categories
	 * @return array of Timber\Terms
	 */
	public function get_categories() {
		return $this->terms('category');
	}

	/**
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @see Timber\Post::category
	 * @return mixed
	 */
	public function get_category( ) {
		$cats = $this->get_categories();
		if ( count($cats) && isset($cats[0]) ) {
			return $cats[0];
		}
	}

	/**
	 * @param string $field
	 * @return Timber\Image
	 */
	public function get_image( $field ) {
		return new $this->ImageClass($this->$field);
	}

	/**
	 * Gets an array of tags for you to use
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @example
	 * ```twig
	 * <ul class="tags">
	 *     {% for tag in post.tags %}
	 *         <li>{{tag.name}}</li>
	 *     {% endfor %}
	 * </ul>
	 * ```
	 * @return array
	 */
	public function get_tags() {
		return $this->terms('post_tag');
	}

	/**
	 * Outputs the title with filters applied
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @example
	 * ```twig
	 * <h1>{{post.get_title}}</h1>
	 * ```
	 * ```html
	 * <h1>Hello World!</h1>
	 * ```
	 * @return string
	 */
	public function get_title() {
		return $this->title();
	}

	/**
	 * Displays the content of the post with filters, shortcodes and wpautop applied
	 * @example
	 * ```twig
	 * <div class="article-text">{{post.get_content}}</div>
	 * ```
	 * ```html
	 * <div class="article-text"><p>Blah blah blah</p><p>More blah blah blah.</p></div>
	 * ```
	 * @param int $len
	 * @param int $page
	 * @return string
	 */
	public function get_content( $len = -1, $page = 0 ) {
		if ( $len === 0 ) {
			$len = -1;
		}
		return $this->content($page, $len);
	}

	/**
	 * @internal
	 * @deprecated since 1.0
	 * @return mixed
	 */
	public function get_format() {
		return $this->format();
	}

	/**
	 * Get the terms associated with the post
	 * This goes across all taxonomies by default
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @param string|array $tax What taxonom(y|ies) to pull from. Defaults to all registered taxonomies for the post type. You can use custom ones, or built-in WordPress taxonomies (category, tag). Timber plays nice and figures out that tag/tags/post_tag are all the same (and categories/category), for custom taxonomies you're on your own.
	 * @param bool $merge Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)?
	 * @return array
	 */
	public function get_terms( $tax = '', $merge = true, $TermClass = '' ) {
		return $this->terms($tax, $merge, $TermClass);
	}

	/**
	 * @deprecated 0.20.0 use link() instead
	 * @codeCoverageIgnore
	 * @return string
	 */
	public function permalink() {
		Helper::warn('post.permalink has been removed, please use post.link');
		return $this->link();
	}

	/**
	 * @internal
	 * @see Timber\Post::date
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @param  string $date_format
	 * @return string
	 */
	public function get_date( $date_format = '' ) {
		return $this->date($date_format);
	}

	/**
	 * @internal
	 * @see Timber\Post::modified_date
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @param  string $date_format
	 * @return string
	 */
	public function get_modified_date( $date_format = '' ) {
		return $this->modified_date($date_format);
	}

	/**
	 * @internal
	 * @param  string $time_format
	 * @return string
	 */
	public function get_modified_time( $time_format = '' ) {
		$tf = $time_format ? $time_format : get_option('time_format');
		$the_time = get_post_modified_time($tf, false, $this->ID, true);
		return apply_filters('get_the_modified_time', $the_time, $time_format, get_post($this->id));
	}

	/**
	 * @internal
	 * @see Timber\Post::children
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @param string 		$post_type
	 * @param bool|string 	$childPostClass
	 * @return array
	 */
	public function get_children( $post_type = 'any', $childPostClass = false ) {
		return $this->children($post_type, $childPostClass);
	}

	/**
	 * Get the permalink for a post, but as a relative path
	 * For example, where {{post.link}} would return "http://example.org/2015/07/04/my-cool-post"
	 * this will return the relative version: "/2015/07/04/my-cool-post"
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return string
	 */
	public function get_path() {
		return $this->path();
	}

	/**
	 * Get the next post in WordPress's ordering
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return TimberPost|boolean
	 */
	public function get_prev( $in_same_term = false ) {
		return $this->prev($in_same_term);
	}

	/**
	 * Get the parent post of the post
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return bool|TimberPost
	 */
	public function get_parent() {
		return $this->parent();
	}

	/**
	 * Gets a User object from the author of the post
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @see Timber\Post::author
	 * @return User|null
	 */
	public function get_author() {
		return $this->author();
	}

	/**
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return User|null
	 */
	public function get_modified_author() {
		return $this->modified_author();
	}

	/**
	 * @internal
	 * @see TimberPost::thumbnail
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return Image|null
	 */
	public function get_thumbnail() {
		return $this->thumbnail();
	}

	/**
	 * @internal
	 * @see TimberPost::link
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return string
	 */
	public function get_permalink() {
		return $this->link();
	}

	/**
	 * get the permalink for a post object
	 * In your templates you should use link:
	 * Read my post
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return string
	 */
	public function get_link() {
		return $this->get_permalink();
	}

	/**
	 * Get the next post in WordPress's ordering
	 * @internal
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @param bool $taxonomy
	 * @return TimberPost|boolean
	 */
	public function get_next( $taxonomy = false ) {
		return $this->next($taxonomy);
	}

	/**
	 * Get a data array of pagination so you can navigate to the previous/next for a paginated post
	 * @internal
	 * @see Timber\Post::pagination();
	 * @deprecated since 1.0
	 * @codeCoverageIgnore
	 * @return array
	 */
	public function get_pagination() {
		return $this->pagination();
	}

	/**
	 * Get the comments for a post
	 * @internal
	 * @see Timber\Post::comments
	 * @param int $count
	 * @param string $order
	 * @param string $type
	 * @param string $status
	 * @param string $CommentClass
	 * @return array|mixed
	 */
	public function get_comments( $count = null, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'Timber\Comment' ) {
		return $this->comments($count, $order, $type, $status, $CommentClass);
	}

}


text:
'use strict';

import sinon from 'sinon'
import {router} from 'nxus-router'
import {application as app} from 'nxus-core'
import UsersLoginRoutes from '../'
import {users} from '../../../'

describe("Users Login Routes", () => {
  var module;

  before(() => {
    users.getBaseUrl = () => Promise.resolve('/')
  })

  describe("Load", function() {
    it("should not be null", () => UsersLoginRoutes.should.not.be.null)

    it("should be instantiated", function() {
      this.timeout(5000)
      module = new UsersLoginRoutes();
      module.should.not.be.null;
    });
  });

  describe("Init", () => {
    it("should provide routes", (done) => {
      app.onceAfter('load', () => {
        router.provide.calledWith('route', 'GET', '/logout').should.be.true
        router.provide.calledWith('route', 'GET', '/forgot').should.be.true
        router.provide.calledWith('route', 'POST', '/forgot').should.be.true
        router.provide.calledWith('route', 'GET', '/login-link').should.be.true
        router.provide.calledWith('route', 'GET', '/login').should.be.true
        done()
      })
      app.emit('load')
    });
  });
});


text:
<!doctype html>

    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />

    <link rel="stylesheet" href="styles/main.css">


text:
import mock
from oslo_config import cfg
import oslo_messaging as messaging

from ironic.common import context as ironic_context
from ironic.common import rpc
from ironic.tests import base

CONF = cfg.CONF

class TestUtils(base.TestCase):

    @mock.patch.object(messaging, 'Notifier', autospec=True)
    @mock.patch.object(messaging, 'JsonPayloadSerializer', autospec=True)
    @mock.patch.object(messaging, 'get_notification_transport', autospec=True)
    @mock.patch.object(messaging, 'get_transport', autospec=True)
    def test_init_globals(self, mock_get_transport, mock_get_notification,
                          mock_serializer, mock_notifier):
        rpc.TRANSPORT = None
        rpc.NOTIFICATION_TRANSPORT = None
        rpc.NOTIFIER = None
        rpc.init(CONF)
        self.assertEqual(mock_get_transport.return_value, rpc.TRANSPORT)
        self.assertEqual(mock_get_notification.return_value,
                         rpc.NOTIFICATION_TRANSPORT)
        self.assertTrue(mock_serializer.called)
        self.assertEqual(mock_notifier.return_value, rpc.NOTIFIER)

class TestRequestContextSerializer(base.TestCase):

    def setUp(self):
        super(TestRequestContextSerializer, self).setUp()

        self.mock_serializer = mock.MagicMock()
        self.serializer = rpc.RequestContextSerializer(self.mock_serializer)
        self.context = ironic_context.RequestContext()
        self.entity = {'foo': 'bar'}

    def test_serialize_entity(self):
        self.serializer.serialize_entity(self.context, self.entity)
        self.mock_serializer.serialize_entity.assert_called_with(
            self.context, self.entity)

    def test_serialize_entity_empty_base(self):
        # NOTE(viktors): Return False for check `if self.serializer._base:`
        bool_args = {'__bool__': lambda *args: False,
                     '__nonzero__': lambda *args: False}
        self.mock_serializer.configure_mock(**bool_args)

        entity = self.serializer.serialize_entity(self.context, self.entity)
        self.assertFalse(self.mock_serializer.serialize_entity.called)
        # If self.serializer._base is empty, return entity directly
        self.assertEqual(self.entity, entity)

    def test_deserialize_entity(self):
        self.serializer.deserialize_entity(self.context, self.entity)
        self.mock_serializer.deserialize_entity.assert_called_with(
            self.context, self.entity)

    def test_deserialize_entity_empty_base(self):
        # NOTE(viktors): Return False for check `if self.serializer._base:`
        bool_args = {'__bool__': lambda *args: False,
                     '__nonzero__': lambda *args: False}
        self.mock_serializer.configure_mock(**bool_args)

        entity = self.serializer.deserialize_entity(self.context, self.entity)
        self.assertFalse(self.mock_serializer.serialize_entity.called)
        self.assertEqual(self.entity, entity)

    def test_serialize_context(self):
        serialize_values = self.serializer.serialize_context(self.context)

        self.assertEqual(self.context.to_dict(), serialize_values)

    def test_deserialize_context(self):
        self.context.user = 'fake-user'
        self.context.tenant = 'fake-tenant'
        serialize_values = self.context.to_dict()
        new_context = self.serializer.deserialize_context(serialize_values)
        # Ironic RequestContext from_dict will pop 'user' and 'tenant' and
        # initialize to None.
        self.assertIsNone(new_context.user)
        self.assertIsNone(new_context.tenant)


text:
<?php
// WARNING, this is a read only file created by import scripts
// WARNING
// WARNING,  Changes made to this file will be clobbered
// WARNING
// WARNING,  Please make changes on poeditor instead of here
//
//
?>
konu: {target.type} #{target.id} hakkında rapor

{alternative:plain}

Merhaba,

{target.type} ile ilgili rapor buradadır:

{target.type} numarası: {target.id}

{if:target.type == "Transfer"}
Bu aktarma {transfer.files} toplam  {size:transfer.size} boyutunda dosyalara sahiptir.

Bu aktarma {date:transfer.expires} tarihine kadar geçerlidir.

Bu aktarma {transfer.recipients} alıcılara gönderilmiştir.
{endif}
{if:target.type == "File"}
Bu dosya {file.path} şeklinde adlandırılır,  {size:file.size} boyutundadır ve  {date:file.transfer.expires} tarihine kadar geçerlidir.
{endif}
{if:target.type == "Recipient"}
Bu alıcı bir e-posta adresinde {recipient.email} sahiptir ve {date:recipient.expires} tarihine kadar geçerlidir.
{endif}

Aktarmada olanlara dair kayıtların tümü buradadır :

{raw:content.plain}

Saygılarımızla,
{cfg:site_name}

{alternative:html}

    Merhaba,

    {target.type} ile ilgili rapor buradadır:

    {target.type} numarası: {target.id}

    {if:target.type == "Transfer"}
    Bu aktarma {transfer.files} toplam  {size:transfer.size} boyutunda dosyalara sahiptir.

    aktarma {date:transfer.expires} tarihine kadar geçerlidir.

    Bu aktarma {transfer.recipients} alıcılara gönderilmiştir.
    {endif}
    {if:target.type == "File"}
    Bu dosya {file.path} şeklinde adlandırılır,  {size:file.size} boyutundadır ve  {date:file.transfer.expires} tarihine kadar geçerlidir.
    {endif}
    {if:target.type == "Recipient"}
    Bu alıcı bir e-posta adresinde {recipient.email} sahiptir ve {date:recipient.expires} tarihine kadar geçerlidir.
    {endif}

    Aktarmada olanlara dair kayıtların tümü buradadır :

            Date
            Event
            IP address

            {raw:content.html}

Saygılarımızla,

{cfg:site_name}