__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Imagely\NGG\DataMapper;
abstract class Model {
use Validation;
// This attribute is no longer used, but serialized objects created before the POPE -> namespace transition will
// still retain this attribute and generate a warning with PHP 8.0 when hydrating the object.
public $__defaults_set;
public function __construct( \stdClass $object = null ) {
if ( $object ) {
foreach ( get_object_vars( $object ) as $key => $value ) {
$this->$key = $value;
}
}
$this->set_defaults();
}
abstract function get_mapper();
/**
* This should be removed when POPE compat v1 is reached in Pro
*
* @deprecated
* @return bool|array
*/
public function validate() {
return $this->validation();
}
public function validation() {
return true;
}
public function set_defaults() {
$mapper = $this->get_mapper();
if ( method_exists( $mapper, 'set_defaults' ) ) {
$mapper->set_defaults( $this );
}
}
/**
* @return bool
*/
public function is_new() {
return ! $this->id();
}
public function get_primary_key_column() {
return 'id';
}
/**
* @param null|int|string $value (optional)
* @return mixed
*/
public function id( $value = null ) {
$key = $this->get_primary_key_column();
if ( $value ) {
$this->$key = $value;
}
return $this->$key;
}
/**
* This should be removed when POPE compat v1 is reached in Pro
*
* @deprecated
* @return array
*/
public function get_errors() {
return $this->validation();
}
/**
* Necessary for compatibility with some WP-Admin pages.
*
* @deprecated
*/
public function clear_errors() {
return true;
}
/**
* Determines if a particular field for the object has errors
*
* @param string $property
* @return bool
*/
public function is_valid( $property = null ) {
$errors = $this->validation();
return ! ( is_array( $errors ) && isset( $errors[ $property ] ) );
}
/**
* @param array $updated_attributes
* @return int|bool Object ID or false upon failure
*/
public function save( $updated_attributes = [] ) {
foreach ( $updated_attributes as $key => $value ) {
$this->$key = $value;
}
return $this->get_mapper()->save( $this );
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| DriverBase.php | File | 16.63 KB | 0644 |
|
| Manager.php | File | 4.47 KB | 0644 |
|
| Model.php | File | 2.16 KB | 0644 |
|
| TableDriver.php | File | 16.33 KB | 0644 |
|
| Validation.php | File | 10.79 KB | 0644 |
|
| WPModel.php | File | 754 B | 0644 |
|
| WPPostDriver.php | File | 15.73 KB | 0644 |
|