method __call documentation in bbn\Api\Cloudmintest

function($name, $arguments) { $cmd_name = str_replace('-', '_', $name); // TODO ho tolto il controllo $this->commands[$cmd_name] // if ( isset($this->commands[$cmd_name]) ){ //Setting the last action performed $this->last_action = $cmd_name; //Defining the $url_part and the command to be executed $url_part = $cmd_name; if ( !empty($arguments[0]) ){ //Prepping, processing and validating the create user parameters $args = $this->processParameters($arguments[0]); // TODO tolto i comandi, messo gli argomenti foreach ( $args as $k => $v ){ if ( !empty($v['mandatory']) && !isset($args[$k]) ){ if ( (strpos($k, 'pass') === false) && (!isset($args['pass']) && !isset($args['encpass']) && !isset($args['passfile'])) ){ var_dump("Parameter $k mandatory for $name!"); return false; } } // TODO controlllo se questi valori sono boolean e se no a true if ( isset($v) ){ if ( is_bool($v['binary']) && ($v['binary'] == true) ){ $url_part .= "&$k"; } else if ( \is_array($v) && is_bool($v['multiple']) && ($v['multiple'] == true) ){ foreach ( $v as $w ){ $url_part .= "&$k=$w"; } } else{ $url_part .= "&$k=".$args[$k]; } } } // } //Concatenating the closing single quote $url_part .= "'"; //Concatenating the header url and $url_part to create the full url to be executed $url_part = $this->getHeaderUrl() . $url_part; //Calling shell_exec and returning the result array return $this->callShellExec($url_part); } // We force even if we don't have the command in the list else if ( !empty($arguments[1]) ){ $args = $this->processParameters($arguments[0]); $url_part = $cmd_name; foreach ( $args as $k => $v ){ if ( \is_array($v) ){ foreach ( $v as $w ){ $url_part .= "&$k=$w"; } } else if ( $v === 1 ){ $url_part .= "&$k"; } else{ $url_part .= "&$k=$v"; } } //Concatenating the closing single quote $url_part .= "'"; //Concatenating the header url and $url_part to create the full url to be executed $url_part = $this->getHeaderUrl() . $url_part; \bbn\X::log($url_part, 'webmin'); //Calling shell_exec and returning the result array return $this->callShellExec($url_part); } else{ die("The command $name doesn't exist..."); } } return false; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.