Now tainacan is compatible with php 5.6 or greater
This commit is contained in:
parent
b0b98630d6
commit
c410b3cfa8
|
@ -23,3 +23,4 @@ cypress/videos
|
|||
cypress/screenshots
|
||||
.vscode
|
||||
src/pdf-viewer/pdfjs-dist
|
||||
report.txt
|
|
@ -5,8 +5,17 @@
|
|||
"require": {
|
||||
"respect/validation": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2",
|
||||
"wimg/php-compatibility": "*"
|
||||
},
|
||||
"prefer-stable" : true,
|
||||
"minimum-stability": "dev",
|
||||
"config": {
|
||||
"vendor-dir": "src/vendor"
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/wimg/php-compatibility",
|
||||
"post-update-cmd" : "\"src/vendor/bin/phpcs\" --config-set installed_paths src/vendor/wimg/php-compatibility"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "64fbb4d01225b482970da995b00dccfb",
|
||||
"content-hash": "b5a7a81dd7eed9bc122ee36e472c6430",
|
||||
"packages": [
|
||||
{
|
||||
"name": "respect/validation",
|
||||
|
@ -131,11 +131,115 @@
|
|||
"time": "2017-10-11T12:05:26+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27",
|
||||
"reference": "4842476c434e375f9d3182ff7b89059583aa8b27",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-simplexml": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpcs",
|
||||
"bin/phpcbf"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Greg Sherwood",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2018-02-20T21:35:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wimg/php-compatibility",
|
||||
"version": "8.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wimg/PHPCompatibility.git",
|
||||
"reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
|
||||
"reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2"
|
||||
},
|
||||
"conflict": {
|
||||
"squizlabs/php_codesniffer": "2.6.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPCompatibility\\": "PHPCompatibility/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wim Godden",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
|
||||
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2017-12-27T21:58:38+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
|
|
|
@ -108,7 +108,7 @@ Represents the entity Filter
|
|||
### `protected $repository = 'Filters'`
|
||||
|
||||
{@inheritDoc}
|
||||
### `public function __toArray()`
|
||||
### `public function _toArray()`
|
||||
|
||||
|
||||
**Returns:** array
|
||||
|
|
|
@ -29,7 +29,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
$get_ = 'get_' . $attribute;
|
||||
$object_filtered[ $attribute ] = $object->$get_();
|
||||
}
|
||||
} catch ( \Error $error ) {
|
||||
} catch ( \Exception $error ) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
try{
|
||||
$get_ = 'get_' . $attributes;
|
||||
$object_filtered[$attributes] = $object->$get_();
|
||||
} catch (\Error $error){
|
||||
} catch (\Exception $error){
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
try {
|
||||
$set_ = 'set_' . $key;
|
||||
$object->$set_( $value );
|
||||
} catch (\Error $error){
|
||||
} catch (\Exception $error){
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
|
||||
if(!isset($request['fetch_only'])) {
|
||||
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if ( $request['context'] === 'edit' ) {
|
||||
$moderators_ids = $item_arr['moderators_ids'];
|
||||
|
@ -239,7 +239,7 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
|
||||
try {
|
||||
$prepared_post = $this->prepare_item_for_database( $body );
|
||||
} catch (\Error $exception){
|
||||
} catch (\Exception $exception){
|
||||
return new \WP_REST_Response($exception->getMessage(), 400);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ class REST_Export_Controller extends REST_Controller {
|
|||
$prepared_item = [];
|
||||
|
||||
foreach ($items_metadata as $item_metadata){
|
||||
$prepared_item[] = $item_metadata->__toArray();
|
||||
$prepared_item[] = $item_metadata->_toArray();
|
||||
}
|
||||
|
||||
return $prepared_item;
|
||||
|
|
|
@ -70,7 +70,7 @@ class REST_Field_Types_Controller extends REST_Controller {
|
|||
$name = "\Tainacan\Field_Types\\$item";
|
||||
$field_type = new $name();
|
||||
|
||||
$field_arr = $field_type->__toArray();
|
||||
$field_arr = $field_type->_toArray();
|
||||
$field_arr['name'] = $item;
|
||||
|
||||
return $field_arr;
|
||||
|
|
|
@ -197,7 +197,7 @@ class REST_Fields_Controller extends REST_Controller {
|
|||
|
||||
try {
|
||||
$prepared = $this->prepare_item_for_database( $request->get_body(), $collection_id );
|
||||
} catch (\Error $exception){
|
||||
} catch (\Exception $exception){
|
||||
return new \WP_REST_Response($exception->getMessage(), 400);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ class REST_Fields_Controller extends REST_Controller {
|
|||
} elseif (!empty($request->get_body())) {
|
||||
try {
|
||||
$prepared = $this->prepare_item_for_database( $request->get_body() );
|
||||
} catch ( \Error $exception ) {
|
||||
} catch ( \Exception $exception ) {
|
||||
return new \WP_REST_Response( $exception->getMessage(), 400 );
|
||||
}
|
||||
|
||||
|
@ -266,9 +266,9 @@ class REST_Fields_Controller extends REST_Controller {
|
|||
*/
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
if(!empty($item)){
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
$item_arr['field_type_object'] = $item->get_field_type_object()->__toArray();
|
||||
$item_arr['field_type_object'] = $item->get_field_type_object()->_toArray();
|
||||
|
||||
if($request['context'] === 'edit'){
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
|
|
|
@ -55,7 +55,7 @@ class REST_Filter_Types_Controller extends REST_Controller {
|
|||
$name = "\Tainacan\Filter_Types\\$item";
|
||||
$filter_type = new $name();
|
||||
|
||||
$filter_arr = $filter_type->__toArray();
|
||||
$filter_arr = $filter_type->_toArray();
|
||||
$filter_arr['name'] = $item;
|
||||
|
||||
return $filter_arr;
|
||||
|
|
|
@ -131,7 +131,7 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
try {
|
||||
$set_ = 'set_'. $attribute;
|
||||
$filter_obj->$set_($value);
|
||||
} catch (\Error $error){
|
||||
} catch (\Exception $error){
|
||||
//
|
||||
}
|
||||
}
|
||||
|
@ -315,11 +315,11 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
*/
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
if(!empty($item)) {
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if($request['context'] === 'edit'){
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
$item_arr['filter_type_object'] = $item->get_filter_type_object()->__toArray();
|
||||
$item_arr['filter_type_object'] = $item->get_filter_type_object()->_toArray();
|
||||
$item_arr['enabled'] = $item->get_enabled_for_collection();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
* @return array|\WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if($request['context'] === 'edit'){
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
|
@ -209,7 +209,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
}
|
||||
elseif($field->get_accept_suggestion()) {
|
||||
$log = $this->item_metadata_repository->suggest( $item_metadata );
|
||||
$prepared_item = $log->__toArray();
|
||||
$prepared_item = $log->_toArray();
|
||||
}
|
||||
else {
|
||||
return new \WP_REST_Response( [
|
||||
|
|
|
@ -92,6 +92,8 @@ class REST_Items_Controller extends REST_Controller {
|
|||
* @param $item_object
|
||||
* @param $item_array
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function add_metadata_to_item($item_object, $item_array, $args = []){
|
||||
|
@ -100,7 +102,7 @@ class REST_Items_Controller extends REST_Controller {
|
|||
foreach($item_metadata as $index => $me){
|
||||
$field = $me->get_field();
|
||||
$slug = $field->get_slug();
|
||||
$item_metadata_array = $me->__toArray();
|
||||
$item_metadata_array = $me->_toArray();
|
||||
|
||||
$item_array['metadata'][ $slug ]['name'] = $field->get_name();
|
||||
$item_array['metadata'][ $slug ]['value'] = $item_metadata_array['value'];
|
||||
|
@ -125,7 +127,7 @@ class REST_Items_Controller extends REST_Controller {
|
|||
if(!empty($item)){
|
||||
|
||||
if(!isset($request['fetch_only'])) {
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if ( $request['context'] === 'edit' ) {
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
|
@ -298,7 +300,7 @@ class REST_Items_Controller extends REST_Controller {
|
|||
|
||||
try {
|
||||
$this->prepare_item_for_database( [ $item, $collection_id ] );
|
||||
} catch (\Error $exception){
|
||||
} catch (\Exception $exception){
|
||||
return new \WP_REST_Response($exception->getMessage(), 400);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class REST_Logs_Controller extends REST_Controller {
|
|||
if(!empty($item)){
|
||||
|
||||
if(!isset($request['fetch_only'])) {
|
||||
$item_array = $item->__toArray();
|
||||
$item_array = $item->_toArray();
|
||||
|
||||
unset($item_array['value']);
|
||||
unset($item_array['old_value']);
|
||||
|
|
|
@ -95,7 +95,7 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
|||
public function prepare_item_for_response( $item, $request ) {
|
||||
if(!empty($item)) {
|
||||
if(!isset($request['fetch_only'])) {
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if ( $request['context'] === 'edit' ) {
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
|
|
|
@ -90,7 +90,7 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
|
||||
try {
|
||||
$this->term->$set_( $value );
|
||||
} catch (\Error $error){
|
||||
} catch (\Exception $error){
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
public function prepare_item_for_response( $item, $request ) {
|
||||
if(!empty($item)){
|
||||
if(!isset($request['fetch_only'])) {
|
||||
$item_arr = $item->__toArray();
|
||||
$item_arr = $item->_toArray();
|
||||
|
||||
if ( $request['context'] === 'edit' ) {
|
||||
$item_arr['current_user_can_edit'] = $item->can_edit();
|
||||
|
|
|
@ -18,14 +18,14 @@ class Embed {
|
|||
/**
|
||||
* Replace default WordPress embedders with HTML 5 tags instead of shortcodes
|
||||
*/
|
||||
add_filter('wp_embed_handler_video', [&$this, 'filter_video_embed'], 10, 4);
|
||||
add_filter('wp_embed_handler_audio', [&$this, 'filter_audio_embed'], 10, 4);
|
||||
add_filter('wp_embed_handler_video', [$this, 'filter_video_embed'], 10, 4);
|
||||
add_filter('wp_embed_handler_audio', [$this, 'filter_audio_embed'], 10, 4);
|
||||
|
||||
/**
|
||||
* ADD PDF Embed handler using PDF.js
|
||||
* @var [type]
|
||||
*/
|
||||
wp_embed_register_handler( 'pdf', '#^https?://.+?\.(pdf)$#i', [&$this, 'pdf_embed_handler'] );
|
||||
wp_embed_register_handler( 'pdf', '#^https?://.+?\.(pdf)$#i', [$this, 'pdf_embed_handler'] );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ class Collection extends Entity {
|
|||
return 'Hello, my name is ' . $this->get_name();
|
||||
}
|
||||
|
||||
public function __toArray() {
|
||||
$array_collection = parent::__toArray();
|
||||
public function _toArray() {
|
||||
$array_collection = parent::_toArray();
|
||||
|
||||
$array_collection['thumbnail'] = $this->get_thumbnail();
|
||||
$array_collection['header_image'] = $this->get_header_image();
|
||||
|
|
|
@ -333,7 +333,7 @@ class Entity {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function __toArray(){
|
||||
public function _toArray(){
|
||||
$repository = $this->get_repository();
|
||||
$map = $repository->get_map();
|
||||
|
||||
|
@ -345,8 +345,8 @@ class Entity {
|
|||
return $attributes;
|
||||
}
|
||||
|
||||
public function __toJSON(){
|
||||
return json_encode($this->__toArray(), JSON_NUMERIC_CHECK);
|
||||
public function _toJson(){
|
||||
return json_encode($this->_toArray(), JSON_NUMERIC_CHECK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,8 +37,8 @@ class Filter extends Entity {
|
|||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __toArray(){
|
||||
$filter_array = parent::__toArray();
|
||||
public function _toArray(){
|
||||
$filter_array = parent::_toArray();
|
||||
$field_id = $filter_array['field'];
|
||||
|
||||
$filter_array['field'] = [];
|
||||
|
|
|
@ -111,7 +111,7 @@ class Item_Metadata_Entity extends Entity {
|
|||
|
||||
foreach ($value as $v) {
|
||||
if ( $v instanceof Term || $v instanceof ItemMetadataEntity ) {
|
||||
$return[] = $v->__toArray();
|
||||
$return[] = $v->_toArray();
|
||||
} else {
|
||||
$return[] = $v;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class Item_Metadata_Entity extends Entity {
|
|||
$return = '';
|
||||
|
||||
if ( $value instanceof Term || $value instanceof ItemMetadataEntity ) {
|
||||
$return = $value->__toArray();
|
||||
$return = $value->_toArray();
|
||||
} else {
|
||||
$return = $value;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class Item_Metadata_Entity extends Entity {
|
|||
* Convert the object to an Array
|
||||
* @return array the representation of this object as an array
|
||||
*/
|
||||
public function __toArray(){
|
||||
public function _toArray(){
|
||||
$as_array = [];
|
||||
|
||||
$as_array['value'] = $this->get_value_as_array();
|
||||
|
@ -147,8 +147,8 @@ class Item_Metadata_Entity extends Entity {
|
|||
$as_array['date_i18n'] = $this->get_date_i18n($this->get_value_as_string());
|
||||
}
|
||||
|
||||
$as_array['item'] = $this->get_item()->__toArray();
|
||||
$as_array['field'] = $this->get_field()->__toArray();
|
||||
$as_array['item'] = $this->get_item()->_toArray();
|
||||
$as_array['field'] = $this->get_field()->_toArray();
|
||||
|
||||
return $as_array;
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ class Item extends Entity {
|
|||
return 'Hello, my name is ' . $this->get_title();
|
||||
}
|
||||
|
||||
public function __toArray() {
|
||||
$array_item = parent::__toArray();
|
||||
public function _toArray() {
|
||||
$array_item = parent::_toArray();
|
||||
|
||||
$array_item['thumbnail'] = $this->get_thumbnail();
|
||||
$array_item['_thumbnail_id'] = $this->get__thumbnail_id();
|
||||
|
@ -417,7 +417,7 @@ class Item extends Entity {
|
|||
}
|
||||
|
||||
|
||||
public function __toHtml() {
|
||||
public function _toHtml() {
|
||||
|
||||
$return = '';
|
||||
$id = $this->get_id();
|
||||
|
|
|
@ -44,8 +44,8 @@ class Log extends Entity {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __toArray() {
|
||||
$array_log = parent::__toArray();
|
||||
public function _toArray() {
|
||||
$array_log = parent::_toArray();
|
||||
|
||||
$array_log['user_name'] = $this->get_user_name();
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ class Term extends Entity {
|
|||
return 'Hello, my name is '. $this->get_name();
|
||||
}
|
||||
|
||||
public function __toArray(){
|
||||
$term_array = parent::__toArray();
|
||||
public function _toArray(){
|
||||
$term_array = parent::_toArray();
|
||||
|
||||
$term_id = $term_array['term_id'];
|
||||
|
||||
|
@ -257,7 +257,7 @@ class Term extends Entity {
|
|||
|
||||
}
|
||||
|
||||
public function __toHtml() {
|
||||
public function _toHtml() {
|
||||
|
||||
$return = '';
|
||||
$id = $this->get_id();
|
||||
|
|
|
@ -154,7 +154,7 @@ class Category extends Field_Type {
|
|||
|
||||
foreach ( $value as $term ) {
|
||||
if ( $term instanceof \Tainacan\Entities\Term ) {
|
||||
$return .= $term->__toHtml();
|
||||
$return .= $term->_toHtml();
|
||||
}
|
||||
|
||||
$count ++;
|
||||
|
@ -168,7 +168,7 @@ class Category extends Field_Type {
|
|||
} else {
|
||||
|
||||
if ( $value instanceof \Tainacan\Entities\Term ) {
|
||||
$return .= $value->__toHtml();
|
||||
$return .= $value->_toHtml();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ abstract class Field_Type {
|
|||
|
||||
}
|
||||
|
||||
public function __toArray(){
|
||||
public function _toArray(){
|
||||
$attributes = [];
|
||||
|
||||
$attributes['errors'] = $this->get_errors();
|
||||
|
|
|
@ -90,7 +90,7 @@ class Relationship extends Field_Type {
|
|||
$item = new \Tainacan\Entities\Item($item_id);
|
||||
|
||||
if ( $item instanceof \Tainacan\Entities\Item ) {
|
||||
$return .= $item->__toHtml();
|
||||
$return .= $item->_toHtml();
|
||||
}
|
||||
|
||||
$count ++;
|
||||
|
@ -112,7 +112,7 @@ class Relationship extends Field_Type {
|
|||
$item = new \Tainacan\Entities\Item($value);
|
||||
|
||||
if ( $item instanceof \Tainacan\Entities\Item ) {
|
||||
$return .= $item->__toHtml();
|
||||
$return .= $item->_toHtml();
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -50,7 +50,7 @@ abstract class Filter_Type {
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function __toArray(){
|
||||
public function _toArray(){
|
||||
$attributes = [];
|
||||
|
||||
$attributes['className'] = get_class($this);
|
||||
|
|
|
@ -98,7 +98,7 @@ class Exposers {
|
|||
$items_metadata = $item->get_fields();
|
||||
$prepared_item = [];
|
||||
foreach ($items_metadata as $item_metadata){
|
||||
array_push($prepared_item, $item_metadata->__toArray());
|
||||
array_push($prepared_item, $item_metadata->_toArray());
|
||||
}
|
||||
$item_arr = $prepared_item;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ class Exposers {
|
|||
if(
|
||||
$type === false || // do not have a exposer type
|
||||
$type->get_mappers() === true || // the type accept all mappers
|
||||
( is_array($type->mappers) && in_array($body['exposer-map'], $type->get_mappers()) ) ) { // the current mapper is accepted by type
|
||||
( is_array($type->get_mappers()) && in_array($body['exposer-map'], $type->get_mappers()) ) ) { // the current mapper is accepted by type
|
||||
$mapper = $Tainacan_Exposers->check_class_name($body['exposer-map'], true, self::MAPPER_CLASS_PREFIX);
|
||||
return new $mapper;
|
||||
}
|
||||
|
|
|
@ -20,29 +20,29 @@ class Theme_Helper {
|
|||
|
||||
private function __construct() {
|
||||
|
||||
add_filter( 'the_content', [&$this, 'the_content_filter'] );
|
||||
add_filter( 'the_content', [$this, 'the_content_filter'] );
|
||||
|
||||
|
||||
// Replace collections permalink to post type archive if cover not enabled
|
||||
add_filter('post_type_link', array(&$this, 'permalink_filter'), 10, 3);
|
||||
add_filter('post_type_link', array($this, 'permalink_filter'), 10, 3);
|
||||
|
||||
// Replace single query to the page content set as cover for the colllection
|
||||
// Redirect to post type archive if no cover page is set
|
||||
add_action('wp', array(&$this, 'collection_single_redirect'));
|
||||
add_action('wp', array($this, 'collection_single_redirect'));
|
||||
|
||||
add_action('wp_print_scripts', array(&$this, 'enqueue_scripts'));
|
||||
add_action('wp_print_scripts', array($this, 'enqueue_scripts'));
|
||||
|
||||
// make archive for terms work with items
|
||||
add_action('pre_get_posts', array(&$this, 'tax_archive_pre_get_posts'));
|
||||
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
||||
|
||||
add_action('archive_template_hierarchy', array(&$this, 'items_template_hierachy'));
|
||||
add_action('single_template_hierarchy', array(&$this, 'items_template_hierachy'));
|
||||
add_action('archive_template_hierarchy', array($this, 'items_template_hierachy'));
|
||||
add_action('single_template_hierarchy', array($this, 'items_template_hierachy'));
|
||||
|
||||
add_filter('theme_mod_header_image', array(&$this, 'header_image'));
|
||||
add_filter('theme_mod_header_image', array($this, 'header_image'));
|
||||
|
||||
add_filter('get_the_archive_title', array(&$this, 'filter_archive_title'));
|
||||
add_filter('get_the_archive_title', array($this, 'filter_archive_title'));
|
||||
|
||||
add_shortcode( 'tainacan-search', array(&$this, 'search_shortcode'));
|
||||
add_shortcode( 'tainacan-search', array($this, 'search_shortcode'));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -83,19 +83,19 @@ class Entity_Factory {
|
|||
|
||||
} elseif (empty($args) && !$is_validated_and_in_db) {
|
||||
try {
|
||||
$this->entity->set_name( "$type " . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_name( "$type " . rand( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
} catch (\Error $exception){
|
||||
$this->entity->set_title( "$type " . random_int( 0, 10000 ) . " for test" );
|
||||
} catch (\Exception $exception){
|
||||
$this->entity->set_title( "$type " . rand( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
}
|
||||
|
||||
} elseif (empty($args) && $is_validated_and_in_db) {
|
||||
try {
|
||||
$this->entity->set_name( "$type " . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_name( "$type " . rand( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
} catch (\Error $exception){
|
||||
$this->entity->set_title( "$type " . random_int( 0, 10000 ) . " for test" );
|
||||
} catch (\Exception $exception){
|
||||
$this->entity->set_title( "$type " . rand( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class Entity_Factory {
|
|||
} else {
|
||||
throw new \InvalidArgumentException('One or more arguments are invalid.');
|
||||
}
|
||||
} catch (\Error $exception){
|
||||
} catch (\Exception $exception){
|
||||
echo "\n" . $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
touch report.txt
|
||||
echo 'Verifing potencial incompatibilities with php 5.6 or greater'
|
||||
|
||||
echo 'W is Warning'
|
||||
echo 'E is Error'
|
||||
|
||||
./src/vendor/bin/phpcs -p . --standard=PHPCompatibility --extensions=php --ignore=*/node_modules/*,*/src/vendor/* --report-file=./report.txt --runtime-set testVersion 5.6
|
||||
|
Loading…
Reference in New Issue