Protected API starts here
321551
protected function parse($data, $eof) {
        if (!xml_parse($this->xml_parser, $data, $eof)) {
            throw new progressive_parser_exception(
                'xml_parsing_error', null,
                sprintf('XML error: %s at line %d, column %d',
                        xml_error_string(xml_get_error_code($this->xml_parser)),
                        xml_get_current_line_number($this->xml_parser),
                        xml_get_current_column_number($this->xml_parser)));
        }
    }
714955
function Api(config) {
  // config
  this._config = config || {};
  this._config.transforms = _.merge(this._config.transforms || {},{
    defaults: {
      serialize: JSON.stringify,
      deserialize: JSON.parse
    }
  });

  this._config.headers = this._config.headers || {};

  // stack of [('one' | 'all'), <noun>, <id?>]
  // ex [['all', 'experiments'] or ['one', 'projects', 4001]]
  this._stack = [];

  /**
   * Array of filters to apply to URL
   * ex: /api/v1/projects/4001/experiments?filter=status:Started&filter=project_id:55
   * @var Array.<{field: string, value: string}>
   */
  this._filter = [];
}
1266093
def Handle(self, args, token=None):
    """"""

    if not args.name:
      raise ValueError("Name not specified.")

    return ApiConfigOption().InitFromConfigOption(args.name)
390817
function init (prefs, callback) {
	options = _.extend(defaults, prefs);
	app = options.app || express();
	app.use(cors());

	ramlMocker.generate(options, process(function(requestsToMock){
		requestsToMock.forEach(function(reqToMock){
			addRoute(reqToMock);
		});
		log(new Array(30).join('='));
		log('%s[%s]%s API routes generated', colors.qyan, requestsToMock.length, colors.default);

		if(typeof callback === 'function'){
			callback(app);
		}
	}));

	var watcher = watch();
	var server = launchServer(app);

	function close () {
		if (watcher) { watcher.close(); }
		if (server) { server.close(); }
	}

	return {
		close: close,
		server: server,
		watcher: watcher
	};
}
175547
public static function Start()
  {
    global $_SERVER;
    if (!phoxy_conf()["is_ajax_request"] && phoxy_conf()["api_csrf_prevent"])
      die("Request aborted due API direct CSRF warning");

    if (phoxy_conf()["buffered_output"])
      ob_start();

    global $_GET;
    $get_param = phoxy::Config()["get_api_param"];
    $file = $_GET[$get_param];
    unset($_GET[$get_param]);

    if ($file === 'htaccess')
      exit('Rewrite engine work SUCCESS');

    try
    {
      include_once('rpc_string_parser.php');
      $parser = new \phoxy\rpc_string_parser();

      global $_phoxy_process_obj;
      $_phoxy_process_obj = $obj = $parser->GetRpcObject($file, $_GET);
      $a = $obj['obj'];

      $method = $obj['method'];
      if (is_string($method))
        $method = [$method, []];

      $result = $a->APICall($method[0], $method[1]);
    } catch (phoxy_protected_call_error $e)
    {
      $error = $e->result;

      if (!isset($error['error']))
        $error['phoxy_comment'] = "Phoxy caught soft error. Look inside network log";


      $result = new phoxy_return_worker($error);
    }

    $prepared = (string)$result;

    if (phoxy_conf()["buffered_output"])
    {
      $buffered_output = ob_get_contents();
      ob_end_clean();
    }

    if (phoxy_conf()["debug_api"] && !phoxy_conf()["is_ajax_request"])
    {
      echo "<h1>Result</h1>\n";
      var_dump($result->obj);
    }
    else
      header('Content-Type: application/json; charset=utf-8');

    if (!phoxy_conf()["debug_api"] || phoxy_conf()["is_ajax_request"])
      echo $prepared;
    else if (phoxy_conf()["buffered_output"])
      echo "\n<hr><h1>Log</h1>\n{$buffered_output}";
  }
73951
public MethodDeclarationBuilder startMethod(Protection protection, Type returnType, String methodName) {
    return startMethod(protection, returnType, methodName, false);
  }
