| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/admin-columns-pro.5.1.3/classes/Service/ |
Upload File : |
<?php
namespace ACP\Service;
use AC;
use AC\ListScreenRepository\Storage\ListScreenRepositoryFactory;
use AC\Registrable;
use ACP\ListScreenRepository\Collection;
use ACP\ListScreenRepository\FileFactory;
use ACP\Storage\Directory;
use ACP\Storage\ListScreen\LegacyCollectionDecoder;
use ACP\Storage\ListScreen\SerializerTypes;
final class Storage implements Registrable {
/**
* @var AC\ListScreenRepository\Storage
*/
private $storage;
/**
* @var FileFactory
*/
private $file_factory;
/**
* @var AC\EncodedListScreenDataFactory
*/
private $encoded_list_screen_data_factory;
/**
* @var LegacyCollectionDecoder
*/
private $collection_decoder;
public function __construct(
AC\ListScreenRepository\Storage $storage,
FileFactory $file_factory,
AC\EncodedListScreenDataFactory $encoded_list_screen_data_factory,
LegacyCollectionDecoder $collection_decoder
) {
$this->storage = $storage;
$this->file_factory = $file_factory;
$this->encoded_list_screen_data_factory = $encoded_list_screen_data_factory;
$this->collection_decoder = $collection_decoder;
}
public function register() {
add_action( 'ac/list_screens', [ $this, 'configure' ], 20 );
}
public function configure() {
$repositories = $this->storage->get_repositories();
$this->configure_file_storage( $repositories );
$repositories = apply_filters( 'acp/storage/repositories',
$repositories,
new ListScreenRepositoryFactory( $this->file_factory )
);
$this->configure_api_storage( $repositories );
$this->storage->set_repositories( $repositories );
}
private function configure_api_storage( array &$repositories ) {
$collection = new AC\ListScreenCollection();
foreach ( $this->encoded_list_screen_data_factory->create() as $data ) {
if ( ! $this->collection_decoder->can_decode( $data ) ) {
continue;
}
foreach ( $this->collection_decoder->decode( $data ) as $list_screen ) {
$collection->add( $list_screen );
}
}
if ( ! $collection->count() ) {
return;
}
$repositories['acp-collection'] = new AC\ListScreenRepository\Storage\ListScreenRepository(
new Collection( $collection ),
false
);
}
private function configure_file_storage( array &$repositories ) {
if ( apply_filters( 'acp/storage/file/enable_for_multisite', false ) && is_multisite() ) {
return;
}
$path = apply_filters( 'acp/storage/file/directory', null );
if ( ! is_string( $path ) || $path === '' ) {
return;
}
$directory = new Directory( $path );
if ( ! $directory->exists() && $directory->has_path( WP_CONTENT_DIR ) ) {
$directory->create();
}
$file = new AC\ListScreenRepository\Storage\ListScreenRepository(
$this->file_factory->create(
SerializerTypes::PHP,
$directory
),
apply_filters( 'acp/storage/file/directory/writable', true )
);
$repositories['acp-file'] = $file;
if ( ! $file->is_writable() || ! $this->storage->has_repository( 'acp-database' ) ) {
return;
}
$database = $this->storage->get_repository( 'acp-database' );
if ( apply_filters( 'acp/storage/file/directory/migrate', false ) ) {
foreach ( $database->with_writable( true )->find_all() as $list_screen ) {
$file->save( $list_screen );
$database->delete( $list_screen );
}
}
$repositories['acp-database'] = $database->with_writable( false );
}
}