Use new code style

This commit is contained in:
David Stone
2025-02-07 19:02:33 -07:00
parent 0181024ae1
commit 8433379d90
672 changed files with 37107 additions and 45249 deletions

View File

@ -98,14 +98,10 @@ class Post_Query extends Query {
*/
public function query($query = array()) {
if (!isset($query['type__in'])) {
if ( ! isset($query['type__in'])) {
$query['type'] = $this->item_name;
} // end if;
}
return parent::query($query);
} // end query;
} // end class Post_Query;
}
}

View File

@ -22,11 +22,11 @@ defined('ABSPATH') || exit;
final class Posts_Meta_Table extends Table {
/**
* Table name
*
* @since 2.0.0
* @var string
*/
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'postmeta';
/**
@ -55,8 +55,7 @@ final class Posts_Meta_Table extends Table {
public function __construct() {
parent::__construct();
} // end __construct;
}
/**
* Setup the database schema
@ -76,7 +75,5 @@ final class Posts_Meta_Table extends Table {
PRIMARY KEY (meta_id),
KEY wu_post_id (wu_post_id),
KEY meta_key (meta_key({$max_index_length}))";
} // end set_schema;
} // end class Posts_Meta_Table;
}
}

View File

@ -37,7 +37,7 @@ class Posts_Schema extends Schema {
'unsigned' => true,
'extra' => 'auto_increment',
'primary' => true,
'sortable' => true
'sortable' => true,
),
array(
@ -51,35 +51,35 @@ class Posts_Schema extends Schema {
'name' => 'type',
'type' => 'varchar',
'searchable' => true,
'sortable' => true
'sortable' => true,
),
array(
'name' => 'slug',
'type' => 'varchar',
'searchable' => true,
'sortable' => true
'sortable' => true,
),
array(
'name' => 'title',
'type' => 'varchar',
'searchable' => true,
'sortable' => true
'sortable' => true,
),
array(
'name' => 'content',
'type' => 'longtext',
'default' => '',
'searchable' => true
'searchable' => true,
),
array(
'name' => 'excerpt',
'type' => 'longtext',
'default' => '',
'searchable' => true
'searchable' => true,
),
array(
@ -121,5 +121,4 @@ class Posts_Schema extends Schema {
),
);
} // end class Posts_Schema;
}

View File

@ -22,11 +22,11 @@ defined('ABSPATH') || exit;
final class Posts_Table extends Table {
/**
* Table name
*
* @since 2.0.0
* @var string
*/
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'posts';
/**
@ -64,8 +64,7 @@ final class Posts_Table extends Table {
public function __construct() {
parent::__construct();
} // end __construct;
}
/**
* Setup the database schema
@ -88,8 +87,7 @@ final class Posts_Table extends Table {
list_order tinyint default 10,
status varchar(100) NOT NULL default 'draft',
PRIMARY KEY (id)";
} // end set_schema;
}
/**
* Fixes the datetime columns to accept null.
*
@ -103,21 +101,15 @@ final class Posts_Table extends Table {
);
foreach ($null_columns as $column) {
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
$result = $this->get_db()->query($query);
if (!$this->is_success($result)) {
if ( ! $this->is_success($result)) {
return false;
} // end if;
} // end foreach;
}
}
return true;
} // end __20230601;
} // end class Posts_Table;
}
}