889412
async function main() {
  event.$emit('before-client-render')

  if (globalState.initialData) {
    dataStore.replaceState(globalState.initialData)
  }

  await routerReady(router)

  if (router.getMatchedComponents().length === 0) {
    throw new ReamError(pageNotFound(router.currentRoute.path))
  }
}
275353
public function start()
    {
        $__scope = $this->_runHooks($this->_startHooks);
        extract($__scope);
        
        $this->_write($this->_socket, self::READY);
        
        /* Note the naming of the local variables due to shared scope with the user here */
        for (;;) {
            declare (ticks = 1);
            // don't exit on ctrl-c
            pcntl_signal(SIGINT, SIG_IGN, true);
            
            $this->_cancelled = false;
            
            $__input = $this->_transform($this->_read($this->_socket));
            
            if ($__input === null) {
                continue;
            }
            
            $__response = self::DONE;
            
            $this->_ppid = posix_getpid();
            $this->_pid  = pcntl_fork();
            
            if ($this->_pid < 0) {
                throw new \RuntimeException('Failed to fork child labourer');
            } elseif ($this->_pid > 0) {
                // kill the child on ctrl-c
                pcntl_signal(SIGINT, array(
                    $this,
                    'cancelOperation'
                ), true);
                pcntl_waitpid($this->_pid, $__status);
                
                if (!$this->_cancelled && $__status != (self::ABNORMAL_EXIT << 8)) {
                    $__response = self::EXITED;
                } else {
                    $this->_runHooks($this->_failureHooks);
                    $__response = self::FAILED;
                }
            } else {
                // if the user has installed a custom exception handler, install a new
                // one which calls it and then (if the custom handler didn't already exit)
                // exits with the correct status.
                // If not, leave the exception handler unset; we'll display
                // an uncaught exception error and carry on.
                $__oldexh = set_exception_handler(array(
                    $this,
                    'delegateExceptionHandler'
                ));
                if ($__oldexh && !$this->_userExceptionHandler) {
                    $this->_userExceptionHandler = $__oldexh; // save the old handler (once)
                } else {
                    restore_exception_handler();
                }
                
                // undo ctrl-c signal handling ready for user code execution
                pcntl_signal(SIGINT, SIG_DFL, true);
                $__pid = posix_getpid();
                
                $__result = eval($__input);
                
                if (posix_getpid() != $__pid) {
                    // whatever the user entered caused a forked child
                    // (totally valid, but we don't want that child to loop and wait for input)
                    exit(0);
                }
                
                if (preg_match('/\s*return\b/i', $__input)) {
                    fwrite(STDOUT, sprintf("%s\n", $this->_inspector->inspect($__result)));
                }
                $this->_expungeOldWorker();
            }
            
            $this->_write($this->_socket, $__response);
            
            if ($__response == self::EXITED) {
                exit(0);
            }
        }
    }
63347
private static function initialize()
    {
        if (self::$initialized) return;

        self::$client = \OpenId::getClient();
        self::$version = config('openid.api-version');
        self::$initialized = TRUE;
    }
168011
function processProtectedElement( that, comment, protectedRegexs, filterOpts ) {
		var source = decodeURIComponent( comment.value.replace( /^\{cke_protected\}/, '' ) ),
			protectedFrag,
			toBeRemoved = [],
			node, i, match;

		// Protected element's and protected source's comments look exactly the same.
		// Check if what we have isn't a protected source instead of protected script/noscript.
		if ( protectedRegexs ) {
			for ( i = 0; i < protectedRegexs.length; ++i ) {
				if ( ( match = source.match( protectedRegexs[ i ] ) ) &&
					match[ 0 ].length == source.length	// Check whether this pattern matches entire source
														// to avoid '<script>alert("<? 1 ?>")</script>' matching
														// the PHP's protectedSource regexp.
				)
					return true;
			}
		}

		protectedFrag = CKEDITOR.htmlParser.fragment.fromHtml( source );

		if ( protectedFrag.children.length == 1 && ( node = protectedFrag.children[ 0 ] ).type == CKEDITOR.NODE_ELEMENT )
			processElement( that, node, toBeRemoved, filterOpts );

		// If protected element has been marked to be removed, return 'false' - comment was rejected.
		return !toBeRemoved.length;
	}
