static function has_properly_run() { if (\BE_MCH_TPNF_VARS::$emergency === BE_MCH_TPNF_EMERGENCY_KO) { // Potent fatal error \BE_MCH_TPNF_VARS::$working = BE_MCH_TPNF_WORKING_FATAL; } }
function tpnf_uninstall() { BE_MCH_TPNF_VARS::$msg = BE_MCH_TPNF_MSG_UNDEFINED; BE_MCH_TPNF_VARS::$working = BE_MCH_TPNF_WORKING_UNDEFINED; BE_MCH_TPNF_VARS::$emergency = BE_MCH_TPNF_EMERGENCY_UNDEFINED; BE_MCH_TPNF_VARS::$activation = BE_MCH_TPNF_ACTIVATION_UNDEFINED; BE_MCH_TPNF_VARS::store(); }
function tpnf_check_requirements() { static $alreadyChecked = false; if ($alreadyChecked) { return; } $alreadyChecked = true; // Fatal error until proven otherwise BE_MCH_TPNF_VARS::$working = BE_MCH_TPNF_WORKING_FATAL; try { // Expected behaviour: requirement met or not BE_MCH_TPNF_VARS::$working = tpnf_check_requirements_work() ? BE_MCH_TPNF_WORKING_OK : BE_MCH_TPNF_WORKING_KO; } catch (Exception $e) { // Unexpected error BE_MCH_TPNF_VARS::$working = BE_MCH_TPNF_WORKING_ERROR; } }
public static function store_variable($variable) { $bt = debug_backtrace(); $caller = array_shift($bt); switch ($variable) { default: if ($variable != null) { break; } case BE_MCH_TPNF_WORKING: if (self::$working !== self::$exWorking) { self::$exWorking = self::$working; if (self::$working !== BE_MCH_TPNF_WORKING_UNDEFINED) { update_option(BE_MCH_TPNF_WORKING, self::$working); } else { delete_option(BE_MCH_TPNF_WORKING); } } if ($variable != null) { break; } case BE_MCH_TPNF_EMERGENCY: if (self::$emergency !== self::$exEmergency) { self::$exEmergency = self::$emergency; if (self::$emergency !== BE_MCH_TPNF_EMERGENCY_UNDEFINED) { update_option(BE_MCH_TPNF_EMERGENCY, self::$emergency); } else { delete_option(BE_MCH_TPNF_EMERGENCY); } } if ($variable != null) { break; } case BE_MCH_TPNF_MSG: if (self::$msg !== self::$exMsg) { self::$exMsg = self::$msg; if (self::$msg !== BE_MCH_TPNF_MSG_UNDEFINED) { update_option(BE_MCH_TPNF_MSG, self::$msg); } else { delete_option(BE_MCH_TPNF_MSG); } } if ($variable != null) { break; } case BE_MCH_TPNF_ACTIVATION: if (self::$activation !== self::$exActivation) { self::$exActivation = self::$activation; if (self::$activation !== BE_MCH_TPNF_ACTIVATION_UNDEFINED) { update_option(BE_MCH_TPNF_ACTIVATION, self::$activation->format(DateTime::W3C)); } else { delete_option(BE_MCH_TPNF_ACTIVATION); } } if ($variable != null) { break; } } }