2017 © Pedro Peláez
 

wordpress-muplugin xu

Collection of useful WordPress and PHP functions and classes

image

wp-xu/xu

Collection of useful WordPress and PHP functions and classes

  • Saturday, August 13, 2016
  • by fredrikforsmo
  • Repository
  • 2 Watchers
  • 3 Stars
  • 3,454 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

xu

Build Status codecov.io License, (*1)

Requires PHP 5.5.9 and WordPress 4.4, (*2)

Collection of useful WordPress and PHP functions and classes., (*3)

Install

$ composer require frozzare/wp-xu

Documentation

API reference docs, (*4)

Some cached functions requires that wp_cache_delete_group function exists to delete cache group., (*5)

Models

With xu you can create models that you load from your theme (with xu_get_model) or any where, just use the class., (*6)

<?php

use Xu\Model\Model;

class Post extends Model {

  /**
   * Get model attributes.
   *
   * @return array
   */
  public function get_attributes() {
     return [
       'title' => $this->post->post_title
     ];
  }
}

In your template file:, (*7)

$model = xu_get_model( 'post' );

echo $post->title;

The model class implements a lot of methods like to_array and to_json to convert the model to a array or JSON string., (*8)

Models Collection

A collection is a collection of one or more models. By reading the api reference docs you can find out which methods a collection has, first, last, filter, map, reject and where is some of the methods that exists., (*9)

A collection can be created in different ways:, (*10)

use Xu\Model\Collection;

$collection = new Collection( [$model1, $model2] );
$collcetion = Post::collection( [$model1, $model2] );

class List extends Model {

  /**
   * Get all posts that exists on `post` post type.
   *
   * @return \Xu\Model\Collection
   */
  public function posts() {
    return static::collection( get_posts( 'post_type=post' ) );
  }
}

$collection = ( new List )->posts();

License

MIT © Fredrik Forsmo, (*11)

The Versions

13/08 2016

dev-master

9999999-dev https://github.com/wp-xu/xu

Collection of useful WordPress and PHP functions and classes

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

18/01 2016

v1.2.0

1.2.0.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

12/10 2015

v1.1.3

1.1.3.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

12/10 2015

v1.1.2

1.1.2.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

07/09 2015

v1.1.1

1.1.1.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

20/08 2015

v1.1.0

1.1.0.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities

19/08 2015

v1.0.0

1.0.0.0 https://github.com/wp-xu/framework

Collection of useful WordPress and PHP functions

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin wordpress utilities