Executing with non-xf PHP

How are you attempting to run that code within your callback?

Calling it statically, but that doesn't work since it's not a static class. If I define that specific code as a static class the $this objects won't work so I have no idea what to do.
 
Create a static class that creates an instance of the above class and uses it accordingly?
 
Quick glance looks like it happens on certain events, so realistically shouldn't need cached.
PHP:
<?php

class myCallback {
  public static function callback() {
    // do its work here. initalize, etc.
  }
}
 
What about the $this objects then in the php script since everything is now static functions?
 
Why are you changing the actual class to static? You'll have to create a new instance of said class within the PHP:
PHP:
<?php

class MyCallBack {
    public static function callback() {
        $CServerRcon = new CServerRcon('pass', 'port', 'third argument');
        $CServerRcon->sendCommand('command');
    }
}

You won't change CServerRcon at all. If you wanted it all self contained you could do:
PHP:
<?php
class CServerRcon {
  // current class

  public static function callback() {
    $self = new self();
  }
}
(self may not work in that instance, but I think it will).
 
Why are you changing the actual class to static? You'll have to create a new instance of said class within the PHP:
PHP:
<?php

class MyCallBack {
    public static function callback() {
        $CServerRcon = new CServerRcon('pass', 'port', 'third argument');
        $CServerRcon->sendCommand('command');
    }
}

You won't change CServerRcon at all. If you wanted it all self contained you could do:
PHP:
<?php
class CServerRcon {
  // current class

  public static function callback() {
    $self = new self();
  }
}
(self may not work in that instance, but I think it will).

$*(#@$ Alright
Why are you changing the actual class to static? You'll have to create a new instance of said class within the PHP:
PHP:
<?php

class MyCallBack {
    public static function callback() {
        $CServerRcon = new CServerRcon('pass', 'port', 'third argument');
        $CServerRcon->sendCommand('command');
    }
}

You won't change CServerRcon at all. If you wanted it all self contained you could do:
PHP:
<?php
class CServerRcon {
  // current class

  public static function callback() {
    $self = new self();
  }
}
(self may not work in that instance, but I think it will).

One more: how would I call that class then? (since just CServerRcon would be locally called and i rather have that bulky script in a separate file)
 
What do you mean how would you call that class? You have to set the callback to be MyCallBack::callback() (for my example), and then require the CServerRcon file and initialize and use it as any other normal class.
 
What do you mean how would you call that class? You have to set the callback to be MyCallBack::callback() (for my example), and then require the CServerRcon file and initialize and use it as any other normal class.

Oh so literally include/require the file in that callback?
 
Weird issue in that script:
fwrite() expects parameter 1 to be resource, null given

Why wouldn't it be writing to the global variable even though it's set to do so?
 
Top Bottom