403Webshell
Server IP : 5.129.245.98  /  Your IP : 216.73.217.19
Web Server : Apache/2.4.66 (Debian)
System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/wp-all-import-pro/src/Integrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/wp-all-import-pro/src/Integrations/CodeBox.php
<?php

namespace Wpai\Integrations;

class CodeBox
{
	
	static function isUsingCodeBox($functions)
	{
		return (strpos($functions, '\Wpai\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 Import Function Editor ' . date('Y-m-d H:i:s'),
					'priority' => 10,
					'conditions' => [],
					'description' => 'This code has been copied from WP All Import\'s Function Editor. It will be called automatically when any import 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_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
		$functions = apply_filters( 'import_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_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'functions.php';
		$functions = apply_filters( 'import_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;
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit