HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: /home/goremar3/public_html/wp-content/plugins/metform/core/forms/auto-increment-entry.php
<?php

namespace MetForm\Core\Forms;

defined('ABSPATH') || exit;

class Auto_Increment_Entry
{
    use \MetForm\Traits\Singleton;

    private $id;
    protected $last_entry_key = 'metform_last_entry_serial_no';
    protected $entry_key = 'metform_entries_serial_no';

    public function __construct()
    {
        $this->id = get_option($this->last_entry_key);
        add_action('metform/after_load', [$this, 'update_previous_posts_entry_ids']);
    }


    public function update_previous_posts_entry_ids()
    {
        if (empty(get_option($this->last_entry_key))) {
            $all_post_ids = get_posts(array(
                'fields'          => 'ids',
                'posts_per_page'  => -1,
                'orderby' => 'ID',
                'order' => 'ASC',
                'post_type' => 'metform-entry'
            ));
            foreach ($all_post_ids as $key => $id) {
                update_post_meta($id, $this->entry_key, ++$key);
                $this->id = $key;
            }
            update_option($this->last_entry_key, $this->id);
        }
    }
}