repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
kelunik/acme
lib/AcmeClient.php
AcmeClient.fetchDirectory
private function fetchDirectory(): Promise { return call(function () { try { $this->logger->debug('Fetching directory from {uri}', [ 'uri' => $this->directoryUri ]); /** @var Response $response */ $response = yield $this->http->request($this->directoryUri); $directory = json_decode(yield $response->getBody(), true); if ($response->getStatus() !== 200) { $error = $directory; if (isset($error['type'], $error['detail'])) { throw new AcmeException("Invalid directory response: {$error['detail']}", $error['type']); } throw new AcmeException('Invalid directory response. HTTP response code: ' . $response->getStatus()); } if (empty($directory)) { throw new AcmeException('Invalid empty directory.'); } $this->directory = $directory; $this->saveNonce($response); } catch (Throwable $e) { throw new AcmeException('Could not obtain directory: ' . $e->getMessage(), null, $e); } }); }
php
private function fetchDirectory(): Promise { return call(function () { try { $this->logger->debug('Fetching directory from {uri}', [ 'uri' => $this->directoryUri ]); /** @var Response $response */ $response = yield $this->http->request($this->directoryUri); $directory = json_decode(yield $response->getBody(), true); if ($response->getStatus() !== 200) { $error = $directory; if (isset($error['type'], $error['detail'])) { throw new AcmeException("Invalid directory response: {$error['detail']}", $error['type']); } throw new AcmeException('Invalid directory response. HTTP response code: ' . $response->getStatus()); } if (empty($directory)) { throw new AcmeException('Invalid empty directory.'); } $this->directory = $directory; $this->saveNonce($response); } catch (Throwable $e) { throw new AcmeException('Could not obtain directory: ' . $e->getMessage(), null, $e); } }); }
[ "private", "function", "fetchDirectory", "(", ")", ":", "Promise", "{", "return", "call", "(", "function", "(", ")", "{", "try", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Fetching directory from {uri}'", ",", "[", "'uri'", "=>", "$", "this", "->", "directoryUri", "]", ")", ";", "/** @var Response $response */", "$", "response", "=", "yield", "$", "this", "->", "http", "->", "request", "(", "$", "this", "->", "directoryUri", ")", ";", "$", "directory", "=", "json_decode", "(", "yield", "$", "response", "->", "getBody", "(", ")", ",", "true", ")", ";", "if", "(", "$", "response", "->", "getStatus", "(", ")", "!==", "200", ")", "{", "$", "error", "=", "$", "directory", ";", "if", "(", "isset", "(", "$", "error", "[", "'type'", "]", ",", "$", "error", "[", "'detail'", "]", ")", ")", "{", "throw", "new", "AcmeException", "(", "\"Invalid directory response: {$error['detail']}\"", ",", "$", "error", "[", "'type'", "]", ")", ";", "}", "throw", "new", "AcmeException", "(", "'Invalid directory response. HTTP response code: '", ".", "$", "response", "->", "getStatus", "(", ")", ")", ";", "}", "if", "(", "empty", "(", "$", "directory", ")", ")", "{", "throw", "new", "AcmeException", "(", "'Invalid empty directory.'", ")", ";", "}", "$", "this", "->", "directory", "=", "$", "directory", ";", "$", "this", "->", "saveNonce", "(", "$", "response", ")", ";", "}", "catch", "(", "Throwable", "$", "e", ")", "{", "throw", "new", "AcmeException", "(", "'Could not obtain directory: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "null", ",", "$", "e", ")", ";", "}", "}", ")", ";", "}" ]
Retrieves the directory and stores it in the directory property. @return Promise Resolves once the directory is fetched. @throws AcmeException If the directory could not be fetched or was invalid.
[ "Retrieves", "the", "directory", "and", "stores", "it", "in", "the", "directory", "property", "." ]
21c7b88b8d3cd70cbf9d40f046719358881f0501
https://github.com/kelunik/acme/blob/21c7b88b8d3cd70cbf9d40f046719358881f0501/lib/AcmeClient.php#L185-L216
train
kelunik/acme
lib/AcmeClient.php
AcmeClient.get
public function get(string $resource): Promise { return call(function () use ($resource) { $uri = yield $this->getResourceUri($resource); $this->logger->debug('Requesting {uri} via GET', [ 'uri' => $uri, ]); try { /** @var Response $response */ $response = yield $this->http->request($uri); // We just buffer the body here, so no further I/O will happen once this method's promise resolves. $body = yield $response->getBody(); $this->logger->debug('Request for {uri} via GET has been processed with status {status}: {body}', [ 'uri' => $uri, 'status' => $response->getStatus(), 'body' => $body ]); $this->saveNonce($response); } catch (Throwable $e) { throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e); } catch (Exception $e) { throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e); } return $response; }); }
php
public function get(string $resource): Promise { return call(function () use ($resource) { $uri = yield $this->getResourceUri($resource); $this->logger->debug('Requesting {uri} via GET', [ 'uri' => $uri, ]); try { /** @var Response $response */ $response = yield $this->http->request($uri); // We just buffer the body here, so no further I/O will happen once this method's promise resolves. $body = yield $response->getBody(); $this->logger->debug('Request for {uri} via GET has been processed with status {status}: {body}', [ 'uri' => $uri, 'status' => $response->getStatus(), 'body' => $body ]); $this->saveNonce($response); } catch (Throwable $e) { throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e); } catch (Exception $e) { throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e); } return $response; }); }
[ "public", "function", "get", "(", "string", "$", "resource", ")", ":", "Promise", "{", "return", "call", "(", "function", "(", ")", "use", "(", "$", "resource", ")", "{", "$", "uri", "=", "yield", "$", "this", "->", "getResourceUri", "(", "$", "resource", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Requesting {uri} via GET'", ",", "[", "'uri'", "=>", "$", "uri", ",", "]", ")", ";", "try", "{", "/** @var Response $response */", "$", "response", "=", "yield", "$", "this", "->", "http", "->", "request", "(", "$", "uri", ")", ";", "// We just buffer the body here, so no further I/O will happen once this method's promise resolves.", "$", "body", "=", "yield", "$", "response", "->", "getBody", "(", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Request for {uri} via GET has been processed with status {status}: {body}'", ",", "[", "'uri'", "=>", "$", "uri", ",", "'status'", "=>", "$", "response", "->", "getStatus", "(", ")", ",", "'body'", "=>", "$", "body", "]", ")", ";", "$", "this", "->", "saveNonce", "(", "$", "response", ")", ";", "}", "catch", "(", "Throwable", "$", "e", ")", "{", "throw", "new", "AcmeException", "(", "\"GET request to {$uri} failed: \"", ".", "$", "e", "->", "getMessage", "(", ")", ",", "null", ",", "$", "e", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "AcmeException", "(", "\"GET request to {$uri} failed: \"", ".", "$", "e", "->", "getMessage", "(", ")", ",", "null", ",", "$", "e", ")", ";", "}", "return", "$", "response", ";", "}", ")", ";", "}" ]
Retrieves a resource using a GET request. @api @param string $resource Resource to fetch. @return Promise Resolves to the HTTP response. @throws AcmeException If the request failed.
[ "Retrieves", "a", "resource", "using", "a", "GET", "request", "." ]
21c7b88b8d3cd70cbf9d40f046719358881f0501
https://github.com/kelunik/acme/blob/21c7b88b8d3cd70cbf9d40f046719358881f0501/lib/AcmeClient.php#L228-L258
train
kelunik/acme
lib/AcmeClient.php
AcmeClient.post
public function post(string $resource, array $payload): Promise { return call(function () use ($resource, $payload) { $uri = yield $this->getResourceUri($resource); $attempt = 0; $statusCode = null; do { $attempt++; if ($attempt > 3) { throw new AcmeException("POST request to {$uri} failed, received too many errors (last code: ${statusCode})."); } $payload['resource'] = $payload['resource'] ?? $resource; $requestBody = $this->cryptoBackend->signJwt($this->accountKey, yield $this->getNonce($uri), $payload); $request = (new Request($uri, 'POST')) ->withBody($requestBody); $this->logger->debug('Requesting {uri} via POST: {body}', [ 'uri' => $uri, 'body' => $requestBody, ]); try { /** @var Response $response */ $response = yield $this->http->request($request); $statusCode = $response->getStatus(); $body = yield $response->getBody(); $this->logger->debug('Request for {uri} via POST has been processed with status {status}: {body}', [ 'uri' => $uri, 'status' => $statusCode, 'body' => $body ]); $this->saveNonce($response); if ($statusCode === 400) { $info = json_decode($body); if (!empty($info->type) && ($info->type === 'urn:acme:badNonce' || $info->type === 'urn:acme:error:badNonce')) { $this->nonces = []; continue; } } else if ($statusCode === 429) { /** * Hit rate limit * @{link} https://letsencrypt.org/docs/rate-limits/ */ yield new Delayed(1000); continue; } } catch (Throwable $e) { throw new AcmeException("POST request to {$uri} failed: " . $e->getMessage(), null, $e); } catch (Exception $e) { throw new AcmeException("POST request to {$uri} failed: " . $e->getMessage(), null, $e); } return $response; } while (true); }); }
php
public function post(string $resource, array $payload): Promise { return call(function () use ($resource, $payload) { $uri = yield $this->getResourceUri($resource); $attempt = 0; $statusCode = null; do { $attempt++; if ($attempt > 3) { throw new AcmeException("POST request to {$uri} failed, received too many errors (last code: ${statusCode})."); } $payload['resource'] = $payload['resource'] ?? $resource; $requestBody = $this->cryptoBackend->signJwt($this->accountKey, yield $this->getNonce($uri), $payload); $request = (new Request($uri, 'POST')) ->withBody($requestBody); $this->logger->debug('Requesting {uri} via POST: {body}', [ 'uri' => $uri, 'body' => $requestBody, ]); try { /** @var Response $response */ $response = yield $this->http->request($request); $statusCode = $response->getStatus(); $body = yield $response->getBody(); $this->logger->debug('Request for {uri} via POST has been processed with status {status}: {body}', [ 'uri' => $uri, 'status' => $statusCode, 'body' => $body ]); $this->saveNonce($response); if ($statusCode === 400) { $info = json_decode($body); if (!empty($info->type) && ($info->type === 'urn:acme:badNonce' || $info->type === 'urn:acme:error:badNonce')) { $this->nonces = []; continue; } } else if ($statusCode === 429) { /** * Hit rate limit * @{link} https://letsencrypt.org/docs/rate-limits/ */ yield new Delayed(1000); continue; } } catch (Throwable $e) { throw new AcmeException("POST request to {$uri} failed: " . $e->getMessage(), null, $e); } catch (Exception $e) { throw new AcmeException("POST request to {$uri} failed: " . $e->getMessage(), null, $e); } return $response; } while (true); }); }
[ "public", "function", "post", "(", "string", "$", "resource", ",", "array", "$", "payload", ")", ":", "Promise", "{", "return", "call", "(", "function", "(", ")", "use", "(", "$", "resource", ",", "$", "payload", ")", "{", "$", "uri", "=", "yield", "$", "this", "->", "getResourceUri", "(", "$", "resource", ")", ";", "$", "attempt", "=", "0", ";", "$", "statusCode", "=", "null", ";", "do", "{", "$", "attempt", "++", ";", "if", "(", "$", "attempt", ">", "3", ")", "{", "throw", "new", "AcmeException", "(", "\"POST request to {$uri} failed, received too many errors (last code: ${statusCode}).\"", ")", ";", "}", "$", "payload", "[", "'resource'", "]", "=", "$", "payload", "[", "'resource'", "]", "??", "$", "resource", ";", "$", "requestBody", "=", "$", "this", "->", "cryptoBackend", "->", "signJwt", "(", "$", "this", "->", "accountKey", ",", "yield", "$", "this", "->", "getNonce", "(", "$", "uri", ")", ",", "$", "payload", ")", ";", "$", "request", "=", "(", "new", "Request", "(", "$", "uri", ",", "'POST'", ")", ")", "->", "withBody", "(", "$", "requestBody", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Requesting {uri} via POST: {body}'", ",", "[", "'uri'", "=>", "$", "uri", ",", "'body'", "=>", "$", "requestBody", ",", "]", ")", ";", "try", "{", "/** @var Response $response */", "$", "response", "=", "yield", "$", "this", "->", "http", "->", "request", "(", "$", "request", ")", ";", "$", "statusCode", "=", "$", "response", "->", "getStatus", "(", ")", ";", "$", "body", "=", "yield", "$", "response", "->", "getBody", "(", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "'Request for {uri} via POST has been processed with status {status}: {body}'", ",", "[", "'uri'", "=>", "$", "uri", ",", "'status'", "=>", "$", "statusCode", ",", "'body'", "=>", "$", "body", "]", ")", ";", "$", "this", "->", "saveNonce", "(", "$", "response", ")", ";", "if", "(", "$", "statusCode", "===", "400", ")", "{", "$", "info", "=", "json_decode", "(", "$", "body", ")", ";", "if", "(", "!", "empty", "(", "$", "info", "->", "type", ")", "&&", "(", "$", "info", "->", "type", "===", "'urn:acme:badNonce'", "||", "$", "info", "->", "type", "===", "'urn:acme:error:badNonce'", ")", ")", "{", "$", "this", "->", "nonces", "=", "[", "]", ";", "continue", ";", "}", "}", "else", "if", "(", "$", "statusCode", "===", "429", ")", "{", "/**\n * Hit rate limit\n * @{link} https://letsencrypt.org/docs/rate-limits/\n */", "yield", "new", "Delayed", "(", "1000", ")", ";", "continue", ";", "}", "}", "catch", "(", "Throwable", "$", "e", ")", "{", "throw", "new", "AcmeException", "(", "\"POST request to {$uri} failed: \"", ".", "$", "e", "->", "getMessage", "(", ")", ",", "null", ",", "$", "e", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "AcmeException", "(", "\"POST request to {$uri} failed: \"", ".", "$", "e", "->", "getMessage", "(", ")", ",", "null", ",", "$", "e", ")", ";", "}", "return", "$", "response", ";", "}", "while", "(", "true", ")", ";", "}", ")", ";", "}" ]
Retrieves a resource using a POST request. @api @param string $resource Resource to fetch. @param array $payload Payload as associative array to send. @return Promise Resolves to the HTTP response. @throws AcmeException If the request failed.
[ "Retrieves", "a", "resource", "using", "a", "POST", "request", "." ]
21c7b88b8d3cd70cbf9d40f046719358881f0501
https://github.com/kelunik/acme/blob/21c7b88b8d3cd70cbf9d40f046719358881f0501/lib/AcmeClient.php#L271-L334
train
bozerkins/clickhouse-client
src/ClickhouseClient/Client/Format/TabSeparatedFormat.php
TabSeparatedFormat.encode
public function encode(array $row): string { $stream = fopen('php://memory', 'r+'); fputcsv($stream, $row, "\t"); rewind($stream); $line = fgets($stream); fclose($stream); return $line; }
php
public function encode(array $row): string { $stream = fopen('php://memory', 'r+'); fputcsv($stream, $row, "\t"); rewind($stream); $line = fgets($stream); fclose($stream); return $line; }
[ "public", "function", "encode", "(", "array", "$", "row", ")", ":", "string", "{", "$", "stream", "=", "fopen", "(", "'php://memory'", ",", "'r+'", ")", ";", "fputcsv", "(", "$", "stream", ",", "$", "row", ",", "\"\\t\"", ")", ";", "rewind", "(", "$", "stream", ")", ";", "$", "line", "=", "fgets", "(", "$", "stream", ")", ";", "fclose", "(", "$", "stream", ")", ";", "return", "$", "line", ";", "}" ]
Encode single row of data Generally is used for proper data inserting @param array $row @return string
[ "Encode", "single", "row", "of", "data", "Generally", "is", "used", "for", "proper", "data", "inserting" ]
ad83b9f9090fe56e49d8ec59ee97d8bec1d5b50d
https://github.com/bozerkins/clickhouse-client/blob/ad83b9f9090fe56e49d8ec59ee97d8bec1d5b50d/src/ClickhouseClient/Client/Format/TabSeparatedFormat.php#L42-L50
train
tideways/profiler
Tideways.php
Profiler.startDevelopment
public static function startDevelopment($apiKey = null, array $options = array()) { if ($apiKey) { $options['api_key'] = $apiKey; } else if (!isset($options['api_key'])) { $options['api_key'] = isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"); } $time = time() + 60; $_SERVER['TIDEWAYS_SESSION'] = "time=" . $time . "&user=&method=&hash=" . hash_hmac('sha256', 'method=&time=' . $time . '&user=', md5($options['api_key'])) ; self::start($options); }
php
public static function startDevelopment($apiKey = null, array $options = array()) { if ($apiKey) { $options['api_key'] = $apiKey; } else if (!isset($options['api_key'])) { $options['api_key'] = isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"); } $time = time() + 60; $_SERVER['TIDEWAYS_SESSION'] = "time=" . $time . "&user=&method=&hash=" . hash_hmac('sha256', 'method=&time=' . $time . '&user=', md5($options['api_key'])) ; self::start($options); }
[ "public", "static", "function", "startDevelopment", "(", "$", "apiKey", "=", "null", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "$", "apiKey", ")", "{", "$", "options", "[", "'api_key'", "]", "=", "$", "apiKey", ";", "}", "else", "if", "(", "!", "isset", "(", "$", "options", "[", "'api_key'", "]", ")", ")", "{", "$", "options", "[", "'api_key'", "]", "=", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_APIKEY'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_APIKEY'", "]", ":", "ini_get", "(", "\"tideways.api_key\"", ")", ";", "}", "$", "time", "=", "time", "(", ")", "+", "60", ";", "$", "_SERVER", "[", "'TIDEWAYS_SESSION'", "]", "=", "\"time=\"", ".", "$", "time", ".", "\"&user=&method=&hash=\"", ".", "hash_hmac", "(", "'sha256'", ",", "'method=&time='", ".", "$", "time", ".", "'&user='", ",", "md5", "(", "$", "options", "[", "'api_key'", "]", ")", ")", ";", "self", "::", "start", "(", "$", "options", ")", ";", "}" ]
Start profiling in development mode. This will always generate a full profile and send it to the profiler. It adds a correlation id that forces the profile into "developer" traces and activates the memory profiling as well. WARNING: This method can cause huge performance impact on production setups. Make sure to wrap this in your own sampling code and don't execute it in every request.
[ "Start", "profiling", "in", "development", "mode", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L782-L797
train
tideways/profiler
Tideways.php
Profiler.start
public static function start($options = array(), $sampleRate = null) { self::ignoreTransaction(); // this discards any data that was collected up to now and restarts. if (!is_array($options)) { $options = array('api_key' => $options); } if ($sampleRate !== null) { $options['sample_rate'] = $sampleRate; } $defaults = array( 'api_key' => isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"), 'sample_rate' => isset($_SERVER['TIDEWAYS_SAMPLERATE']) ? intval($_SERVER['TIDEWAYS_SAMPLERATE']) : (ini_get("tideways.sample_rate") ?: 0), 'collect' => isset($_SERVER['TIDEWAYS_COLLECT']) ? $_SERVER['TIDEWAYS_COLLECT'] : (ini_get("tideways.collect") ?: self::MODE_PROFILING), 'monitor' => isset($_SERVER['TIDEWAYS_MONITOR']) ? $_SERVER['TIDEWAYS_MONITOR'] : (ini_get("tideways.monitor") ?: self::MODE_BASIC), 'triggered' => self::MODE_FULL, 'log_level' => ini_get("tideways.log_level") ?: 0, 'service' => isset($_SERVER['TIDEWAYS_SERVICE']) ? $_SERVER['TIDEWAYS_SERVICE'] : ini_get("tideways.service"), 'framework' => isset($_SERVER['TIDEWAYS_FRAMEWORK']) ? $_SERVER['TIDEWAYS_FRAMEWORK'] : ini_get("tideways.framework"), ); $options = array_merge($defaults, $options); if (strlen((string)$options['api_key']) === 0) { return; } self::$logLevel = $options['log_level']; self::init($options['api_key'], $options); self::decideProfiling($options['sample_rate'], $options); }
php
public static function start($options = array(), $sampleRate = null) { self::ignoreTransaction(); // this discards any data that was collected up to now and restarts. if (!is_array($options)) { $options = array('api_key' => $options); } if ($sampleRate !== null) { $options['sample_rate'] = $sampleRate; } $defaults = array( 'api_key' => isset($_SERVER['TIDEWAYS_APIKEY']) ? $_SERVER['TIDEWAYS_APIKEY'] : ini_get("tideways.api_key"), 'sample_rate' => isset($_SERVER['TIDEWAYS_SAMPLERATE']) ? intval($_SERVER['TIDEWAYS_SAMPLERATE']) : (ini_get("tideways.sample_rate") ?: 0), 'collect' => isset($_SERVER['TIDEWAYS_COLLECT']) ? $_SERVER['TIDEWAYS_COLLECT'] : (ini_get("tideways.collect") ?: self::MODE_PROFILING), 'monitor' => isset($_SERVER['TIDEWAYS_MONITOR']) ? $_SERVER['TIDEWAYS_MONITOR'] : (ini_get("tideways.monitor") ?: self::MODE_BASIC), 'triggered' => self::MODE_FULL, 'log_level' => ini_get("tideways.log_level") ?: 0, 'service' => isset($_SERVER['TIDEWAYS_SERVICE']) ? $_SERVER['TIDEWAYS_SERVICE'] : ini_get("tideways.service"), 'framework' => isset($_SERVER['TIDEWAYS_FRAMEWORK']) ? $_SERVER['TIDEWAYS_FRAMEWORK'] : ini_get("tideways.framework"), ); $options = array_merge($defaults, $options); if (strlen((string)$options['api_key']) === 0) { return; } self::$logLevel = $options['log_level']; self::init($options['api_key'], $options); self::decideProfiling($options['sample_rate'], $options); }
[ "public", "static", "function", "start", "(", "$", "options", "=", "array", "(", ")", ",", "$", "sampleRate", "=", "null", ")", "{", "self", "::", "ignoreTransaction", "(", ")", ";", "// this discards any data that was collected up to now and restarts.", "if", "(", "!", "is_array", "(", "$", "options", ")", ")", "{", "$", "options", "=", "array", "(", "'api_key'", "=>", "$", "options", ")", ";", "}", "if", "(", "$", "sampleRate", "!==", "null", ")", "{", "$", "options", "[", "'sample_rate'", "]", "=", "$", "sampleRate", ";", "}", "$", "defaults", "=", "array", "(", "'api_key'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_APIKEY'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_APIKEY'", "]", ":", "ini_get", "(", "\"tideways.api_key\"", ")", ",", "'sample_rate'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_SAMPLERATE'", "]", ")", "?", "intval", "(", "$", "_SERVER", "[", "'TIDEWAYS_SAMPLERATE'", "]", ")", ":", "(", "ini_get", "(", "\"tideways.sample_rate\"", ")", "?", ":", "0", ")", ",", "'collect'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_COLLECT'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_COLLECT'", "]", ":", "(", "ini_get", "(", "\"tideways.collect\"", ")", "?", ":", "self", "::", "MODE_PROFILING", ")", ",", "'monitor'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_MONITOR'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_MONITOR'", "]", ":", "(", "ini_get", "(", "\"tideways.monitor\"", ")", "?", ":", "self", "::", "MODE_BASIC", ")", ",", "'triggered'", "=>", "self", "::", "MODE_FULL", ",", "'log_level'", "=>", "ini_get", "(", "\"tideways.log_level\"", ")", "?", ":", "0", ",", "'service'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_SERVICE'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_SERVICE'", "]", ":", "ini_get", "(", "\"tideways.service\"", ")", ",", "'framework'", "=>", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_FRAMEWORK'", "]", ")", "?", "$", "_SERVER", "[", "'TIDEWAYS_FRAMEWORK'", "]", ":", "ini_get", "(", "\"tideways.framework\"", ")", ",", ")", ";", "$", "options", "=", "array_merge", "(", "$", "defaults", ",", "$", "options", ")", ";", "if", "(", "strlen", "(", "(", "string", ")", "$", "options", "[", "'api_key'", "]", ")", "===", "0", ")", "{", "return", ";", "}", "self", "::", "$", "logLevel", "=", "$", "options", "[", "'log_level'", "]", ";", "self", "::", "init", "(", "$", "options", "[", "'api_key'", "]", ",", "$", "options", ")", ";", "self", "::", "decideProfiling", "(", "$", "options", "[", "'sample_rate'", "]", ",", "$", "options", ")", ";", "}" ]
Start production profiling for the application. There are three modes for profiling: 1. Wall-time only profiling of the complete request (no overhead) 2. Full profile/trace using xhprof (depending of # function calls significant overhead) 3. Whitelist-profiling mode only interesting functions. (5-40% overhead, requires custom xhprof version >= 0.95) Decisions to profile are made based on a sample-rate and random picks. You can influence the sample rate and pick a value that suites your application. Applications with lower request rates need a much higher transaction rate (25-50%) than applications with high load (<= 1%). Factors that influence sample rate: 1. Second parameter $sampleRate to start() method. 2. _tideways Query Parameter (string key is deprecated or array) 3. Cookie TIDEWAYS_SESSION 4. TIDEWAYS_SAMPLERATE environment variable. 5. X-TIDEWAYS-PROFILER HTTP header start() automatically invokes a register shutdown handler that stops and transmits the profiling data to the local daemon for further processing. @param array|string $options Either options array or api key (when string) @param int $sampleRate Deprecated, use "sample_rate" key in options instead. @return void
[ "Start", "production", "profiling", "for", "the", "application", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L831-L861
train
tideways/profiler
Tideways.php
Profiler.containsDeveloperTraceRequest
public static function containsDeveloperTraceRequest() { if (isset($_SERVER['HTTP_X_TIDEWAYS_PROFILER']) && is_string($_SERVER['HTTP_X_TIDEWAYS_PROFILER'])) { return true; } else if (isset($_SERVER['TIDEWAYS_SESSION']) && is_string($_SERVER['TIDEWAYS_SESSION'])) { return true; } else if (isset($_COOKIE['TIDEWAYS_SESSION']) && is_string($_COOKIE['TIDEWAYS_SESSION'])) { return true; } else if (isset($_GET['_tideways']) && is_array($_GET['_tideways'])) { return true; } return false; }
php
public static function containsDeveloperTraceRequest() { if (isset($_SERVER['HTTP_X_TIDEWAYS_PROFILER']) && is_string($_SERVER['HTTP_X_TIDEWAYS_PROFILER'])) { return true; } else if (isset($_SERVER['TIDEWAYS_SESSION']) && is_string($_SERVER['TIDEWAYS_SESSION'])) { return true; } else if (isset($_COOKIE['TIDEWAYS_SESSION']) && is_string($_COOKIE['TIDEWAYS_SESSION'])) { return true; } else if (isset($_GET['_tideways']) && is_array($_GET['_tideways'])) { return true; } return false; }
[ "public", "static", "function", "containsDeveloperTraceRequest", "(", ")", "{", "if", "(", "isset", "(", "$", "_SERVER", "[", "'HTTP_X_TIDEWAYS_PROFILER'", "]", ")", "&&", "is_string", "(", "$", "_SERVER", "[", "'HTTP_X_TIDEWAYS_PROFILER'", "]", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "isset", "(", "$", "_SERVER", "[", "'TIDEWAYS_SESSION'", "]", ")", "&&", "is_string", "(", "$", "_SERVER", "[", "'TIDEWAYS_SESSION'", "]", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "isset", "(", "$", "_COOKIE", "[", "'TIDEWAYS_SESSION'", "]", ")", "&&", "is_string", "(", "$", "_COOKIE", "[", "'TIDEWAYS_SESSION'", "]", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "isset", "(", "$", "_GET", "[", "'_tideways'", "]", ")", "&&", "is_array", "(", "$", "_GET", "[", "'_tideways'", "]", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if headers, cookie or environment variables for a developer trace are present. This method does not validate if the passed information is actually valid for the current API Key. @return bool
[ "Check", "if", "headers", "cookie", "or", "environment", "variables", "for", "a", "developer", "trace", "are", "present", ".", "This", "method", "does", "not", "validate", "if", "the", "passed", "information", "is", "actually", "valid", "for", "the", "current", "API", "Key", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L928-L941
train
tideways/profiler
Tideways.php
Profiler.convertMode
private static function convertMode($mode) { if (is_string($mode)) { $mode = defined('\Tideways\Profiler::MODE_' . strtoupper($mode)) ? constant('\Tideways\Profiler::MODE_' . strtoupper($mode)) : self::MODE_DISABLED; } else if (!is_int($mode)) { $mode = self::MODE_DISABLED; } else if (($mode & (self::MODE_FULL|self::MODE_BASIC)) === 0) { $mode = self::MODE_DISABLED; } return $mode; }
php
private static function convertMode($mode) { if (is_string($mode)) { $mode = defined('\Tideways\Profiler::MODE_' . strtoupper($mode)) ? constant('\Tideways\Profiler::MODE_' . strtoupper($mode)) : self::MODE_DISABLED; } else if (!is_int($mode)) { $mode = self::MODE_DISABLED; } else if (($mode & (self::MODE_FULL|self::MODE_BASIC)) === 0) { $mode = self::MODE_DISABLED; } return $mode; }
[ "private", "static", "function", "convertMode", "(", "$", "mode", ")", "{", "if", "(", "is_string", "(", "$", "mode", ")", ")", "{", "$", "mode", "=", "defined", "(", "'\\Tideways\\Profiler::MODE_'", ".", "strtoupper", "(", "$", "mode", ")", ")", "?", "constant", "(", "'\\Tideways\\Profiler::MODE_'", ".", "strtoupper", "(", "$", "mode", ")", ")", ":", "self", "::", "MODE_DISABLED", ";", "}", "else", "if", "(", "!", "is_int", "(", "$", "mode", ")", ")", "{", "$", "mode", "=", "self", "::", "MODE_DISABLED", ";", "}", "else", "if", "(", "(", "$", "mode", "&", "(", "self", "::", "MODE_FULL", "|", "self", "::", "MODE_BASIC", ")", ")", "===", "0", ")", "{", "$", "mode", "=", "self", "::", "MODE_DISABLED", ";", "}", "return", "$", "mode", ";", "}" ]
Make sure provided mode is converted to a valid integer value. @return int
[ "Make", "sure", "provided", "mode", "is", "converted", "to", "a", "valid", "integer", "value", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1036-L1049
train
tideways/profiler
Tideways.php
Profiler.ignoreTransaction
public static function ignoreTransaction() { if (self::$mode !== self::MODE_DISABLED) { self::$mode = self::MODE_DISABLED; if (self::$extension === self::EXTENSION_XHPROF) { xhprof_disable(); } else if (self::$extension === self::EXTENSION_TIDEWAYS) { tideways_disable(); } } }
php
public static function ignoreTransaction() { if (self::$mode !== self::MODE_DISABLED) { self::$mode = self::MODE_DISABLED; if (self::$extension === self::EXTENSION_XHPROF) { xhprof_disable(); } else if (self::$extension === self::EXTENSION_TIDEWAYS) { tideways_disable(); } } }
[ "public", "static", "function", "ignoreTransaction", "(", ")", "{", "if", "(", "self", "::", "$", "mode", "!==", "self", "::", "MODE_DISABLED", ")", "{", "self", "::", "$", "mode", "=", "self", "::", "MODE_DISABLED", ";", "if", "(", "self", "::", "$", "extension", "===", "self", "::", "EXTENSION_XHPROF", ")", "{", "xhprof_disable", "(", ")", ";", "}", "else", "if", "(", "self", "::", "$", "extension", "===", "self", "::", "EXTENSION_TIDEWAYS", ")", "{", "tideways_disable", "(", ")", ";", "}", "}", "}" ]
Ignore this transaction and don't collect profiling or performance measurements. @return void
[ "Ignore", "this", "transaction", "and", "don", "t", "collect", "profiling", "or", "performance", "measurements", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1056-L1067
train
tideways/profiler
Tideways.php
Profiler.getTransactionName
public static function getTransactionName() { if (self::$trace['tx'] === 'default' && self::$extension === self::EXTENSION_TIDEWAYS) { return tideways_transaction_name() ?: 'default'; } return self::$trace['tx']; }
php
public static function getTransactionName() { if (self::$trace['tx'] === 'default' && self::$extension === self::EXTENSION_TIDEWAYS) { return tideways_transaction_name() ?: 'default'; } return self::$trace['tx']; }
[ "public", "static", "function", "getTransactionName", "(", ")", "{", "if", "(", "self", "::", "$", "trace", "[", "'tx'", "]", "===", "'default'", "&&", "self", "::", "$", "extension", "===", "self", "::", "EXTENSION_TIDEWAYS", ")", "{", "return", "tideways_transaction_name", "(", ")", "?", ":", "'default'", ";", "}", "return", "self", "::", "$", "trace", "[", "'tx'", "]", ";", "}" ]
Returns the current transaction name. If you use automatic framework transaction detection, this is "default" until the engine detects the transaction name somewhere in the frameworks lifecycle. No guarantees given when this happens. @return string
[ "Returns", "the", "current", "transaction", "name", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1130-L1137
train
tideways/profiler
Tideways.php
Profiler.setCustomVariable
public static function setCustomVariable($name, $value) { if ((self::$mode & self::MODE_FULL) === 0 || !is_scalar($value)) { return; } if (!self::$currentRootSpan) { return; } self::$currentRootSpan->annotate(array($name => $value)); }
php
public static function setCustomVariable($name, $value) { if ((self::$mode & self::MODE_FULL) === 0 || !is_scalar($value)) { return; } if (!self::$currentRootSpan) { return; } self::$currentRootSpan->annotate(array($name => $value)); }
[ "public", "static", "function", "setCustomVariable", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "(", "self", "::", "$", "mode", "&", "self", "::", "MODE_FULL", ")", "===", "0", "||", "!", "is_scalar", "(", "$", "value", ")", ")", "{", "return", ";", "}", "if", "(", "!", "self", "::", "$", "currentRootSpan", ")", "{", "return", ";", "}", "self", "::", "$", "currentRootSpan", "->", "annotate", "(", "array", "(", "$", "name", "=>", "$", "value", ")", ")", ";", "}" ]
Add a custom variable to this profile. Examples are the Request URL, UserId, Correlation Ids and more. Please do *NOT* set private data in custom variables as this data is not encrypted on our servers. Only accepts scalar values. The key 'url' is a magic value and should contain the request url if you want to transmit it. The Profiler UI will specially display it. @param string $name @param scalar $value @return void
[ "Add", "a", "custom", "variable", "to", "this", "profile", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1207-L1218
train
tideways/profiler
Tideways.php
Profiler.watch
public static function watch($function, $category = null) { if (self::$extension === self::EXTENSION_TIDEWAYS) { self::$defaultOptions['watches'][$function] = $category; if ((self::$mode & self::MODE_TRACING) > 0) { tideways_span_watch($function, $category); } } }
php
public static function watch($function, $category = null) { if (self::$extension === self::EXTENSION_TIDEWAYS) { self::$defaultOptions['watches'][$function] = $category; if ((self::$mode & self::MODE_TRACING) > 0) { tideways_span_watch($function, $category); } } }
[ "public", "static", "function", "watch", "(", "$", "function", ",", "$", "category", "=", "null", ")", "{", "if", "(", "self", "::", "$", "extension", "===", "self", "::", "EXTENSION_TIDEWAYS", ")", "{", "self", "::", "$", "defaultOptions", "[", "'watches'", "]", "[", "$", "function", "]", "=", "$", "category", ";", "if", "(", "(", "self", "::", "$", "mode", "&", "self", "::", "MODE_TRACING", ")", ">", "0", ")", "{", "tideways_span_watch", "(", "$", "function", ",", "$", "category", ")", ";", "}", "}", "}" ]
Watch a function for calls and create timeline spans around it. @param string $function @param string $category
[ "Watch", "a", "function", "for", "calls", "and", "create", "timeline", "spans", "around", "it", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1226-L1235
train
tideways/profiler
Tideways.php
Profiler.watchCallback
public static function watchCallback($function, $callback) { if (self::$extension === self::EXTENSION_TIDEWAYS) { self::$defaultOptions['callbacks'][$function] = $callback; if ((self::$mode & self::MODE_TRACING) > 0) { tideways_span_callback($function, $callback); } } }
php
public static function watchCallback($function, $callback) { if (self::$extension === self::EXTENSION_TIDEWAYS) { self::$defaultOptions['callbacks'][$function] = $callback; if ((self::$mode & self::MODE_TRACING) > 0) { tideways_span_callback($function, $callback); } } }
[ "public", "static", "function", "watchCallback", "(", "$", "function", ",", "$", "callback", ")", "{", "if", "(", "self", "::", "$", "extension", "===", "self", "::", "EXTENSION_TIDEWAYS", ")", "{", "self", "::", "$", "defaultOptions", "[", "'callbacks'", "]", "[", "$", "function", "]", "=", "$", "callback", ";", "if", "(", "(", "self", "::", "$", "mode", "&", "self", "::", "MODE_TRACING", ")", ">", "0", ")", "{", "tideways_span_callback", "(", "$", "function", ",", "$", "callback", ")", ";", "}", "}", "}" ]
Watch a function and invoke a callback when its called. To start a span, call {@link \Tideways\Profiler::createSpan($category)} inside the callback and return {$span->getId()}: @example \Tideways\Profiler::watchCallback('mysql_query', function ($context) { $span = \Tideways\Profiler::createSpan('sql'); $span->annotate(array('title' => $context['args'][0])); return $span->getId(); });
[ "Watch", "a", "function", "and", "invoke", "a", "callback", "when", "its", "called", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1251-L1260
train
tideways/profiler
Tideways.php
Profiler.createSpan
public static function createSpan($name) { return (self::$mode & self::MODE_TRACING) > 0 ? self::$currentRootSpan->createSpan($name) : new \Tideways\Traces\NullSpan(); }
php
public static function createSpan($name) { return (self::$mode & self::MODE_TRACING) > 0 ? self::$currentRootSpan->createSpan($name) : new \Tideways\Traces\NullSpan(); }
[ "public", "static", "function", "createSpan", "(", "$", "name", ")", "{", "return", "(", "self", "::", "$", "mode", "&", "self", "::", "MODE_TRACING", ")", ">", "0", "?", "self", "::", "$", "currentRootSpan", "->", "createSpan", "(", "$", "name", ")", ":", "new", "\\", "Tideways", "\\", "Traces", "\\", "NullSpan", "(", ")", ";", "}" ]
Create a new trace span with the given category name. @example $span = \Tideways\Profiler::createSpan('sql'); @return \Tideways\Traces\Span
[ "Create", "a", "new", "trace", "span", "with", "the", "given", "category", "name", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1271-L1276
train
tideways/profiler
Tideways.php
Profiler.log
public static function log($level, $message) { if ($level <= self::$logLevel) { $level = ($level === 3) ? "debug" : (($level === 2) ? "info" : "warn"); error_log(sprintf('[%s] tideways - %s', $level, $message), 0); } }
php
public static function log($level, $message) { if ($level <= self::$logLevel) { $level = ($level === 3) ? "debug" : (($level === 2) ? "info" : "warn"); error_log(sprintf('[%s] tideways - %s', $level, $message), 0); } }
[ "public", "static", "function", "log", "(", "$", "level", ",", "$", "message", ")", "{", "if", "(", "$", "level", "<=", "self", "::", "$", "logLevel", ")", "{", "$", "level", "=", "(", "$", "level", "===", "3", ")", "?", "\"debug\"", ":", "(", "(", "$", "level", "===", "2", ")", "?", "\"info\"", ":", "\"warn\"", ")", ";", "error_log", "(", "sprintf", "(", "'[%s] tideways - %s'", ",", "$", "level", ",", "$", "message", ")", ",", "0", ")", ";", "}", "}" ]
Log a message to the PHP error log when the defined log-level is higher or equal to the messages log-level. @param int $level Logs message level. 1 = warning, 2 = notice, 3 = debug @param string $message @return void
[ "Log", "a", "message", "to", "the", "PHP", "error", "log", "when", "the", "defined", "log", "-", "level", "is", "higher", "or", "equal", "to", "the", "messages", "log", "-", "level", "." ]
b32311d31becbdcaf61a35b8f75e97db9c6285bb
https://github.com/tideways/profiler/blob/b32311d31becbdcaf61a35b8f75e97db9c6285bb/Tideways.php#L1516-L1522
train
scriptixru/sypexgeo
src/Scriptixru/SypexGeo/SypexGeo.php
Sypexgeo.getIP
public function getIP() { if(getenv('HTTP_CLIENT_IP')) $ip = getenv('HTTP_CLIENT_IP'); elseif(getenv('HTTP_X_FORWARDED_FOR')) $ip = getenv('HTTP_X_FORWARDED_FOR'); elseif(getenv('HTTP_X_FORWARDED')) $ip = getenv('HTTP_X_FORWARDED'); elseif(getenv('HTTP_FORWARDED_FOR')) $ip = getenv('HTTP_FORWARDED_FOR'); elseif(getenv('HTTP_FORWARDED')) $ip = getenv('HTTP_FORWARDED'); else $ip = getenv('REMOTE_ADDR'); $this->ip = $ip; $this->ipAsLong = sprintf('%u', ip2long($ip)); return $ip; }
php
public function getIP() { if(getenv('HTTP_CLIENT_IP')) $ip = getenv('HTTP_CLIENT_IP'); elseif(getenv('HTTP_X_FORWARDED_FOR')) $ip = getenv('HTTP_X_FORWARDED_FOR'); elseif(getenv('HTTP_X_FORWARDED')) $ip = getenv('HTTP_X_FORWARDED'); elseif(getenv('HTTP_FORWARDED_FOR')) $ip = getenv('HTTP_FORWARDED_FOR'); elseif(getenv('HTTP_FORWARDED')) $ip = getenv('HTTP_FORWARDED'); else $ip = getenv('REMOTE_ADDR'); $this->ip = $ip; $this->ipAsLong = sprintf('%u', ip2long($ip)); return $ip; }
[ "public", "function", "getIP", "(", ")", "{", "if", "(", "getenv", "(", "'HTTP_CLIENT_IP'", ")", ")", "$", "ip", "=", "getenv", "(", "'HTTP_CLIENT_IP'", ")", ";", "elseif", "(", "getenv", "(", "'HTTP_X_FORWARDED_FOR'", ")", ")", "$", "ip", "=", "getenv", "(", "'HTTP_X_FORWARDED_FOR'", ")", ";", "elseif", "(", "getenv", "(", "'HTTP_X_FORWARDED'", ")", ")", "$", "ip", "=", "getenv", "(", "'HTTP_X_FORWARDED'", ")", ";", "elseif", "(", "getenv", "(", "'HTTP_FORWARDED_FOR'", ")", ")", "$", "ip", "=", "getenv", "(", "'HTTP_FORWARDED_FOR'", ")", ";", "elseif", "(", "getenv", "(", "'HTTP_FORWARDED'", ")", ")", "$", "ip", "=", "getenv", "(", "'HTTP_FORWARDED'", ")", ";", "else", "$", "ip", "=", "getenv", "(", "'REMOTE_ADDR'", ")", ";", "$", "this", "->", "ip", "=", "$", "ip", ";", "$", "this", "->", "ipAsLong", "=", "sprintf", "(", "'%u'", ",", "ip2long", "(", "$", "ip", ")", ")", ";", "return", "$", "ip", ";", "}" ]
Detect client IP address @return string IP
[ "Detect", "client", "IP", "address" ]
2c34009a44c4f61b1af5906f0892c40bb475cc0a
https://github.com/scriptixru/sypexgeo/blob/2c34009a44c4f61b1af5906f0892c40bb475cc0a/src/Scriptixru/SypexGeo/SypexGeo.php#L116-L134
train
laravel-doctrine/acl
src/Mappings/Subscribers/MappedEventSubscriber.php
MappedEventSubscriber.isInstantiable
protected function isInstantiable(ClassMetadata $metadata) { if ($metadata->isMappedSuperclass) { return false; } if (!$metadata->getReflectionClass() || $metadata->getReflectionClass()->isAbstract()) { return false; } return true; }
php
protected function isInstantiable(ClassMetadata $metadata) { if ($metadata->isMappedSuperclass) { return false; } if (!$metadata->getReflectionClass() || $metadata->getReflectionClass()->isAbstract()) { return false; } return true; }
[ "protected", "function", "isInstantiable", "(", "ClassMetadata", "$", "metadata", ")", "{", "if", "(", "$", "metadata", "->", "isMappedSuperclass", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "metadata", "->", "getReflectionClass", "(", ")", "||", "$", "metadata", "->", "getReflectionClass", "(", ")", "->", "isAbstract", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
A MappedSuperClass or Abstract class cannot be instantiated. @param ClassMetadata $metadata @return bool
[ "A", "MappedSuperClass", "or", "Abstract", "class", "cannot", "be", "instantiated", "." ]
b0033a2650e336979f28d4fea6df38c3d698ced8
https://github.com/laravel-doctrine/acl/blob/b0033a2650e336979f28d4fea6df38c3d698ced8/src/Mappings/Subscribers/MappedEventSubscriber.php#L118-L129
train
silverstripe/silverstripe-restfulserver
src/BasicRestfulAuthenticator.php
BasicRestfulAuthenticator.authenticate
public static function authenticate() { //if there is no username or password, fail if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { return null; } // With a valid user and password, check the password is correct $data = [ 'Email' => $_SERVER['PHP_AUTH_USER'], 'Password' => $_SERVER['PHP_AUTH_PW'], ]; $request = Controller::curr()->getRequest(); $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::LOGIN); $member = null; foreach ($authenticators as $authenticator) { $member = $authenticator->authenticate($data, $request); if ($member) { break; } } return $member; }
php
public static function authenticate() { //if there is no username or password, fail if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { return null; } // With a valid user and password, check the password is correct $data = [ 'Email' => $_SERVER['PHP_AUTH_USER'], 'Password' => $_SERVER['PHP_AUTH_PW'], ]; $request = Controller::curr()->getRequest(); $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::LOGIN); $member = null; foreach ($authenticators as $authenticator) { $member = $authenticator->authenticate($data, $request); if ($member) { break; } } return $member; }
[ "public", "static", "function", "authenticate", "(", ")", "{", "//if there is no username or password, fail", "if", "(", "!", "isset", "(", "$", "_SERVER", "[", "'PHP_AUTH_USER'", "]", ")", "||", "!", "isset", "(", "$", "_SERVER", "[", "'PHP_AUTH_PW'", "]", ")", ")", "{", "return", "null", ";", "}", "// With a valid user and password, check the password is correct", "$", "data", "=", "[", "'Email'", "=>", "$", "_SERVER", "[", "'PHP_AUTH_USER'", "]", ",", "'Password'", "=>", "$", "_SERVER", "[", "'PHP_AUTH_PW'", "]", ",", "]", ";", "$", "request", "=", "Controller", "::", "curr", "(", ")", "->", "getRequest", "(", ")", ";", "$", "authenticators", "=", "Security", "::", "singleton", "(", ")", "->", "getApplicableAuthenticators", "(", "Authenticator", "::", "LOGIN", ")", ";", "$", "member", "=", "null", ";", "foreach", "(", "$", "authenticators", "as", "$", "authenticator", ")", "{", "$", "member", "=", "$", "authenticator", "->", "authenticate", "(", "$", "data", ",", "$", "request", ")", ";", "if", "(", "$", "member", ")", "{", "break", ";", "}", "}", "return", "$", "member", ";", "}" ]
The authenticate function Takes the basic auth details and attempts to log a user in from the DB @return Member|false The Member object, or false if no member
[ "The", "authenticate", "function" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/BasicRestfulAuthenticator.php#L26-L48
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.for_extension
public static function for_extension($extension) { $classes = ClassInfo::subclassesFor(DataFormatter::class); array_shift($classes); $sortedClasses = []; foreach ($classes as $class) { $sortedClasses[$class] = Config::inst()->get($class, 'priority'); } arsort($sortedClasses); foreach ($sortedClasses as $className => $priority) { $formatter = new $className(); if (in_array($extension, $formatter->supportedExtensions())) { return $formatter; } } }
php
public static function for_extension($extension) { $classes = ClassInfo::subclassesFor(DataFormatter::class); array_shift($classes); $sortedClasses = []; foreach ($classes as $class) { $sortedClasses[$class] = Config::inst()->get($class, 'priority'); } arsort($sortedClasses); foreach ($sortedClasses as $className => $priority) { $formatter = new $className(); if (in_array($extension, $formatter->supportedExtensions())) { return $formatter; } } }
[ "public", "static", "function", "for_extension", "(", "$", "extension", ")", "{", "$", "classes", "=", "ClassInfo", "::", "subclassesFor", "(", "DataFormatter", "::", "class", ")", ";", "array_shift", "(", "$", "classes", ")", ";", "$", "sortedClasses", "=", "[", "]", ";", "foreach", "(", "$", "classes", "as", "$", "class", ")", "{", "$", "sortedClasses", "[", "$", "class", "]", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "$", "class", ",", "'priority'", ")", ";", "}", "arsort", "(", "$", "sortedClasses", ")", ";", "foreach", "(", "$", "sortedClasses", "as", "$", "className", "=>", "$", "priority", ")", "{", "$", "formatter", "=", "new", "$", "className", "(", ")", ";", "if", "(", "in_array", "(", "$", "extension", ",", "$", "formatter", "->", "supportedExtensions", "(", ")", ")", ")", "{", "return", "$", "formatter", ";", "}", "}", "}" ]
Get a DataFormatter object suitable for handling the given file extension. @param string $extension @return DataFormatter
[ "Get", "a", "DataFormatter", "object", "suitable", "for", "handling", "the", "given", "file", "extension", "." ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L115-L130
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.for_extensions
public static function for_extensions($extensions) { foreach ($extensions as $extension) { if ($formatter = self::for_extension($extension)) { return $formatter; } } return false; }
php
public static function for_extensions($extensions) { foreach ($extensions as $extension) { if ($formatter = self::for_extension($extension)) { return $formatter; } } return false; }
[ "public", "static", "function", "for_extensions", "(", "$", "extensions", ")", "{", "foreach", "(", "$", "extensions", "as", "$", "extension", ")", "{", "if", "(", "$", "formatter", "=", "self", "::", "for_extension", "(", "$", "extension", ")", ")", "{", "return", "$", "formatter", ";", "}", "}", "return", "false", ";", "}" ]
Get formatter for the first matching extension. @param array $extensions @return DataFormatter
[ "Get", "formatter", "for", "the", "first", "matching", "extension", "." ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L138-L147
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.for_mimetype
public static function for_mimetype($mimeType) { $classes = ClassInfo::subclassesFor(DataFormatter::class); array_shift($classes); $sortedClasses = []; foreach ($classes as $class) { $sortedClasses[$class] = Config::inst()->get($class, 'priority'); } arsort($sortedClasses); foreach ($sortedClasses as $className => $priority) { $formatter = new $className(); if (in_array($mimeType, $formatter->supportedMimeTypes())) { return $formatter; } } }
php
public static function for_mimetype($mimeType) { $classes = ClassInfo::subclassesFor(DataFormatter::class); array_shift($classes); $sortedClasses = []; foreach ($classes as $class) { $sortedClasses[$class] = Config::inst()->get($class, 'priority'); } arsort($sortedClasses); foreach ($sortedClasses as $className => $priority) { $formatter = new $className(); if (in_array($mimeType, $formatter->supportedMimeTypes())) { return $formatter; } } }
[ "public", "static", "function", "for_mimetype", "(", "$", "mimeType", ")", "{", "$", "classes", "=", "ClassInfo", "::", "subclassesFor", "(", "DataFormatter", "::", "class", ")", ";", "array_shift", "(", "$", "classes", ")", ";", "$", "sortedClasses", "=", "[", "]", ";", "foreach", "(", "$", "classes", "as", "$", "class", ")", "{", "$", "sortedClasses", "[", "$", "class", "]", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "$", "class", ",", "'priority'", ")", ";", "}", "arsort", "(", "$", "sortedClasses", ")", ";", "foreach", "(", "$", "sortedClasses", "as", "$", "className", "=>", "$", "priority", ")", "{", "$", "formatter", "=", "new", "$", "className", "(", ")", ";", "if", "(", "in_array", "(", "$", "mimeType", ",", "$", "formatter", "->", "supportedMimeTypes", "(", ")", ")", ")", "{", "return", "$", "formatter", ";", "}", "}", "}" ]
Get a DataFormatter object suitable for handling the given mimetype. @param string $mimeType @return DataFormatter
[ "Get", "a", "DataFormatter", "object", "suitable", "for", "handling", "the", "given", "mimetype", "." ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L155-L170
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.for_mimetypes
public static function for_mimetypes($mimetypes) { foreach ($mimetypes as $mimetype) { if ($formatter = self::for_mimetype($mimetype)) { return $formatter; } } return false; }
php
public static function for_mimetypes($mimetypes) { foreach ($mimetypes as $mimetype) { if ($formatter = self::for_mimetype($mimetype)) { return $formatter; } } return false; }
[ "public", "static", "function", "for_mimetypes", "(", "$", "mimetypes", ")", "{", "foreach", "(", "$", "mimetypes", "as", "$", "mimetype", ")", "{", "if", "(", "$", "formatter", "=", "self", "::", "for_mimetype", "(", "$", "mimetype", ")", ")", "{", "return", "$", "formatter", ";", "}", "}", "return", "false", ";", "}" ]
Get formatter for the first matching mimetype. Useful for HTTP Accept headers which can contain multiple comma-separated mimetypes. @param array $mimetypes @return DataFormatter
[ "Get", "formatter", "for", "the", "first", "matching", "mimetype", ".", "Useful", "for", "HTTP", "Accept", "headers", "which", "can", "contain", "multiple", "comma", "-", "separated", "mimetypes", "." ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L180-L189
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.getRealFields
public function getRealFields($className, $fields) { $apiMapping = $this->getApiMapping($className); if (is_array($apiMapping) && is_array($fields)) { $mappedFields = []; foreach ($fields as $field) { $mappedFields[] = $this->getMappedKey($apiMapping, $field); } return $mappedFields; } return $fields; }
php
public function getRealFields($className, $fields) { $apiMapping = $this->getApiMapping($className); if (is_array($apiMapping) && is_array($fields)) { $mappedFields = []; foreach ($fields as $field) { $mappedFields[] = $this->getMappedKey($apiMapping, $field); } return $mappedFields; } return $fields; }
[ "public", "function", "getRealFields", "(", "$", "className", ",", "$", "fields", ")", "{", "$", "apiMapping", "=", "$", "this", "->", "getApiMapping", "(", "$", "className", ")", ";", "if", "(", "is_array", "(", "$", "apiMapping", ")", "&&", "is_array", "(", "$", "fields", ")", ")", "{", "$", "mappedFields", "=", "[", "]", ";", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "$", "mappedFields", "[", "]", "=", "$", "this", "->", "getMappedKey", "(", "$", "apiMapping", ",", "$", "field", ")", ";", "}", "return", "$", "mappedFields", ";", "}", "return", "$", "fields", ";", "}" ]
Convert an array of aliased field names to their Dataobject field name @param string $className @param string[] $fields @return string[]
[ "Convert", "an", "array", "of", "aliased", "field", "names", "to", "their", "Dataobject", "field", "name" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L384-L395
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.getRealFieldName
public function getRealFieldName($className, $field) { $apiMapping = $this->getApiMapping($className); return $this->getMappedKey($apiMapping, $field); }
php
public function getRealFieldName($className, $field) { $apiMapping = $this->getApiMapping($className); return $this->getMappedKey($apiMapping, $field); }
[ "public", "function", "getRealFieldName", "(", "$", "className", ",", "$", "field", ")", "{", "$", "apiMapping", "=", "$", "this", "->", "getApiMapping", "(", "$", "className", ")", ";", "return", "$", "this", "->", "getMappedKey", "(", "$", "apiMapping", ",", "$", "field", ")", ";", "}" ]
Get the DataObject field name from its alias @param string $className @param string $field @return string
[ "Get", "the", "DataObject", "field", "name", "from", "its", "alias" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L404-L408
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.getFieldAlias
public function getFieldAlias($className, $field) { $apiMapping = $this->getApiMapping($className); $apiMapping = array_flip($apiMapping); return $this->getMappedKey($apiMapping, $field); }
php
public function getFieldAlias($className, $field) { $apiMapping = $this->getApiMapping($className); $apiMapping = array_flip($apiMapping); return $this->getMappedKey($apiMapping, $field); }
[ "public", "function", "getFieldAlias", "(", "$", "className", ",", "$", "field", ")", "{", "$", "apiMapping", "=", "$", "this", "->", "getApiMapping", "(", "$", "className", ")", ";", "$", "apiMapping", "=", "array_flip", "(", "$", "apiMapping", ")", ";", "return", "$", "this", "->", "getMappedKey", "(", "$", "apiMapping", ",", "$", "field", ")", ";", "}" ]
Get a DataObject Field's Alias defaults to the fieldname @param string $className @param string $field @return string
[ "Get", "a", "DataObject", "Field", "s", "Alias", "defaults", "to", "the", "fieldname" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L418-L423
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.getApiMapping
protected function getApiMapping($className) { $apiMapping = Config::inst()->get($className, 'api_field_mapping'); if ($apiMapping && is_array($apiMapping)) { return $apiMapping; } return []; }
php
protected function getApiMapping($className) { $apiMapping = Config::inst()->get($className, 'api_field_mapping'); if ($apiMapping && is_array($apiMapping)) { return $apiMapping; } return []; }
[ "protected", "function", "getApiMapping", "(", "$", "className", ")", "{", "$", "apiMapping", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "$", "className", ",", "'api_field_mapping'", ")", ";", "if", "(", "$", "apiMapping", "&&", "is_array", "(", "$", "apiMapping", ")", ")", "{", "return", "$", "apiMapping", ";", "}", "return", "[", "]", ";", "}" ]
Get the 'api_field_mapping' config value for a class or return an empty array @param string $className @return string[]|array
[ "Get", "the", "api_field_mapping", "config", "value", "for", "a", "class", "or", "return", "an", "empty", "array" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L432-L439
train
silverstripe/silverstripe-restfulserver
src/DataFormatter.php
DataFormatter.getMappedKey
protected function getMappedKey($map, $key) { if (is_array($map)) { if (array_key_exists($key, $map)) { return $map[$key]; } else { return $key; } } return $key; }
php
protected function getMappedKey($map, $key) { if (is_array($map)) { if (array_key_exists($key, $map)) { return $map[$key]; } else { return $key; } } return $key; }
[ "protected", "function", "getMappedKey", "(", "$", "map", ",", "$", "key", ")", "{", "if", "(", "is_array", "(", "$", "map", ")", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "map", ")", ")", "{", "return", "$", "map", "[", "$", "key", "]", ";", "}", "else", "{", "return", "$", "key", ";", "}", "}", "return", "$", "key", ";", "}" ]
Helper function to get mapped field names @param array $map @param string $key @return string
[ "Helper", "function", "to", "get", "mapped", "field", "names" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/DataFormatter.php#L448-L458
train
silverstripe/silverstripe-restfulserver
src/RestfulServer.php
RestfulServer.getHandler
protected function getHandler($className, $id, $relationName) { $sort = ''; if ($this->request->getVar('sort')) { $dir = $this->request->getVar('dir'); $sort = array($this->request->getVar('sort') => ($dir ? $dir : 'ASC')); } $limit = array( 'start' => $this->request->getVar('start'), 'limit' => $this->request->getVar('limit') ); $params = $this->request->getVars(); $responseFormatter = $this->getResponseDataFormatter($className); if (!$responseFormatter) { return $this->unsupportedMediaType(); } // $obj can be either a DataObject or a SS_List, // depending on the request if ($id) { // Format: /api/v1/<MyClass>/<ID> $obj = $this->getObjectQuery($className, $id, $params)->First(); if (!$obj) { return $this->notFound(); } if (!$obj->canView($this->getMember())) { return $this->permissionFailure(); } // Format: /api/v1/<MyClass>/<ID>/<Relation> if ($relationName) { $obj = $this->getObjectRelationQuery($obj, $params, $sort, $limit, $relationName); if (!$obj) { return $this->notFound(); } // TODO Avoid creating data formatter again for relation class (see above) $responseFormatter = $this->getResponseDataFormatter($obj->dataClass()); } } else { // Format: /api/v1/<MyClass> $obj = $this->getObjectsQuery($className, $params, $sort, $limit); } $this->getResponse()->addHeader('Content-Type', $responseFormatter->getOutputContentType()); $rawFields = $this->request->getVar('fields'); $realFields = $responseFormatter->getRealFields($className, explode(',', $rawFields)); $fields = $rawFields ? $realFields : null; if ($obj instanceof SS_List) { $objs = ArrayList::create($obj->toArray()); foreach ($objs as $obj) { if (!$obj->canView($this->getMember())) { $objs->remove($obj); } } $responseFormatter->setTotalSize($objs->count()); return $responseFormatter->convertDataObjectSet($objs, $fields); } if (!$obj) { $responseFormatter->setTotalSize(0); return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields); } return $responseFormatter->convertDataObject($obj, $fields); }
php
protected function getHandler($className, $id, $relationName) { $sort = ''; if ($this->request->getVar('sort')) { $dir = $this->request->getVar('dir'); $sort = array($this->request->getVar('sort') => ($dir ? $dir : 'ASC')); } $limit = array( 'start' => $this->request->getVar('start'), 'limit' => $this->request->getVar('limit') ); $params = $this->request->getVars(); $responseFormatter = $this->getResponseDataFormatter($className); if (!$responseFormatter) { return $this->unsupportedMediaType(); } // $obj can be either a DataObject or a SS_List, // depending on the request if ($id) { // Format: /api/v1/<MyClass>/<ID> $obj = $this->getObjectQuery($className, $id, $params)->First(); if (!$obj) { return $this->notFound(); } if (!$obj->canView($this->getMember())) { return $this->permissionFailure(); } // Format: /api/v1/<MyClass>/<ID>/<Relation> if ($relationName) { $obj = $this->getObjectRelationQuery($obj, $params, $sort, $limit, $relationName); if (!$obj) { return $this->notFound(); } // TODO Avoid creating data formatter again for relation class (see above) $responseFormatter = $this->getResponseDataFormatter($obj->dataClass()); } } else { // Format: /api/v1/<MyClass> $obj = $this->getObjectsQuery($className, $params, $sort, $limit); } $this->getResponse()->addHeader('Content-Type', $responseFormatter->getOutputContentType()); $rawFields = $this->request->getVar('fields'); $realFields = $responseFormatter->getRealFields($className, explode(',', $rawFields)); $fields = $rawFields ? $realFields : null; if ($obj instanceof SS_List) { $objs = ArrayList::create($obj->toArray()); foreach ($objs as $obj) { if (!$obj->canView($this->getMember())) { $objs->remove($obj); } } $responseFormatter->setTotalSize($objs->count()); return $responseFormatter->convertDataObjectSet($objs, $fields); } if (!$obj) { $responseFormatter->setTotalSize(0); return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields); } return $responseFormatter->convertDataObject($obj, $fields); }
[ "protected", "function", "getHandler", "(", "$", "className", ",", "$", "id", ",", "$", "relationName", ")", "{", "$", "sort", "=", "''", ";", "if", "(", "$", "this", "->", "request", "->", "getVar", "(", "'sort'", ")", ")", "{", "$", "dir", "=", "$", "this", "->", "request", "->", "getVar", "(", "'dir'", ")", ";", "$", "sort", "=", "array", "(", "$", "this", "->", "request", "->", "getVar", "(", "'sort'", ")", "=>", "(", "$", "dir", "?", "$", "dir", ":", "'ASC'", ")", ")", ";", "}", "$", "limit", "=", "array", "(", "'start'", "=>", "$", "this", "->", "request", "->", "getVar", "(", "'start'", ")", ",", "'limit'", "=>", "$", "this", "->", "request", "->", "getVar", "(", "'limit'", ")", ")", ";", "$", "params", "=", "$", "this", "->", "request", "->", "getVars", "(", ")", ";", "$", "responseFormatter", "=", "$", "this", "->", "getResponseDataFormatter", "(", "$", "className", ")", ";", "if", "(", "!", "$", "responseFormatter", ")", "{", "return", "$", "this", "->", "unsupportedMediaType", "(", ")", ";", "}", "// $obj can be either a DataObject or a SS_List,", "// depending on the request", "if", "(", "$", "id", ")", "{", "// Format: /api/v1/<MyClass>/<ID>", "$", "obj", "=", "$", "this", "->", "getObjectQuery", "(", "$", "className", ",", "$", "id", ",", "$", "params", ")", "->", "First", "(", ")", ";", "if", "(", "!", "$", "obj", ")", "{", "return", "$", "this", "->", "notFound", "(", ")", ";", "}", "if", "(", "!", "$", "obj", "->", "canView", "(", "$", "this", "->", "getMember", "(", ")", ")", ")", "{", "return", "$", "this", "->", "permissionFailure", "(", ")", ";", "}", "// Format: /api/v1/<MyClass>/<ID>/<Relation>", "if", "(", "$", "relationName", ")", "{", "$", "obj", "=", "$", "this", "->", "getObjectRelationQuery", "(", "$", "obj", ",", "$", "params", ",", "$", "sort", ",", "$", "limit", ",", "$", "relationName", ")", ";", "if", "(", "!", "$", "obj", ")", "{", "return", "$", "this", "->", "notFound", "(", ")", ";", "}", "// TODO Avoid creating data formatter again for relation class (see above)", "$", "responseFormatter", "=", "$", "this", "->", "getResponseDataFormatter", "(", "$", "obj", "->", "dataClass", "(", ")", ")", ";", "}", "}", "else", "{", "// Format: /api/v1/<MyClass>", "$", "obj", "=", "$", "this", "->", "getObjectsQuery", "(", "$", "className", ",", "$", "params", ",", "$", "sort", ",", "$", "limit", ")", ";", "}", "$", "this", "->", "getResponse", "(", ")", "->", "addHeader", "(", "'Content-Type'", ",", "$", "responseFormatter", "->", "getOutputContentType", "(", ")", ")", ";", "$", "rawFields", "=", "$", "this", "->", "request", "->", "getVar", "(", "'fields'", ")", ";", "$", "realFields", "=", "$", "responseFormatter", "->", "getRealFields", "(", "$", "className", ",", "explode", "(", "','", ",", "$", "rawFields", ")", ")", ";", "$", "fields", "=", "$", "rawFields", "?", "$", "realFields", ":", "null", ";", "if", "(", "$", "obj", "instanceof", "SS_List", ")", "{", "$", "objs", "=", "ArrayList", "::", "create", "(", "$", "obj", "->", "toArray", "(", ")", ")", ";", "foreach", "(", "$", "objs", "as", "$", "obj", ")", "{", "if", "(", "!", "$", "obj", "->", "canView", "(", "$", "this", "->", "getMember", "(", ")", ")", ")", "{", "$", "objs", "->", "remove", "(", "$", "obj", ")", ";", "}", "}", "$", "responseFormatter", "->", "setTotalSize", "(", "$", "objs", "->", "count", "(", ")", ")", ";", "return", "$", "responseFormatter", "->", "convertDataObjectSet", "(", "$", "objs", ",", "$", "fields", ")", ";", "}", "if", "(", "!", "$", "obj", ")", "{", "$", "responseFormatter", "->", "setTotalSize", "(", "0", ")", ";", "return", "$", "responseFormatter", "->", "convertDataObjectSet", "(", "new", "ArrayList", "(", ")", ",", "$", "fields", ")", ";", "}", "return", "$", "responseFormatter", "->", "convertDataObject", "(", "$", "obj", ",", "$", "fields", ")", ";", "}" ]
Handler for object read. The data object will be returned in the following format: <ClassName> <FieldName>Value</FieldName> ... <HasOneRelName id="ForeignID" href="LinkToForeignRecordInAPI" /> ... <HasManyRelName> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> </HasManyRelName> ... <ManyManyRelName> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> </ManyManyRelName> </ClassName> Access is controlled by two variables: - static $api_access must be set. This enables the API on a class by class basis - $obj->canView() must return true. This lets you implement record-level security @todo Access checking @param string $className @param Int $id @param string $relation @return string The serialized representation of the requested object(s) - usually XML or JSON.
[ "Handler", "for", "object", "read", "." ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/RestfulServer.php#L260-L331
train
silverstripe/silverstripe-restfulserver
src/RestfulServer.php
RestfulServer.deleteHandler
protected function deleteHandler($className, $id) { $obj = DataObject::get_by_id($className, $id); if (!$obj) { return $this->notFound(); } if (!$obj->canDelete($this->getMember())) { return $this->permissionFailure(); } $obj->delete(); $this->getResponse()->setStatusCode(204); // No Content return true; }
php
protected function deleteHandler($className, $id) { $obj = DataObject::get_by_id($className, $id); if (!$obj) { return $this->notFound(); } if (!$obj->canDelete($this->getMember())) { return $this->permissionFailure(); } $obj->delete(); $this->getResponse()->setStatusCode(204); // No Content return true; }
[ "protected", "function", "deleteHandler", "(", "$", "className", ",", "$", "id", ")", "{", "$", "obj", "=", "DataObject", "::", "get_by_id", "(", "$", "className", ",", "$", "id", ")", ";", "if", "(", "!", "$", "obj", ")", "{", "return", "$", "this", "->", "notFound", "(", ")", ";", "}", "if", "(", "!", "$", "obj", "->", "canDelete", "(", "$", "this", "->", "getMember", "(", ")", ")", ")", "{", "return", "$", "this", "->", "permissionFailure", "(", ")", ";", "}", "$", "obj", "->", "delete", "(", ")", ";", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "204", ")", ";", "// No Content", "return", "true", ";", "}" ]
Handler for object delete
[ "Handler", "for", "object", "delete" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/RestfulServer.php#L460-L474
train
silverstripe/silverstripe-restfulserver
src/RestfulServer.php
RestfulServer.putHandler
protected function putHandler($className, $id) { $obj = DataObject::get_by_id($className, $id); if (!$obj) { return $this->notFound(); } if (!$obj->canEdit($this->getMember())) { return $this->permissionFailure(); } $reqFormatter = $this->getRequestDataFormatter($className); if (!$reqFormatter) { return $this->unsupportedMediaType(); } $responseFormatter = $this->getResponseDataFormatter($className); if (!$responseFormatter) { return $this->unsupportedMediaType(); } try { /** @var DataObject|string */ $obj = $this->updateDataObject($obj, $reqFormatter); } catch (ValidationException $e) { return $this->validationFailure($responseFormatter, $e->getResult()); } if (is_string($obj)) { return $obj; } $this->getResponse()->setStatusCode(202); // Accepted $this->getResponse()->addHeader('Content-Type', $responseFormatter->getOutputContentType()); // Append the default extension for the output format to the Location header // or else we'll use the default (XML) $types = $responseFormatter->supportedExtensions(); $type = ''; if (count($types)) { $type = ".{$types[0]}"; } $urlSafeClassName = $this->sanitiseClassName(get_class($obj)); $apiBase = $this->config()->api_base; $objHref = Director::absoluteURL($apiBase . "$urlSafeClassName/$obj->ID" . $type); $this->getResponse()->addHeader('Location', $objHref); return $responseFormatter->convertDataObject($obj); }
php
protected function putHandler($className, $id) { $obj = DataObject::get_by_id($className, $id); if (!$obj) { return $this->notFound(); } if (!$obj->canEdit($this->getMember())) { return $this->permissionFailure(); } $reqFormatter = $this->getRequestDataFormatter($className); if (!$reqFormatter) { return $this->unsupportedMediaType(); } $responseFormatter = $this->getResponseDataFormatter($className); if (!$responseFormatter) { return $this->unsupportedMediaType(); } try { /** @var DataObject|string */ $obj = $this->updateDataObject($obj, $reqFormatter); } catch (ValidationException $e) { return $this->validationFailure($responseFormatter, $e->getResult()); } if (is_string($obj)) { return $obj; } $this->getResponse()->setStatusCode(202); // Accepted $this->getResponse()->addHeader('Content-Type', $responseFormatter->getOutputContentType()); // Append the default extension for the output format to the Location header // or else we'll use the default (XML) $types = $responseFormatter->supportedExtensions(); $type = ''; if (count($types)) { $type = ".{$types[0]}"; } $urlSafeClassName = $this->sanitiseClassName(get_class($obj)); $apiBase = $this->config()->api_base; $objHref = Director::absoluteURL($apiBase . "$urlSafeClassName/$obj->ID" . $type); $this->getResponse()->addHeader('Location', $objHref); return $responseFormatter->convertDataObject($obj); }
[ "protected", "function", "putHandler", "(", "$", "className", ",", "$", "id", ")", "{", "$", "obj", "=", "DataObject", "::", "get_by_id", "(", "$", "className", ",", "$", "id", ")", ";", "if", "(", "!", "$", "obj", ")", "{", "return", "$", "this", "->", "notFound", "(", ")", ";", "}", "if", "(", "!", "$", "obj", "->", "canEdit", "(", "$", "this", "->", "getMember", "(", ")", ")", ")", "{", "return", "$", "this", "->", "permissionFailure", "(", ")", ";", "}", "$", "reqFormatter", "=", "$", "this", "->", "getRequestDataFormatter", "(", "$", "className", ")", ";", "if", "(", "!", "$", "reqFormatter", ")", "{", "return", "$", "this", "->", "unsupportedMediaType", "(", ")", ";", "}", "$", "responseFormatter", "=", "$", "this", "->", "getResponseDataFormatter", "(", "$", "className", ")", ";", "if", "(", "!", "$", "responseFormatter", ")", "{", "return", "$", "this", "->", "unsupportedMediaType", "(", ")", ";", "}", "try", "{", "/** @var DataObject|string */", "$", "obj", "=", "$", "this", "->", "updateDataObject", "(", "$", "obj", ",", "$", "reqFormatter", ")", ";", "}", "catch", "(", "ValidationException", "$", "e", ")", "{", "return", "$", "this", "->", "validationFailure", "(", "$", "responseFormatter", ",", "$", "e", "->", "getResult", "(", ")", ")", ";", "}", "if", "(", "is_string", "(", "$", "obj", ")", ")", "{", "return", "$", "obj", ";", "}", "$", "this", "->", "getResponse", "(", ")", "->", "setStatusCode", "(", "202", ")", ";", "// Accepted", "$", "this", "->", "getResponse", "(", ")", "->", "addHeader", "(", "'Content-Type'", ",", "$", "responseFormatter", "->", "getOutputContentType", "(", ")", ")", ";", "// Append the default extension for the output format to the Location header", "// or else we'll use the default (XML)", "$", "types", "=", "$", "responseFormatter", "->", "supportedExtensions", "(", ")", ";", "$", "type", "=", "''", ";", "if", "(", "count", "(", "$", "types", ")", ")", "{", "$", "type", "=", "\".{$types[0]}\"", ";", "}", "$", "urlSafeClassName", "=", "$", "this", "->", "sanitiseClassName", "(", "get_class", "(", "$", "obj", ")", ")", ";", "$", "apiBase", "=", "$", "this", "->", "config", "(", ")", "->", "api_base", ";", "$", "objHref", "=", "Director", "::", "absoluteURL", "(", "$", "apiBase", ".", "\"$urlSafeClassName/$obj->ID\"", ".", "$", "type", ")", ";", "$", "this", "->", "getResponse", "(", ")", "->", "addHeader", "(", "'Location'", ",", "$", "objHref", ")", ";", "return", "$", "responseFormatter", "->", "convertDataObject", "(", "$", "obj", ")", ";", "}" ]
Handler for object write
[ "Handler", "for", "object", "write" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/RestfulServer.php#L479-L528
train
silverstripe/silverstripe-restfulserver
src/RestfulServer.php
RestfulServer.authenticate
protected function authenticate() { $authClass = $this->config()->authenticator; $member = $authClass::authenticate(); Security::setCurrentUser($member); return $member; }
php
protected function authenticate() { $authClass = $this->config()->authenticator; $member = $authClass::authenticate(); Security::setCurrentUser($member); return $member; }
[ "protected", "function", "authenticate", "(", ")", "{", "$", "authClass", "=", "$", "this", "->", "config", "(", ")", "->", "authenticator", ";", "$", "member", "=", "$", "authClass", "::", "authenticate", "(", ")", ";", "Security", "::", "setCurrentUser", "(", "$", "member", ")", ";", "return", "$", "member", ";", "}" ]
A function to authenticate a user @return Member|false the logged in member
[ "A", "function", "to", "authenticate", "a", "user" ]
080ce4015be2378e5bd821adec01c0792eb71df1
https://github.com/silverstripe/silverstripe-restfulserver/blob/080ce4015be2378e5bd821adec01c0792eb71df1/src/RestfulServer.php#L833-L839
train
silverstripe/cwp-pdfexport
src/Extensions/PdfExportControllerExtension.php
PdfExportControllerExtension.downloadpdf
public function downloadpdf() { if (!$this->owner->data()->config()->get('pdf_export')) { return false; } // We only allow producing live pdf. There is no way to secure the draft files. Versioned::set_stage(Versioned::LIVE); $path = $this->owner->data()->getPdfFilename(); if (!file_exists($path)) { $this->owner->generatePDF(); } return HTTPRequest::send_file(file_get_contents($path), basename($path), 'application/pdf'); }
php
public function downloadpdf() { if (!$this->owner->data()->config()->get('pdf_export')) { return false; } // We only allow producing live pdf. There is no way to secure the draft files. Versioned::set_stage(Versioned::LIVE); $path = $this->owner->data()->getPdfFilename(); if (!file_exists($path)) { $this->owner->generatePDF(); } return HTTPRequest::send_file(file_get_contents($path), basename($path), 'application/pdf'); }
[ "public", "function", "downloadpdf", "(", ")", "{", "if", "(", "!", "$", "this", "->", "owner", "->", "data", "(", ")", "->", "config", "(", ")", "->", "get", "(", "'pdf_export'", ")", ")", "{", "return", "false", ";", "}", "// We only allow producing live pdf. There is no way to secure the draft files.", "Versioned", "::", "set_stage", "(", "Versioned", "::", "LIVE", ")", ";", "$", "path", "=", "$", "this", "->", "owner", "->", "data", "(", ")", "->", "getPdfFilename", "(", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "$", "this", "->", "owner", "->", "generatePDF", "(", ")", ";", "}", "return", "HTTPRequest", "::", "send_file", "(", "file_get_contents", "(", "$", "path", ")", ",", "basename", "(", "$", "path", ")", ",", "'application/pdf'", ")", ";", "}" ]
Serve the page rendered as PDF. @return HTTPResponse|false
[ "Serve", "the", "page", "rendered", "as", "PDF", "." ]
da064d167ef3206bdfb511089ba3059bf86c063c
https://github.com/silverstripe/cwp-pdfexport/blob/da064d167ef3206bdfb511089ba3059bf86c063c/src/Extensions/PdfExportControllerExtension.php#L26-L41
train
silverstripe/cwp-pdfexport
src/Extensions/PdfExportControllerExtension.php
PdfExportControllerExtension.getPDFBaseURL
public function getPDFBaseURL() { // if base url YML is defined in YML, use that if ($this->owner->data()->config()->get('pdf_base_url')) { $pdfBaseUrl = $this->owner->data()->config()->get('pdf_base_url').'/'; // otherwise, if we are CWP use the secure domain } elseif (Environment::getEnv('CWP_SECURE_DOMAIN')) { $pdfBaseUrl = Environment::getEnv('CWP_SECURE_DOMAIN') . '/'; // or if neither, leave blank } else { $pdfBaseUrl = ''; } return $pdfBaseUrl; }
php
public function getPDFBaseURL() { // if base url YML is defined in YML, use that if ($this->owner->data()->config()->get('pdf_base_url')) { $pdfBaseUrl = $this->owner->data()->config()->get('pdf_base_url').'/'; // otherwise, if we are CWP use the secure domain } elseif (Environment::getEnv('CWP_SECURE_DOMAIN')) { $pdfBaseUrl = Environment::getEnv('CWP_SECURE_DOMAIN') . '/'; // or if neither, leave blank } else { $pdfBaseUrl = ''; } return $pdfBaseUrl; }
[ "public", "function", "getPDFBaseURL", "(", ")", "{", "// if base url YML is defined in YML, use that", "if", "(", "$", "this", "->", "owner", "->", "data", "(", ")", "->", "config", "(", ")", "->", "get", "(", "'pdf_base_url'", ")", ")", "{", "$", "pdfBaseUrl", "=", "$", "this", "->", "owner", "->", "data", "(", ")", "->", "config", "(", ")", "->", "get", "(", "'pdf_base_url'", ")", ".", "'/'", ";", "// otherwise, if we are CWP use the secure domain", "}", "elseif", "(", "Environment", "::", "getEnv", "(", "'CWP_SECURE_DOMAIN'", ")", ")", "{", "$", "pdfBaseUrl", "=", "Environment", "::", "getEnv", "(", "'CWP_SECURE_DOMAIN'", ")", ".", "'/'", ";", "// or if neither, leave blank", "}", "else", "{", "$", "pdfBaseUrl", "=", "''", ";", "}", "return", "$", "pdfBaseUrl", ";", "}" ]
This will return either pdf_base_url from YML, CWP_SECURE_DOMAIN from _ss_environment, or blank. In that order of importance. @return string
[ "This", "will", "return", "either", "pdf_base_url", "from", "YML", "CWP_SECURE_DOMAIN", "from", "_ss_environment", "or", "blank", ".", "In", "that", "order", "of", "importance", "." ]
da064d167ef3206bdfb511089ba3059bf86c063c
https://github.com/silverstripe/cwp-pdfexport/blob/da064d167ef3206bdfb511089ba3059bf86c063c/src/Extensions/PdfExportControllerExtension.php#L49-L62
train
silverstripe/cwp-pdfexport
src/Extensions/PdfExportControllerExtension.php
PdfExportControllerExtension.getPDFProxy
public function getPDFProxy($pdfBaseUrl) { if (!Environment::getEnv('CWP_SECURE_DOMAIN') || $pdfBaseUrl == Environment::getEnv('CWP_SECURE_DOMAIN') . '/' ) { $proxy = ''; } else { $proxy = ' --proxy ' . Environment::getEnv('SS_OUTBOUND_PROXY') . ':' . Environment::getEnv('SS_OUTBOUND_PROXY_PORT'); } return $proxy; }
php
public function getPDFProxy($pdfBaseUrl) { if (!Environment::getEnv('CWP_SECURE_DOMAIN') || $pdfBaseUrl == Environment::getEnv('CWP_SECURE_DOMAIN') . '/' ) { $proxy = ''; } else { $proxy = ' --proxy ' . Environment::getEnv('SS_OUTBOUND_PROXY') . ':' . Environment::getEnv('SS_OUTBOUND_PROXY_PORT'); } return $proxy; }
[ "public", "function", "getPDFProxy", "(", "$", "pdfBaseUrl", ")", "{", "if", "(", "!", "Environment", "::", "getEnv", "(", "'CWP_SECURE_DOMAIN'", ")", "||", "$", "pdfBaseUrl", "==", "Environment", "::", "getEnv", "(", "'CWP_SECURE_DOMAIN'", ")", ".", "'/'", ")", "{", "$", "proxy", "=", "''", ";", "}", "else", "{", "$", "proxy", "=", "' --proxy '", ".", "Environment", "::", "getEnv", "(", "'SS_OUTBOUND_PROXY'", ")", ".", "':'", ".", "Environment", "::", "getEnv", "(", "'SS_OUTBOUND_PROXY_PORT'", ")", ";", "}", "return", "$", "proxy", ";", "}" ]
Don't use the proxy if the pdf domain is the CWP secure domain or if we aren't on a CWP server @return string
[ "Don", "t", "use", "the", "proxy", "if", "the", "pdf", "domain", "is", "the", "CWP", "secure", "domain", "or", "if", "we", "aren", "t", "on", "a", "CWP", "server" ]
da064d167ef3206bdfb511089ba3059bf86c063c
https://github.com/silverstripe/cwp-pdfexport/blob/da064d167ef3206bdfb511089ba3059bf86c063c/src/Extensions/PdfExportControllerExtension.php#L69-L80
train
silverstripe/cwp-pdfexport
src/Extensions/PdfExportExtension.php
PdfExportExtension.getPdfFilename
public function getPdfFilename() { $baseName = sprintf('%s-%s', $this->owner->URLSegment, $this->owner->ID); $folderPath = $this->owner->config()->get('generated_pdf_path'); if ($folderPath[0] !== '/') { $folderPath = File::join_paths(Director::publicFolder(), $folderPath); } return sprintf('%s/%s.pdf', $folderPath, $baseName); }
php
public function getPdfFilename() { $baseName = sprintf('%s-%s', $this->owner->URLSegment, $this->owner->ID); $folderPath = $this->owner->config()->get('generated_pdf_path'); if ($folderPath[0] !== '/') { $folderPath = File::join_paths(Director::publicFolder(), $folderPath); } return sprintf('%s/%s.pdf', $folderPath, $baseName); }
[ "public", "function", "getPdfFilename", "(", ")", "{", "$", "baseName", "=", "sprintf", "(", "'%s-%s'", ",", "$", "this", "->", "owner", "->", "URLSegment", ",", "$", "this", "->", "owner", "->", "ID", ")", ";", "$", "folderPath", "=", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "get", "(", "'generated_pdf_path'", ")", ";", "if", "(", "$", "folderPath", "[", "0", "]", "!==", "'/'", ")", "{", "$", "folderPath", "=", "File", "::", "join_paths", "(", "Director", "::", "publicFolder", "(", ")", ",", "$", "folderPath", ")", ";", "}", "return", "sprintf", "(", "'%s/%s.pdf'", ",", "$", "folderPath", ",", "$", "baseName", ")", ";", "}" ]
Return the full filename of the pdf file, including path & extension
[ "Return", "the", "full", "filename", "of", "the", "pdf", "file", "including", "path", "&", "extension" ]
da064d167ef3206bdfb511089ba3059bf86c063c
https://github.com/silverstripe/cwp-pdfexport/blob/da064d167ef3206bdfb511089ba3059bf86c063c/src/Extensions/PdfExportExtension.php#L50-L60
train
silverstripe/cwp-pdfexport
src/Extensions/PdfExportExtension.php
PdfExportExtension.PdfLink
public function PdfLink() { if (!$this->owner->config()->get('pdf_export')) { return false; } $path = $this->getPdfFilename(); if ((Versioned::get_stage() === Versioned::LIVE) && file_exists($path)) { return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path)); } return $this->owner->Link('downloadpdf'); }
php
public function PdfLink() { if (!$this->owner->config()->get('pdf_export')) { return false; } $path = $this->getPdfFilename(); if ((Versioned::get_stage() === Versioned::LIVE) && file_exists($path)) { return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path)); } return $this->owner->Link('downloadpdf'); }
[ "public", "function", "PdfLink", "(", ")", "{", "if", "(", "!", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "get", "(", "'pdf_export'", ")", ")", "{", "return", "false", ";", "}", "$", "path", "=", "$", "this", "->", "getPdfFilename", "(", ")", ";", "if", "(", "(", "Versioned", "::", "get_stage", "(", ")", "===", "Versioned", "::", "LIVE", ")", "&&", "file_exists", "(", "$", "path", ")", ")", "{", "return", "Director", "::", "baseURL", "(", ")", ".", "preg_replace", "(", "'#^/#'", ",", "''", ",", "Director", "::", "makeRelative", "(", "$", "path", ")", ")", ";", "}", "return", "$", "this", "->", "owner", "->", "Link", "(", "'downloadpdf'", ")", ";", "}" ]
Build pdf link for template.
[ "Build", "pdf", "link", "for", "template", "." ]
da064d167ef3206bdfb511089ba3059bf86c063c
https://github.com/silverstripe/cwp-pdfexport/blob/da064d167ef3206bdfb511089ba3059bf86c063c/src/Extensions/PdfExportExtension.php#L65-L77
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.setPopupAttributes
public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { if (isset($this->_popup)) $this->_popup->setAttributes($variation, $popupEvent); }
php
public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { if (isset($this->_popup)) $this->_popup->setAttributes($variation, $popupEvent); }
[ "public", "function", "setPopupAttributes", "(", "$", "variation", "=", "NULL", ",", "$", "popupEvent", "=", "NULL", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_popup", ")", ")", "$", "this", "->", "_popup", "->", "setAttributes", "(", "$", "variation", ",", "$", "popupEvent", ")", ";", "}" ]
Defines the popup attributes @param string $variation @param string $popupEvent
[ "Defines", "the", "popup", "attributes" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L43-L46
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.addPopup
public function addPopup($title="", $content="", $variation=NULL, $params=array()) { $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); return $this; }
php
public function addPopup($title="", $content="", $variation=NULL, $params=array()) { $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); return $this; }
[ "public", "function", "addPopup", "(", "$", "title", "=", "\"\"", ",", "$", "content", "=", "\"\"", ",", "$", "variation", "=", "NULL", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_popup", "=", "new", "InternalPopup", "(", "$", "this", ",", "$", "title", ",", "$", "content", ",", "$", "variation", ",", "$", "params", ")", ";", "return", "$", "this", ";", "}" ]
Adds a popup to the element @param string $title @param string $content @param string $variation @param array $params @return HtmlSemDoubleElement
[ "Adds", "a", "popup", "to", "the", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L56-L59
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.addPopupHtml
public function addPopupHtml($html="", $variation=NULL, $params=array()) { $this->_popup=new InternalPopup($this); $this->_popup->setHtml($html); $this->_popup->setAttributes($variation, $params); return $this; }
php
public function addPopupHtml($html="", $variation=NULL, $params=array()) { $this->_popup=new InternalPopup($this); $this->_popup->setHtml($html); $this->_popup->setAttributes($variation, $params); return $this; }
[ "public", "function", "addPopupHtml", "(", "$", "html", "=", "\"\"", ",", "$", "variation", "=", "NULL", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_popup", "=", "new", "InternalPopup", "(", "$", "this", ")", ";", "$", "this", "->", "_popup", "->", "setHtml", "(", "$", "html", ")", ";", "$", "this", "->", "_popup", "->", "setAttributes", "(", "$", "variation", ",", "$", "params", ")", ";", "return", "$", "this", ";", "}" ]
Adds an html popup to the element @param string $html @param string $variation @param array $params @return HtmlSemDoubleElement
[ "Adds", "an", "html", "popup", "to", "the", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L68-L73
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.addDimmer
public function addDimmer($params=array(), $content=NULL) { $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); $dimmer->setParams($params); $dimmer->setContainer($this); $this->addContent($dimmer); return $dimmer; }
php
public function addDimmer($params=array(), $content=NULL) { $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); $dimmer->setParams($params); $dimmer->setContainer($this); $this->addContent($dimmer); return $dimmer; }
[ "public", "function", "addDimmer", "(", "$", "params", "=", "array", "(", ")", ",", "$", "content", "=", "NULL", ")", "{", "$", "dimmer", "=", "new", "HtmlDimmer", "(", "\"dimmer-\"", ".", "$", "this", "->", "identifier", ",", "$", "content", ")", ";", "$", "dimmer", "->", "setParams", "(", "$", "params", ")", ";", "$", "dimmer", "->", "setContainer", "(", "$", "this", ")", ";", "$", "this", "->", "addContent", "(", "$", "dimmer", ")", ";", "return", "$", "dimmer", ";", "}" ]
Adds a Dimmer to the element @param array $params @param mixed $content @return HtmlDimmer
[ "Adds", "a", "Dimmer", "to", "the", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L81-L87
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.addLabel
public function addLabel($label, $before=false, $icon=NULL) { $labelO=$label; if (\is_object($label) === false) { $labelO=new HtmlLabel("label-" . $this->identifier, $label); if (isset($icon)) $labelO->addIcon($icon); } else { $labelO->addToPropertyCtrl("class", "label", array ("label" )); } $this->addContent($labelO, $before); return $labelO; }
php
public function addLabel($label, $before=false, $icon=NULL) { $labelO=$label; if (\is_object($label) === false) { $labelO=new HtmlLabel("label-" . $this->identifier, $label); if (isset($icon)) $labelO->addIcon($icon); } else { $labelO->addToPropertyCtrl("class", "label", array ("label" )); } $this->addContent($labelO, $before); return $labelO; }
[ "public", "function", "addLabel", "(", "$", "label", ",", "$", "before", "=", "false", ",", "$", "icon", "=", "NULL", ")", "{", "$", "labelO", "=", "$", "label", ";", "if", "(", "\\", "is_object", "(", "$", "label", ")", "===", "false", ")", "{", "$", "labelO", "=", "new", "HtmlLabel", "(", "\"label-\"", ".", "$", "this", "->", "identifier", ",", "$", "label", ")", ";", "if", "(", "isset", "(", "$", "icon", ")", ")", "$", "labelO", "->", "addIcon", "(", "$", "icon", ")", ";", "}", "else", "{", "$", "labelO", "->", "addToPropertyCtrl", "(", "\"class\"", ",", "\"label\"", ",", "array", "(", "\"label\"", ")", ")", ";", "}", "$", "this", "->", "addContent", "(", "$", "labelO", ",", "$", "before", ")", ";", "return", "$", "labelO", ";", "}" ]
Adds a label to the element @param mixed $label @param boolean $before @param string $icon @return mixed|HtmlLabel
[ "Adds", "a", "label", "to", "the", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L96-L107
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.attachLabel
public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ $label=$this->addLabel($label,true,$icon); $label->setAttached($side,$direction); return $this; }
php
public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ $label=$this->addLabel($label,true,$icon); $label->setAttached($side,$direction); return $this; }
[ "public", "function", "attachLabel", "(", "$", "label", ",", "$", "side", "=", "Side", "::", "TOP", ",", "$", "direction", "=", "Direction", "::", "NONE", ",", "$", "icon", "=", "NULL", ")", "{", "$", "label", "=", "$", "this", "->", "addLabel", "(", "$", "label", ",", "true", ",", "$", "icon", ")", ";", "$", "label", "->", "setAttached", "(", "$", "side", ",", "$", "direction", ")", ";", "return", "$", "this", ";", "}" ]
Adds an attached label to the element @param mixed $label @param string $side @param string $direction @param string $icon @return HtmlSemDoubleElement
[ "Adds", "an", "attached", "label", "to", "the", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L117-L121
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.asLink
public function asLink($href=NULL,$target=NULL) { if (isset($href)) $this->setProperty("href", $href); if(isset($target)) $this->setProperty("target", $target); return $this->setTagName("a"); }
php
public function asLink($href=NULL,$target=NULL) { if (isset($href)) $this->setProperty("href", $href); if(isset($target)) $this->setProperty("target", $target); return $this->setTagName("a"); }
[ "public", "function", "asLink", "(", "$", "href", "=", "NULL", ",", "$", "target", "=", "NULL", ")", "{", "if", "(", "isset", "(", "$", "href", ")", ")", "$", "this", "->", "setProperty", "(", "\"href\"", ",", "$", "href", ")", ";", "if", "(", "isset", "(", "$", "target", ")", ")", "$", "this", "->", "setProperty", "(", "\"target\"", ",", "$", "target", ")", ";", "return", "$", "this", "->", "setTagName", "(", "\"a\"", ")", ";", "}" ]
Transforms the element into a link @return HtmlSemDoubleElement
[ "Transforms", "the", "element", "into", "a", "link" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L127-L133
train
phpMv/phpMv-UI
Ajax/semantic/html/base/HtmlSemDoubleElement.php
HtmlSemDoubleElement.jsShowDimmer
public function jsShowDimmer($show=true) { $status="hide"; if ($show === true) $status="show"; return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; }
php
public function jsShowDimmer($show=true) { $status="hide"; if ($show === true) $status="show"; return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; }
[ "public", "function", "jsShowDimmer", "(", "$", "show", "=", "true", ")", "{", "$", "status", "=", "\"hide\"", ";", "if", "(", "$", "show", "===", "true", ")", "$", "status", "=", "\"show\"", ";", "return", "'$(\"#.'", ".", "$", "this", "->", "identifier", ".", "').dimmer(\"'", ".", "$", "status", ".", "'\");'", ";", "}" ]
Returns the script displaying the dimmer @param boolean $show @return string
[ "Returns", "the", "script", "displaying", "the", "dimmer" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/base/HtmlSemDoubleElement.php#L140-L145
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/form/traits/FieldsTrait.php
FieldsTrait.setFieldsPropertyValues
public function setFieldsPropertyValues($property,$values){ $i=0; if(\is_array($values)===false){ $values=\array_fill(0, $this->count(),$values); } foreach ($values as $value){ $c=$this->content[$i++]; if(isset($c)){ $df=$c->getDataField(); $df->setProperty($property,$value); } else{ return $this; } } return $this; }
php
public function setFieldsPropertyValues($property,$values){ $i=0; if(\is_array($values)===false){ $values=\array_fill(0, $this->count(),$values); } foreach ($values as $value){ $c=$this->content[$i++]; if(isset($c)){ $df=$c->getDataField(); $df->setProperty($property,$value); } else{ return $this; } } return $this; }
[ "public", "function", "setFieldsPropertyValues", "(", "$", "property", ",", "$", "values", ")", "{", "$", "i", "=", "0", ";", "if", "(", "\\", "is_array", "(", "$", "values", ")", "===", "false", ")", "{", "$", "values", "=", "\\", "array_fill", "(", "0", ",", "$", "this", "->", "count", "(", ")", ",", "$", "values", ")", ";", "}", "foreach", "(", "$", "values", "as", "$", "value", ")", "{", "$", "c", "=", "$", "this", "->", "content", "[", "$", "i", "++", "]", ";", "if", "(", "isset", "(", "$", "c", ")", ")", "{", "$", "df", "=", "$", "c", "->", "getDataField", "(", ")", ";", "$", "df", "->", "setProperty", "(", "$", "property", ",", "$", "value", ")", ";", "}", "else", "{", "return", "$", "this", ";", "}", "}", "return", "$", "this", ";", "}" ]
Sets the values of a property for each Field of each item in the collection @param string $property @param array|mixed $values @return HtmlFormFields
[ "Sets", "the", "values", "of", "a", "property", "for", "each", "Field", "of", "each", "item", "in", "the", "collection" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/form/traits/FieldsTrait.php#L60-L76
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/form/traits/FieldsTrait.php
FieldsTrait.addDropdown
public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); }
php
public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); }
[ "public", "function", "addDropdown", "(", "$", "identifier", ",", "$", "items", "=", "array", "(", ")", ",", "$", "label", "=", "NULL", ",", "$", "value", "=", "NULL", ",", "$", "multiple", "=", "false", ")", "{", "return", "$", "this", "->", "addItem", "(", "new", "HtmlFormDropdown", "(", "$", "identifier", ",", "$", "items", ",", "$", "label", ",", "$", "value", ",", "$", "multiple", ")", ")", ";", "}" ]
Adds a new dropdown element @param string $identifier @param array $items @param string $label @param string $value @param boolean $multiple @return HtmlFormDropdown
[ "Adds", "a", "new", "dropdown", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/form/traits/FieldsTrait.php#L103-L105
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/form/traits/FieldsTrait.php
FieldsTrait.addButtonGroups
public function addButtonGroups($identifier,$elements=[],$asIcons=false){ return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons)); }
php
public function addButtonGroups($identifier,$elements=[],$asIcons=false){ return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons)); }
[ "public", "function", "addButtonGroups", "(", "$", "identifier", ",", "$", "elements", "=", "[", "]", ",", "$", "asIcons", "=", "false", ")", "{", "return", "$", "this", "->", "addItem", "(", "new", "HtmlButtonGroups", "(", "$", "identifier", ",", "$", "elements", ",", "$", "asIcons", ")", ")", ";", "}" ]
Adds a new button groups @param string $identifier @param array $elements @param boolean $asIcons @return HtmlButtonGroups
[ "Adds", "a", "new", "button", "groups" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/form/traits/FieldsTrait.php#L114-L116
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/form/traits/FieldsTrait.php
FieldsTrait.addDropdownButton
public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){ return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon)); }
php
public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){ return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon)); }
[ "public", "function", "addDropdownButton", "(", "$", "identifier", ",", "$", "value", ",", "$", "items", "=", "[", "]", ",", "$", "asCombo", "=", "false", ",", "$", "icon", "=", "null", ")", "{", "return", "$", "this", "->", "addItem", "(", "HtmlButton", "::", "dropdown", "(", "$", "identifier", ",", "$", "value", ",", "$", "items", ",", "$", "asCombo", ",", "$", "icon", ")", ")", ";", "}" ]
Adds a button with a dropdown button @param string $identifier @param string $value @param array $items @param boolean $asCombo @param string $icon @return HtmlButtonGroups
[ "Adds", "a", "button", "with", "a", "dropdown", "button" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/form/traits/FieldsTrait.php#L127-L129
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php
SemanticHtmlCollectionsTrait.htmlMessage
public function htmlMessage($identifier, $content="",$styles=NULL) { $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); if(isset($msg) && $styles!==null) $msg->setStyle($styles); return $msg; }
php
public function htmlMessage($identifier, $content="",$styles=NULL) { $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); if(isset($msg) && $styles!==null) $msg->setStyle($styles); return $msg; }
[ "public", "function", "htmlMessage", "(", "$", "identifier", ",", "$", "content", "=", "\"\"", ",", "$", "styles", "=", "NULL", ")", "{", "$", "msg", "=", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlMessage", "(", "$", "identifier", ",", "$", "content", ")", ")", ";", "if", "(", "isset", "(", "$", "msg", ")", "&&", "$", "styles", "!==", "null", ")", "$", "msg", "->", "setStyle", "(", "$", "styles", ")", ";", "return", "$", "msg", ";", "}" ]
Adds a new message @param string $identifier @param string $content @param $styles string|array|NULL @return HtmlMessage
[ "Adds", "a", "new", "message" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php#L36-L41
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php
SemanticHtmlCollectionsTrait.htmlBreadcrumb
public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); }
php
public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); }
[ "public", "function", "htmlBreadcrumb", "(", "$", "identifier", ",", "$", "items", "=", "array", "(", ")", ",", "$", "autoActive", "=", "true", ",", "$", "startIndex", "=", "0", ",", "$", "hrefFunction", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlBreadcrumb", "(", "$", "identifier", ",", "$", "items", ",", "$", "autoActive", ",", "$", "startIndex", ",", "$", "hrefFunction", ")", ")", ";", "}" ]
Returns a new Semantic Html Breadcrumb @param string $identifier @param array $items @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true @param callable $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} @return HtmlBreadcrumb
[ "Returns", "a", "new", "Semantic", "Html", "Breadcrumb" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlCollectionsTrait.php#L79-L81
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/form/HtmlFormField.php
HtmlFormField.setWidth
public function setWidth($width){ if(\is_int($width)){ $width=Wide::getConstants()["W".$width]; } $this->addToPropertyCtrl("class", $width, Wide::getConstants()); if(isset($this->_container)){ $this->_container->setEqualWidth(false); } return $this->addToPropertyCtrl("class", "wide",array("wide")); }
php
public function setWidth($width){ if(\is_int($width)){ $width=Wide::getConstants()["W".$width]; } $this->addToPropertyCtrl("class", $width, Wide::getConstants()); if(isset($this->_container)){ $this->_container->setEqualWidth(false); } return $this->addToPropertyCtrl("class", "wide",array("wide")); }
[ "public", "function", "setWidth", "(", "$", "width", ")", "{", "if", "(", "\\", "is_int", "(", "$", "width", ")", ")", "{", "$", "width", "=", "Wide", "::", "getConstants", "(", ")", "[", "\"W\"", ".", "$", "width", "]", ";", "}", "$", "this", "->", "addToPropertyCtrl", "(", "\"class\"", ",", "$", "width", ",", "Wide", "::", "getConstants", "(", ")", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "_container", ")", ")", "{", "$", "this", "->", "_container", "->", "setEqualWidth", "(", "false", ")", ";", "}", "return", "$", "this", "->", "addToPropertyCtrl", "(", "\"class\"", ",", "\"wide\"", ",", "array", "(", "\"wide\"", ")", ")", ";", "}" ]
Defines the field width @param int $width @return \Ajax\semantic\html\collections\form\HtmlFormField
[ "Defines", "the", "field", "width" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/form/HtmlFormField.php#L88-L97
train
phpMv/phpMv-UI
Ajax/bootstrap/html/HtmlGridsystem.php
HtmlGridSystem.addRow
public function addRow($numCols=NULL){ $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); $this->rows[]=$row; return $row; }
php
public function addRow($numCols=NULL){ $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); $this->rows[]=$row; return $row; }
[ "public", "function", "addRow", "(", "$", "numCols", "=", "NULL", ")", "{", "$", "row", "=", "new", "HtmlGridRow", "(", "$", "this", "->", "identifier", ".", "\"-row-\"", ".", "(", "sizeof", "(", "$", "this", "->", "rows", ")", "+", "1", ")", ",", "$", "numCols", ")", ";", "$", "this", "->", "rows", "[", "]", "=", "$", "row", ";", "return", "$", "row", ";", "}" ]
Add a new row @param int $numCols @return \Ajax\bootstrap\html\content\HtmlGridRow
[ "Add", "a", "new", "row" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/bootstrap/html/HtmlGridsystem.php#L31-L35
train
phpMv/phpMv-UI
Ajax/bootstrap/html/HtmlModal.php
HtmlModal.addButton
public function addButton($value="Okay", $style="btn-primary") { $btn=new HtmlButton($this->identifier."-".$value); $btn->setStyle($style); $btn->setValue($value); $this->buttons []=$btn; return $btn; }
php
public function addButton($value="Okay", $style="btn-primary") { $btn=new HtmlButton($this->identifier."-".$value); $btn->setStyle($style); $btn->setValue($value); $this->buttons []=$btn; return $btn; }
[ "public", "function", "addButton", "(", "$", "value", "=", "\"Okay\"", ",", "$", "style", "=", "\"btn-primary\"", ")", "{", "$", "btn", "=", "new", "HtmlButton", "(", "$", "this", "->", "identifier", ".", "\"-\"", ".", "$", "value", ")", ";", "$", "btn", "->", "setStyle", "(", "$", "style", ")", ";", "$", "btn", "->", "setValue", "(", "$", "value", ")", ";", "$", "this", "->", "buttons", "[", "]", "=", "$", "btn", ";", "return", "$", "btn", ";", "}" ]
Add a button @param string $value the button caption @param string $style one of "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger" @return HtmlButton
[ "Add", "a", "button" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/bootstrap/html/HtmlModal.php#L44-L50
train
phpMv/phpMv-UI
Ajax/common/Widget.php
Widget.setValueFunction
public function setValueFunction($index,$callback){ $index=$this->_getIndex($index); if($index!==false){ $this->_instanceViewer->setValueFunction($index, $callback); } return $this; }
php
public function setValueFunction($index,$callback){ $index=$this->_getIndex($index); if($index!==false){ $this->_instanceViewer->setValueFunction($index, $callback); } return $this; }
[ "public", "function", "setValueFunction", "(", "$", "index", ",", "$", "callback", ")", "{", "$", "index", "=", "$", "this", "->", "_getIndex", "(", "$", "index", ")", ";", "if", "(", "$", "index", "!==", "false", ")", "{", "$", "this", "->", "_instanceViewer", "->", "setValueFunction", "(", "$", "index", ",", "$", "callback", ")", ";", "}", "return", "$", "this", ";", "}" ]
Defines the function which displays the field value @param int|string $index index or name of the field to display @param callable $callback function parameters are : $value : the field value, $instance : the active instance of model, $fieldIndex : the field index, $rowIndex : the row index @return Widget
[ "Defines", "the", "function", "which", "displays", "the", "field", "value" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/common/Widget.php#L215-L221
train
phpMv/phpMv-UI
Ajax/common/Widget.php
Widget.addInToolbar
public function addInToolbar($element,$callback=NULL){ $tb=$this->getToolbar(); if($element instanceof BaseWidget){ if($element->getIdentifier()===""){ $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); } } if(isset($callback)){ if(\is_callable($callback)){ $callback($element); } } return $tb->addItem($element); }
php
public function addInToolbar($element,$callback=NULL){ $tb=$this->getToolbar(); if($element instanceof BaseWidget){ if($element->getIdentifier()===""){ $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); } } if(isset($callback)){ if(\is_callable($callback)){ $callback($element); } } return $tb->addItem($element); }
[ "public", "function", "addInToolbar", "(", "$", "element", ",", "$", "callback", "=", "NULL", ")", "{", "$", "tb", "=", "$", "this", "->", "getToolbar", "(", ")", ";", "if", "(", "$", "element", "instanceof", "BaseWidget", ")", "{", "if", "(", "$", "element", "->", "getIdentifier", "(", ")", "===", "\"\"", ")", "{", "$", "element", "->", "setIdentifier", "(", "\"tb-item-\"", ".", "$", "this", "->", "identifier", ".", "\"-\"", ".", "$", "tb", "->", "count", "(", ")", ")", ";", "}", "}", "if", "(", "isset", "(", "$", "callback", ")", ")", "{", "if", "(", "\\", "is_callable", "(", "$", "callback", ")", ")", "{", "$", "callback", "(", "$", "element", ")", ";", "}", "}", "return", "$", "tb", "->", "addItem", "(", "$", "element", ")", ";", "}" ]
Adds a new element in toolbar @param mixed $element @param callable $callback function to call on $element @return \Ajax\common\html\HtmlDoubleElement
[ "Adds", "a", "new", "element", "in", "toolbar" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/common/Widget.php#L244-L257
train
phpMv/phpMv-UI
Ajax/semantic/html/content/table/HtmlTableContent.php
HtmlTableContent.addValues
public function addValues($values=array()) { return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);}); }
php
public function addValues($values=array()) { return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);}); }
[ "public", "function", "addValues", "(", "$", "values", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "_addOrSetValues", "(", "$", "values", ",", "function", "(", "HtmlTR", "$", "row", ",", "$", "_values", ")", "{", "$", "row", "->", "addValues", "(", "$", "_values", ")", ";", "}", ")", ";", "}" ]
Adds the cells values @param mixed $values
[ "Adds", "the", "cells", "values" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/content/table/HtmlTableContent.php#L161-L163
train
phpMv/phpMv-UI
Ajax/semantic/html/collections/menus/HtmlMenu.php
HtmlMenu.setWidth
public function setWidth($width) { if (\is_int($width)) { $width=Wide::getConstants()["W" . $width]; } $this->addToPropertyCtrl("class", $width, Wide::getConstants()); return $this->addToPropertyCtrl("class", "item", array ("item" )); }
php
public function setWidth($width) { if (\is_int($width)) { $width=Wide::getConstants()["W" . $width]; } $this->addToPropertyCtrl("class", $width, Wide::getConstants()); return $this->addToPropertyCtrl("class", "item", array ("item" )); }
[ "public", "function", "setWidth", "(", "$", "width", ")", "{", "if", "(", "\\", "is_int", "(", "$", "width", ")", ")", "{", "$", "width", "=", "Wide", "::", "getConstants", "(", ")", "[", "\"W\"", ".", "$", "width", "]", ";", "}", "$", "this", "->", "addToPropertyCtrl", "(", "\"class\"", ",", "$", "width", ",", "Wide", "::", "getConstants", "(", ")", ")", ";", "return", "$", "this", "->", "addToPropertyCtrl", "(", "\"class\"", ",", "\"item\"", ",", "array", "(", "\"item\"", ")", ")", ";", "}" ]
Defines the menu width @param int $width @return \Ajax\semantic\html\collections\menus\HtmlMenu
[ "Defines", "the", "menu", "width" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/collections/menus/HtmlMenu.php#L216-L222
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlButtonGroups
public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); }
php
public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); }
[ "public", "function", "htmlButtonGroups", "(", "$", "identifier", ",", "$", "elements", "=", "array", "(", ")", ",", "$", "asIcons", "=", "false", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlButtonGroups", "(", "$", "identifier", ",", "$", "elements", ",", "$", "asIcons", ")", ")", ";", "}" ]
Returns a group of Semantic buttons @see http://phpmv-ui.kobject.net/index/direct/main/50 @see http://semantic-ui.com/elements/button.html#buttons @param string $identifier @param array $elements @param boolean $asIcons @return HtmlButtonGroups
[ "Returns", "a", "group", "of", "Semantic", "buttons" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L59-L61
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlDivider
public function htmlDivider($identifier, $content="", $tagName="div") { return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); }
php
public function htmlDivider($identifier, $content="", $tagName="div") { return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); }
[ "public", "function", "htmlDivider", "(", "$", "identifier", ",", "$", "content", "=", "\"\"", ",", "$", "tagName", "=", "\"div\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlDivider", "(", "$", "identifier", ",", "$", "content", ",", "$", "tagName", ")", ")", ";", "}" ]
Returns a new Semantic divider @see http://phpmv-ui.kobject.net/index/direct/main/42 @see http://semantic-ui.com/elements/divider.html @param string $identifier @param string $content @return HtmlDivider
[ "Returns", "a", "new", "Semantic", "divider" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L83-L85
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlHeader
public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); }
php
public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); }
[ "public", "function", "htmlHeader", "(", "$", "identifier", ",", "$", "niveau", "=", "1", ",", "$", "content", "=", "NULL", ",", "$", "type", "=", "\"page\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlHeader", "(", "$", "identifier", ",", "$", "niveau", ",", "$", "content", ",", "$", "type", ")", ")", ";", "}" ]
Returns a new Semantic header @see http://phpmv-ui.kobject.net/index/direct/main/43 @see http://semantic-ui.com/elements/header.html @param string $identifier @param number $niveau @param mixed $content @param string $type @return HtmlHeader
[ "Returns", "a", "new", "Semantic", "header" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L97-L99
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlImage
public function htmlImage($identifier, $src="", $alt="", $size=NULL) { return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); }
php
public function htmlImage($identifier, $src="", $alt="", $size=NULL) { return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); }
[ "public", "function", "htmlImage", "(", "$", "identifier", ",", "$", "src", "=", "\"\"", ",", "$", "alt", "=", "\"\"", ",", "$", "size", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlImage", "(", "$", "identifier", ",", "$", "src", ",", "$", "alt", ",", "$", "size", ")", ")", ";", "}" ]
Returns a new Semantic image @see http://phpmv-ui.kobject.net/index/direct/main/55 @see http://semantic-ui.com/elements/image.html @param string $identifier @param string $src @param string $alt @param string $size @return HtmlImage
[ "Returns", "a", "new", "Semantic", "image" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L123-L125
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlIconGroups
public function htmlIconGroups($identifier, $icons=array(), $size="") { return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); }
php
public function htmlIconGroups($identifier, $icons=array(), $size="") { return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); }
[ "public", "function", "htmlIconGroups", "(", "$", "identifier", ",", "$", "icons", "=", "array", "(", ")", ",", "$", "size", "=", "\"\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlIconGroups", "(", "$", "identifier", ",", "$", "icons", ",", "$", "size", ")", ")", ";", "}" ]
Returns a new Semantic group of images @see http://phpmv-ui.kobject.net/index/direct/main/0 @see http://semantic-ui.com/elements/image.html#size @param string $identifier @param array $icons @param string $size @return HtmlIconGroups
[ "Returns", "a", "new", "Semantic", "group", "of", "images" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L136-L138
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlInput
public function htmlInput($identifier, $type="text", $value="", $placeholder="") { return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); }
php
public function htmlInput($identifier, $type="text", $value="", $placeholder="") { return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); }
[ "public", "function", "htmlInput", "(", "$", "identifier", ",", "$", "type", "=", "\"text\"", ",", "$", "value", "=", "\"\"", ",", "$", "placeholder", "=", "\"\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlInput", "(", "$", "identifier", ",", "$", "type", ",", "$", "value", ",", "$", "placeholder", ")", ")", ";", "}" ]
Returns a new Semantic html input @see http://phpmv-ui.kobject.net/index/direct/main/45 @see http://semantic-ui.com/elements/input.html @param string $identifier @param string $type @param string $value @param string $placeholder @return HtmlInput
[ "Returns", "a", "new", "Semantic", "html", "input" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L150-L152
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlElementsTrait.php
SemanticHtmlElementsTrait.htmlLabel
public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") { return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName)); }
php
public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") { return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName)); }
[ "public", "function", "htmlLabel", "(", "$", "identifier", ",", "$", "content", "=", "\"\"", ",", "$", "icon", "=", "NULL", ",", "$", "tagName", "=", "\"div\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlLabel", "(", "$", "identifier", ",", "$", "content", ",", "$", "icon", ",", "$", "tagName", ")", ")", ";", "}" ]
Returns a new Semantic label @see http://phpmv-ui.kobject.net/index/direct/main/46 @see http://semantic-ui.com/elements/label.html @param string $identifier @param string $content @param string $tagName @return HtmlLabel
[ "Returns", "a", "new", "Semantic", "label" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlElementsTrait.php#L163-L165
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI._fetch_uri_string
function _fetch_uri_string() { $uri=""; if ($this->uri_protocol == 'AUTO') { // Is the request coming from the command line? if (php_sapi_name() == 'cli' || defined('STDIN')) { $this->_set_uri_string($this->_parse_cli_args()); return; } // Let's try the REQUEST_URI first, this will work in most situations if ($uri=$this->_detect_uri()) { $this->_set_uri_string($uri); return; } // Is there a PATH_INFO variable? // Note: some servers seem to have trouble with getenv() so we'll test it two ways $path=(isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); if (trim($path, '/') != '' && $path != "/" . SELF) { $this->_set_uri_string($path); return; } // No PATH_INFO?... What about QUERY_STRING? $path=(isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); if (trim($path, '/') != '') { $this->_set_uri_string($path); return; } // As a last ditch effort lets try using the $_GET array if (\is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') { $this->_set_uri_string(key($_GET)); return; } // We've exhausted all our options... $this->uri_string=''; return; } if ($uri == 'REQUEST_URI') { $this->_set_uri_string($this->_detect_uri()); return; } $path=(isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri); $this->_set_uri_string($path); }
php
function _fetch_uri_string() { $uri=""; if ($this->uri_protocol == 'AUTO') { // Is the request coming from the command line? if (php_sapi_name() == 'cli' || defined('STDIN')) { $this->_set_uri_string($this->_parse_cli_args()); return; } // Let's try the REQUEST_URI first, this will work in most situations if ($uri=$this->_detect_uri()) { $this->_set_uri_string($uri); return; } // Is there a PATH_INFO variable? // Note: some servers seem to have trouble with getenv() so we'll test it two ways $path=(isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); if (trim($path, '/') != '' && $path != "/" . SELF) { $this->_set_uri_string($path); return; } // No PATH_INFO?... What about QUERY_STRING? $path=(isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); if (trim($path, '/') != '') { $this->_set_uri_string($path); return; } // As a last ditch effort lets try using the $_GET array if (\is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') { $this->_set_uri_string(key($_GET)); return; } // We've exhausted all our options... $this->uri_string=''; return; } if ($uri == 'REQUEST_URI') { $this->_set_uri_string($this->_detect_uri()); return; } $path=(isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri); $this->_set_uri_string($path); }
[ "function", "_fetch_uri_string", "(", ")", "{", "$", "uri", "=", "\"\"", ";", "if", "(", "$", "this", "->", "uri_protocol", "==", "'AUTO'", ")", "{", "// Is the request coming from the command line?", "if", "(", "php_sapi_name", "(", ")", "==", "'cli'", "||", "defined", "(", "'STDIN'", ")", ")", "{", "$", "this", "->", "_set_uri_string", "(", "$", "this", "->", "_parse_cli_args", "(", ")", ")", ";", "return", ";", "}", "// Let's try the REQUEST_URI first, this will work in most situations", "if", "(", "$", "uri", "=", "$", "this", "->", "_detect_uri", "(", ")", ")", "{", "$", "this", "->", "_set_uri_string", "(", "$", "uri", ")", ";", "return", ";", "}", "// Is there a PATH_INFO variable?", "// Note: some servers seem to have trouble with getenv() so we'll test it two ways", "$", "path", "=", "(", "isset", "(", "$", "_SERVER", "[", "'PATH_INFO'", "]", ")", ")", "?", "$", "_SERVER", "[", "'PATH_INFO'", "]", ":", "@", "getenv", "(", "'PATH_INFO'", ")", ";", "if", "(", "trim", "(", "$", "path", ",", "'/'", ")", "!=", "''", "&&", "$", "path", "!=", "\"/\"", ".", "SELF", ")", "{", "$", "this", "->", "_set_uri_string", "(", "$", "path", ")", ";", "return", ";", "}", "// No PATH_INFO?... What about QUERY_STRING?", "$", "path", "=", "(", "isset", "(", "$", "_SERVER", "[", "'QUERY_STRING'", "]", ")", ")", "?", "$", "_SERVER", "[", "'QUERY_STRING'", "]", ":", "@", "getenv", "(", "'QUERY_STRING'", ")", ";", "if", "(", "trim", "(", "$", "path", ",", "'/'", ")", "!=", "''", ")", "{", "$", "this", "->", "_set_uri_string", "(", "$", "path", ")", ";", "return", ";", "}", "// As a last ditch effort lets try using the $_GET array", "if", "(", "\\", "is_array", "(", "$", "_GET", ")", "&&", "count", "(", "$", "_GET", ")", "==", "1", "&&", "trim", "(", "key", "(", "$", "_GET", ")", ",", "'/'", ")", "!=", "''", ")", "{", "$", "this", "->", "_set_uri_string", "(", "key", "(", "$", "_GET", ")", ")", ";", "return", ";", "}", "// We've exhausted all our options...", "$", "this", "->", "uri_string", "=", "''", ";", "return", ";", "}", "if", "(", "$", "uri", "==", "'REQUEST_URI'", ")", "{", "$", "this", "->", "_set_uri_string", "(", "$", "this", "->", "_detect_uri", "(", ")", ")", ";", "return", ";", "}", "$", "path", "=", "(", "isset", "(", "$", "_SERVER", "[", "$", "uri", "]", ")", ")", "?", "$", "_SERVER", "[", "$", "uri", "]", ":", "@", "getenv", "(", "$", "uri", ")", ";", "$", "this", "->", "_set_uri_string", "(", "$", "path", ")", ";", "}" ]
Get the URI String @access private @return string
[ "Get", "the", "URI", "String" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L76-L124
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI._reindex_segments
function _reindex_segments() { array_unshift($this->segments, NULL); array_unshift($this->rsegments, NULL); unset($this->segments[0]); unset($this->rsegments[0]); }
php
function _reindex_segments() { array_unshift($this->segments, NULL); array_unshift($this->rsegments, NULL); unset($this->segments[0]); unset($this->rsegments[0]); }
[ "function", "_reindex_segments", "(", ")", "{", "array_unshift", "(", "$", "this", "->", "segments", ",", "NULL", ")", ";", "array_unshift", "(", "$", "this", "->", "rsegments", ",", "NULL", ")", ";", "unset", "(", "$", "this", "->", "segments", "[", "0", "]", ")", ";", "unset", "(", "$", "this", "->", "rsegments", "[", "0", "]", ")", ";", "}" ]
Re-index Segments This function re-indexes the $this->segment array so that it starts at 1 rather than 0. Doing so makes it simpler to use functions like $this->uri->segment(n) since there is a 1:1 relationship between the segment array and the actual segments. @access private @return void
[ "Re", "-", "index", "Segments" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L269-L274
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI.segment
function segment($n, $no_result=FALSE) { return (!isset($this->segments[$n])) ? $no_result : $this->segments[$n]; }
php
function segment($n, $no_result=FALSE) { return (!isset($this->segments[$n])) ? $no_result : $this->segments[$n]; }
[ "function", "segment", "(", "$", "n", ",", "$", "no_result", "=", "FALSE", ")", "{", "return", "(", "!", "isset", "(", "$", "this", "->", "segments", "[", "$", "n", "]", ")", ")", "?", "$", "no_result", ":", "$", "this", "->", "segments", "[", "$", "n", "]", ";", "}" ]
Fetch a URI Segment This function returns the URI segment based on the number provided. @access public @param integer @param bool @return string
[ "Fetch", "a", "URI", "Segment" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L289-L291
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI.rsegment
function rsegment($n, $no_result=FALSE) { return (!isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; }
php
function rsegment($n, $no_result=FALSE) { return (!isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; }
[ "function", "rsegment", "(", "$", "n", ",", "$", "no_result", "=", "FALSE", ")", "{", "return", "(", "!", "isset", "(", "$", "this", "->", "rsegments", "[", "$", "n", "]", ")", ")", "?", "$", "no_result", ":", "$", "this", "->", "rsegments", "[", "$", "n", "]", ";", "}" ]
Fetch a URI "routed" Segment This function returns the re-routed URI segment (assuming routing rules are used) based on the number provided. If there is no routing this function returns the same result as $this->segment() @access public @param integer @param bool @return string
[ "Fetch", "a", "URI", "routed", "Segment" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L308-L310
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI._uri_to_assoc
function _uri_to_assoc($n=3, $default=array(), $which='segment') { if ($which == 'segment') { $total_segments='total_segments'; $segment_array='segment_array'; } else { $total_segments='total_rsegments'; $segment_array='rsegment_array'; } if (!is_numeric($n)) { return $default; } if (isset($this->keyval[$n])) { return $this->keyval[$n]; } if ($this->$total_segments() < $n) { if (count($default) == 0) { return array (); } $retval=array (); foreach ( $default as $val ) { $retval[$val]=FALSE; } return $retval; } $segments=array_slice($this->$segment_array(), ($n - 1)); $i=0; $lastval=''; $retval=array (); foreach ( $segments as $seg ) { if ($i % 2) { $retval[$lastval]=$seg; } else { $retval[$seg]=FALSE; $lastval=$seg; } $i++; } if (count($default) > 0) { foreach ( $default as $val ) { if (!array_key_exists($val, $retval)) { $retval[$val]=FALSE; } } } // Cache the array for reuse $this->keyval[$n]=$retval; return $retval; }
php
function _uri_to_assoc($n=3, $default=array(), $which='segment') { if ($which == 'segment') { $total_segments='total_segments'; $segment_array='segment_array'; } else { $total_segments='total_rsegments'; $segment_array='rsegment_array'; } if (!is_numeric($n)) { return $default; } if (isset($this->keyval[$n])) { return $this->keyval[$n]; } if ($this->$total_segments() < $n) { if (count($default) == 0) { return array (); } $retval=array (); foreach ( $default as $val ) { $retval[$val]=FALSE; } return $retval; } $segments=array_slice($this->$segment_array(), ($n - 1)); $i=0; $lastval=''; $retval=array (); foreach ( $segments as $seg ) { if ($i % 2) { $retval[$lastval]=$seg; } else { $retval[$seg]=FALSE; $lastval=$seg; } $i++; } if (count($default) > 0) { foreach ( $default as $val ) { if (!array_key_exists($val, $retval)) { $retval[$val]=FALSE; } } } // Cache the array for reuse $this->keyval[$n]=$retval; return $retval; }
[ "function", "_uri_to_assoc", "(", "$", "n", "=", "3", ",", "$", "default", "=", "array", "(", ")", ",", "$", "which", "=", "'segment'", ")", "{", "if", "(", "$", "which", "==", "'segment'", ")", "{", "$", "total_segments", "=", "'total_segments'", ";", "$", "segment_array", "=", "'segment_array'", ";", "}", "else", "{", "$", "total_segments", "=", "'total_rsegments'", ";", "$", "segment_array", "=", "'rsegment_array'", ";", "}", "if", "(", "!", "is_numeric", "(", "$", "n", ")", ")", "{", "return", "$", "default", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "keyval", "[", "$", "n", "]", ")", ")", "{", "return", "$", "this", "->", "keyval", "[", "$", "n", "]", ";", "}", "if", "(", "$", "this", "->", "$", "total_segments", "(", ")", "<", "$", "n", ")", "{", "if", "(", "count", "(", "$", "default", ")", "==", "0", ")", "{", "return", "array", "(", ")", ";", "}", "$", "retval", "=", "array", "(", ")", ";", "foreach", "(", "$", "default", "as", "$", "val", ")", "{", "$", "retval", "[", "$", "val", "]", "=", "FALSE", ";", "}", "return", "$", "retval", ";", "}", "$", "segments", "=", "array_slice", "(", "$", "this", "->", "$", "segment_array", "(", ")", ",", "(", "$", "n", "-", "1", ")", ")", ";", "$", "i", "=", "0", ";", "$", "lastval", "=", "''", ";", "$", "retval", "=", "array", "(", ")", ";", "foreach", "(", "$", "segments", "as", "$", "seg", ")", "{", "if", "(", "$", "i", "%", "2", ")", "{", "$", "retval", "[", "$", "lastval", "]", "=", "$", "seg", ";", "}", "else", "{", "$", "retval", "[", "$", "seg", "]", "=", "FALSE", ";", "$", "lastval", "=", "$", "seg", ";", "}", "$", "i", "++", ";", "}", "if", "(", "count", "(", "$", "default", ")", ">", "0", ")", "{", "foreach", "(", "$", "default", "as", "$", "val", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "val", ",", "$", "retval", ")", ")", "{", "$", "retval", "[", "$", "val", "]", "=", "FALSE", ";", "}", "}", "}", "// Cache the array for reuse", "$", "this", "->", "keyval", "[", "$", "n", "]", "=", "$", "retval", ";", "return", "$", "retval", ";", "}" ]
Generate a key value pair from the URI string or Re-routed URI string @access private @param integer the starting segment number @param array an array of default values @param string which array we should use @return array
[ "Generate", "a", "key", "value", "pair", "from", "the", "URI", "string", "or", "Re", "-", "routed", "URI", "string" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L366-L422
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI.assoc_to_uri
function assoc_to_uri($array) { $temp=array (); foreach ( ( array ) $array as $key => $val ) { $temp[]=$key; $temp[]=$val; } return implode('/', $temp); }
php
function assoc_to_uri($array) { $temp=array (); foreach ( ( array ) $array as $key => $val ) { $temp[]=$key; $temp[]=$val; } return implode('/', $temp); }
[ "function", "assoc_to_uri", "(", "$", "array", ")", "{", "$", "temp", "=", "array", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "array", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "temp", "[", "]", "=", "$", "key", ";", "$", "temp", "[", "]", "=", "$", "val", ";", "}", "return", "implode", "(", "'/'", ",", "$", "temp", ")", ";", "}" ]
Generate a URI string from an associative array @access public @param array an associative array of key/values @return array
[ "Generate", "a", "URI", "string", "from", "an", "associative", "array" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L435-L443
train
phpMv/phpMv-UI
Ajax/php/yii/URI.php
URI._slash_segment
function _slash_segment($n, $where='trailing', $which='segment') { $leading='/'; $trailing='/'; if ($where == 'trailing') { $leading=''; } elseif ($where == 'leading') { $trailing=''; } return $leading . $this->$which($n) . $trailing; }
php
function _slash_segment($n, $where='trailing', $which='segment') { $leading='/'; $trailing='/'; if ($where == 'trailing') { $leading=''; } elseif ($where == 'leading') { $trailing=''; } return $leading . $this->$which($n) . $trailing; }
[ "function", "_slash_segment", "(", "$", "n", ",", "$", "where", "=", "'trailing'", ",", "$", "which", "=", "'segment'", ")", "{", "$", "leading", "=", "'/'", ";", "$", "trailing", "=", "'/'", ";", "if", "(", "$", "where", "==", "'trailing'", ")", "{", "$", "leading", "=", "''", ";", "}", "elseif", "(", "$", "where", "==", "'leading'", ")", "{", "$", "trailing", "=", "''", ";", "}", "return", "$", "leading", ".", "$", "this", "->", "$", "which", "(", "$", "n", ")", ".", "$", "trailing", ";", "}" ]
Fetch a URI Segment and add a trailing slash - helper function @access private @param integer @param string @param string @return string
[ "Fetch", "a", "URI", "Segment", "and", "add", "a", "trailing", "slash", "-", "helper", "function" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/php/yii/URI.php#L487-L498
train
phpMv/phpMv-UI
Ajax/semantic/html/elements/HtmlIcon.php
HtmlIcon.setIcon
public function setIcon($icon) { if (isset($this->_icon)) { $this->removePropertyValue("class", $this->_icon); } $this->_icon=$icon; $this->addToProperty("class", $icon); return $this; }
php
public function setIcon($icon) { if (isset($this->_icon)) { $this->removePropertyValue("class", $this->_icon); } $this->_icon=$icon; $this->addToProperty("class", $icon); return $this; }
[ "public", "function", "setIcon", "(", "$", "icon", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_icon", ")", ")", "{", "$", "this", "->", "removePropertyValue", "(", "\"class\"", ",", "$", "this", "->", "_icon", ")", ";", "}", "$", "this", "->", "_icon", "=", "$", "icon", ";", "$", "this", "->", "addToProperty", "(", "\"class\"", ",", "$", "icon", ")", ";", "return", "$", "this", ";", "}" ]
sets the icon @param string $icon @return HtmlIcon
[ "sets", "the", "icon" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/elements/HtmlIcon.php#L31-L38
train
phpMv/phpMv-UI
Ajax/semantic/html/elements/HtmlIcon.php
HtmlIcon.addToIcon
public function addToIcon($icon) { $this->addToProperty("class", $icon); return $this->addToMember($this->_icon, $icon); }
php
public function addToIcon($icon) { $this->addToProperty("class", $icon); return $this->addToMember($this->_icon, $icon); }
[ "public", "function", "addToIcon", "(", "$", "icon", ")", "{", "$", "this", "->", "addToProperty", "(", "\"class\"", ",", "$", "icon", ")", ";", "return", "$", "this", "->", "addToMember", "(", "$", "this", "->", "_icon", ",", "$", "icon", ")", ";", "}" ]
adds an icon in icon element @param string $icon @return HtmlIcon
[ "adds", "an", "icon", "in", "icon", "element" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/html/elements/HtmlIcon.php#L45-L48
train
nelmio/NelmioSolariumBundle
src/ClientRegistry.php
ClientRegistry.getClient
public function getClient($name = null) { if (null === $name) { $name = $this->defaultClientName; } if (in_array($name, $this->getClientNames())) { return $this->clients[$name]; } throw new \InvalidArgumentException(($name === null ? 'default client' : 'client ' . $name) . ' not configured'); }
php
public function getClient($name = null) { if (null === $name) { $name = $this->defaultClientName; } if (in_array($name, $this->getClientNames())) { return $this->clients[$name]; } throw new \InvalidArgumentException(($name === null ? 'default client' : 'client ' . $name) . ' not configured'); }
[ "public", "function", "getClient", "(", "$", "name", "=", "null", ")", "{", "if", "(", "null", "===", "$", "name", ")", "{", "$", "name", "=", "$", "this", "->", "defaultClientName", ";", "}", "if", "(", "in_array", "(", "$", "name", ",", "$", "this", "->", "getClientNames", "(", ")", ")", ")", "{", "return", "$", "this", "->", "clients", "[", "$", "name", "]", ";", "}", "throw", "new", "\\", "InvalidArgumentException", "(", "(", "$", "name", "===", "null", "?", "'default client'", ":", "'client '", ".", "$", "name", ")", ".", "' not configured'", ")", ";", "}" ]
Gets the named client. @param string $name The client name (null for the default one). @throws \InvalidArgumentException @return Client
[ "Gets", "the", "named", "client", "." ]
0752cf003bd936af19b4947c9f829ce5db1825bf
https://github.com/nelmio/NelmioSolariumBundle/blob/0752cf003bd936af19b4947c9f829ce5db1825bf/src/ClientRegistry.php#L46-L57
train
phpMv/phpMv-UI
Ajax/common/traits/JsUtilsActionsTrait.php
JsUtilsActionsTrait._showHideWithEffect
protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { $element=Javascript::prep_element($element); $speed=$this->_validate_speed($speed); if ($callback!='') { $callback=", function(){\n{$callback}\n}"; } $str="$({$element}).{$action}({$speed}{$callback});"; if ($immediatly) $this->jquery_code_for_compile[]=$str; return $str; }
php
protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { $element=Javascript::prep_element($element); $speed=$this->_validate_speed($speed); if ($callback!='') { $callback=", function(){\n{$callback}\n}"; } $str="$({$element}).{$action}({$speed}{$callback});"; if ($immediatly) $this->jquery_code_for_compile[]=$str; return $str; }
[ "protected", "function", "_showHideWithEffect", "(", "$", "action", ",", "$", "element", "=", "'this'", ",", "$", "speed", "=", "''", ",", "$", "callback", "=", "''", ",", "$", "immediatly", "=", "false", ")", "{", "$", "element", "=", "Javascript", "::", "prep_element", "(", "$", "element", ")", ";", "$", "speed", "=", "$", "this", "->", "_validate_speed", "(", "$", "speed", ")", ";", "if", "(", "$", "callback", "!=", "''", ")", "{", "$", "callback", "=", "\", function(){\\n{$callback}\\n}\"", ";", "}", "$", "str", "=", "\"$({$element}).{$action}({$speed}{$callback});\"", ";", "if", "(", "$", "immediatly", ")", "$", "this", "->", "jquery_code_for_compile", "[", "]", "=", "$", "str", ";", "return", "$", "str", ";", "}" ]
show or hide with effect @param string $action @param string $element element @param string $speed One of 'slow', 'normal', 'fast', or time in milliseconds @param string $callback Javascript callback function @param boolean $immediatly defers the execution if set to false @return string
[ "show", "or", "hide", "with", "effect" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/common/traits/JsUtilsActionsTrait.php#L25-L35
train
phpMv/phpMv-UI
Ajax/common/traits/JsUtilsActionsTrait.php
JsUtilsActionsTrait._validate_speed
private function _validate_speed($speed) { if (in_array($speed, array ( 'slow','normal','fast' ))) { $speed='"'.$speed.'"'; } elseif (preg_match("/[^0-9]/", $speed)) { $speed=''; } return $speed; }
php
private function _validate_speed($speed) { if (in_array($speed, array ( 'slow','normal','fast' ))) { $speed='"'.$speed.'"'; } elseif (preg_match("/[^0-9]/", $speed)) { $speed=''; } return $speed; }
[ "private", "function", "_validate_speed", "(", "$", "speed", ")", "{", "if", "(", "in_array", "(", "$", "speed", ",", "array", "(", "'slow'", ",", "'normal'", ",", "'fast'", ")", ")", ")", "{", "$", "speed", "=", "'\"'", ".", "$", "speed", ".", "'\"'", ";", "}", "elseif", "(", "preg_match", "(", "\"/[^0-9]/\"", ",", "$", "speed", ")", ")", "{", "$", "speed", "=", "''", ";", "}", "return", "$", "speed", ";", "}" ]
Ensures the speed parameter is valid for jQuery @param string|int $speed @return string
[ "Ensures", "the", "speed", "parameter", "is", "valid", "for", "jQuery" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/common/traits/JsUtilsActionsTrait.php#L41-L51
train
phpMv/phpMv-UI
Ajax/common/traits/JsUtilsActionsTrait.php
JsUtilsActionsTrait.toggle
public function toggle($element='this', $speed='', $callback='', $immediatly=false) { return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); }
php
public function toggle($element='this', $speed='', $callback='', $immediatly=false) { return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); }
[ "public", "function", "toggle", "(", "$", "element", "=", "'this'", ",", "$", "speed", "=", "''", ",", "$", "callback", "=", "''", ",", "$", "immediatly", "=", "false", ")", "{", "return", "$", "this", "->", "_showHideWithEffect", "(", "\"toggle\"", ",", "$", "element", ",", "$", "speed", ",", "$", "callback", ",", "$", "immediatly", ")", ";", "}" ]
Execute a javascript library toggle action @param string $element element @param string $speed One of 'slow', 'normal', 'fast', or time in milliseconds @param string $callback Javascript callback function @param boolean $immediatly defers the execution if set to false @return string
[ "Execute", "a", "javascript", "library", "toggle", "action" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/common/traits/JsUtilsActionsTrait.php#L319-L321
train
phpMv/phpMv-UI
Ajax/semantic/traits/SemanticHtmlModulesTrait.php
SemanticHtmlModulesTrait.htmlModal
public function htmlModal($identifier, $header="", $content="", $actions=array()) { return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); }
php
public function htmlModal($identifier, $header="", $content="", $actions=array()) { return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); }
[ "public", "function", "htmlModal", "(", "$", "identifier", ",", "$", "header", "=", "\"\"", ",", "$", "content", "=", "\"\"", ",", "$", "actions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlModal", "(", "$", "identifier", ",", "$", "header", ",", "$", "content", ",", "$", "actions", ")", ")", ";", "}" ]
Returns a new semantic modal dialog @param string $identifier @param string $header @param string $content @param array $actions @return HtmlModal
[ "Returns", "a", "new", "semantic", "modal", "dialog" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/semantic/traits/SemanticHtmlModulesTrait.php#L102-L104
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.dialog
public function dialog($attachTo=NULL, $params=NULL) { return $this->addComponent(new Dialog($this->js), $attachTo, $params); }
php
public function dialog($attachTo=NULL, $params=NULL) { return $this->addComponent(new Dialog($this->js), $attachTo, $params); }
[ "public", "function", "dialog", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Dialog", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Dialog @return Dialog
[ "Retourne", "un", "composant", "Dialog" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L39-L41
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.accordion
public function accordion($attachTo=NULL, $params=NULL) { return $this->addComponent(new Accordion($this->js), $attachTo, $params); }
php
public function accordion($attachTo=NULL, $params=NULL) { return $this->addComponent(new Accordion($this->js), $attachTo, $params); }
[ "public", "function", "accordion", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Accordion", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Accordion @return Accordion
[ "Retourne", "un", "composant", "Accordion" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L47-L49
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.menu
public function menu($attachTo=NULL, $params=NULL) { return $this->addComponent(new Menu($this->js), $attachTo, $params); }
php
public function menu($attachTo=NULL, $params=NULL) { return $this->addComponent(new Menu($this->js), $attachTo, $params); }
[ "public", "function", "menu", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Menu", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Menu @return Menu
[ "Retourne", "un", "composant", "Menu" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L55-L57
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.progressbar
public function progressbar($attachTo=NULL, $params=NULL) { return $this->addComponent(new Progressbar($this->js), $attachTo, $params); }
php
public function progressbar($attachTo=NULL, $params=NULL) { return $this->addComponent(new Progressbar($this->js), $attachTo, $params); }
[ "public", "function", "progressbar", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Progressbar", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Progressbar @return Progressbar
[ "Retourne", "un", "composant", "Progressbar" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L63-L65
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.selectmenu
public function selectmenu($attachTo=NULL, $params=NULL) { return $this->addComponent(new Selectmenu($this->js), $attachTo, $params); }
php
public function selectmenu($attachTo=NULL, $params=NULL) { return $this->addComponent(new Selectmenu($this->js), $attachTo, $params); }
[ "public", "function", "selectmenu", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Selectmenu", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Selectmenu @return Selectmenu
[ "Retourne", "un", "composant", "Selectmenu" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L71-L73
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.slider
public function slider($attachTo=NULL, $params=NULL) { return $this->addComponent(new Slider($this->js), $attachTo, $params); }
php
public function slider($attachTo=NULL, $params=NULL) { return $this->addComponent(new Slider($this->js), $attachTo, $params); }
[ "public", "function", "slider", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Slider", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Slider @return Slider
[ "Retourne", "un", "composant", "Slider" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L79-L81
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.spinner
public function spinner($attachTo=NULL, $params=NULL) { return $this->addComponent(new Spinner($this->js), $attachTo, $params); }
php
public function spinner($attachTo=NULL, $params=NULL) { return $this->addComponent(new Spinner($this->js), $attachTo, $params); }
[ "public", "function", "spinner", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Spinner", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Spinner @return Spinner
[ "Retourne", "un", "composant", "Spinner" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L87-L89
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.autocomplete
public function autocomplete($attachTo=NULL, $params=NULL) { return $this->addComponent(new Autocomplete($this->js), $attachTo, $params); }
php
public function autocomplete($attachTo=NULL, $params=NULL) { return $this->addComponent(new Autocomplete($this->js), $attachTo, $params); }
[ "public", "function", "autocomplete", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Autocomplete", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Retourne un composant Autocomplete @return Autocomplete
[ "Retourne", "un", "composant", "Autocomplete" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L95-L97
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.tabs
public function tabs($attachTo=NULL, $params=NULL) { return $this->addComponent(new Tabs($this->js), $attachTo, $params); }
php
public function tabs($attachTo=NULL, $params=NULL) { return $this->addComponent(new Tabs($this->js), $attachTo, $params); }
[ "public", "function", "tabs", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Tabs", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Create and return a Tabs component @return Tabs
[ "Create", "and", "return", "a", "Tabs", "component" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L103-L105
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.button
public function button($attachTo=NULL, $params=NULL) { return $this->addComponent(new Button($this->js), $attachTo, $params); }
php
public function button($attachTo=NULL, $params=NULL) { return $this->addComponent(new Button($this->js), $attachTo, $params); }
[ "public", "function", "button", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Button", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Create and return a Button component @param string $attachTo css/jquery selector attached to the component @param array $params php array of parameters @return Button
[ "Create", "and", "return", "a", "Button", "component" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L113-L115
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.buttonSet
public function buttonSet($attachTo=NULL, $params=NULL) { return $this->addComponent(new Buttonset($this->js), $attachTo, $params); }
php
public function buttonSet($attachTo=NULL, $params=NULL) { return $this->addComponent(new Buttonset($this->js), $attachTo, $params); }
[ "public", "function", "buttonSet", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Buttonset", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Create and return a ButtonSet component @param string $attachTo css/jquery selector attached to the component @param array $params php array of parameters @return ButtonSet
[ "Create", "and", "return", "a", "ButtonSet", "component" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L123-L125
train
phpMv/phpMv-UI
Ajax/JqueryUI.php
JqueryUI.tooltip
public function tooltip($attachTo=NULL, $params=NULL) { return $this->addComponent(new Tooltip($this->js), $attachTo, $params); }
php
public function tooltip($attachTo=NULL, $params=NULL) { return $this->addComponent(new Tooltip($this->js), $attachTo, $params); }
[ "public", "function", "tooltip", "(", "$", "attachTo", "=", "NULL", ",", "$", "params", "=", "NULL", ")", "{", "return", "$", "this", "->", "addComponent", "(", "new", "Tooltip", "(", "$", "this", "->", "js", ")", ",", "$", "attachTo", ",", "$", "params", ")", ";", "}" ]
Create and return a Tooltip component @param string $attachTo css/jquery selector attached to the component @param array $params php array of parameters @return Tooltip
[ "Create", "and", "return", "a", "Tooltip", "component" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/JqueryUI.php#L133-L135
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlButton
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); }
php
public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) { return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); }
[ "public", "function", "htmlButton", "(", "$", "identifier", ",", "$", "value", "=", "\"\"", ",", "$", "cssStyle", "=", "null", ",", "$", "onClick", "=", "null", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlButton", "(", "$", "identifier", ",", "$", "value", ",", "$", "cssStyle", ",", "$", "onClick", ")", ")", ";", "}" ]
Return a new Bootstrap Html Button @param string $identifier @param string $value @param string $cssStyle @param string $onClick @return HtmlButton
[ "Return", "a", "new", "Bootstrap", "Html", "Button" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L42-L44
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlGlyphButton
public function htmlGlyphButton($identifier, $glyphIcon=0, $value="", $cssStyle=NULL, $onClick=NULL) { return $this->addHtmlComponent(new HtmlGlyphButton($identifier, $glyphIcon, $value, $cssStyle, $onClick)); }
php
public function htmlGlyphButton($identifier, $glyphIcon=0, $value="", $cssStyle=NULL, $onClick=NULL) { return $this->addHtmlComponent(new HtmlGlyphButton($identifier, $glyphIcon, $value, $cssStyle, $onClick)); }
[ "public", "function", "htmlGlyphButton", "(", "$", "identifier", ",", "$", "glyphIcon", "=", "0", ",", "$", "value", "=", "\"\"", ",", "$", "cssStyle", "=", "NULL", ",", "$", "onClick", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlGlyphButton", "(", "$", "identifier", ",", "$", "glyphIcon", ",", "$", "value", ",", "$", "cssStyle", ",", "$", "onClick", ")", ")", ";", "}" ]
Return a new Bootstrap Html Glyphbutton @param string $identifier @param mixed $glyphIcon @param string $value @param string $cssStyle @param string $onClick @return HtmlGlyphButton
[ "Return", "a", "new", "Bootstrap", "Html", "Glyphbutton" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L55-L57
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlButtongroups
public function htmlButtongroups($identifier, $values=array(), $cssStyle=NULL, $size=NULL) { return $this->addHtmlComponent(new HtmlButtongroups($identifier, $values, $cssStyle, $size)); }
php
public function htmlButtongroups($identifier, $values=array(), $cssStyle=NULL, $size=NULL) { return $this->addHtmlComponent(new HtmlButtongroups($identifier, $values, $cssStyle, $size)); }
[ "public", "function", "htmlButtongroups", "(", "$", "identifier", ",", "$", "values", "=", "array", "(", ")", ",", "$", "cssStyle", "=", "NULL", ",", "$", "size", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlButtongroups", "(", "$", "identifier", ",", "$", "values", ",", "$", "cssStyle", ",", "$", "size", ")", ")", ";", "}" ]
Return a new Bootstrap Html Buttongroups @param string $identifier @param array $values @param string $cssStyle @param string $size @return HtmlButtongroups
[ "Return", "a", "new", "Bootstrap", "Html", "Buttongroups" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L67-L69
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlNavbar
public function htmlNavbar($identifier, $brand="Brand", $brandHref="#") { return $this->addHtmlComponent(new HtmlNavbar($identifier, $brand, $brandHref)); }
php
public function htmlNavbar($identifier, $brand="Brand", $brandHref="#") { return $this->addHtmlComponent(new HtmlNavbar($identifier, $brand, $brandHref)); }
[ "public", "function", "htmlNavbar", "(", "$", "identifier", ",", "$", "brand", "=", "\"Brand\"", ",", "$", "brandHref", "=", "\"#\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlNavbar", "(", "$", "identifier", ",", "$", "brand", ",", "$", "brandHref", ")", ")", ";", "}" ]
Return a new Bootstrap Html Navbar @param string $identifier @param string $brand @param string $brandHref @return HtmlNavbar
[ "Return", "a", "new", "Bootstrap", "Html", "Navbar" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L102-L104
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlProgressbar
public function htmlProgressbar($identifier, $style="info", $value=0, $max=100, $min=0) { return $this->addHtmlComponent(new HtmlProgressbar($identifier, $style, $value, $max, $min)); }
php
public function htmlProgressbar($identifier, $style="info", $value=0, $max=100, $min=0) { return $this->addHtmlComponent(new HtmlProgressbar($identifier, $style, $value, $max, $min)); }
[ "public", "function", "htmlProgressbar", "(", "$", "identifier", ",", "$", "style", "=", "\"info\"", ",", "$", "value", "=", "0", ",", "$", "max", "=", "100", ",", "$", "min", "=", "0", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlProgressbar", "(", "$", "identifier", ",", "$", "style", ",", "$", "value", ",", "$", "max", ",", "$", "min", ")", ")", ";", "}" ]
Return a new Bootstrap Html Progressbar @param string $identifier @param string $value @param string $max @param string $min @return HtmlProgressbar
[ "Return", "a", "new", "Bootstrap", "Html", "Progressbar" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L114-L116
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlPanel
public function htmlPanel($identifier, $content=NULL, $header=NULL, $footer=NULL) { return $this->addHtmlComponent(new HtmlPanel($identifier, $content, $header, $footer)); }
php
public function htmlPanel($identifier, $content=NULL, $header=NULL, $footer=NULL) { return $this->addHtmlComponent(new HtmlPanel($identifier, $content, $header, $footer)); }
[ "public", "function", "htmlPanel", "(", "$", "identifier", ",", "$", "content", "=", "NULL", ",", "$", "header", "=", "NULL", ",", "$", "footer", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlPanel", "(", "$", "identifier", ",", "$", "content", ",", "$", "header", ",", "$", "footer", ")", ")", ";", "}" ]
Return a new Bootstrap Html Panel @param string $identifier the Html identifier of the element @param mixed $content the panel content (string or HtmlComponent) @param string $header the header @param string $footer the footer @return HtmlPanel
[ "Return", "a", "new", "Bootstrap", "Html", "Panel" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L126-L128
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlAlert
public function htmlAlert($identifier, $message=NULL, $cssStyle="alert-warning") { return $this->addHtmlComponent(new HtmlAlert($identifier, $message, $cssStyle)); }
php
public function htmlAlert($identifier, $message=NULL, $cssStyle="alert-warning") { return $this->addHtmlComponent(new HtmlAlert($identifier, $message, $cssStyle)); }
[ "public", "function", "htmlAlert", "(", "$", "identifier", ",", "$", "message", "=", "NULL", ",", "$", "cssStyle", "=", "\"alert-warning\"", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlAlert", "(", "$", "identifier", ",", "$", "message", ",", "$", "cssStyle", ")", ")", ";", "}" ]
Return a new Bootstrap Html Alert @param string $identifier @param string $message @param string $cssStyle @return HtmlAlert
[ "Return", "a", "new", "Bootstrap", "Html", "Alert" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L137-L139
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlListgroup
public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ $listGroup=new HtmlListgroup($identifier,$tagName); $listGroup->addItems($items); return $this->addHtmlComponent($listGroup); }
php
public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ $listGroup=new HtmlListgroup($identifier,$tagName); $listGroup->addItems($items); return $this->addHtmlComponent($listGroup); }
[ "public", "function", "htmlListgroup", "(", "$", "identifier", ",", "$", "items", "=", "array", "(", ")", ",", "$", "tagName", "=", "\"ul\"", ")", "{", "$", "listGroup", "=", "new", "HtmlListgroup", "(", "$", "identifier", ",", "$", "tagName", ")", ";", "$", "listGroup", "->", "addItems", "(", "$", "items", ")", ";", "return", "$", "this", "->", "addHtmlComponent", "(", "$", "listGroup", ")", ";", "}" ]
Return a new Bootstrap Html listGroup @param string $identifier @param array $items array of items to add @param string $tagName container tagName @return HtmlListgroup
[ "Return", "a", "new", "Bootstrap", "Html", "listGroup" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L175-L179
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlModal
public function htmlModal($identifier, $title="", $content="", $buttonCaptions=array()) { return $this->addHtmlComponent(new HtmlModal($identifier, $title, $content, $buttonCaptions)); }
php
public function htmlModal($identifier, $title="", $content="", $buttonCaptions=array()) { return $this->addHtmlComponent(new HtmlModal($identifier, $title, $content, $buttonCaptions)); }
[ "public", "function", "htmlModal", "(", "$", "identifier", ",", "$", "title", "=", "\"\"", ",", "$", "content", "=", "\"\"", ",", "$", "buttonCaptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlModal", "(", "$", "identifier", ",", "$", "title", ",", "$", "content", ",", "$", "buttonCaptions", ")", ")", ";", "}" ]
Return a new Bootstrap Html modal dialog @param string $identifier @param string $title @param string $content @param array $buttonCaptions @return HtmlModal
[ "Return", "a", "new", "Bootstrap", "Html", "modal", "dialog" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L188-L190
train
phpMv/phpMv-UI
Ajax/Bootstrap.php
Bootstrap.htmlSplitbutton
public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); }
php
public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); }
[ "public", "function", "htmlSplitbutton", "(", "$", "identifier", ",", "$", "value", "=", "\"\"", ",", "$", "items", "=", "array", "(", ")", ",", "$", "cssStyle", "=", "\"btn-default\"", ",", "$", "onClick", "=", "NULL", ")", "{", "return", "$", "this", "->", "addHtmlComponent", "(", "new", "HtmlSplitbutton", "(", "$", "identifier", ",", "$", "value", ",", "$", "items", ",", "$", "cssStyle", ",", "$", "onClick", ")", ")", ";", "}" ]
Return a new Bootstrap Html SplitButton @param string $identifier @param string $value @param array $items @param string $cssStyle @param string $onClick @return HtmlSplitbutton
[ "Return", "a", "new", "Bootstrap", "Html", "SplitButton" ]
1fb59e44082756e6750e647c76b4ec13c04ddc16
https://github.com/phpMv/phpMv-UI/blob/1fb59e44082756e6750e647c76b4ec13c04ddc16/Ajax/Bootstrap.php#L201-L203
train