| Server IP : 10.19.1.101 / Your IP : 216.73.216.158 Web Server : Apache System : Linux web1f13.kinghost.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64 User : schererimoveisrs ( 170628) PHP Version : 7.4.33 Disable Function : apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/schererimoveisrs/www/pre backup/wp-content/themes/sauron/inc/meta/ |
Upload File : |
<?php
class WDWT_meta{
protected $meta_sections = array();
public function init(){
$screen = get_current_screen();
if($screen->post_type == 'post' || $screen->post_type == 'page'){
add_meta_box(WDWT_META, WDWT_TITLE , array($this, 'view'), $screen->post_type, 'normal', 'high');
}
}
public function view(){
?>
<div class="wdwt_meta" id="wdwt_meta_content">
<?php
foreach ($this->meta_sections as $section) {
$section->view();
}
?>
</div>
<?php
}
public function save($post_id){
$new_meta = array();
foreach ($this->meta_sections as $section) {
$section_meta = $section->save($post_id);
$new_meta = array_merge($new_meta, $section_meta);
}
// check user permissions
if (isset($_POST['post_type']) && $_POST['post_type'] == 'page') {
if (!current_user_can('edit_page', $post_id)) return $post_id;
} else {
if (!current_user_can('edit_post', $post_id)) return $post_id;
}
if (gettype ($post_id) == 'integer') {
if(! update_post_meta($post_id, WDWT_META, $new_meta)){
add_post_meta($post_id, WDWT_META, $new_meta, true);
}
}
return $post_id;
}
}