HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/shoetique/wp-content/plugins/wp-all-export-pro/src/Integrations/CodeBox.php
<?php

namespace Wpae\Integrations;

class CodeBox
{
	
	static function isUsingCodeBox($functions)
	{
		return (strpos($functions, '\Wpae\Integrations\CodeBox::runSnippet(') !== false);
	}
	
	/**
	 * @return boolean
	 */
	static function isCodeBoxInstalled()
	{
		return class_exists('\Wpcb2\Api\Api');
	}
	
	// API for WPCodeBox To build
	/**
	 * @param string $code
	 * @return int
	 */
	static function saveSnippetToCodeBox($code)
	{
		if( !self::isCodeBoxInstalled() ) {
			return 0;
		}

		$wpcbApi = new \Wpcb2\Api\Api();

		try {
			$snippetId = $wpcbApi->createSnippet(
				[
					'code' => $code,
					'codeType' => ['value' => 'php'],
					'minify' => false,
					'title' => 'WP All Export Function Editor ' . date('Y-m-d H:i:s'),
					'priority' => 10,
					'conditions' => [],
					'description' => 'This code has been copied from WP All Export\'s Function Editor. It will be called automatically when any export runs. Do not delete.',
					'location' => '',
					'runType' => ['value' => 'never'],
				]
			);
			return $snippetId;
		} catch (\Exception $e) {
			return 0;
		}
	}

	/**
	 * @param int $id
	 */
	static function runSnippet($id)
	{
		if( !self::isCodeBoxInstalled() ) {
			return 0;
		}
		
		$wpcbApi = new \Wpcb2\Api\Api();
		$wpcbApi->runSnippet($id);
	}
	
	static function revertToFunctionsFile(){
		$uploads   = wp_upload_dir();
		$functions = $uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_EXPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
		$functions = apply_filters( 'export_functions_file_path', $functions );
		$backupFunctions = str_replace('.php', '_backup.php', $functions);
		
		if( file_exists( $backupFunctions ) ){
			rename( $backupFunctions, $functions );
		}
	}
	
	static function requireFunctionsFile(){
		$uploads   = wp_upload_dir();
		$functions = $uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_EXPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
		$functions = apply_filters( 'export_functions_file_path', $functions );
		$backupFunctions = str_replace('.php', '_backup.php', $functions);

		if( file_exists( $functions ) ){
			$content = file_get_contents( $functions );
			if( self::isUsingCodeBox($content) && !self::isCodeBoxInstalled() ){
				if( file_exists( $backupFunctions ) ){
					require_once $backupFunctions;
				}
			}else {
				require_once $functions;
			}
		}
	}
}