56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
namespace admin\factory;
|
|
class SeoAdditional
|
|
{
|
|
public static function element_delete( $element_id )
|
|
{
|
|
global $mdb;
|
|
return $mdb -> delete( 'pp_seo_additional', [ 'id' => (int)$element_id ] );
|
|
}
|
|
|
|
public static function element_save( $id, $url, $status, $title, $keywords, $description, $text )
|
|
{
|
|
global $mdb;
|
|
|
|
if ( !$id )
|
|
{
|
|
if ( $mdb -> insert( 'pp_seo_additional', [
|
|
'url' => $url,
|
|
'status' => $status == 'on' ? 1 : 0,
|
|
'title' => $title,
|
|
'keywords' => $keywords,
|
|
'description' => $description,
|
|
'text' => $text
|
|
] ) )
|
|
{
|
|
\S::delete_cache();
|
|
return $mdb -> id();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$mdb -> update( 'pp_seo_additional', [
|
|
'url' => $url,
|
|
'status' => $status == 'on' ? 1 : 0,
|
|
'title' => $title,
|
|
'keywords' => $keywords,
|
|
'description' => $description,
|
|
'text' => $text
|
|
|
|
], [
|
|
'id' => (int)$id
|
|
] );
|
|
|
|
\S::delete_cache();
|
|
return $id;
|
|
}
|
|
}
|
|
|
|
public static function element_details( $element_id )
|
|
{
|
|
global $mdb;
|
|
$result = $mdb -> get ( 'pp_seo_additional', '*', [ 'id' => (int)$element_id ] );
|
|
return $result;
|
|
}
|
|
}
|