Plugin's account URL.

@author Vova Feldman (@svovaf)
@since  1.0.4

@param bool|string $action
@param array       $params

@param bool        $add_action_nonce

@return string
341858
function get_account_url( $action = false, $params = array(), $add_action_nonce = true ) {
            if ( is_string( $action ) ) {
                $params['fs_action'] = $action;
            }

            self::require_pluggable_essentials();

            return ( $add_action_nonce && is_string( $action ) ) ?
                fs_nonce_url( $this->_get_admin_page_url( 'account', $params ), $action ) :
                $this->_get_admin_page_url( 'account', $params );
        }
581289
public function Link($action=null) {
        $link = Controller::join_links(
            $this->stat('url_base', true),
            $this->stat('url_segment', true), // in case we want to change the segment
            '/', // trailing slash needed if $action is null!
            "$action"
        );
        
        $this->extend('updateLink', $link);
        return $link;
    }
529115
function post($action,$params = array(),$options = array()){
		$options["method"] = "POST";
		return $this->_doRequest($action,$params,$options);
	}
579436
protected function soap(string $service, string $action, array $params = [])
    {
        $params["ID"] = $this->id;

        return $this->getSpeaker()->soap($service, $action, $params);
    }
628307
protected function doRequest($action, $params = array())
    {
        if ('common-info' != $action && 'login' != $action) {
            $this->checkIfIsConnected();
            $this->checkIfIsLoggedIn();
        }

        if ($this->cookie && ! isset($params['session'])) {
            $params['session'] = $this->getCookie();
        }

        return new Response(new Request($this->config->getHost(), $action, $params));
    }
909887
private function buildOobLink($param, $action) {
    $code = $this->rpcHelper->getOobCode($param);
    $separator = parse_url($this->widgetUrl, PHP_URL_QUERY) ? '&' : '?';
    return $this->widgetUrl . $separator  .
        http_build_query(array('mode' => $action, 'oobCode' => $code));
  }
151971
protected function urlAction ($action)
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Return generated URL
        return $this->url()->fromRoute($ctrlPubName, array('action' => $action));
    }
53368
public function actionUrl($action = null, $path = null)
    {
        if ($action === null) {
            $action = $this->action;
        }

        $class = get_called_class();
        $uriPath = dirname(dirname(strtolower(str_replace('\\', '/', $class))));
        $controllerName = strtolower(class_basename($class));

        $url = $uriPath.'/'.$controllerName.'/'.$action;
        if ($path) {
            $url .= '/'.$path;
        }

        return Backend::url($url);
    }
750983
public static function verifyNonce($nonce, $action)
    {
        //Safety check for multiple nonces
        if (is_array($nonce)) {
            $nonce = array_shift($nonce);
        }

        //Nonce generated 0-12 hours ago
        if ($nonce === self::getNonce($action)) {
            return true;
        }

        //Nonce generated 12-24 hours ago
        $previousTick = true;

        return $nonce === self::getNonce($action, $previousTick);
    }