1363066
@Deprecated
    // to force even if someone wants to remove the one from the class
    @Restricted(NoExternalUse.class) 
    public static @Nonnull ApiTokenStats load(@CheckForNull File parent) {
        // even if we are not using statistics, we load the existing one in case the configuration
        // is enabled afterwards to avoid erasing data
        
        if (parent == null) {
            return new ApiTokenStats();
        }
    
        ApiTokenStats apiTokenStats = internalLoad(parent);
        if (apiTokenStats == null) {
            apiTokenStats = new ApiTokenStats();
        }
    
        apiTokenStats.setParent(parent);
        return apiTokenStats;
    }
1259231
public function call() {
    if (empty($this->getApp()->getRequest()->apiApplication)) {
      $this->getApp()->returnError(DefaultAppErrors::$NOT_AUTHORIZED);
    }

    if (!empty($this->next)) {
      $this->next->call();
    }
  }
900387
protected function api()
    {
        if (!isset($this->api)) {
            $this->api = $this->getService('api');
            $this->api
                ->dispatcher
                ->addListener('login_required', [$this, 'login']);
            $this->api
                ->dispatcher
                ->addListener('environments_changed', [$this, 'updateDrushAliases']);
        }

        return $this->api;
    }
537093
private function start()
    {
        $annotation = (object) array(
            'name' => $this->tokens->getValue($this->tokens->key() + 1),
            'values' => new ArrayObject(),
        );

        // skip the name token
        $this->tokens->next();

        $offset = $this->tokens->key();

        // nest, if necessary
        if ($this->current) {
            if (null === ($key = $this->tokens->getKey($offset - 1))) {
                $this->current[] = $annotation;
            } else {
                $this->current[$key] = $annotation;
            }

            $this->stack[] = $this->current;

            // add to root
        } else {
            $this->result[] = $annotation;
        }

        if (DocLexer::T_OPEN_PARENTHESIS
            === $this->tokens->getId($offset + 1)) {
            $this->current = $annotation->values;
        }
    }
1186739
def initialize_api(args):
  
  global api
  api = ApiResource(server_host=args.hostname, server_port=args.port,
                    username=args.username, password=args.password,
                    version=args.api_version, use_tls=args.use_tls)
777103
function access(cb, force){
						_this.login(function(login_result, login_accesskey){
							// console.log(login_result, login_accesskey);
							if( login_result === false && login_accesskey === false ){
								cb(null, false, 0, {});
								return;
							}
							_this.httpRequest(
								url,
								{
									'params': options ,
									'method': apiSettings.method
								},
								function(bin, status, responseHeaders){
									if( !status ){
										cb(false, false, 0, {});
										return;
									}
									try {
										bin = JSON.parse(bin);
									} catch (e) {
									}
									// console.log(bin);
									if( bin.return_code !== 0 ){
										if(force){
											cb(null, bin, status, responseHeaders);
											return;
										}
										setTimeout(function(){
											access(cb, true);
										}, 1000);
										return;
									}
									cb(bin.list, bin, status, responseHeaders);
									return;
								}
							);
						}, force);

					}
837726
public function on_start()
    {
        parent::on_start();
        $arHandle = (string) $this->request->query->get('arHandle', '');
        $this->area = $arHandle === '' ? null : Area::get($this->page, $arHandle);
        if (!$this->area) {
            throw new UserMessageException('Invalid Area');
        }
        if ($this->area->isGlobalArea()) {
            $cx = Stack::getByName($this->area->getAreaHandle());
            if (!$cx) {
                throw new UserMessageException('Invalid Stack');
            }
            $this->permissions = new Checker($cx);
            $ax = Area::get($cx, STACKS_AREA_NAME);
            if (!$this->area) {
                throw new UserMessageException('Invalid Area for Permissions');
            }
            $this->areaPermissions = new Checker($ax);
        } else {
            $this->areaPermissions = new Checker($this->area);
        }
        $this->set('a', $this->area);
        $this->set('ap', $this->areaPermissions);
        $this->set('token', $this->app->make('token'));
    }