id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
187,800 | lexik/LexikPayboxBundle | Controller/DefaultController.php | DefaultController.ipnAction | public function ipnAction()
{
$payboxResponse = $this->container->get('lexik_paybox.response_handler');
$result = $payboxResponse->verifySignature();
return new Response($result ? 'OK' : 'KO');
} | php | public function ipnAction()
{
$payboxResponse = $this->container->get('lexik_paybox.response_handler');
$result = $payboxResponse->verifySignature();
return new Response($result ? 'OK' : 'KO');
} | [
"public",
"function",
"ipnAction",
"(",
")",
"{",
"$",
"payboxResponse",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'lexik_paybox.response_handler'",
")",
";",
"$",
"result",
"=",
"$",
"payboxResponse",
"->",
"verifySignature",
"(",
")",
";",
"r... | Instant Payment Notification action.
Here, presentation is anecdotal, the requesting server only looks at the http status.
@return Response | [
"Instant",
"Payment",
"Notification",
"action",
".",
"Here",
"presentation",
"is",
"anecdotal",
"the",
"requesting",
"server",
"only",
"looks",
"at",
"the",
"http",
"status",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Controller/DefaultController.php#L24-L30 |
187,801 | lexik/LexikPayboxBundle | Paybox/System/Base/Response.php | Response.getRequestParameters | protected function getRequestParameters()
{
if ($this->request->isMethod('POST')) {
$parameters = $this->request->request;
} else {
$parameters = $this->request->query;
}
return $parameters;
} | php | protected function getRequestParameters()
{
if ($this->request->isMethod('POST')) {
$parameters = $this->request->request;
} else {
$parameters = $this->request->query;
}
return $parameters;
} | [
"protected",
"function",
"getRequestParameters",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"isMethod",
"(",
"'POST'",
")",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"request",
"->",
"request",
";",
"}",
"else",
"{",
"$",
... | Returns the GET or POST parameters form the request.
@return ParameterBag | [
"Returns",
"the",
"GET",
"or",
"POST",
"parameters",
"form",
"the",
"request",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Response.php#L75-L84 |
187,802 | lexik/LexikPayboxBundle | Paybox/System/Base/Response.php | Response.initSignature | protected function initSignature()
{
if (!$this->getRequestParameters()->has($this->parameters['hmac']['signature_name'])) {
$this->logger->error('Payment signature not set.');
return false;
}
$signature = $this->getRequestParameters()->get($this->parameters['hmac']... | php | protected function initSignature()
{
if (!$this->getRequestParameters()->has($this->parameters['hmac']['signature_name'])) {
$this->logger->error('Payment signature not set.');
return false;
}
$signature = $this->getRequestParameters()->get($this->parameters['hmac']... | [
"protected",
"function",
"initSignature",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getRequestParameters",
"(",
")",
"->",
"has",
"(",
"$",
"this",
"->",
"parameters",
"[",
"'hmac'",
"]",
"[",
"'signature_name'",
"]",
")",
")",
"{",
"$",
"this... | Gets the signature set in the http request.
Paybox documentation says :
The Paybox signature is created by encrypting a SHA-1 hash with the private Paybox RSA key. The size
of a SHA-1 hash is 160 bits and the size of the Paybox key is 1024 bits. The signature is always a binary
value of fixed 128 bytes size (172 bytes... | [
"Gets",
"the",
"signature",
"set",
"in",
"the",
"http",
"request",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Response.php#L96-L125 |
187,803 | lexik/LexikPayboxBundle | Paybox/System/Base/Response.php | Response.initData | protected function initData()
{
foreach ($this->getRequestParameters() as $key => $value) {
$this->logger->info(sprintf('%s=%s', $key, $value));
if ($this->parameters['hmac']['signature_name'] !== $key) {
$this->data[$key] = urlencode($value);
}
}... | php | protected function initData()
{
foreach ($this->getRequestParameters() as $key => $value) {
$this->logger->info(sprintf('%s=%s', $key, $value));
if ($this->parameters['hmac']['signature_name'] !== $key) {
$this->data[$key] = urlencode($value);
}
}... | [
"protected",
"function",
"initData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getRequestParameters",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"sprintf",
"(",
"'%s=%s'",
",",
"... | Concatenates all parameters set in the http request. | [
"Concatenates",
"all",
"parameters",
"set",
"in",
"the",
"http",
"request",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Response.php#L130-L139 |
187,804 | lexik/LexikPayboxBundle | Paybox/System/Base/Response.php | Response.verifySignature | public function verifySignature()
{
$this->logger->info('New IPN call.');
$this->initData();
$this->initSignature();
$file = fopen($this->parameters['public_key'], 'r');
$cert = fread($file, 1024);
fclose($file);
$publicKey = openssl_pkey_get_public($cert);... | php | public function verifySignature()
{
$this->logger->info('New IPN call.');
$this->initData();
$this->initSignature();
$file = fopen($this->parameters['public_key'], 'r');
$cert = fread($file, 1024);
fclose($file);
$publicKey = openssl_pkey_get_public($cert);... | [
"public",
"function",
"verifySignature",
"(",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'New IPN call.'",
")",
";",
"$",
"this",
"->",
"initData",
"(",
")",
";",
"$",
"this",
"->",
"initSignature",
"(",
")",
";",
"$",
"file",
"=",
"f... | Verifies the validity of the signature.
@return bool | [
"Verifies",
"the",
"validity",
"of",
"the",
"signature",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Response.php#L146-L185 |
187,805 | euskadi31/CorsServiceProvider | src/Provider/CorsServiceProvider.php | CorsServiceProvider.createOptionsRoutes | private function createOptionsRoutes(Application $app)
{
foreach ($app['cors.allowed_methods'] as $path => $route) {
$app->match($path, new Cors\OptionsController($route['methods']))
->setRequirements($route['requirements'])
->method('OPTIONS');
}
} | php | private function createOptionsRoutes(Application $app)
{
foreach ($app['cors.allowed_methods'] as $path => $route) {
$app->match($path, new Cors\OptionsController($route['methods']))
->setRequirements($route['requirements'])
->method('OPTIONS');
}
} | [
"private",
"function",
"createOptionsRoutes",
"(",
"Application",
"$",
"app",
")",
"{",
"foreach",
"(",
"$",
"app",
"[",
"'cors.allowed_methods'",
"]",
"as",
"$",
"path",
"=>",
"$",
"route",
")",
"{",
"$",
"app",
"->",
"match",
"(",
"$",
"path",
",",
"... | Create options route
@param Application $app
@return void | [
"Create",
"options",
"route"
] | 6169e66bec79cbd80c918b6e65c8af91997f7683 | https://github.com/euskadi31/CorsServiceProvider/blob/6169e66bec79cbd80c918b6e65c8af91997f7683/src/Provider/CorsServiceProvider.php#L98-L105 |
187,806 | lexik/LexikPayboxBundle | Paybox/System/Base/Request.php | Request.getParameters | public function getParameters()
{
if (null === $this->getParameter('PBX_HMAC')) {
$this->setParameter('PBX_TIME', date('c'));
$this->setParameter('PBX_HMAC', strtoupper($this->computeHmac()));
}
$resolver = new ParameterResolver($this->globals['currencies']);
... | php | public function getParameters()
{
if (null === $this->getParameter('PBX_HMAC')) {
$this->setParameter('PBX_TIME', date('c'));
$this->setParameter('PBX_HMAC', strtoupper($this->computeHmac()));
}
$resolver = new ParameterResolver($this->globals['currencies']);
... | [
"public",
"function",
"getParameters",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getParameter",
"(",
"'PBX_HMAC'",
")",
")",
"{",
"$",
"this",
"->",
"setParameter",
"(",
"'PBX_TIME'",
",",
"date",
"(",
"'c'",
")",
")",
";",
"$",
"t... | Returns all parameters set for a payment.
@return array | [
"Returns",
"all",
"parameters",
"set",
"for",
"a",
"payment",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Request.php#L127-L137 |
187,807 | lexik/LexikPayboxBundle | Paybox/System/Base/Request.php | Request.getForm | public function getForm($options = array())
{
$options['csrf_protection'] = false;
$parameters = $this->getParameters();
// If symfony version is >=2.8 then we use the FQCN for form types
// Else we use the IDs.
if (method_exists('Symfony\Component\Form\AbstractType', 'getBl... | php | public function getForm($options = array())
{
$options['csrf_protection'] = false;
$parameters = $this->getParameters();
// If symfony version is >=2.8 then we use the FQCN for form types
// Else we use the IDs.
if (method_exists('Symfony\Component\Form\AbstractType', 'getBl... | [
"public",
"function",
"getForm",
"(",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"[",
"'csrf_protection'",
"]",
"=",
"false",
";",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getParameters",
"(",
")",
";",
"// If symfony version is >... | Returns a form with defined parameters.
@param array $options
@return Form | [
"Returns",
"a",
"form",
"with",
"defined",
"parameters",
"."
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Paybox/System/Base/Request.php#L146-L171 |
187,808 | lexik/LexikPayboxBundle | Transport/AbstractTransport.php | AbstractTransport.checkEndpoint | protected function checkEndpoint()
{
if ($this->endpoint == '' || null === $this->endpoint || empty($this->endpoint)) {
throw new \RunTimeException('No endpoint defined.');
}
} | php | protected function checkEndpoint()
{
if ($this->endpoint == '' || null === $this->endpoint || empty($this->endpoint)) {
throw new \RunTimeException('No endpoint defined.');
}
} | [
"protected",
"function",
"checkEndpoint",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"endpoint",
"==",
"''",
"||",
"null",
"===",
"$",
"this",
"->",
"endpoint",
"||",
"empty",
"(",
"$",
"this",
"->",
"endpoint",
")",
")",
"{",
"throw",
"new",
"\\",... | Perform a call
@throws \RuntimeException If no endpoint defined | [
"Perform",
"a",
"call"
] | ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac | https://github.com/lexik/LexikPayboxBundle/blob/ffa35cc2753e69d8b3151aecc5e5b9199fd9c2ac/Transport/AbstractTransport.php#L62-L67 |
187,809 | chronon/CakePHP-StripeComponent-Plugin | Controller/Component/StripeComponent.php | StripeComponent.customerRetrieve | public function customerRetrieve($id) {
Stripe::setApiKey($this->key);
$customer = false;
try {
$customer = Stripe_Customer::retrieve($id);
} catch (Exception $e) {
return false;
}
return $customer;
} | php | public function customerRetrieve($id) {
Stripe::setApiKey($this->key);
$customer = false;
try {
$customer = Stripe_Customer::retrieve($id);
} catch (Exception $e) {
return false;
}
return $customer;
} | [
"public",
"function",
"customerRetrieve",
"(",
"$",
"id",
")",
"{",
"Stripe",
"::",
"setApiKey",
"(",
"$",
"this",
"->",
"key",
")",
";",
"$",
"customer",
"=",
"false",
";",
"try",
"{",
"$",
"customer",
"=",
"Stripe_Customer",
"::",
"retrieve",
"(",
"$... | The customerRetrieve method gets a customer object for viewing, updating, or
deleting.
@param string $id Must be an existing customer id.
@return object $customer if success, boolean false if failure or not found. | [
"The",
"customerRetrieve",
"method",
"gets",
"a",
"customer",
"object",
"for",
"viewing",
"updating",
"or",
"deleting",
"."
] | cc6fec6e829041a7687a57ec4c9e4623c11e8648 | https://github.com/chronon/CakePHP-StripeComponent-Plugin/blob/cc6fec6e829041a7687a57ec4c9e4623c11e8648/Controller/Component/StripeComponent.php#L288-L298 |
187,810 | chronon/CakePHP-StripeComponent-Plugin | Controller/Component/StripeComponent.php | StripeComponent._formatResult | protected function _formatResult($response) {
$result = array();
foreach ($this->fields as $local => $stripe) {
if (is_array($stripe)) {
foreach ($stripe as $obj => $field) {
if (isset($response->$obj->$field)) {
$result[$local] = $response->$obj->$field;
}
}
} else {
if (isset($re... | php | protected function _formatResult($response) {
$result = array();
foreach ($this->fields as $local => $stripe) {
if (is_array($stripe)) {
foreach ($stripe as $obj => $field) {
if (isset($response->$obj->$field)) {
$result[$local] = $response->$obj->$field;
}
}
} else {
if (isset($re... | [
"protected",
"function",
"_formatResult",
"(",
"$",
"response",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"local",
"=>",
"$",
"stripe",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"... | Returns an array of fields we want from Stripe's response objects
@param object $response A successful response object from this component.
@return array The desired fields from the response object as an array. | [
"Returns",
"an",
"array",
"of",
"fields",
"we",
"want",
"from",
"Stripe",
"s",
"response",
"objects"
] | cc6fec6e829041a7687a57ec4c9e4623c11e8648 | https://github.com/chronon/CakePHP-StripeComponent-Plugin/blob/cc6fec6e829041a7687a57ec4c9e4623c11e8648/Controller/Component/StripeComponent.php#L307-L327 |
187,811 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.sendText | function sendText ( $to, $from, $message, $unicode=null ) {
// Making sure strings are UTF-8 encoded
if ( !is_numeric($from) && !mb_check_encoding($from, 'UTF-8') ) {
trigger_error('$from needs to be a valid UTF-8 encoded string');
return false;
}
if ( !mb_check_encoding($message, 'UTF-8') ) {
... | php | function sendText ( $to, $from, $message, $unicode=null ) {
// Making sure strings are UTF-8 encoded
if ( !is_numeric($from) && !mb_check_encoding($from, 'UTF-8') ) {
trigger_error('$from needs to be a valid UTF-8 encoded string');
return false;
}
if ( !mb_check_encoding($message, 'UTF-8') ) {
... | [
"function",
"sendText",
"(",
"$",
"to",
",",
"$",
"from",
",",
"$",
"message",
",",
"$",
"unicode",
"=",
"null",
")",
"{",
"// Making sure strings are UTF-8 encoded\r",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"from",
")",
"&&",
"!",
"mb_check_encoding",
"(... | Prepare new text message.
If $unicode is not provided we will try to detect the
message type. Otherwise set to TRUE if you require
unicode characters. | [
"Prepare",
"new",
"text",
"message",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L73-L108 |
187,812 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.sendBinary | function sendBinary ( $to, $from, $body, $udh ) {
//Binary messages must be hex encoded
$body = bin2hex ( $body );
$udh = bin2hex ( $udh );
// Make sure $from is valid
$from = $this->validateOriginator($from);
// Send away!
$post = array(
'from' => $from,
'to' => $to,
'type' => '... | php | function sendBinary ( $to, $from, $body, $udh ) {
//Binary messages must be hex encoded
$body = bin2hex ( $body );
$udh = bin2hex ( $udh );
// Make sure $from is valid
$from = $this->validateOriginator($from);
// Send away!
$post = array(
'from' => $from,
'to' => $to,
'type' => '... | [
"function",
"sendBinary",
"(",
"$",
"to",
",",
"$",
"from",
",",
"$",
"body",
",",
"$",
"udh",
")",
"{",
"//Binary messages must be hex encoded\r",
"$",
"body",
"=",
"bin2hex",
"(",
"$",
"body",
")",
";",
"$",
"udh",
"=",
"bin2hex",
"(",
"$",
"udh",
... | Prepare new WAP message. | [
"Prepare",
"new",
"WAP",
"message",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L114-L133 |
187,813 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.pushWap | function pushWap ( $to, $from, $title, $url, $validity = 172800000 ) {
// Making sure $title and $url are UTF-8 encoded
if ( !mb_check_encoding($title, 'UTF-8') || !mb_check_encoding($url, 'UTF-8') ) {
trigger_error('$title and $udh need to be valid UTF-8 encoded strings');
return false;
}
// ... | php | function pushWap ( $to, $from, $title, $url, $validity = 172800000 ) {
// Making sure $title and $url are UTF-8 encoded
if ( !mb_check_encoding($title, 'UTF-8') || !mb_check_encoding($url, 'UTF-8') ) {
trigger_error('$title and $udh need to be valid UTF-8 encoded strings');
return false;
}
// ... | [
"function",
"pushWap",
"(",
"$",
"to",
",",
"$",
"from",
",",
"$",
"title",
",",
"$",
"url",
",",
"$",
"validity",
"=",
"172800000",
")",
"{",
"// Making sure $title and $url are UTF-8 encoded\r",
"if",
"(",
"!",
"mb_check_encoding",
"(",
"$",
"title",
",",
... | Prepare new binary message. | [
"Prepare",
"new",
"binary",
"message",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L139-L161 |
187,814 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.sendRequest | private function sendRequest ( $data ) {
// Build the post data
$data = array_merge($data, array('username' => $this->nx_key, 'password' => $this->nx_secret));
$post = '';
foreach($data as $k => $v){
$post .= "&$k=$v";
}
// If available, use CURL
if (function_exists('curl_version')) {
$... | php | private function sendRequest ( $data ) {
// Build the post data
$data = array_merge($data, array('username' => $this->nx_key, 'password' => $this->nx_secret));
$post = '';
foreach($data as $k => $v){
$post .= "&$k=$v";
}
// If available, use CURL
if (function_exists('curl_version')) {
$... | [
"private",
"function",
"sendRequest",
"(",
"$",
"data",
")",
"{",
"// Build the post data\r",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"data",
",",
"array",
"(",
"'username'",
"=>",
"$",
"this",
"->",
"nx_key",
",",
"'password'",
"=>",
"$",
"this",
"->",... | Prepare and send a new message. | [
"Prepare",
"and",
"send",
"a",
"new",
"message",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L167-L211 |
187,815 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.normaliseKeys | private function normaliseKeys ($obj) {
// Determine is working with a class or araay
if ($obj instanceof stdClass) {
$new_obj = new stdClass();
$is_obj = true;
} else {
$new_obj = array();
$is_obj = false;
}
foreach($obj as $key => $val){
// If we come across another class/array,... | php | private function normaliseKeys ($obj) {
// Determine is working with a class or araay
if ($obj instanceof stdClass) {
$new_obj = new stdClass();
$is_obj = true;
} else {
$new_obj = array();
$is_obj = false;
}
foreach($obj as $key => $val){
// If we come across another class/array,... | [
"private",
"function",
"normaliseKeys",
"(",
"$",
"obj",
")",
"{",
"// Determine is working with a class or araay\r",
"if",
"(",
"$",
"obj",
"instanceof",
"stdClass",
")",
"{",
"$",
"new_obj",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"is_obj",
"=",
"true",
... | Recursively normalise any key names in an object, removing unwanted characters | [
"Recursively",
"normalise",
"any",
"key",
"names",
"in",
"an",
"object",
"removing",
"unwanted",
"characters"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L217-L243 |
187,816 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.nexmoParse | private function nexmoParse ( $from_nexmo ) {
$response = json_decode($from_nexmo);
// Copy the response data into an object, removing any '-' characters from the key
$response_obj = $this->normaliseKeys($response);
if ($response_obj) {
$this->nexmo_response = $response_obj;
// Find the total ... | php | private function nexmoParse ( $from_nexmo ) {
$response = json_decode($from_nexmo);
// Copy the response data into an object, removing any '-' characters from the key
$response_obj = $this->normaliseKeys($response);
if ($response_obj) {
$this->nexmo_response = $response_obj;
// Find the total ... | [
"private",
"function",
"nexmoParse",
"(",
"$",
"from_nexmo",
")",
"{",
"$",
"response",
"=",
"json_decode",
"(",
"$",
"from_nexmo",
")",
";",
"// Copy the response data into an object, removing any '-' characters from the key\r",
"$",
"response_obj",
"=",
"$",
"this",
"... | Parse server response. | [
"Parse",
"server",
"response",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L249-L278 |
187,817 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.displayOverview | public function displayOverview( $nexmo_response=null ){
$info = (!$nexmo_response) ? $this->nexmo_response : $nexmo_response;
if (!$nexmo_response ) return 'Cannot display an overview of this response';
// How many messages were sent?
if ( $info->messagecount > 1 ) {
$status = 'Your message was... | php | public function displayOverview( $nexmo_response=null ){
$info = (!$nexmo_response) ? $this->nexmo_response : $nexmo_response;
if (!$nexmo_response ) return 'Cannot display an overview of this response';
// How many messages were sent?
if ( $info->messagecount > 1 ) {
$status = 'Your message was... | [
"public",
"function",
"displayOverview",
"(",
"$",
"nexmo_response",
"=",
"null",
")",
"{",
"$",
"info",
"=",
"(",
"!",
"$",
"nexmo_response",
")",
"?",
"$",
"this",
"->",
"nexmo_response",
":",
"$",
"nexmo_response",
";",
"if",
"(",
"!",
"$",
"nexmo_res... | Display a brief overview of a sent message.
Useful for debugging and quick-start purposes. | [
"Display",
"a",
"brief",
"overview",
"of",
"a",
"sent",
"message",
".",
"Useful",
"for",
"debugging",
"and",
"quick",
"-",
"start",
"purposes",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L315-L386 |
187,818 | prawnsalad/Nexmo-PHP-lib | src/NexmoMessage.php | NexmoMessage.reply | public function reply ($message) {
// Make sure we actually have a text to reply to
if (!$this->inbound_message) {
return false;
}
return $this->sendText($this->from, $this->to, $message);
} | php | public function reply ($message) {
// Make sure we actually have a text to reply to
if (!$this->inbound_message) {
return false;
}
return $this->sendText($this->from, $this->to, $message);
} | [
"public",
"function",
"reply",
"(",
"$",
"message",
")",
"{",
"// Make sure we actually have a text to reply to\r",
"if",
"(",
"!",
"$",
"this",
"->",
"inbound_message",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"sendText",
"(",
"$",
... | Reply the current message if one is set. | [
"Reply",
"the",
"current",
"message",
"if",
"one",
"is",
"set",
"."
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoMessage.php#L427-L434 |
187,819 | aws/aws-sdk-php-zf2 | src/Filter/File/S3RenameUpload.php | S3RenameUpload.getFinalTarget | protected function getFinalTarget($uploadData)
{
// We cannot upload without a bucket
if (null === $this->options['bucket']) {
throw new MissingBucketException('No bucket was set when trying to upload a file to S3');
}
// Get the tmp file name and convert it to an S3 key... | php | protected function getFinalTarget($uploadData)
{
// We cannot upload without a bucket
if (null === $this->options['bucket']) {
throw new MissingBucketException('No bucket was set when trying to upload a file to S3');
}
// Get the tmp file name and convert it to an S3 key... | [
"protected",
"function",
"getFinalTarget",
"(",
"$",
"uploadData",
")",
"{",
"// We cannot upload without a bucket",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"options",
"[",
"'bucket'",
"]",
")",
"{",
"throw",
"new",
"MissingBucketException",
"(",
"'No bucket ... | This method is overloaded so that the final target points to a URI using S3 protocol
{@inheritdoc} | [
"This",
"method",
"is",
"overloaded",
"so",
"that",
"the",
"final",
"target",
"points",
"to",
"a",
"URI",
"using",
"S3",
"protocol"
] | f766d29910375c089d74d42cb3ec44ea739e18b8 | https://github.com/aws/aws-sdk-php-zf2/blob/f766d29910375c089d74d42cb3ec44ea739e18b8/src/Filter/File/S3RenameUpload.php#L72-L86 |
187,820 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.balance | public function balance () {
if (!isset($this->cache['balance'])) {
$tmp = $this->apiCall('get_balance');
if (!$tmp['data']) return false;
$this->cache['balance'] = $tmp['data']['value'];
}
return (float)$this->cache['balance'];
} | php | public function balance () {
if (!isset($this->cache['balance'])) {
$tmp = $this->apiCall('get_balance');
if (!$tmp['data']) return false;
$this->cache['balance'] = $tmp['data']['value'];
}
return (float)$this->cache['balance'];
} | [
"public",
"function",
"balance",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"'balance'",
"]",
")",
")",
"{",
"$",
"tmp",
"=",
"$",
"this",
"->",
"apiCall",
"(",
"'get_balance'",
")",
";",
"if",
"(",
"!",
"$",
... | Return your account balance in Euros
@return float|bool | [
"Return",
"your",
"account",
"balance",
"in",
"Euros"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L49-L58 |
187,821 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.smsPricing | public function smsPricing ($country_code) {
$country_code = strtoupper($country_code);
if (!isset($this->cache['country_codes']))
$this->cache['country_codes'] = array();
if (!isset($this->cache['country_codes'][$country_code])) {
$tmp = $this->apiCall('get_pricing', array('country_code'=>$country_c... | php | public function smsPricing ($country_code) {
$country_code = strtoupper($country_code);
if (!isset($this->cache['country_codes']))
$this->cache['country_codes'] = array();
if (!isset($this->cache['country_codes'][$country_code])) {
$tmp = $this->apiCall('get_pricing', array('country_code'=>$country_c... | [
"public",
"function",
"smsPricing",
"(",
"$",
"country_code",
")",
"{",
"$",
"country_code",
"=",
"strtoupper",
"(",
"$",
"country_code",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"'country_codes'",
"]",
")",
")",
"$",
"t... | Find out the price to send a message to a country
@param $country_code Country code to return the SMS price for
@return float|bool | [
"Find",
"out",
"the",
"price",
"to",
"send",
"a",
"message",
"to",
"a",
"country"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L66-L80 |
187,822 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.getCountryDialingCode | public function getCountryDialingCode ($country_code) {
$country_code = strtoupper($country_code);
if (!isset($this->cache['country_codes']))
$this->cache['country_codes'] = array();
if (!isset($this->cache['country_codes'][$country_code])) {
$tmp = $this->apiCall('get_pricing', array('country_code'=... | php | public function getCountryDialingCode ($country_code) {
$country_code = strtoupper($country_code);
if (!isset($this->cache['country_codes']))
$this->cache['country_codes'] = array();
if (!isset($this->cache['country_codes'][$country_code])) {
$tmp = $this->apiCall('get_pricing', array('country_code'=... | [
"public",
"function",
"getCountryDialingCode",
"(",
"$",
"country_code",
")",
"{",
"$",
"country_code",
"=",
"strtoupper",
"(",
"$",
"country_code",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"'country_codes'",
"]",
")",
")",
... | Return a countries international dialing code
@param $country_code Country code to return the dialing code for
@return string|bool | [
"Return",
"a",
"countries",
"international",
"dialing",
"code"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L88-L102 |
187,823 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.numbersList | public function numbersList () {
if (!isset($this->cache['own_numbers'])) {
$tmp = $this->apiCall('get_own_numbers');
if (!$tmp['data']) return false;
$this->cache['own_numbers'] = $tmp['data'];
}
if (!$this->cache['own_numbers']['numbers']) {
return array();
}
return $this->cache['own... | php | public function numbersList () {
if (!isset($this->cache['own_numbers'])) {
$tmp = $this->apiCall('get_own_numbers');
if (!$tmp['data']) return false;
$this->cache['own_numbers'] = $tmp['data'];
}
if (!$this->cache['own_numbers']['numbers']) {
return array();
}
return $this->cache['own... | [
"public",
"function",
"numbersList",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"'own_numbers'",
"]",
")",
")",
"{",
"$",
"tmp",
"=",
"$",
"this",
"->",
"apiCall",
"(",
"'get_own_numbers'",
")",
";",
"if",
"(",
"!... | Get an array of all purchased numbers for your account
@return array|bool | [
"Get",
"an",
"array",
"of",
"all",
"purchased",
"numbers",
"for",
"your",
"account"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L109-L122 |
187,824 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.numbersSearch | public function numbersSearch ($country_code, $pattern) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('search_numbers', array('country_code'=>$country_code, 'pattern'=>$pattern));
if (!$tmp['data'] || !isset($tmp['data']['numbers'])) return false;
return $tmp['data']['numbers'];
} | php | public function numbersSearch ($country_code, $pattern) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('search_numbers', array('country_code'=>$country_code, 'pattern'=>$pattern));
if (!$tmp['data'] || !isset($tmp['data']['numbers'])) return false;
return $tmp['data']['numbers'];
} | [
"public",
"function",
"numbersSearch",
"(",
"$",
"country_code",
",",
"$",
"pattern",
")",
"{",
"$",
"country_code",
"=",
"strtoupper",
"(",
"$",
"country_code",
")",
";",
"$",
"tmp",
"=",
"$",
"this",
"->",
"apiCall",
"(",
"'search_numbers'",
",",
"array"... | Search available numbers to purchase for your account
@param $country_code Country code to search available numbers in
@param $pattern Number pattern to search for
@return bool | [
"Search",
"available",
"numbers",
"to",
"purchase",
"for",
"your",
"account"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L131-L137 |
187,825 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.numbersBuy | public function numbersBuy ($country_code, $msisdn) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('buy_number', array('country_code'=>$country_code, 'msisdn'=>$msisdn));
return ($tmp['http_code'] === 200);
} | php | public function numbersBuy ($country_code, $msisdn) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('buy_number', array('country_code'=>$country_code, 'msisdn'=>$msisdn));
return ($tmp['http_code'] === 200);
} | [
"public",
"function",
"numbersBuy",
"(",
"$",
"country_code",
",",
"$",
"msisdn",
")",
"{",
"$",
"country_code",
"=",
"strtoupper",
"(",
"$",
"country_code",
")",
";",
"$",
"tmp",
"=",
"$",
"this",
"->",
"apiCall",
"(",
"'buy_number'",
",",
"array",
"(",... | Purchase an available number to your account
@param $country_code Country code for your desired number
@param $msisdn Full number which you wish to purchase
@return bool | [
"Purchase",
"an",
"available",
"number",
"to",
"your",
"account"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L146-L151 |
187,826 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.numbersCancel | public function numbersCancel ($country_code, $msisdn) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('cancel_number', array('country_code'=>$country_code, 'msisdn'=>$msisdn));
return ($tmp['http_code'] === 200);
} | php | public function numbersCancel ($country_code, $msisdn) {
$country_code = strtoupper($country_code);
$tmp = $this->apiCall('cancel_number', array('country_code'=>$country_code, 'msisdn'=>$msisdn));
return ($tmp['http_code'] === 200);
} | [
"public",
"function",
"numbersCancel",
"(",
"$",
"country_code",
",",
"$",
"msisdn",
")",
"{",
"$",
"country_code",
"=",
"strtoupper",
"(",
"$",
"country_code",
")",
";",
"$",
"tmp",
"=",
"$",
"this",
"->",
"apiCall",
"(",
"'cancel_number'",
",",
"array",
... | Cancel an existing number on your account
@param $country_code Country code for which the number is for
@param $msisdn The number to cancel
@return bool | [
"Cancel",
"an",
"existing",
"number",
"on",
"your",
"account"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L160-L165 |
187,827 | prawnsalad/Nexmo-PHP-lib | src/NexmoAccount.php | NexmoAccount.apiCall | private function apiCall($command, $data=array()) {
if (!isset($this->rest_commands[$command])) {
return false;
}
$cmd = $this->rest_commands[$command];
$url = $cmd['url'];
$url = str_replace(array('{k}', '{s}') ,array($this->nx_key, $this->nx_secret), $url);
$parsed_data = array();
foreach ... | php | private function apiCall($command, $data=array()) {
if (!isset($this->rest_commands[$command])) {
return false;
}
$cmd = $this->rest_commands[$command];
$url = $cmd['url'];
$url = str_replace(array('{k}', '{s}') ,array($this->nx_key, $this->nx_secret), $url);
$parsed_data = array();
foreach ... | [
"private",
"function",
"apiCall",
"(",
"$",
"command",
",",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rest_commands",
"[",
"$",
"command",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$"... | Run a REST command on Nexmo SMS services
@param $command
@param array $data
@return array|bool | [
"Run",
"a",
"REST",
"command",
"on",
"Nexmo",
"SMS",
"services"
] | 8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352 | https://github.com/prawnsalad/Nexmo-PHP-lib/blob/8e422c4f8f43c52acb70ebd5f9e7c6ff81a1f352/src/NexmoAccount.php#L174-L243 |
187,828 | kittinan/php-line-notify | src/LineNotify.php | LineNotify.send | public function send($text, $imagePath = null, $sticker = null) {
if (empty($text)) {
return false;
}
$request_params = [
'headers' => [
'Authorization' => 'Bearer ' . $this->token,
],
];
//Message always required
$request_params['multipart'] = [
[
... | php | public function send($text, $imagePath = null, $sticker = null) {
if (empty($text)) {
return false;
}
$request_params = [
'headers' => [
'Authorization' => 'Bearer ' . $this->token,
],
];
//Message always required
$request_params['multipart'] = [
[
... | [
"public",
"function",
"send",
"(",
"$",
"text",
",",
"$",
"imagePath",
"=",
"null",
",",
"$",
"sticker",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"text",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"request_params",
"=",
"[",
"'h... | Send text message, image or sticker on Line notify
@param string $text text message on Line notify can not be empty
@param string $imagePath image path you want to send on the local machine
@param array() $sticker array of line sticker ['stickerPackageId' => PACKAGE_ID, 'stickerId' => STICKER_ID ]
more info https://de... | [
"Send",
"text",
"message",
"image",
"or",
"sticker",
"on",
"Line",
"notify"
] | 69a6b53623398773840d72cceb3a50c635ca4ca6 | https://github.com/kittinan/php-line-notify/blob/69a6b53623398773840d72cceb3a50c635ca4ca6/src/LineNotify.php#L60-L130 |
187,829 | jeremykenedy/laravel-phpinfo | src/LaravelPhpInfoServiceProvider.php | LaravelPhpInfoServiceProvider.publishFiles | private function publishFiles()
{
$publishTag = $this->_packageTag;
$this->publishes([
__DIR__ . '/config/' . $this->_packageTag . '.php' => base_path('config/' . $this->_packageTag . '.php'),
], $publishTag);
$this->publishes([
__DIR__ . '/resources/views' ... | php | private function publishFiles()
{
$publishTag = $this->_packageTag;
$this->publishes([
__DIR__ . '/config/' . $this->_packageTag . '.php' => base_path('config/' . $this->_packageTag . '.php'),
], $publishTag);
$this->publishes([
__DIR__ . '/resources/views' ... | [
"private",
"function",
"publishFiles",
"(",
")",
"{",
"$",
"publishTag",
"=",
"$",
"this",
"->",
"_packageTag",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/config/'",
".",
"$",
"this",
"->",
"_packageTag",
".",
"'.php'",
"=>",
"base... | Publish files for Laravel PHP Info.
@return void | [
"Publish",
"files",
"for",
"Laravel",
"PHP",
"Info",
"."
] | b4550f8acfca7e7e6d2ad25a6e1182397c3a6e4c | https://github.com/jeremykenedy/laravel-phpinfo/blob/b4550f8acfca7e7e6d2ad25a6e1182397c3a6e4c/src/LaravelPhpInfoServiceProvider.php#L47-L62 |
187,830 | koconder/android-market-api-php | src/proto/protoc-gen-php/protocolbuffers.inc.php | Protobuf.read_field | public static function read_field($fp, $wire_type, &$limit = null) {
switch ($wire_type) {
case 0: // varint
return Protobuf::read_varint($fp, $limit);
case 1: // 64bit
$limit -= 8;
return fread($fp, 8);
case 2: // length delimited
$len = Protobuf::read_varint($fp, $limit);
$limit -= $l... | php | public static function read_field($fp, $wire_type, &$limit = null) {
switch ($wire_type) {
case 0: // varint
return Protobuf::read_varint($fp, $limit);
case 1: // 64bit
$limit -= 8;
return fread($fp, 8);
case 2: // length delimited
$len = Protobuf::read_varint($fp, $limit);
$limit -= $l... | [
"public",
"static",
"function",
"read_field",
"(",
"$",
"fp",
",",
"$",
"wire_type",
",",
"&",
"$",
"limit",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"wire_type",
")",
"{",
"case",
"0",
":",
"// varint",
"return",
"Protobuf",
"::",
"read_varint",
"("... | Read a unknown field from the stream and return its raw bytes | [
"Read",
"a",
"unknown",
"field",
"from",
"the",
"stream",
"and",
"return",
"its",
"raw",
"bytes"
] | e267ed3634af915e7c5590ab9767641954c39fc4 | https://github.com/koconder/android-market-api-php/blob/e267ed3634af915e7c5590ab9767641954c39fc4/src/proto/protoc-gen-php/protocolbuffers.inc.php#L245-L271 |
187,831 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.getCMSFields | public function getCMSFields()
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
if ($this->exists()) {
// Add a GridField for domains to a new tab if the subsite has already been created
$fields->addFieldsToTab('Root.Domains', [
Gr... | php | public function getCMSFields()
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
if ($this->exists()) {
// Add a GridField for domains to a new tab if the subsite has already been created
$fields->addFieldsToTab('Root.Domains', [
Gr... | [
"public",
"function",
"getCMSFields",
"(",
")",
"{",
"$",
"this",
"->",
"beforeUpdateCMSFields",
"(",
"function",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"// Add a GridField for domains to a new ta... | Show the configuration fields for each subsite
@return FieldList | [
"Show",
"the",
"configuration",
"fields",
"for",
"each",
"subsite"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L682-L741 |
187,832 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.getPageTypeMap | public function getPageTypeMap()
{
$pageTypeMap = [];
$pageTypes = SiteTree::page_type_classes();
foreach ($pageTypes as $pageType) {
$pageTypeMap[$pageType] = singleton($pageType)->i18n_singular_name();
}
asort($pageTypeMap);
return $pageTypeMap;
} | php | public function getPageTypeMap()
{
$pageTypeMap = [];
$pageTypes = SiteTree::page_type_classes();
foreach ($pageTypes as $pageType) {
$pageTypeMap[$pageType] = singleton($pageType)->i18n_singular_name();
}
asort($pageTypeMap);
return $pageTypeMap;
} | [
"public",
"function",
"getPageTypeMap",
"(",
")",
"{",
"$",
"pageTypeMap",
"=",
"[",
"]",
";",
"$",
"pageTypes",
"=",
"SiteTree",
"::",
"page_type_classes",
"(",
")",
";",
"foreach",
"(",
"$",
"pageTypes",
"as",
"$",
"pageType",
")",
"{",
"$",
"pageTypeM... | Return a list of the different page types available to the CMS
@return array | [
"Return",
"a",
"list",
"of",
"the",
"different",
"page",
"types",
"available",
"to",
"the",
"CMS"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L748-L760 |
187,833 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.allowedThemes | public function allowedThemes()
{
if ($themes = self::$allowed_themes) {
return ArrayLib::valuekey($themes);
}
$themes = [];
if (is_dir(THEMES_PATH)) {
foreach (scandir(THEMES_PATH) as $theme) {
if ($theme[0] == '.') {
cont... | php | public function allowedThemes()
{
if ($themes = self::$allowed_themes) {
return ArrayLib::valuekey($themes);
}
$themes = [];
if (is_dir(THEMES_PATH)) {
foreach (scandir(THEMES_PATH) as $theme) {
if ($theme[0] == '.') {
cont... | [
"public",
"function",
"allowedThemes",
"(",
")",
"{",
"if",
"(",
"$",
"themes",
"=",
"self",
"::",
"$",
"allowed_themes",
")",
"{",
"return",
"ArrayLib",
"::",
"valuekey",
"(",
"$",
"themes",
")",
";",
"}",
"$",
"themes",
"=",
"[",
"]",
";",
"if",
... | Return the themes that can be used with this subsite, as an array of themecode => description
@return array | [
"Return",
"the",
"themes",
"that",
"can",
"be",
"used",
"with",
"this",
"subsite",
"as",
"an",
"array",
"of",
"themecode",
"=",
">",
"description"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L788-L806 |
187,834 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.createDefaultPages | protected function createDefaultPages()
{
SubsiteState::singleton()->withState(function (SubsiteState $newState) {
$newState->setSubsiteId($this->ID);
// Silence DB schema output
DB::quiet();
$siteTree = new SiteTree();
$siteTree->requireDefaultRe... | php | protected function createDefaultPages()
{
SubsiteState::singleton()->withState(function (SubsiteState $newState) {
$newState->setSubsiteId($this->ID);
// Silence DB schema output
DB::quiet();
$siteTree = new SiteTree();
$siteTree->requireDefaultRe... | [
"protected",
"function",
"createDefaultPages",
"(",
")",
"{",
"SubsiteState",
"::",
"singleton",
"(",
")",
"->",
"withState",
"(",
"function",
"(",
"SubsiteState",
"$",
"newState",
")",
"{",
"$",
"newState",
"->",
"setSubsiteId",
"(",
"$",
"this",
"->",
"ID"... | Automatically create default pages for new subsites | [
"Automatically",
"create",
"default",
"pages",
"for",
"new",
"subsites"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L850-L860 |
187,835 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.adminDuplicate | public function adminDuplicate()
{
$newItem = $this->duplicate();
$message = _t(
__CLASS__ . '.CopyMessage',
'Created a copy of {title}',
['title' => Convert::raw2js($this->Title)]
);
return <<<JS
statusMessage($message, 'good');
... | php | public function adminDuplicate()
{
$newItem = $this->duplicate();
$message = _t(
__CLASS__ . '.CopyMessage',
'Created a copy of {title}',
['title' => Convert::raw2js($this->Title)]
);
return <<<JS
statusMessage($message, 'good');
... | [
"public",
"function",
"adminDuplicate",
"(",
")",
"{",
"$",
"newItem",
"=",
"$",
"this",
"->",
"duplicate",
"(",
")",
";",
"$",
"message",
"=",
"_t",
"(",
"__CLASS__",
".",
"'.CopyMessage'",
",",
"'Created a copy of {title}'",
",",
"[",
"'title'",
"=>",
"C... | Javascript admin action to duplicate this subsite
@return string - javascript | [
"Javascript",
"admin",
"action",
"to",
"duplicate",
"this",
"subsite"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L923-L936 |
187,836 | silverstripe/silverstripe-subsites | src/Model/Subsite.php | Subsite.duplicate | public function duplicate($doWrite = true, $manyMany = 'many_many')
{
$duplicate = parent::duplicate($doWrite);
$oldSubsiteID = SubsiteState::singleton()->getSubsiteId();
self::changeSubsite($this->ID);
/*
* Copy data from this object to the given subsite. Does this using ... | php | public function duplicate($doWrite = true, $manyMany = 'many_many')
{
$duplicate = parent::duplicate($doWrite);
$oldSubsiteID = SubsiteState::singleton()->getSubsiteId();
self::changeSubsite($this->ID);
/*
* Copy data from this object to the given subsite. Does this using ... | [
"public",
"function",
"duplicate",
"(",
"$",
"doWrite",
"=",
"true",
",",
"$",
"manyMany",
"=",
"'many_many'",
")",
"{",
"$",
"duplicate",
"=",
"parent",
"::",
"duplicate",
"(",
"$",
"doWrite",
")",
";",
"$",
"oldSubsiteID",
"=",
"SubsiteState",
"::",
"s... | Duplicate this subsite
@param bool $doWrite
@param string $manyMany
@return DataObject | [
"Duplicate",
"this",
"subsite"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/Subsite.php#L976-L1013 |
187,837 | silverstripe/silverstripe-subsites | src/Forms/WildcardDomainField.php | WildcardDomainField.validate | public function validate($validator)
{
if ($this->checkHostname($this->Value())) {
return true;
}
$validator->validationError(
$this->getName(),
_t('DomainNameField.INVALID_DOMAIN', 'Invalid domain name'),
'validation'
);
retur... | php | public function validate($validator)
{
if ($this->checkHostname($this->Value())) {
return true;
}
$validator->validationError(
$this->getName(),
_t('DomainNameField.INVALID_DOMAIN', 'Invalid domain name'),
'validation'
);
retur... | [
"public",
"function",
"validate",
"(",
"$",
"validator",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkHostname",
"(",
"$",
"this",
"->",
"Value",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"validator",
"->",
"validationError",
"(",
"$... | Validate this field as a valid hostname
@param Validator $validator
@return bool | [
"Validate",
"this",
"field",
"as",
"a",
"valid",
"hostname"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Forms/WildcardDomainField.php#L17-L29 |
187,838 | silverstripe/silverstripe-subsites | src/Extensions/GroupSubsites.php | GroupSubsites.requireDefaultRecords | public function requireDefaultRecords()
{
if (!$this->owner) {
return;
}
// Migration for Group.SubsiteID data from when Groups only had a single subsite
$schema = DataObject::getSchema();
$groupTable = Convert::raw2sql($schema->tableName(Group::class));
$... | php | public function requireDefaultRecords()
{
if (!$this->owner) {
return;
}
// Migration for Group.SubsiteID data from when Groups only had a single subsite
$schema = DataObject::getSchema();
$groupTable = Convert::raw2sql($schema->tableName(Group::class));
$... | [
"public",
"function",
"requireDefaultRecords",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"owner",
")",
"{",
"return",
";",
"}",
"// Migration for Group.SubsiteID data from when Groups only had a single subsite",
"$",
"schema",
"=",
"DataObject",
"::",
"getSche... | Migrations for GroupSubsites data. | [
"Migrations",
"for",
"GroupSubsites",
"data",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/GroupSubsites.php#L43-L76 |
187,839 | silverstripe/silverstripe-subsites | src/Extensions/GroupSubsites.php | GroupSubsites.updateTreeTitle | public function updateTreeTitle(&$title)
{
if ($this->owner->AccessAllSubsites) {
$title = _t(__CLASS__ . '.GlobalGroup', 'global group');
$title = htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(' . $title . ')</i>';
} else {
$subsites = Convert::raw2xm... | php | public function updateTreeTitle(&$title)
{
if ($this->owner->AccessAllSubsites) {
$title = _t(__CLASS__ . '.GlobalGroup', 'global group');
$title = htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(' . $title . ')</i>';
} else {
$subsites = Convert::raw2xm... | [
"public",
"function",
"updateTreeTitle",
"(",
"&",
"$",
"title",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"AccessAllSubsites",
")",
"{",
"$",
"title",
"=",
"_t",
"(",
"__CLASS__",
".",
"'.GlobalGroup'",
",",
"'global group'",
")",
";",
"$",... | If this group belongs to a subsite, append the subsites title to the group title to make it easy to
distinguish in the tree-view of the security admin interface.
@param string $title | [
"If",
"this",
"group",
"belongs",
"to",
"a",
"subsite",
"append",
"the",
"subsites",
"title",
"to",
"the",
"group",
"title",
"to",
"make",
"it",
"easy",
"to",
"distinguish",
"in",
"the",
"tree",
"-",
"view",
"of",
"the",
"security",
"admin",
"interface",
... | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/GroupSubsites.php#L132-L141 |
187,840 | silverstripe/silverstripe-subsites | src/Middleware/InitStateMiddleware.php | InitStateMiddleware.getIsAdmin | public function getIsAdmin(HTTPRequest $request)
{
$adminPaths = static::config()->get('admin_url_paths');
$adminPaths[] = AdminRootController::admin_url();
$currentPath = rtrim($request->getURL(), '/') . '/';
foreach ($adminPaths as $adminPath) {
if (substr($currentPath,... | php | public function getIsAdmin(HTTPRequest $request)
{
$adminPaths = static::config()->get('admin_url_paths');
$adminPaths[] = AdminRootController::admin_url();
$currentPath = rtrim($request->getURL(), '/') . '/';
foreach ($adminPaths as $adminPath) {
if (substr($currentPath,... | [
"public",
"function",
"getIsAdmin",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"$",
"adminPaths",
"=",
"static",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'admin_url_paths'",
")",
";",
"$",
"adminPaths",
"[",
"]",
"=",
"AdminRootController",
"::",
"a... | Determine whether the website is being viewed from an admin protected area or not
@param HTTPRequest $request
@return bool | [
"Determine",
"whether",
"the",
"website",
"is",
"being",
"viewed",
"from",
"an",
"admin",
"protected",
"area",
"or",
"not"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Middleware/InitStateMiddleware.php#L68-L79 |
187,841 | silverstripe/silverstripe-subsites | src/Middleware/InitStateMiddleware.php | InitStateMiddleware.detectSubsiteId | protected function detectSubsiteId(HTTPRequest $request)
{
if ($request->getVar('SubsiteID') !== null) {
return (int) $request->getVar('SubsiteID');
}
if (SubsiteState::singleton()->getUseSessions() && $request->getSession()->get('SubsiteID') !== null) {
return (int)... | php | protected function detectSubsiteId(HTTPRequest $request)
{
if ($request->getVar('SubsiteID') !== null) {
return (int) $request->getVar('SubsiteID');
}
if (SubsiteState::singleton()->getUseSessions() && $request->getSession()->get('SubsiteID') !== null) {
return (int)... | [
"protected",
"function",
"detectSubsiteId",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"getVar",
"(",
"'SubsiteID'",
")",
"!==",
"null",
")",
"{",
"return",
"(",
"int",
")",
"$",
"request",
"->",
"getVar",
"(",
"'Subsi... | Use the given request to detect the current subsite ID
@param HTTPRequest $request
@return int | [
"Use",
"the",
"given",
"request",
"to",
"detect",
"the",
"current",
"subsite",
"ID"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Middleware/InitStateMiddleware.php#L87-L104 |
187,842 | silverstripe/silverstripe-subsites | src/Model/SubsiteDomain.php | SubsiteDomain.getSubstitutedDomain | public function getSubstitutedDomain()
{
$currentHost = $_SERVER['HTTP_HOST'];
// If there are wildcards in the primary domain (not recommended), make some
// educated guesses about what to replace them with:
$domain = preg_replace('/\.\*$/', ".{$currentHost}", $this->Domain);
... | php | public function getSubstitutedDomain()
{
$currentHost = $_SERVER['HTTP_HOST'];
// If there are wildcards in the primary domain (not recommended), make some
// educated guesses about what to replace them with:
$domain = preg_replace('/\.\*$/', ".{$currentHost}", $this->Domain);
... | [
"public",
"function",
"getSubstitutedDomain",
"(",
")",
"{",
"$",
"currentHost",
"=",
"$",
"_SERVER",
"[",
"'HTTP_HOST'",
"]",
";",
"// If there are wildcards in the primary domain (not recommended), make some",
"// educated guesses about what to replace them with:",
"$",
"domain... | Retrieves domain name with wildcards substituted with actual values
@todo Refactor domains into separate wildcards / primary domains
@return string | [
"Retrieves",
"domain",
"name",
"with",
"wildcards",
"substituted",
"with",
"actual",
"values"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Model/SubsiteDomain.php#L186-L202 |
187,843 | silverstripe/silverstripe-subsites | src/Extensions/LeftAndMainSubsites.php | LeftAndMainSubsites.getCMSTreeTitle | public function getCMSTreeTitle()
{
$subsite = Subsite::currentSubsite();
return $subsite ? Convert::raw2xml($subsite->Title) : _t(__CLASS__.'.SITECONTENTLEFT', 'Site Content');
} | php | public function getCMSTreeTitle()
{
$subsite = Subsite::currentSubsite();
return $subsite ? Convert::raw2xml($subsite->Title) : _t(__CLASS__.'.SITECONTENTLEFT', 'Site Content');
} | [
"public",
"function",
"getCMSTreeTitle",
"(",
")",
"{",
"$",
"subsite",
"=",
"Subsite",
"::",
"currentSubsite",
"(",
")",
";",
"return",
"$",
"subsite",
"?",
"Convert",
"::",
"raw2xml",
"(",
"$",
"subsite",
"->",
"Title",
")",
":",
"_t",
"(",
"__CLASS__"... | Set the title of the CMS tree | [
"Set",
"the",
"title",
"of",
"the",
"CMS",
"tree"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/LeftAndMainSubsites.php#L52-L56 |
187,844 | silverstripe/silverstripe-subsites | src/Extensions/LeftAndMainSubsites.php | LeftAndMainSubsites.sectionSites | public function sectionSites($includeMainSite = true, $mainSiteTitle = 'Main site', $member = null)
{
if ($mainSiteTitle == 'Main site') {
$mainSiteTitle = _t('Subsites.MainSiteTitle', 'Main site');
}
// Rationalise member arguments
if (!$member) {
$member = ... | php | public function sectionSites($includeMainSite = true, $mainSiteTitle = 'Main site', $member = null)
{
if ($mainSiteTitle == 'Main site') {
$mainSiteTitle = _t('Subsites.MainSiteTitle', 'Main site');
}
// Rationalise member arguments
if (!$member) {
$member = ... | [
"public",
"function",
"sectionSites",
"(",
"$",
"includeMainSite",
"=",
"true",
",",
"$",
"mainSiteTitle",
"=",
"'Main site'",
",",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"mainSiteTitle",
"==",
"'Main site'",
")",
"{",
"$",
"mainSiteTitle",
... | Find all subsites accessible for current user on this controller.
@param bool $includeMainSite
@param string $mainSiteTitle
@param null $member
@return ArrayList of <a href='psi_element://Subsite'>Subsite</a> instances.
instances. | [
"Find",
"all",
"subsites",
"accessible",
"for",
"current",
"user",
"on",
"this",
"controller",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/LeftAndMainSubsites.php#L72-L127 |
187,845 | silverstripe/silverstripe-subsites | src/Extensions/LeftAndMainSubsites.php | LeftAndMainSubsites.shouldChangeSubsite | public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsiteID)
{
if (Config::inst()->get($adminClass, 'treats_subsite_0_as_global') && $recordSubsiteID == 0) {
return false;
}
if ($recordSubsiteID != $currentSubsiteID) {
return true;
}
... | php | public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsiteID)
{
if (Config::inst()->get($adminClass, 'treats_subsite_0_as_global') && $recordSubsiteID == 0) {
return false;
}
if ($recordSubsiteID != $currentSubsiteID) {
return true;
}
... | [
"public",
"function",
"shouldChangeSubsite",
"(",
"$",
"adminClass",
",",
"$",
"recordSubsiteID",
",",
"$",
"currentSubsiteID",
")",
"{",
"if",
"(",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"$",
"adminClass",
",",
"'treats_subsite_0_as_global'",
")"... | Helper for testing if the subsite should be adjusted.
@param string $adminClass
@param int $recordSubsiteID
@param int $currentSubsiteID
@return bool | [
"Helper",
"for",
"testing",
"if",
"the",
"subsite",
"should",
"be",
"adjusted",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/LeftAndMainSubsites.php#L205-L214 |
187,846 | silverstripe/silverstripe-subsites | src/Extensions/LeftAndMainSubsites.php | LeftAndMainSubsites.canAccess | public function canAccess()
{
// Admin can access everything, no point in checking.
$member = Security::getCurrentUser();
if ($member
&& (Permission::checkMember($member, [
'ADMIN', // Full administrative rights
'CMS_ACCESS_LeftAndMain', // Access ... | php | public function canAccess()
{
// Admin can access everything, no point in checking.
$member = Security::getCurrentUser();
if ($member
&& (Permission::checkMember($member, [
'ADMIN', // Full administrative rights
'CMS_ACCESS_LeftAndMain', // Access ... | [
"public",
"function",
"canAccess",
"(",
")",
"{",
"// Admin can access everything, no point in checking.",
"$",
"member",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
";",
"if",
"(",
"$",
"member",
"&&",
"(",
"Permission",
"::",
"checkMember",
"(",
"$",
"m... | Check if the current controller is accessible for this user on this subsite. | [
"Check",
"if",
"the",
"current",
"controller",
"is",
"accessible",
"for",
"this",
"user",
"on",
"this",
"subsite",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/LeftAndMainSubsites.php#L219-L236 |
187,847 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.duplicateToSubsitePrep | public function duplicateToSubsitePrep($subsiteID, $includeChildren)
{
if (is_object($subsiteID)) {
$subsiteID = $subsiteID->ID;
}
return SubsiteState::singleton()
->withState(function (SubsiteState $newState) use ($subsiteID, $includeChildren) {
$new... | php | public function duplicateToSubsitePrep($subsiteID, $includeChildren)
{
if (is_object($subsiteID)) {
$subsiteID = $subsiteID->ID;
}
return SubsiteState::singleton()
->withState(function (SubsiteState $newState) use ($subsiteID, $includeChildren) {
$new... | [
"public",
"function",
"duplicateToSubsitePrep",
"(",
"$",
"subsiteID",
",",
"$",
"includeChildren",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"subsiteID",
")",
")",
"{",
"$",
"subsiteID",
"=",
"$",
"subsiteID",
"->",
"ID",
";",
"}",
"return",
"SubsiteSta... | Does the basic duplication, but doesn't write anything this means we can subclass this easier and do more
complex relation duplication.
Note that when duplicating including children, everything is written.
@param Subsite|int $subsiteID
@param bool $includeChildren
@return SiteTree | [
"Does",
"the",
"basic",
"duplication",
"but",
"doesn",
"t",
"write",
"anything",
"this",
"means",
"we",
"can",
"subclass",
"this",
"easier",
"and",
"do",
"more",
"complex",
"relation",
"duplication",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L182-L222 |
187,848 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.onBeforeDuplicate | public function onBeforeDuplicate()
{
$subsiteId = SubsiteState::singleton()->getSubsiteId();
if ($subsiteId !== null) {
$this->owner->SubsiteID = $subsiteId;
}
} | php | public function onBeforeDuplicate()
{
$subsiteId = SubsiteState::singleton()->getSubsiteId();
if ($subsiteId !== null) {
$this->owner->SubsiteID = $subsiteId;
}
} | [
"public",
"function",
"onBeforeDuplicate",
"(",
")",
"{",
"$",
"subsiteId",
"=",
"SubsiteState",
"::",
"singleton",
"(",
")",
"->",
"getSubsiteId",
"(",
")",
";",
"if",
"(",
"$",
"subsiteId",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"owner",
"->",
"... | When duplicating a page, assign the current subsite ID from the state | [
"When",
"duplicating",
"a",
"page",
"assign",
"the",
"current",
"subsite",
"ID",
"from",
"the",
"state"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L227-L233 |
187,849 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.duplicateToSubsite | public function duplicateToSubsite($subsiteID = null, $includeChildren = false)
{
$clone = $this->owner->duplicateToSubsitePrep($subsiteID, $includeChildren);
$clone->invokeWithExtensions('onBeforeDuplicateToSubsite', $this->owner);
if (!$includeChildren) {
// Write the new page... | php | public function duplicateToSubsite($subsiteID = null, $includeChildren = false)
{
$clone = $this->owner->duplicateToSubsitePrep($subsiteID, $includeChildren);
$clone->invokeWithExtensions('onBeforeDuplicateToSubsite', $this->owner);
if (!$includeChildren) {
// Write the new page... | [
"public",
"function",
"duplicateToSubsite",
"(",
"$",
"subsiteID",
"=",
"null",
",",
"$",
"includeChildren",
"=",
"false",
")",
"{",
"$",
"clone",
"=",
"$",
"this",
"->",
"owner",
"->",
"duplicateToSubsitePrep",
"(",
"$",
"subsiteID",
",",
"$",
"includeChild... | Create a duplicate of this page and save it to another subsite
@param Subsite|int $subsiteID The Subsite to copy to, or its ID
@param boolean $includeChildren Whether to duplicate child pages too
@return SiteTree The duplicated page | [
"Create",
"a",
"duplicate",
"of",
"this",
"page",
"and",
"save",
"it",
"to",
"another",
"subsite"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L242-L257 |
187,850 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.duplicateSubsiteRelations | public function duplicateSubsiteRelations($originalPage)
{
$thisClass = $originalPage->ClassName;
$relations = Config::inst()->get($thisClass, 'duplicate_to_subsite_relations');
if ($relations && !empty($relations)) {
foreach ($relations as $relation) {
$items = ... | php | public function duplicateSubsiteRelations($originalPage)
{
$thisClass = $originalPage->ClassName;
$relations = Config::inst()->get($thisClass, 'duplicate_to_subsite_relations');
if ($relations && !empty($relations)) {
foreach ($relations as $relation) {
$items = ... | [
"public",
"function",
"duplicateSubsiteRelations",
"(",
"$",
"originalPage",
")",
"{",
"$",
"thisClass",
"=",
"$",
"originalPage",
"->",
"ClassName",
";",
"$",
"relations",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"$",
"thisClass",
",",
"'d... | Duplicate relations using a static property to define
which ones we want to duplicate
It may be that some relations are not diostinct to sub site so can stay
whereas others may need to be duplicated
@deprecated 2.2..3.0 Use the "cascade_duplicates" config API instead
@param SiteTree $originalPage | [
"Duplicate",
"relations",
"using",
"a",
"static",
"property",
"to",
"define",
"which",
"ones",
"we",
"want",
"to",
"duplicate"
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L269-L284 |
187,851 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.updatePreviewLink | public function updatePreviewLink(&$link, $action = null)
{
$url = Director::absoluteURL($this->owner->Link($action));
$link = HTTP::setGetVar('SubsiteID', $this->owner->SubsiteID, $url);
return $link;
} | php | public function updatePreviewLink(&$link, $action = null)
{
$url = Director::absoluteURL($this->owner->Link($action));
$link = HTTP::setGetVar('SubsiteID', $this->owner->SubsiteID, $url);
return $link;
} | [
"public",
"function",
"updatePreviewLink",
"(",
"&",
"$",
"link",
",",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"Director",
"::",
"absoluteURL",
"(",
"$",
"this",
"->",
"owner",
"->",
"Link",
"(",
"$",
"action",
")",
")",
";",
"$",
"l... | Use the CMS domain for iframed CMS previews to prevent single-origin violations
and SSL cert problems. Always set SubsiteID to avoid errors because a page doesn't
exist on the CMS domain.
@param string &$link
@param string|null $action
@return string | [
"Use",
"the",
"CMS",
"domain",
"for",
"iframed",
"CMS",
"previews",
"to",
"prevent",
"single",
"-",
"origin",
"violations",
"and",
"SSL",
"cert",
"problems",
".",
"Always",
"set",
"SubsiteID",
"to",
"avoid",
"errors",
"because",
"a",
"page",
"doesn",
"t",
... | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L426-L431 |
187,852 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.MetaTags | public function MetaTags(&$tags)
{
if ($this->owner->SubsiteID) {
$tags .= '<meta name="x-subsite-id" content="' . $this->owner->SubsiteID . "\" />\n";
}
return $tags;
} | php | public function MetaTags(&$tags)
{
if ($this->owner->SubsiteID) {
$tags .= '<meta name="x-subsite-id" content="' . $this->owner->SubsiteID . "\" />\n";
}
return $tags;
} | [
"public",
"function",
"MetaTags",
"(",
"&",
"$",
"tags",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"SubsiteID",
")",
"{",
"$",
"tags",
".=",
"'<meta name=\"x-subsite-id\" content=\"'",
".",
"$",
"this",
"->",
"owner",
"->",
"SubsiteID",
".",
... | Inject the subsite ID into the content so it can be used by frontend scripts.
@param $tags
@return string | [
"Inject",
"the",
"subsite",
"ID",
"into",
"the",
"content",
"so",
"it",
"can",
"be",
"used",
"by",
"frontend",
"scripts",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L453-L460 |
187,853 | silverstripe/silverstripe-subsites | src/Extensions/SiteTreeSubsites.php | SiteTreeSubsites.augmentValidURLSegment | public function augmentValidURLSegment()
{
// If this page is being filtered in the current subsite, then no custom validation query is required.
$subsite = Subsite::$force_subsite ?: SubsiteState::singleton()->getSubsiteId();
if (empty($this->owner->SubsiteID) || $subsite == $this->owner->S... | php | public function augmentValidURLSegment()
{
// If this page is being filtered in the current subsite, then no custom validation query is required.
$subsite = Subsite::$force_subsite ?: SubsiteState::singleton()->getSubsiteId();
if (empty($this->owner->SubsiteID) || $subsite == $this->owner->S... | [
"public",
"function",
"augmentValidURLSegment",
"(",
")",
"{",
"// If this page is being filtered in the current subsite, then no custom validation query is required.",
"$",
"subsite",
"=",
"Subsite",
"::",
"$",
"force_subsite",
"?",
":",
"SubsiteState",
"::",
"singleton",
"(",... | Ensure that valid url segments are checked within the correct subsite of the owner object,
even if the current subsiteID is set to some other subsite.
@return null|bool Either true or false, or null to not influence result | [
"Ensure",
"that",
"valid",
"url",
"segments",
"are",
"checked",
"within",
"the",
"correct",
"subsite",
"of",
"the",
"owner",
"object",
"even",
"if",
"the",
"current",
"subsiteID",
"is",
"set",
"to",
"some",
"other",
"subsite",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/SiteTreeSubsites.php#L512-L531 |
187,854 | silverstripe/silverstripe-subsites | src/Extensions/FolderFormFactoryExtension.php | FolderFormFactoryExtension.updateFormFields | public function updateFormFields(FieldList $fields)
{
$sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
$values = [];
$values[0] = _t(__CLASS__ . '.AllSitesDropdownOpt', 'All sites');
foreach ($sites as $site) {
$values[$site->ID] = $site->Title;
}
... | php | public function updateFormFields(FieldList $fields)
{
$sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
$values = [];
$values[0] = _t(__CLASS__ . '.AllSitesDropdownOpt', 'All sites');
foreach ($sites as $site) {
$values[$site->ID] = $site->Title;
}
... | [
"public",
"function",
"updateFormFields",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"$",
"sites",
"=",
"Subsite",
"::",
"accessible_sites",
"(",
"'CMS_ACCESS_AssetAdmin'",
")",
";",
"$",
"values",
"=",
"[",
"]",
";",
"$",
"values",
"[",
"0",
"]",
"=",
"... | Add subsites-specific fields to the folder editor.
@param FieldList $fields | [
"Add",
"subsites",
"-",
"specific",
"fields",
"to",
"the",
"folder",
"editor",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Extensions/FolderFormFactoryExtension.php#L17-L46 |
187,855 | silverstripe/silverstripe-subsites | src/Controller/SubsiteXHRController.php | SubsiteXHRController.canView | public function canView($member = null)
{
if (parent::canView($member)) {
return true;
}
if (Subsite::all_accessible_sites()->count() > 0) {
return true;
}
return false;
} | php | public function canView($member = null)
{
if (parent::canView($member)) {
return true;
}
if (Subsite::all_accessible_sites()->count() > 0) {
return true;
}
return false;
} | [
"public",
"function",
"canView",
"(",
"$",
"member",
"=",
"null",
")",
"{",
"if",
"(",
"parent",
"::",
"canView",
"(",
"$",
"member",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"Subsite",
"::",
"all_accessible_sites",
"(",
")",
"->",
"coun... | Relax the access permissions, so anyone who has access to any CMS subsite can access this controller.
@param Member|null $member
@return bool | [
"Relax",
"the",
"access",
"permissions",
"so",
"anyone",
"who",
"has",
"access",
"to",
"any",
"CMS",
"subsite",
"can",
"access",
"this",
"controller",
"."
] | 46653e2b07e79c91d9fabd28561d1b67c9368630 | https://github.com/silverstripe/silverstripe-subsites/blob/46653e2b07e79c91d9fabd28561d1b67c9368630/src/Controller/SubsiteXHRController.php#L24-L35 |
187,856 | pacely/mailchimp-api-v3 | src/Mailchimp.php | Mailchimp.setProxy | public function setProxy(
$host,
$port,
$ssl = false,
$username = null,
$password = null
) {
$scheme = ($ssl ? 'https://' : 'http://');
if ( ! is_null($username)) {
return $this->options['proxy'] = sprintf('%s%s:%s@%s:%s', $scheme, $username, $pas... | php | public function setProxy(
$host,
$port,
$ssl = false,
$username = null,
$password = null
) {
$scheme = ($ssl ? 'https://' : 'http://');
if ( ! is_null($username)) {
return $this->options['proxy'] = sprintf('%s%s:%s@%s:%s', $scheme, $username, $pas... | [
"public",
"function",
"setProxy",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"ssl",
"=",
"false",
",",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
")",
"{",
"$",
"scheme",
"=",
"(",
"$",
"ssl",
"?",
"'https://'",
":",
"'ht... | Enable proxy if needed.
@param string $host
@param int $port
@param bool $ssl
@param string $username
@param string $password
@return string | [
"Enable",
"proxy",
"if",
"needed",
"."
] | 859943e93fef53e93af1882faee5c1338a654c88 | https://github.com/pacely/mailchimp-api-v3/blob/859943e93fef53e93af1882faee5c1338a654c88/src/Mailchimp.php#L94-L108 |
187,857 | yii2mod/yii2-user | actions/RequestPasswordResetAction.php | RequestPasswordResetAction.run | public function run()
{
$model = Yii::createObject($this->modelClass);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_REQUEST, $event);
$load = $model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->respo... | php | public function run()
{
$model = Yii::createObject($this->modelClass);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_REQUEST, $event);
$load = $model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->respo... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"model",
"=",
"Yii",
"::",
"createObject",
"(",
"$",
"this",
"->",
"modelClass",
")",
";",
"$",
"event",
"=",
"$",
"this",
"->",
"getFormEvent",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"trigg... | Request password reset for a user.
@return string|\yii\web\Response | [
"Request",
"password",
"reset",
"for",
"a",
"user",
"."
] | 3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e | https://github.com/yii2mod/yii2-user/blob/3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e/actions/RequestPasswordResetAction.php#L56-L85 |
187,858 | yii2mod/yii2-user | commands/RoleController.php | RoleController.actionRevoke | public function actionRevoke($roleName, $email)
{
$user = UserModel::findByEmail($email);
if (empty($user)) {
throw new Exception(Yii::t('yii2mod.user', 'User is not found.'));
}
$role = $this->findRole($roleName);
if (!in_array($roleName, array_keys($this->_au... | php | public function actionRevoke($roleName, $email)
{
$user = UserModel::findByEmail($email);
if (empty($user)) {
throw new Exception(Yii::t('yii2mod.user', 'User is not found.'));
}
$role = $this->findRole($roleName);
if (!in_array($roleName, array_keys($this->_au... | [
"public",
"function",
"actionRevoke",
"(",
"$",
"roleName",
",",
"$",
"email",
")",
"{",
"$",
"user",
"=",
"UserModel",
"::",
"findByEmail",
"(",
"$",
"email",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"Exception"... | Revoke role from the user
@param $roleName
@param $email
@return int
@throws Exception | [
"Revoke",
"role",
"from",
"the",
"user"
] | 3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e | https://github.com/yii2mod/yii2-user/blob/3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e/commands/RoleController.php#L77-L98 |
187,859 | yii2mod/yii2-user | commands/RoleController.php | RoleController.findRole | protected function findRole($roleName)
{
if (($role = $this->_authManager->getRole($roleName)) !== null) {
return $role;
}
throw new Exception(Yii::t('yii2mod.user', 'The role "{roleName}" is not found.', [
'roleName' => $roleName,
]));
} | php | protected function findRole($roleName)
{
if (($role = $this->_authManager->getRole($roleName)) !== null) {
return $role;
}
throw new Exception(Yii::t('yii2mod.user', 'The role "{roleName}" is not found.', [
'roleName' => $roleName,
]));
} | [
"protected",
"function",
"findRole",
"(",
"$",
"roleName",
")",
"{",
"if",
"(",
"(",
"$",
"role",
"=",
"$",
"this",
"->",
"_authManager",
"->",
"getRole",
"(",
"$",
"roleName",
")",
")",
"!==",
"null",
")",
"{",
"return",
"$",
"role",
";",
"}",
"th... | Returns the named role.
@param string $roleName
@return Role
@throws Exception | [
"Returns",
"the",
"named",
"role",
"."
] | 3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e | https://github.com/yii2mod/yii2-user/blob/3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e/commands/RoleController.php#L109-L118 |
187,860 | yii2mod/yii2-user | actions/PasswordResetAction.php | PasswordResetAction.run | public function run($token)
{
try {
$model = Yii::createObject($this->modelClass, [$token]);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_RESET, $event);
} catch (InvalidParamException $e) {
throw new BadRequestHttpException(... | php | public function run($token)
{
try {
$model = Yii::createObject($this->modelClass, [$token]);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_RESET, $event);
} catch (InvalidParamException $e) {
throw new BadRequestHttpException(... | [
"public",
"function",
"run",
"(",
"$",
"token",
")",
"{",
"try",
"{",
"$",
"model",
"=",
"Yii",
"::",
"createObject",
"(",
"$",
"this",
"->",
"modelClass",
",",
"[",
"$",
"token",
"]",
")",
";",
"$",
"event",
"=",
"$",
"this",
"->",
"getFormEvent",... | Reset password for a user.
@param $token
@return string|\yii\web\Response
@throws \yii\web\BadRequestHttpException | [
"Reset",
"password",
"for",
"a",
"user",
"."
] | 3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e | https://github.com/yii2mod/yii2-user/blob/3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e/actions/PasswordResetAction.php#L55-L75 |
187,861 | kenjis/codeigniter-doctrine | libraries/Doctrine.php | Doctrine.convertDbConfig | public function convertDbConfig($db)
{
$connectionOptions = [];
if ($db['dbdriver'] === 'pdo') {
return $this->convertDbConfigPdo($db);
} elseif ($db['dbdriver'] === 'mysqli') {
$connectionOptions = [
'driver' => $db['dbdriver'],
'us... | php | public function convertDbConfig($db)
{
$connectionOptions = [];
if ($db['dbdriver'] === 'pdo') {
return $this->convertDbConfigPdo($db);
} elseif ($db['dbdriver'] === 'mysqli') {
$connectionOptions = [
'driver' => $db['dbdriver'],
'us... | [
"public",
"function",
"convertDbConfig",
"(",
"$",
"db",
")",
"{",
"$",
"connectionOptions",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"db",
"[",
"'dbdriver'",
"]",
"===",
"'pdo'",
")",
"{",
"return",
"$",
"this",
"->",
"convertDbConfigPdo",
"(",
"$",
"db",
... | Convert CodeIgniter database config array to Doctrine's
See http://www.codeigniter.com/user_guide/database/configuration.html
See http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
@param array $db
@return array
@throws Exception | [
"Convert",
"CodeIgniter",
"database",
"config",
"array",
"to",
"Doctrine",
"s"
] | b77810a7ed5685f409af9ef0791aeec7bbc0f113 | https://github.com/kenjis/codeigniter-doctrine/blob/b77810a7ed5685f409af9ef0791aeec7bbc0f113/libraries/Doctrine.php#L86-L106 |
187,862 | yii2mod/yii2-user | actions/SignupAction.php | SignupAction.run | public function run()
{
$model = Yii::createObject($this->modelClass);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_SIGNUP, $event);
$load = $model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->respon... | php | public function run()
{
$model = Yii::createObject($this->modelClass);
$event = $this->getFormEvent($model);
$this->trigger(self::EVENT_BEFORE_SIGNUP, $event);
$load = $model->load(Yii::$app->request->post());
if (Yii::$app->request->isAjax) {
Yii::$app->respon... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"model",
"=",
"Yii",
"::",
"createObject",
"(",
"$",
"this",
"->",
"modelClass",
")",
";",
"$",
"event",
"=",
"$",
"this",
"->",
"getFormEvent",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"trigg... | Signup a user.
@return string|\yii\web\Response | [
"Signup",
"a",
"user",
"."
] | 3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e | https://github.com/yii2mod/yii2-user/blob/3e68b5bcea3c18f1f3dcb3ed89bd55f3d1b62e6e/actions/SignupAction.php#L46-L71 |
187,863 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.replaceNode | protected function replaceNode($string)
{
if (empty($string)) {
$this->node->parentNode->removeChild($this->node);
return null;
}
$newDocument = new Document($string);
if ($newDocument->outertext !== $string) {
throw new RuntimeException('Not va... | php | protected function replaceNode($string)
{
if (empty($string)) {
$this->node->parentNode->removeChild($this->node);
return null;
}
$newDocument = new Document($string);
if ($newDocument->outertext !== $string) {
throw new RuntimeException('Not va... | [
"protected",
"function",
"replaceNode",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"this",
"->",
"node",
"->",
"parentNode",
"->",
"removeChild",
"(",
"$",
"this",
"->",
"node",
")",
";",
"return",
"null... | Replace this node
@param $string
@return $this
@throws RuntimeException | [
"Replace",
"this",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L74-L94 |
187,864 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.replaceChild | protected function replaceChild($string)
{
if (!empty($string)) {
$newDocument = new Document($string);
if ($newDocument->outertext !== $string) {
throw new RuntimeException('Not valid HTML fragment');
}
}
foreach ($this->node->childNodes... | php | protected function replaceChild($string)
{
if (!empty($string)) {
$newDocument = new Document($string);
if ($newDocument->outertext !== $string) {
throw new RuntimeException('Not valid HTML fragment');
}
}
foreach ($this->node->childNodes... | [
"protected",
"function",
"replaceChild",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"newDocument",
"=",
"new",
"Document",
"(",
"$",
"string",
")",
";",
"if",
"(",
"$",
"newDocument",
"->",
"outerte... | Replace child node
@param $string
@return $this
@throws RuntimeException | [
"Replace",
"child",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L105-L125 |
187,865 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.replaceText | protected function replaceText($string)
{
if (empty($string)) {
$this->node->parentNode->removeChild($this->node);
return null;
}
$newElement = $this->node->ownerDocument->createTextNode($string);
$newNode = $this->node->ownerDocument->importNode($newElemen... | php | protected function replaceText($string)
{
if (empty($string)) {
$this->node->parentNode->removeChild($this->node);
return null;
}
$newElement = $this->node->ownerDocument->createTextNode($string);
$newNode = $this->node->ownerDocument->importNode($newElemen... | [
"protected",
"function",
"replaceText",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"this",
"->",
"node",
"->",
"parentNode",
"->",
"removeChild",
"(",
"$",
"this",
"->",
"node",
")",
";",
"return",
"null... | Replace this node with text
@param $string
@return $this | [
"Replace",
"this",
"node",
"with",
"text"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L134-L150 |
187,866 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.childNodes | public function childNodes($idx = -1)
{
$nodeList = $this->getIterator();
if ($idx === -1) {
return $nodeList;
}
if (isset($nodeList[$idx])) {
return $nodeList[$idx];
}
return null;
} | php | public function childNodes($idx = -1)
{
$nodeList = $this->getIterator();
if ($idx === -1) {
return $nodeList;
}
if (isset($nodeList[$idx])) {
return $nodeList[$idx];
}
return null;
} | [
"public",
"function",
"childNodes",
"(",
"$",
"idx",
"=",
"-",
"1",
")",
"{",
"$",
"nodeList",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"if",
"(",
"$",
"idx",
"===",
"-",
"1",
")",
"{",
"return",
"$",
"nodeList",
";",
"}",
"if",
"(... | Returns children of node
@param int $idx
@return NodeList|Element|null | [
"Returns",
"children",
"of",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L230-L243 |
187,867 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.firstChild | public function firstChild()
{
$node = $this->node->firstChild;
if ($node === null) {
return null;
}
return new Element($node);
} | php | public function firstChild()
{
$node = $this->node->firstChild;
if ($node === null) {
return null;
}
return new Element($node);
} | [
"public",
"function",
"firstChild",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"node",
"->",
"firstChild",
";",
"if",
"(",
"$",
"node",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Element",
"(",
"$",
"node",
")",... | Returns the first child of node
@return Element|null | [
"Returns",
"the",
"first",
"child",
"of",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L250-L259 |
187,868 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.lastChild | public function lastChild()
{
$node = $this->node->lastChild;
if ($node === null) {
return null;
}
return new Element($node);
} | php | public function lastChild()
{
$node = $this->node->lastChild;
if ($node === null) {
return null;
}
return new Element($node);
} | [
"public",
"function",
"lastChild",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"node",
"->",
"lastChild",
";",
"if",
"(",
"$",
"node",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Element",
"(",
"$",
"node",
")",
... | Returns the last child of node
@return Element|null | [
"Returns",
"the",
"last",
"child",
"of",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L266-L275 |
187,869 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.nextSibling | public function nextSibling()
{
$node = $this->node->nextSibling;
if ($node === null) {
return null;
}
return new Element($node);
} | php | public function nextSibling()
{
$node = $this->node->nextSibling;
if ($node === null) {
return null;
}
return new Element($node);
} | [
"public",
"function",
"nextSibling",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"node",
"->",
"nextSibling",
";",
"if",
"(",
"$",
"node",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Element",
"(",
"$",
"node",
")... | Returns the next sibling of node
@return Element|null | [
"Returns",
"the",
"next",
"sibling",
"of",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L282-L291 |
187,870 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.previousSibling | public function previousSibling()
{
$node = $this->node->previousSibling;
if ($node === null) {
return null;
}
return new Element($node);
} | php | public function previousSibling()
{
$node = $this->node->previousSibling;
if ($node === null) {
return null;
}
return new Element($node);
} | [
"public",
"function",
"previousSibling",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"node",
"->",
"previousSibling",
";",
"if",
"(",
"$",
"node",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Element",
"(",
"$",
"nod... | Returns the previous sibling of node
@return Element|null | [
"Returns",
"the",
"previous",
"sibling",
"of",
"node"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L298-L307 |
187,871 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Element.php | Element.getAllAttributes | public function getAllAttributes()
{
if ($this->node->hasAttributes()) {
$attributes = [];
foreach ($this->node->attributes as $attr) {
$attributes[$attr->name] = $attr->value;
}
return $attributes;
}
return null;
} | php | public function getAllAttributes()
{
if ($this->node->hasAttributes()) {
$attributes = [];
foreach ($this->node->attributes as $attr) {
$attributes[$attr->name] = $attr->value;
}
return $attributes;
}
return null;
} | [
"public",
"function",
"getAllAttributes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"node",
"->",
"hasAttributes",
"(",
")",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"node",
"->",
"attributes",
"as",
"$",... | Returns array of attributes
@return array|null | [
"Returns",
"array",
"of",
"attributes"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Element.php#L354-L366 |
187,872 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Document.php | Document.loadHtml | public function loadHtml($html)
{
if (!is_string($html)) {
throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
}
libxml_use_internal_errors(true);
libxml_disable_entity_loader(true);
$sxe = simplexml_load_string($html);
... | php | public function loadHtml($html)
{
if (!is_string($html)) {
throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
}
libxml_use_internal_errors(true);
libxml_disable_entity_loader(true);
$sxe = simplexml_load_string($html);
... | [
"public",
"function",
"loadHtml",
"(",
"$",
"html",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"html",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"__METHOD__",
".",
"' expects parameter 1 to be string.'",
")",
";",
"}",
"libxml_use_i... | Load HTML from string
@param string $html
@return Document
@throws InvalidArgumentException if argument is not string | [
"Load",
"HTML",
"from",
"string"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Document.php#L82-L103 |
187,873 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Document.php | Document.loadHtmlFile | public function loadHtmlFile($filePath)
{
if (!is_string($filePath)) {
throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
}
if (!preg_match("/^https?:\/\//i", $filePath) && !file_exists($filePath)) {
throw new RuntimeException("Fil... | php | public function loadHtmlFile($filePath)
{
if (!is_string($filePath)) {
throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be string.');
}
if (!preg_match("/^https?:\/\//i", $filePath) && !file_exists($filePath)) {
throw new RuntimeException("Fil... | [
"public",
"function",
"loadHtmlFile",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"__METHOD__",
".",
"' expects parameter 1 to be string.'",
")",
";",
"}",
"... | Load HTML from file
@param string $filePath
@return Document
@throws InvalidArgumentException
@throws RuntimeException | [
"Load",
"HTML",
"from",
"file"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Document.php#L115-L138 |
187,874 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Document.php | Document.html | public function html()
{
if ($this::$callback !== null) {
call_user_func($this::$callback, $this);
}
return trim($this->document->saveHTML($this->document->documentElement));
} | php | public function html()
{
if ($this::$callback !== null) {
call_user_func($this::$callback, $this);
}
return trim($this->document->saveHTML($this->document->documentElement));
} | [
"public",
"function",
"html",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"::",
"$",
"callback",
"!==",
"null",
")",
"{",
"call_user_func",
"(",
"$",
"this",
"::",
"$",
"callback",
",",
"$",
"this",
")",
";",
"}",
"return",
"trim",
"(",
"$",
"this",
"... | Get dom node's outer html
@return string | [
"Get",
"dom",
"node",
"s",
"outer",
"html"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Document.php#L184-L191 |
187,875 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Document.php | Document.innerHtml | public function innerHtml()
{
$text = '';
foreach ($this->document->documentElement->childNodes as $node) {
$text .= trim($this->document->saveXML($node));
}
return $text;
} | php | public function innerHtml()
{
$text = '';
foreach ($this->document->documentElement->childNodes as $node) {
$text .= trim($this->document->saveXML($node));
}
return $text;
} | [
"public",
"function",
"innerHtml",
"(",
")",
"{",
"$",
"text",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"document",
"->",
"documentElement",
"->",
"childNodes",
"as",
"$",
"node",
")",
"{",
"$",
"text",
".=",
"trim",
"(",
"$",
"this",
"->",... | Get dom node's inner html
@return string | [
"Get",
"dom",
"node",
"s",
"inner",
"html"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Document.php#L198-L206 |
187,876 | dimabdc/PHP-Fast-Simple-HTML-DOM-Parser | lib/Document.php | Document.save | public function save($filepath = '')
{
$string = $this->innerHtml();
if ($filepath !== '') {
file_put_contents($filepath, $string, LOCK_EX);
}
return $string;
} | php | public function save($filepath = '')
{
$string = $this->innerHtml();
if ($filepath !== '') {
file_put_contents($filepath, $string, LOCK_EX);
}
return $string;
} | [
"public",
"function",
"save",
"(",
"$",
"filepath",
"=",
"''",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"innerHtml",
"(",
")",
";",
"if",
"(",
"$",
"filepath",
"!==",
"''",
")",
"{",
"file_put_contents",
"(",
"$",
"filepath",
",",
"$",
"str... | Save dom as string
@param string $filepath
@return string | [
"Save",
"dom",
"as",
"string"
] | 376785f306a6012b96f1e67e8be2bc182ba09939 | https://github.com/dimabdc/PHP-Fast-Simple-HTML-DOM-Parser/blob/376785f306a6012b96f1e67e8be2bc182ba09939/lib/Document.php#L225-L233 |
187,877 | tomwalder/php-gds | src/GDS/Mapper.php | Mapper.determineDynamicType | protected function determineDynamicType($mix_value)
{
switch(gettype($mix_value)) {
case 'boolean':
$int_dynamic_type = Schema::PROPERTY_BOOLEAN;
break;
case 'integer':
$int_dynamic_type = Schema::PROPERTY_INTEGER;
brea... | php | protected function determineDynamicType($mix_value)
{
switch(gettype($mix_value)) {
case 'boolean':
$int_dynamic_type = Schema::PROPERTY_BOOLEAN;
break;
case 'integer':
$int_dynamic_type = Schema::PROPERTY_INTEGER;
brea... | [
"protected",
"function",
"determineDynamicType",
"(",
"$",
"mix_value",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"mix_value",
")",
")",
"{",
"case",
"'boolean'",
":",
"$",
"int_dynamic_type",
"=",
"Schema",
"::",
"PROPERTY_BOOLEAN",
";",
"break",
";",
"... | Dynamically determine type for a value
@param $mix_value
@return array | [
"Dynamically",
"determine",
"type",
"for",
"a",
"value"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper.php#L64-L115 |
187,878 | tomwalder/php-gds | src/GDS/Mapper.php | Mapper.mapFromResults | public function mapFromResults(array $arr_results)
{
$arr_entities = [];
foreach ($arr_results as $obj_result) {
$arr_entities[] = $this->mapOneFromResult($obj_result);
}
return $arr_entities;
} | php | public function mapFromResults(array $arr_results)
{
$arr_entities = [];
foreach ($arr_results as $obj_result) {
$arr_entities[] = $this->mapOneFromResult($obj_result);
}
return $arr_entities;
} | [
"public",
"function",
"mapFromResults",
"(",
"array",
"$",
"arr_results",
")",
"{",
"$",
"arr_entities",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr_results",
"as",
"$",
"obj_result",
")",
"{",
"$",
"arr_entities",
"[",
"]",
"=",
"$",
"this",
"->",
"... | Map 1-many results out of the Raw response data array
@param array $arr_results
@return Entity[]|null | [
"Map",
"1",
"-",
"many",
"results",
"out",
"of",
"the",
"Raw",
"response",
"data",
"array"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper.php#L123-L130 |
187,879 | tomwalder/php-gds | src/GDS/Store.php | Store.delete | public function delete($entities)
{
if($entities instanceof Entity) {
$entities = [$entities];
}
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->consumeTransaction())
->deleteMulti($entities);
} | php | public function delete($entities)
{
if($entities instanceof Entity) {
$entities = [$entities];
}
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->consumeTransaction())
->deleteMulti($entities);
} | [
"public",
"function",
"delete",
"(",
"$",
"entities",
")",
"{",
"if",
"(",
"$",
"entities",
"instanceof",
"Entity",
")",
"{",
"$",
"entities",
"=",
"[",
"$",
"entities",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"("... | Delete one or more Model objects from the Datastore
@param mixed
@return bool | [
"Delete",
"one",
"or",
"more",
"Model",
"objects",
"from",
"the",
"Datastore"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L130-L139 |
187,880 | tomwalder/php-gds | src/GDS/Store.php | Store.fetchById | public function fetchById($str_id)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchById($str_id);
} | php | public function fetchById($str_id)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchById($str_id);
} | [
"public",
"function",
"fetchById",
"(",
"$",
"str_id",
")",
"{",
"return",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"(",
"$",
"this",
"->",
"obj_schema",
")",
"->",
"withTransaction",
"(",
"$",
"this",
"->",
"str_transaction_id",
")",
"->",
"f... | Fetch a single Entity from the Datastore, by it's Key ID
Only works for root Entities (i.e. those without parent Entities)
@param $str_id
@return Entity|null | [
"Fetch",
"a",
"single",
"Entity",
"from",
"the",
"Datastore",
"by",
"it",
"s",
"Key",
"ID"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L149-L155 |
187,881 | tomwalder/php-gds | src/GDS/Store.php | Store.fetchByIds | public function fetchByIds(array $arr_ids)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByIds($arr_ids);
} | php | public function fetchByIds(array $arr_ids)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByIds($arr_ids);
} | [
"public",
"function",
"fetchByIds",
"(",
"array",
"$",
"arr_ids",
")",
"{",
"return",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"(",
"$",
"this",
"->",
"obj_schema",
")",
"->",
"withTransaction",
"(",
"$",
"this",
"->",
"str_transaction_id",
")",... | Fetch multiple entities by Key ID
@param $arr_ids
@return Entity[] | [
"Fetch",
"multiple",
"entities",
"by",
"Key",
"ID"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L163-L169 |
187,882 | tomwalder/php-gds | src/GDS/Store.php | Store.fetchByName | public function fetchByName($str_name)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByName($str_name);
} | php | public function fetchByName($str_name)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByName($str_name);
} | [
"public",
"function",
"fetchByName",
"(",
"$",
"str_name",
")",
"{",
"return",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"(",
"$",
"this",
"->",
"obj_schema",
")",
"->",
"withTransaction",
"(",
"$",
"this",
"->",
"str_transaction_id",
")",
"->",
... | Fetch a single Entity from the Datastore, by it's Key Name
Only works for root Entities (i.e. those without parent Entities)
@param $str_name
@return Entity|null | [
"Fetch",
"a",
"single",
"Entity",
"from",
"the",
"Datastore",
"by",
"it",
"s",
"Key",
"Name"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L179-L185 |
187,883 | tomwalder/php-gds | src/GDS/Store.php | Store.fetchByNames | public function fetchByNames(array $arr_names)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByNames($arr_names);
} | php | public function fetchByNames(array $arr_names)
{
return $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->fetchByNames($arr_names);
} | [
"public",
"function",
"fetchByNames",
"(",
"array",
"$",
"arr_names",
")",
"{",
"return",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"(",
"$",
"this",
"->",
"obj_schema",
")",
"->",
"withTransaction",
"(",
"$",
"this",
"->",
"str_transaction_id",
... | Fetch one or more Entities from the Datastore, by their Key Name
Only works for root Entities (i.e. those without parent Entities)
@param $arr_names
@return Entity[]|null | [
"Fetch",
"one",
"or",
"more",
"Entities",
"from",
"the",
"Datastore",
"by",
"their",
"Key",
"Name"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L195-L201 |
187,884 | tomwalder/php-gds | src/GDS/Store.php | Store.query | public function query($str_query, $arr_params = null)
{
$this->str_last_query = $str_query;
$this->arr_last_params = $arr_params;
$this->str_last_cursor = null;
return $this;
} | php | public function query($str_query, $arr_params = null)
{
$this->str_last_query = $str_query;
$this->arr_last_params = $arr_params;
$this->str_last_cursor = null;
return $this;
} | [
"public",
"function",
"query",
"(",
"$",
"str_query",
",",
"$",
"arr_params",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"str_last_query",
"=",
"$",
"str_query",
";",
"$",
"this",
"->",
"arr_last_params",
"=",
"$",
"arr_params",
";",
"$",
"this",
"->",
... | Fetch Entities based on a GQL query
Supported parameter types: String, Integer, DateTime, GDS\Entity
@param $str_query
@param array|null $arr_params
@return $this | [
"Fetch",
"Entities",
"based",
"on",
"a",
"GQL",
"query"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L212-L218 |
187,885 | tomwalder/php-gds | src/GDS/Store.php | Store.fetchEntityGroup | public function fetchEntityGroup(Entity $obj_entity)
{
$arr_results = $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->gql("SELECT * FROM `" . $this->obj_schema->getKind() . "` WHERE __key__ HAS ANCESTOR @ancestorKey", [
... | php | public function fetchEntityGroup(Entity $obj_entity)
{
$arr_results = $this->obj_gateway
->withSchema($this->obj_schema)
->withTransaction($this->str_transaction_id)
->gql("SELECT * FROM `" . $this->obj_schema->getKind() . "` WHERE __key__ HAS ANCESTOR @ancestorKey", [
... | [
"public",
"function",
"fetchEntityGroup",
"(",
"Entity",
"$",
"obj_entity",
")",
"{",
"$",
"arr_results",
"=",
"$",
"this",
"->",
"obj_gateway",
"->",
"withSchema",
"(",
"$",
"this",
"->",
"obj_schema",
")",
"->",
"withTransaction",
"(",
"$",
"this",
"->",
... | Fetch all of the entities in a particular group
@param Entity $obj_entity
@return Entity[] | [
"Fetch",
"all",
"of",
"the",
"entities",
"in",
"a",
"particular",
"group"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L296-L306 |
187,886 | tomwalder/php-gds | src/GDS/Store.php | Store.createEntity | public final function createEntity($arr_data = null)
{
$obj_entity = $this->obj_schema->createEntity();
if(null !== $arr_data) {
foreach ($arr_data as $str_property => $mix_value) {
$obj_entity->__set($str_property, $mix_value);
}
}
return $obj... | php | public final function createEntity($arr_data = null)
{
$obj_entity = $this->obj_schema->createEntity();
if(null !== $arr_data) {
foreach ($arr_data as $str_property => $mix_value) {
$obj_entity->__set($str_property, $mix_value);
}
}
return $obj... | [
"public",
"final",
"function",
"createEntity",
"(",
"$",
"arr_data",
"=",
"null",
")",
"{",
"$",
"obj_entity",
"=",
"$",
"this",
"->",
"obj_schema",
"->",
"createEntity",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"arr_data",
")",
"{",
"foreach",
"(... | Create a new instance of this GDS Entity class
@param array|null $arr_data
@return Entity | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"GDS",
"Entity",
"class"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Store.php#L338-L347 |
187,887 | tomwalder/php-gds | src/GDS/Mapper/ProtoBuf.php | ProtoBuf.mapToGoogle | public function mapToGoogle(Entity $obj_gds_entity, \google\appengine\datastore\v4\Entity $obj_entity)
{
// Key
$this->configureGoogleKey($obj_entity->mutableKey(), $obj_gds_entity);
// Properties
$arr_field_defs = $this->obj_schema->getProperties();
foreach($obj_gds_entity-... | php | public function mapToGoogle(Entity $obj_gds_entity, \google\appengine\datastore\v4\Entity $obj_entity)
{
// Key
$this->configureGoogleKey($obj_entity->mutableKey(), $obj_gds_entity);
// Properties
$arr_field_defs = $this->obj_schema->getProperties();
foreach($obj_gds_entity-... | [
"public",
"function",
"mapToGoogle",
"(",
"Entity",
"$",
"obj_gds_entity",
",",
"\\",
"google",
"\\",
"appengine",
"\\",
"datastore",
"\\",
"v4",
"\\",
"Entity",
"$",
"obj_entity",
")",
"{",
"// Key",
"$",
"this",
"->",
"configureGoogleKey",
"(",
"$",
"obj_e... | Map from GDS to Google Protocol Buffer
@param Entity $obj_gds_entity
@param \google\appengine\datastore\v4\Entity $obj_entity | [
"Map",
"from",
"GDS",
"to",
"Google",
"Protocol",
"Buffer"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/ProtoBuf.php#L39-L57 |
187,888 | tomwalder/php-gds | src/GDS/Mapper/ProtoBuf.php | ProtoBuf.mapOneFromResult | public function mapOneFromResult($obj_result)
{
// Key & Ancestry
list($obj_gds_entity, $bol_schema_match) = $this->createEntityWithKey($obj_result);
// Properties
$arr_property_definitions = $this->obj_schema->getProperties();
foreach($obj_result->getEntity()->getPropertyLi... | php | public function mapOneFromResult($obj_result)
{
// Key & Ancestry
list($obj_gds_entity, $bol_schema_match) = $this->createEntityWithKey($obj_result);
// Properties
$arr_property_definitions = $this->obj_schema->getProperties();
foreach($obj_result->getEntity()->getPropertyLi... | [
"public",
"function",
"mapOneFromResult",
"(",
"$",
"obj_result",
")",
"{",
"// Key & Ancestry",
"list",
"(",
"$",
"obj_gds_entity",
",",
"$",
"bol_schema_match",
")",
"=",
"$",
"this",
"->",
"createEntityWithKey",
"(",
"$",
"obj_result",
")",
";",
"// Propertie... | Map a single result out of the Raw response data into a supplied Entity object
@todo Validate dynamic schema mapping in multi-kind responses like fetchEntityGroup()
@param EntityResult $obj_result
@return Entity | [
"Map",
"a",
"single",
"result",
"out",
"of",
"the",
"Raw",
"response",
"data",
"into",
"a",
"supplied",
"Entity",
"object"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/ProtoBuf.php#L67-L84 |
187,889 | tomwalder/php-gds | src/GDS/Mapper/ProtoBuf.php | ProtoBuf.configureGoogleKey | public function configureGoogleKey(Key $obj_key, Entity $obj_gds_entity)
{
// Add any ancestors FIRST
$mix_ancestry = $obj_gds_entity->getAncestry();
if(is_array($mix_ancestry)) {
// @todo Get direction right!
foreach ($mix_ancestry as $arr_ancestor_element) {
... | php | public function configureGoogleKey(Key $obj_key, Entity $obj_gds_entity)
{
// Add any ancestors FIRST
$mix_ancestry = $obj_gds_entity->getAncestry();
if(is_array($mix_ancestry)) {
// @todo Get direction right!
foreach ($mix_ancestry as $arr_ancestor_element) {
... | [
"public",
"function",
"configureGoogleKey",
"(",
"Key",
"$",
"obj_key",
",",
"Entity",
"$",
"obj_gds_entity",
")",
"{",
"// Add any ancestors FIRST",
"$",
"mix_ancestry",
"=",
"$",
"obj_gds_entity",
"->",
"getAncestry",
"(",
")",
";",
"if",
"(",
"is_array",
"(",... | Populate a ProtoBuf Key from a GDS Entity
@param Key $obj_key
@param Entity $obj_gds_entity
@return Key | [
"Populate",
"a",
"ProtoBuf",
"Key",
"from",
"a",
"GDS",
"Entity"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/ProtoBuf.php#L142-L164 |
187,890 | tomwalder/php-gds | src/GDS/Mapper/ProtoBuf.php | ProtoBuf.configureGoogleKeyPathElement | private function configureGoogleKeyPathElement(Key\PathElement $obj_path_element, array $arr_kpe)
{
$obj_path_element->setKind($arr_kpe['kind']);
isset($arr_kpe['id']) && $obj_path_element->setId($arr_kpe['id']);
isset($arr_kpe['name']) && $obj_path_element->setName($arr_kpe['name']);
} | php | private function configureGoogleKeyPathElement(Key\PathElement $obj_path_element, array $arr_kpe)
{
$obj_path_element->setKind($arr_kpe['kind']);
isset($arr_kpe['id']) && $obj_path_element->setId($arr_kpe['id']);
isset($arr_kpe['name']) && $obj_path_element->setName($arr_kpe['name']);
} | [
"private",
"function",
"configureGoogleKeyPathElement",
"(",
"Key",
"\\",
"PathElement",
"$",
"obj_path_element",
",",
"array",
"$",
"arr_kpe",
")",
"{",
"$",
"obj_path_element",
"->",
"setKind",
"(",
"$",
"arr_kpe",
"[",
"'kind'",
"]",
")",
";",
"isset",
"(",... | Configure a Google Key Path Element object
@param Key\PathElement $obj_path_element
@param array $arr_kpe | [
"Configure",
"a",
"Google",
"Key",
"Path",
"Element",
"object"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/ProtoBuf.php#L172-L177 |
187,891 | tomwalder/php-gds | src/GDS/Mapper/ProtoBuf.php | ProtoBuf.configureGooglePropertyValue | private function configureGooglePropertyValue(Value $obj_val, array $arr_field_def, $mix_value)
{
// Indexed?
$bol_index = TRUE;
if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
$bol_index = FALSE;
}
$obj_val->setIndexed($bol_index);
... | php | private function configureGooglePropertyValue(Value $obj_val, array $arr_field_def, $mix_value)
{
// Indexed?
$bol_index = TRUE;
if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
$bol_index = FALSE;
}
$obj_val->setIndexed($bol_index);
... | [
"private",
"function",
"configureGooglePropertyValue",
"(",
"Value",
"$",
"obj_val",
",",
"array",
"$",
"arr_field_def",
",",
"$",
"mix_value",
")",
"{",
"// Indexed?",
"$",
"bol_index",
"=",
"TRUE",
";",
"if",
"(",
"isset",
"(",
"$",
"arr_field_def",
"[",
"... | Populate a ProtoBuf Property Value from a GDS Entity field definition & value
@todo compare with Google API implementation
@param Value $obj_val
@param array $arr_field_def
@param $mix_value | [
"Populate",
"a",
"ProtoBuf",
"Property",
"Value",
"from",
"a",
"GDS",
"Entity",
"field",
"definition",
"&",
"value"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/ProtoBuf.php#L188-L244 |
187,892 | tomwalder/php-gds | src/GDS/Mapper/RESTv1.php | RESTv1.mapOneFromResult | public function mapOneFromResult($obj_result)
{
// Key & Ancestry
list($obj_gds_entity, $bol_schema_match) = $this->createEntityWithKey($obj_result);
/** @var Entity $obj_gds_entity */
// Properties
if(isset($obj_result->entity->properties)) {
$arr_property_defin... | php | public function mapOneFromResult($obj_result)
{
// Key & Ancestry
list($obj_gds_entity, $bol_schema_match) = $this->createEntityWithKey($obj_result);
/** @var Entity $obj_gds_entity */
// Properties
if(isset($obj_result->entity->properties)) {
$arr_property_defin... | [
"public",
"function",
"mapOneFromResult",
"(",
"$",
"obj_result",
")",
"{",
"// Key & Ancestry",
"list",
"(",
"$",
"obj_gds_entity",
",",
"$",
"bol_schema_match",
")",
"=",
"$",
"this",
"->",
"createEntityWithKey",
"(",
"$",
"obj_result",
")",
";",
"/** @var Ent... | Map a single result out of the Raw response data array FROM Google TO a GDS Entity
@param object $obj_result
@return Entity
@throws \Exception | [
"Map",
"a",
"single",
"result",
"out",
"of",
"the",
"Raw",
"response",
"data",
"array",
"FROM",
"Google",
"TO",
"a",
"GDS",
"Entity"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/RESTv1.php#L133-L153 |
187,893 | tomwalder/php-gds | src/GDS/Mapper/RESTv1.php | RESTv1.mapToGoogle | public function mapToGoogle(Entity $obj_gds_entity)
{
// Base entity with key (partition applied later)
$obj_rest_entity = (object)[
'key' => (object)['path' => $this->buildKeyPath($obj_gds_entity)],
'properties' => (object)[]
];
// Properties
$arr_f... | php | public function mapToGoogle(Entity $obj_gds_entity)
{
// Base entity with key (partition applied later)
$obj_rest_entity = (object)[
'key' => (object)['path' => $this->buildKeyPath($obj_gds_entity)],
'properties' => (object)[]
];
// Properties
$arr_f... | [
"public",
"function",
"mapToGoogle",
"(",
"Entity",
"$",
"obj_gds_entity",
")",
"{",
"// Base entity with key (partition applied later)",
"$",
"obj_rest_entity",
"=",
"(",
"object",
")",
"[",
"'key'",
"=>",
"(",
"object",
")",
"[",
"'path'",
"=>",
"$",
"this",
"... | Create a REST representation of a GDS entity
https://cloud.google.com/datastore/reference/rest/v1/Entity
@param Entity $obj_gds_entity
@return \stdClass | [
"Create",
"a",
"REST",
"representation",
"of",
"a",
"GDS",
"entity"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/RESTv1.php#L263-L284 |
187,894 | tomwalder/php-gds | src/GDS/Mapper/RESTv1.php | RESTv1.buildKeyPath | public function buildKeyPath(Entity $obj_gds_entity, $bol_first_node = true)
{
$str_kind = $obj_gds_entity->getKind();
if(null === $str_kind) {
if($bol_first_node) {
if($this->obj_schema instanceof Schema) {
$str_kind = $this->obj_schema->getKind();
... | php | public function buildKeyPath(Entity $obj_gds_entity, $bol_first_node = true)
{
$str_kind = $obj_gds_entity->getKind();
if(null === $str_kind) {
if($bol_first_node) {
if($this->obj_schema instanceof Schema) {
$str_kind = $this->obj_schema->getKind();
... | [
"public",
"function",
"buildKeyPath",
"(",
"Entity",
"$",
"obj_gds_entity",
",",
"$",
"bol_first_node",
"=",
"true",
")",
"{",
"$",
"str_kind",
"=",
"$",
"obj_gds_entity",
"->",
"getKind",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"str_kind",
")",
"{... | Create a fully qualified Key path
@equivalent ProtoBuf::configureKey() ?
@param Entity $obj_gds_entity
@param bool $bol_first_node
@return array
@throws \Exception | [
"Create",
"a",
"fully",
"qualified",
"Key",
"path"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/RESTv1.php#L313-L347 |
187,895 | tomwalder/php-gds | src/GDS/Mapper/RESTv1.php | RESTv1.createKeyPathElement | protected function createKeyPathElement(array $arr_kpe)
{
$obj_element = (object)['kind' => $arr_kpe['kind']];
if(isset($arr_kpe['id'])) {
$obj_element->id = $arr_kpe['id'];
} elseif (isset($arr_kpe['name'])) {
$obj_element->name = $arr_kpe['name'];
}
... | php | protected function createKeyPathElement(array $arr_kpe)
{
$obj_element = (object)['kind' => $arr_kpe['kind']];
if(isset($arr_kpe['id'])) {
$obj_element->id = $arr_kpe['id'];
} elseif (isset($arr_kpe['name'])) {
$obj_element->name = $arr_kpe['name'];
}
... | [
"protected",
"function",
"createKeyPathElement",
"(",
"array",
"$",
"arr_kpe",
")",
"{",
"$",
"obj_element",
"=",
"(",
"object",
")",
"[",
"'kind'",
"=>",
"$",
"arr_kpe",
"[",
"'kind'",
"]",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"arr_kpe",
"[",
"'id'... | Create a Key Path Element from array
@param array $arr_kpe
@return \stdClass | [
"Create",
"a",
"Key",
"Path",
"Element",
"from",
"array"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/RESTv1.php#L355-L364 |
187,896 | tomwalder/php-gds | src/GDS/Mapper/RESTv1.php | RESTv1.createPropertyValue | protected function createPropertyValue(array $arr_field_def, $mix_value)
{
$obj_property_value = new \stdClass();
// Indexed?
$bol_index = TRUE;
if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
$bol_index = FALSE;
}
$obj_property_... | php | protected function createPropertyValue(array $arr_field_def, $mix_value)
{
$obj_property_value = new \stdClass();
// Indexed?
$bol_index = TRUE;
if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
$bol_index = FALSE;
}
$obj_property_... | [
"protected",
"function",
"createPropertyValue",
"(",
"array",
"$",
"arr_field_def",
",",
"$",
"mix_value",
")",
"{",
"$",
"obj_property_value",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"// Indexed?",
"$",
"bol_index",
"=",
"TRUE",
";",
"if",
"(",
"isset"... | Create a property object
@todo Compare with parameter value method from REST Gateway
@param array $arr_field_def
@param $mix_value
@return mixed | [
"Create",
"a",
"property",
"object"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Mapper/RESTv1.php#L375-L448 |
187,897 | tomwalder/php-gds | src/GDS/Schema.php | Schema.addProperty | public function addProperty($str_name, $int_type = self::PROPERTY_STRING, $bol_index = TRUE)
{
$this->arr_defined_properties[$str_name] = [
'type' => $int_type,
'index' => $bol_index
];
return $this;
} | php | public function addProperty($str_name, $int_type = self::PROPERTY_STRING, $bol_index = TRUE)
{
$this->arr_defined_properties[$str_name] = [
'type' => $int_type,
'index' => $bol_index
];
return $this;
} | [
"public",
"function",
"addProperty",
"(",
"$",
"str_name",
",",
"$",
"int_type",
"=",
"self",
"::",
"PROPERTY_STRING",
",",
"$",
"bol_index",
"=",
"TRUE",
")",
"{",
"$",
"this",
"->",
"arr_defined_properties",
"[",
"$",
"str_name",
"]",
"=",
"[",
"'type'",... | Add a field to the known field array
@param $str_name
@param $int_type
@param bool $bol_index
@return $this | [
"Add",
"a",
"field",
"to",
"the",
"known",
"field",
"array"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Schema.php#L84-L91 |
187,898 | tomwalder/php-gds | src/GDS/Schema.php | Schema.addString | public function addString($str_name, $bol_index = TRUE)
{
return $this->addProperty($str_name, self::PROPERTY_STRING, $bol_index);
} | php | public function addString($str_name, $bol_index = TRUE)
{
return $this->addProperty($str_name, self::PROPERTY_STRING, $bol_index);
} | [
"public",
"function",
"addString",
"(",
"$",
"str_name",
",",
"$",
"bol_index",
"=",
"TRUE",
")",
"{",
"return",
"$",
"this",
"->",
"addProperty",
"(",
"$",
"str_name",
",",
"self",
"::",
"PROPERTY_STRING",
",",
"$",
"bol_index",
")",
";",
"}"
] | Add a string field to the schema
@param $str_name
@param bool $bol_index
@return Schema | [
"Add",
"a",
"string",
"field",
"to",
"the",
"schema"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Schema.php#L100-L103 |
187,899 | tomwalder/php-gds | src/GDS/Schema.php | Schema.addInteger | public function addInteger($str_name, $bol_index = TRUE)
{
return $this->addProperty($str_name, self::PROPERTY_INTEGER, $bol_index);
} | php | public function addInteger($str_name, $bol_index = TRUE)
{
return $this->addProperty($str_name, self::PROPERTY_INTEGER, $bol_index);
} | [
"public",
"function",
"addInteger",
"(",
"$",
"str_name",
",",
"$",
"bol_index",
"=",
"TRUE",
")",
"{",
"return",
"$",
"this",
"->",
"addProperty",
"(",
"$",
"str_name",
",",
"self",
"::",
"PROPERTY_INTEGER",
",",
"$",
"bol_index",
")",
";",
"}"
] | Add an integer field to the schema
@param $str_name
@param bool $bol_index
@return Schema | [
"Add",
"an",
"integer",
"field",
"to",
"the",
"schema"
] | 65fbafffbb36d864f245f3405da6d683c1ca2265 | https://github.com/tomwalder/php-gds/blob/65fbafffbb36d864f245f3405da6d683c1ca2265/src/GDS/Schema.php#L112-L115 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.