1018739
function _doRequest($action,$params,$options){
		$params += array(
			"lang" => $this->lang,
		);
		$params += $this->default_params;

		$options += array(
			"cache" => 0,
			"return_cached_content_on_error" => false,
			"acceptable_error_codes" => array(),
			"file" => array(), // see postFile(),
			"raw_post_data" => null,
			"additional_headers" => array() // array("X-Forwarded-For: 127.0.0.1","X-Logged-User-Id: 123")
		);

		$this->errors = array();
		$this->data = null;

		$timer = new StopWatch();
		$timer->start();

		$lang = $params["lang"];
		unset($params["lang"]);

		$url = $this->base_url;
		if($lang){
			if($this->automatically_add_leading_slash && !preg_match('/\/$/',$url)){
				$url .= "/";
			}
			$url .= "$lang/";
		}
		if($this->automatically_add_leading_slash && !preg_match('/\/$/',$url)){
			$url .= "/";
		}
		$url .= "$action";
		if($this->automatically_add_trailing_slash && !preg_match('/\/$/',$url) && !preg_match('/\?/',$url)){
			$url .= "/";
		}

		$action_url = $url;

		if($options["method"]!="POST" || $options["file"] || !is_null($options["raw_post_data"])){
			$url = $this->_addParamsToUrl($url,$params);
		}
		$this->url = $url;
		$this->method = $options["method"];
		$this->duration = null;

		$cached_ar = null;
		if($options["cache"]>0 && ($ar = $this->_readCache($url,$options["cache"],$cached_ar))){
			return $this->__setCacheAndReturnData($ar);
		}

		// Pro stahovani dat se pouziva UrlFetcher - soucast ATK14
		$headers = $this->additional_headers;
		//if($options["file"]){
		//	$headers["X-FileName"] = $options["name"];
		//}
		$u = new UrlFetcher($url,array(
			"user_agent" => $this->user_agent,
			"additional_headers" => $headers
		));

		if(!is_null($options["raw_post_data"])){
			$u->post($options["raw_post_data"],array(
				"content_type" => $options["mime_type"],
				"additional_headers" => $options["additional_headers"],
			));

		}elseif($options["file"]){
			$content = Files::GetFileContent($options["file"]["path"]);
			$u->post($content,array(
				"content_type" => $options["file"]["mime_type"],
				"additional_headers" => array(
					sprintf('Content-Type: %s',$options["file"]["mime_type"]),
					sprintf('Content-Disposition: attachment; filename="%s"',rawurlencode($options["file"]["name"]))
				)
			));

		}elseif($options["method"]=="POST"){
			// Content-Type: application/x-www-form-urlencoded
			// Content-Length: 244

			$u->post($params);
		}else{
			$u->fetchContent(array(
				"request_method" => $options["method"],
			));
		}
		$this->status_code = $u->getStatusCode();

		$timer->stop();

		$this->duration = $timer->getResult();

		$this->status_code = $u->getStatusCode();

		// TODO: vyresit zalogovani parametru POSTem

		$content = $u->getContent();
		if(!strlen($content) && ($this->status_code!=204)){
			if($options["return_cached_content_on_error"] && $cached_ar){
				return $this->__useOutdatedCache($cached_ar);
			}
			throw new Exception("No content on $url (HTTP $this->status_code)");
		}

		if(strlen($content)>0){

			$d = json_decode($content,true);
			if(is_null($d)){
				trigger_error("ApiDataFetcher:
URL: $url
response code: ".$u->getStatusCode()."
invalid json:\n".$u->getContent()
				);
				if($options["return_cached_content_on_error"] && $cached_ar){
					return $this->__useOutdatedCache($cached_ar);
				}
				throw new Exception("json_decode() failed on $url (HTTP status code: $this->status_code; content: ".$u->getContent().")");
			}

		}else{

			// The $content is empty (HTTP status code is 204).
			// Empty answer means empty JSON.
			$d = array();

		}

		ApiDataFetcher::$QueriesExecuted[] = array(
			"action" => $action,
			"action_url" => $action_url,
			"method" => $options["method"],
			"url" => $url,
			"status_code" => $this->status_code,
			"status_message" => $u->getStatusMessage(),
			"params" => $params,
			"duration" => $timer->getResult(),
			"data" => $d,
		);

		if(preg_match('/^2/',$this->status_code)){
			$this->data = $d;
			$valid_response = true;
		}else{
			$this->errors = $d;
			$valid_response = false;
		}

		if(!$valid_response && !in_array($this->status_code,$options["acceptable_error_codes"])){
			$this->_loggerLog(
				"ApiDataFetcher: $options[method] $url (HTTP $this->status_code, $timer)\n".
				($options["method"] == "POST" ? "params: ".print_r($params,true)."\n" : "").
				"error: ".join(" | ",$this->errors)."\n".
				"requested URL: ".$this->request->getUrl()
			);
			$this->_loggerFlush();
			if($options["return_cached_content_on_error"] && $cached_ar){
				return $this->__useOutdatedCache($cached_ar);
			}
			throw new Exception("HTTP status code $this->status_code (".join(" | ",$this->errors)."), url: $url");
		}else{
			$this->_loggerDebug(
				"ApiDataFetcher: $options[method] $url (HTTP $this->status_code, $timer)".
				($options["method"] == "POST" ? "\nparams: ".print_r($params,true)."\n" : "")
			);
			if($options["cache"]>0){
				$this->_writeCache($url,$this->status_code,$this->data,$this->errors);
			}
		}

		return $this->data;
	}
987348
protected function redirectAction ($action, $params=array())
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Get original parameters
        $paramsOrig = $this->params()->fromRoute();

        // Combine parameters - if action is explicitly specified in params it is overriden
        $params2pass = array_merge(
            $paramsOrig,
            $params,
            array('action' => $action)
        );

        // Do the redirect
        return $this->redirect()->toRoute($ctrlPubName, $params2pass);
    }
1088544
public function doAction( $action, $params = array() )
    {
        if ( isset( $this->actions[ $action ] ) )
        {
            foreach( $this->actions[ $action ] as $callback )
            {
                call_user_func_array( $callback[ 'callback' ], $params );

                if ( $this->debug )
                {
                    echo PHP_EOL . '->ACTION: ' . $action . ' -> '
                            . $this->_serializeCallback( $callback[ 'callback' ] )
                            . ' + Priority: ' . $callback[ 'priority' ]
                            . PHP_EOL;
                }
            }
        }
    }
438901
public function register_return_link($action, $params) {
        global $PAGE;
        $params['action'] = $action;
        $cm = $this->get_course_module();
        if ($cm) {
            $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $cm->id));
        } else {
            $currenturl = new moodle_url('/mod/assign/index.php', array('id' => $this->get_course()->id));
        }

        $currenturl->params($params);
        $PAGE->set_url($currenturl);
    }
1080914
function Link($action = null) {
		$cur = Controller::curr();
		if ($cur instanceof ExternalContentPage_Controller) {
			return $cur->data()->LinkFor($this, 'view');
		}
		return ExternalContentPage_Controller::URL_STUB . '/view/' . $this->ID;
	}
731556
protected function forwardAction ($action, $params=array())
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Get original parameters
        $paramsOrig = $this->params()->fromRoute();

        // Combine parameters - if action is explicitly specified in params it is overriden
        $params2pass = array_merge(
            $paramsOrig,
            $params,
            array('action' => $action)
        );

        // Do the forward
        return $this->forward()->dispatch($ctrlPubName, $params2pass);
    }
265207
public function checkAction( $action, $parameters = array(), $absolute = true )
  {
    try {
      $url = $this->_app['url']->action($action, $parameters, $absolute);
    } catch( InvalidArgumentException $e ) {
      return false;
    }

    return $url;
  }
1144652
public function verify_nonce($action, $key = '_wpnonce'){
		$nonce = $this->request($key);
		return $nonce && wp_verify_nonce($this->request($key), $action);
	}