Exemplo n.º 1
0
 /**
  * @group Csrf
  * @group Csrf_Storage
  * @group Csrf_Storage_Callback
  */
 function testConstruct()
 {
     $saved = new \ArrayObject();
     $obj = new CallBack(function ($str) use($saved) {
         $saved[0] = $str;
     }, function () use($saved) {
         return $saved[0];
     });
     $ext = 'tempword';
     $obj->save($ext);
     $this->assertEquals($ext, $obj->load());
     $this->assertEquals($ext, $saved[0]);
     $saved[0] = 'overwrite';
     $this->assertEquals($saved[0], $obj->load());
 }
Exemplo n.º 2
0
 protected function callClassMethod($className, $method, $params)
 {
     $classNameFull = $className . "::" . $method;
     $classNameFull = preg_replace($this->pattern, $classNameFull, $this->routeString);
     $class = explode("::", $classNameFull);
     return parent::callClassMethod($class[0], $class[1], $params);
 }
Exemplo n.º 3
0
 public function execute($routeString, $debug = true)
 {
     $this->debug = $debug;
     $matchedRoute = $this->routeExecuter($routeString);
     $matchedRouteName = $matchedRoute[0];
     /** @var Route $matchedRoute */
     $matchedRoute = $matchedRoute[1];
     $namesExplode = explode(".", $matchedRouteName);
     $myselfhander = function () use($matchedRouteName, $matchedRoute, $namesExplode) {
         $this->contextExecuter($namesExplode);
         $result = $matchedRoute->invoke();
         $this->contextExecuter($namesExplode, false);
         return $result;
     };
     $_matchedRouteName = $namesExplode;
     $_matchedRouteNameCount = count($_matchedRouteName);
     $handers[] = CallBack::init(["name" => '__$$$$$__', "callback" => $myselfhander]);
     for ($i = 1; $i <= $_matchedRouteNameCount; $i++) {
         $name = implode(".", $_matchedRouteName);
         array_pop($_matchedRouteName);
         if (isset($this->handlers[$name])) {
             $handers[] = $this->handlers[$name][1];
         }
     }
     $this->handlerExecuter($handers, count($handers), 1);
 }
Exemplo n.º 4
0
 public function __construct()
 {
     mgActivateThisPlugin(__FILE__, array(__CLASS__, 'activate'));
     mgAddAction(__FILE__, array(__CLASS__, 'pageSettingsPlugin'));
     mgAddShortcode('call-back', array(__CLASS__, 'handleShortCode'));
     self::$lang = PM::plugLocales(self::$pluginName);
     self::$path = PLUGIN_DIR . self::$pluginName;
     if (!URL::isSection('mg-admin')) {
         mgAddMeta('<link rel="stylesheet" href="' . SITE . '/' . self::$path . '/css/user.css" type="text/css" />');
         mgAddMeta('<script type="text/javascript" src="' . SITE . '/' . self::$path . '/js/jquery.maskedinput.min.js"></script>');
         mgAddMeta('<script type="text/javascript" src="' . SITE . '/' . self::$path . '/js/user.js"></script>');
     }
     MG::addInformer(array('count' => self::getEntityActive(), 'class' => 'count-wrap', 'classIcon' => 'message-icon', 'isPlugin' => true, 'section' => 'call-back', 'priority' => 80));
 }
Exemplo n.º 5
0
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/callback.php';
$module = new CallBack();
echo $module->ajaxCityChange($_GET['id_city']);
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/callback.php';
$frcallback = new CallBack();
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if (empty($action)) {
    // Send back the contact form HTML
    $frcallback->show_form();
} else {
    if ($action == "send") {
        $frcallback->send_request();
    }
}
exit;