_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q19500
CCodeModel.sticky
train
public function sticky($attribute,$params) { if(!$this->hasErrors())
php
{ "resource": "" }
q19501
CCodeModel.loadStickyAttributes
train
public function loadStickyAttributes() { $this->_stickyAttributes=array(); $path=$this->getStickyFile(); if(is_file($path)) { $result=@include($path); if(is_array($result)) { $this->_stickyAttributes=$result; foreach($this->_stickyAttributes
php
{ "resource": "" }
q19502
CCodeModel.saveStickyAttributes
train
public function saveStickyAttributes() { $path=$this->getStickyFile(); @mkdir(dirname($path),0755,true);
php
{ "resource": "" }
q19503
CCodeModel.class2name
train
public function class2name($name,$ucwords=true) { $result=trim(strtolower(str_replace('_','
php
{ "resource": "" }
q19504
CCodeModel.validateReservedWord
train
public function validateReservedWord($attribute,$params) { $value=$this->$attribute; if(in_array(strtolower($value),self::$keywords)) $this->addError($attribute,
php
{ "resource": "" }
q19505
CActiveForm.validate
train
public static function validate($models, $attributes=null, $loadInput=true) { $result=array(); if(!is_array($models)) $models=array($models); foreach($models as $model) { $modelName=CHtml::modelName($model); if($loadInput && isset($_POST[$modelName])) $model->attributes=$_POST[$modelName]; $mod...
php
{ "resource": "" }
q19506
CCaptcha.registerClientScript
train
public function registerClientScript() { $cs=Yii::app()->clientScript; $id=$this->imageOptions['id']; $url=$this->getController()->createUrl($this->captchaAction,array(CCaptchaAction::REFRESH_GET_VAR=>true)); $js=""; if($this->showRefreshButton) { // reserve a place in the registered script so that any...
php
{ "resource": "" }
q19507
CCaptcha.checkRequirements
train
public static function checkRequirements($extension=null) { if(extension_loaded('imagick')) { $imagick=new Imagick(); $imagickFormats=$imagick->queryFormats('PNG'); } if(extension_loaded('gd')) { $gdInfo=gd_info(); } if($extension===null)
php
{ "resource": "" }
q19508
SpamCheck.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'threshold' => $this->getThreshold(), 'post_to_url' => $this->getPostToUrl() ],
php
{ "resource": "" }
q19509
TrackingSettings.setGanalytics
train
public function setGanalytics( $enable, $utm_source = null, $utm_medium = null, $utm_term = null, $utm_content = null, $utm_campaign = null ) { if ($enable instanceof Ganalytics) {
php
{ "resource": "" }
q19510
TrackingSettings.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'click_tracking' => $this->getClickTracking(), 'open_tracking' => $this->getOpenTracking(), 'subscription_tracking' => $this->getSubscriptionTracking(), 'ganalytics'
php
{ "resource": "" }
q19511
ClickTracking.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'enable_text' => $this->getEnableText() ],
php
{ "resource": "" }
q19512
Footer.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'text' => $this->getText(), 'html' => $this->getHtml()
php
{ "resource": "" }
q19513
Header.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'key' => $this->getKey(), 'value' => $this->getValue() ],
php
{ "resource": "" }
q19514
BccSettings.setEmail
train
public function setEmail($email) { if (!is_string($email) && filter_var($email, FILTER_VALIDATE_EMAIL) ) { throw new TypeException(
php
{ "resource": "" }
q19515
BccSettings.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'email' => $this->getEmail() ],
php
{ "resource": "" }
q19516
EmailAddress.setEmailAddress
train
public function setEmailAddress($emailAddress) { if (!(is_string($emailAddress) && filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) ) { throw new TypeException(
php
{ "resource": "" }
q19517
EmailAddress.setName
train
public function setName($name) { if (!is_string($name)) { throw new TypeException('$name must be of type string.'); } /* Issue #368 ========== If the name is not wrapped in double quotes and contains a comma or semicolon, the API f...
php
{ "resource": "" }
q19518
EmailAddress.setSubject
train
public function setSubject($subject) { if (!is_string($subject)) { throw new TypeException('$subject must be of type string.'); } if (!($subject instanceof Subject)) {
php
{ "resource": "" }
q19519
EmailAddress.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'name' => $this->getName(), 'email' => $this->getEmail() ],
php
{ "resource": "" }
q19520
Personalization.jsonSerialize
train
public function jsonSerialize() { if ($this->getHasDynamicTemplate() == true) { $dynamic_substitutions = $this->getSubstitutions(); $substitutions = null; } else { $substitutions = $this->getSubstitutions(); $dynamic_substitutions = null; } ...
php
{ "resource": "" }
q19521
Recipient.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'email' => $this->getEmail(), 'first_name' => $this->getFirstName(), 'last_name' => $this->getLastName() ],
php
{ "resource": "" }
q19522
Stats.getCategory
train
public function getCategory($categories) { $this->validateNumericArray('categories', $categories); $stats = $this->getGlobal();
php
{ "resource": "" }
q19523
Stats.getSubuser
train
public function getSubuser($subusers) { $this->validateNumericArray('subusers', $subusers); $stats = $this->getGlobal();
php
{ "resource": "" }
q19524
Stats.getSum
train
public function getSum( $sortByMetric = 'delivered', $sortByDirection = 'desc', $limit = 5, $offset = 0 ) { $this->validateOptions( 'sortByDirection', $sortByDirection, self::OPTIONS_SORT_DIRECTION ); $this->validateInteger('limit',...
php
{ "resource": "" }
q19525
Stats.getSubuserMonthly
train
public function getSubuserMonthly( $subuser = null, $sortByMetric = 'delivered', $sortByDirection = 'desc', $limit = 5, $offset = 0 ) { $this->validateOptions( 'sortByDirection', $sortByDirection,
php
{ "resource": "" }
q19526
Stats.validateNumericArray
train
protected function validateNumericArray($name, $value) { if (!is_array($value) || empty($value) ||
php
{ "resource": "" }
q19527
OpenTracking.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'substitution_tag' => $this->getSubstitutionTag() ],
php
{ "resource": "" }
q19528
MailSettings.setBccSettings
train
public function setBccSettings($enable, $email = null) { if ($enable instanceof BccSettings) { $bcc = $enable; $this->bcc = $bcc; return; } if (!is_bool($enable)) { throw new TypeException(
php
{ "resource": "" }
q19529
MailSettings.setBypassListManagement
train
public function setBypassListManagement($enable) { if ($enable instanceof BypassListManagement) { $bypass_list_management = $enable; $this->bypass_list_management = $bypass_list_management;
php
{ "resource": "" }
q19530
MailSettings.setFooter
train
public function setFooter($enable, $text = null, $html = null) { if ($enable instanceof Footer) { $footer = $enable; $this->footer = $footer;
php
{ "resource": "" }
q19531
MailSettings.setSandboxMode
train
public function setSandboxMode($enable) { if ($enable instanceof SandBoxMode) { $sandbox_mode = $enable;
php
{ "resource": "" }
q19532
MailSettings.setSpamCheck
train
public function setSpamCheck($enable, $threshold = null, $post_to_url = null) { if ($enable instanceof SpamCheck) { $spam_check = $enable; $this->spam_check = $spam_check; return;
php
{ "resource": "" }
q19533
MailSettings.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'bcc' => $this->getBccSettings(), 'bypass_list_management' => $this->getBypassListManagement(), 'footer' => $this->getFooter(), 'sandbox_mode'
php
{ "resource": "" }
q19534
Substitution.setValue
train
public function setValue($value) { if (!is_string($value) && !is_array($value) && !is_object($value) &&!is_bool($value) &&!is_int($value))
php
{ "resource": "" }
q19535
Content.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'type' => $this->getType(), 'value' => $this->getValue() ],
php
{ "resource": "" }
q19536
GroupsToDisplay.setGroupsToDisplay
train
public function setGroupsToDisplay($groups_to_display) { if (!is_array($groups_to_display)) { throw new TypeException('$groups_to_display must be an array.'); } if (is_array($groups_to_display)) {
php
{ "resource": "" }
q19537
Attachment.setContent
train
public function setContent($content) { if (!is_string($content)) { throw new TypeException('$content must be of type string.'); } if (!$this->isBase64($content)) { $this->content
php
{ "resource": "" }
q19538
Attachment.isBase64
train
private function isBase64($string) { $decoded_data = base64_decode($string, true);
php
{ "resource": "" }
q19539
Asm.setGroupId
train
public function setGroupId($group_id) { if ($group_id instanceof GroupId) { $this->group_id = $group_id->getGroupId(); } else { if (!is_int($group_id)) { throw new TypeException(
php
{ "resource": "" }
q19540
Asm.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'group_id' => $this->getGroupId(), 'groups_to_display' => $this->getGroupsToDisplay() ],
php
{ "resource": "" }
q19541
Mail.addRecipientEmail
train
private function addRecipientEmail( $emailType, $email, $name = null, $substitutions = null, $personalizationIndex = null, $personalization = null ) { $personalizationFunctionCall = "add" . $emailType; $emailType = "\SendGrid\Mail\\" . $emailType; ...
php
{ "resource": "" }
q19542
Mail.addRecipientEmails
train
private function addRecipientEmails( $emailType, $emails, $personalizationIndex = null, $personalization = null ) { $emailFunctionCall = "add" . $emailType; if (current($emails) instanceof EmailAddress) { foreach ($emails as $email) { $thi...
php
{ "resource": "" }
q19543
Mail.addTo
train
public function addTo( $to, $name = null, $substitutions = null, $personalizationIndex = null, $personalization = null ) { if ($to instanceof To) { $name = $to->getName(); $substitutions = $to->getSubstitutions(); $to = $to->getEmai...
php
{ "resource": "" }
q19544
Mail.addTos
train
public function addTos( $toEmails, $personalizationIndex = null, $personalization = null ) { $this->addRecipientEmails( "To",
php
{ "resource": "" }
q19545
Mail.addCc
train
public function addCc( $cc, $name = null, $personalizationIndex = null, $personalization = null ) { if ($cc instanceof Cc) { $name = $cc->getName(); $cc = $cc->getEmailAddress();
php
{ "resource": "" }
q19546
Mail.addCcs
train
public function addCcs( $ccEmails, $personalizationIndex = null, $personalization = null ) { $this->addRecipientEmails( "Cc",
php
{ "resource": "" }
q19547
Mail.addBcc
train
public function addBcc( $bcc, $name = null, $personalizationIndex = null, $personalization = null ) { if ($bcc instanceof Bcc) { $name = $bcc->getName(); $bcc = $bcc->getEmailAddress();
php
{ "resource": "" }
q19548
Mail.addBccs
train
public function addBccs( $bccEmails, $personalizationIndex = null, $personalization = null ) { $this->addRecipientEmails( "Bcc",
php
{ "resource": "" }
q19549
Mail.setSubject
train
public function setSubject( $subject, $personalizationIndex = null, $personalization = null ) { if (!($subject instanceof Subject)) { $subject = new Subject($subject); } if ($personalization != null) { $personalization->setSubject($subject); ...
php
{ "resource": "" }
q19550
Mail.addHeader
train
public function addHeader( $key, $value = null, $personalizationIndex = null, $personalization = null ) { $header = null; if ($key instanceof Header) { $h = $key; $header = new Header($h->getKey(), $h->getValue()); } else { ...
php
{ "resource": "" }
q19551
Mail.addHeaders
train
public function addHeaders( $headers, $personalizationIndex = null, $personalization = null ) { if (current($headers) instanceof Header) { foreach ($headers as $header) { $this->addHeader($header); } } else { foreach ($heade...
php
{ "resource": "" }
q19552
Mail.addSubstitution
train
public function addSubstitution( $key, $value = null, $personalizationIndex = null, $personalization = null ) { $substitution = null; if ($key instanceof Substitution) { $s = $key; $substitution = new Substitution($s->getKey(), $s->getValue());...
php
{ "resource": "" }
q19553
Mail.addSubstitutions
train
public function addSubstitutions( $substitutions, $personalizationIndex = null, $personalization = null ) { if (current($substitutions) instanceof Substitution) { foreach ($substitutions as $substitution) { $this->addSubstitution($substitution); ...
php
{ "resource": "" }
q19554
Mail.addCustomArg
train
public function addCustomArg( $key, $value = null, $personalizationIndex = null, $personalization = null ) { $custom_arg = null; if ($key instanceof CustomArg) { $ca = $key; $custom_arg = new CustomArg($ca->getKey(), $ca->getValue()); }...
php
{ "resource": "" }
q19555
Mail.addCustomArgs
train
public function addCustomArgs( $custom_args, $personalizationIndex = null, $personalization = null ) { if (current($custom_args) instanceof CustomArg) { foreach ($custom_args as $custom_arg) { $this->addCustomArg($custom_arg); } } else ...
php
{ "resource": "" }
q19556
Mail.setSendAt
train
public function setSendAt( $send_at, $personalizationIndex = null, $personalization = null ) { if (!($send_at instanceof SendAt)) { $send_at = new SendAt($send_at); } if ($personalization != null) { $personalization->setSendAt($send_at); ...
php
{ "resource": "" }
q19557
Mail.setFrom
train
public function setFrom($email, $name = null) { if ($email instanceof From) { $this->from = $email; } else { if ( is_string($email) && filter_var($email, FILTER_VALIDATE_EMAIL)
php
{ "resource": "" }
q19558
Mail.setReplyTo
train
public function setReplyTo($email, $name = null) { if ($email instanceof ReplyTo) {
php
{ "resource": "" }
q19559
Mail.setGlobalSubject
train
public function setGlobalSubject($subject) { if (!($subject instanceof Subject))
php
{ "resource": "" }
q19560
Mail.addContent
train
public function addContent($type, $value = null) { if ($type instanceof Content) { $content = $type; } else { $content =
php
{ "resource": "" }
q19561
Mail.addContents
train
public function addContents($contents) { if (current($contents) instanceof Content) { foreach ($contents as $content) { $this->addContent($content); }
php
{ "resource": "" }
q19562
Mail.getContents
train
public function getContents() { if ($this->contents) { if ($this->contents[0]->getType() !== 'text/plain' && count($this->contents) > 1 ) { foreach ($this->contents as $key => $value) { if ($value->getType() == 'text/plain') { ...
php
{ "resource": "" }
q19563
Mail.addAttachment
train
public function addAttachment( $attachment, $type = null, $filename = null, $disposition = null, $content_id = null ) { if (is_array($attachment)) { $attachment = new Attachment( $attachment[0], $attachment[1], ...
php
{ "resource": "" }
q19564
Mail.setTemplateId
train
public function setTemplateId($template_id) { if (!($template_id instanceof TemplateId))
php
{ "resource": "" }
q19565
Mail.addSection
train
public function addSection($key, $value = null) { if ($key instanceof Section) { $section = $key; $this->sections[$section->getKey()]
php
{ "resource": "" }
q19566
Mail.addSections
train
public function addSections($sections) { if (current($sections) instanceof Section) { foreach ($sections as $section) { $this->addSection($section); }
php
{ "resource": "" }
q19567
Mail.addGlobalHeader
train
public function addGlobalHeader($key, $value = null) { if ($key instanceof Header) { $header = $key;
php
{ "resource": "" }
q19568
Mail.addGlobalHeaders
train
public function addGlobalHeaders($headers) { if (current($headers) instanceof Header) { foreach ($headers as $header) { $this->addGlobalHeader($header); }
php
{ "resource": "" }
q19569
Mail.addGlobalSubstitution
train
public function addGlobalSubstitution($key, $value = null) { if ($key instanceof Substitution) { $substitution = $key;
php
{ "resource": "" }
q19570
Mail.addGlobalSubstitutions
train
public function addGlobalSubstitutions($substitutions) { if (current($substitutions) instanceof Substitution) { foreach ($substitutions as $substitution) { $this->addGlobalSubstitution($substitution); }
php
{ "resource": "" }
q19571
Mail.addCategory
train
public function addCategory($category) { if (!($category instanceof Category))
php
{ "resource": "" }
q19572
Mail.addGlobalCustomArg
train
public function addGlobalCustomArg($key, $value = null) { if ($key instanceof CustomArg) { $custom_arg = $key;
php
{ "resource": "" }
q19573
Mail.addGlobalCustomArgs
train
public function addGlobalCustomArgs($custom_args) { if (current($custom_args) instanceof CustomArg) { foreach ($custom_args as $custom_arg) { $this->addGlobalCustomArg($custom_arg); }
php
{ "resource": "" }
q19574
Mail.setGlobalSendAt
train
public function setGlobalSendAt($send_at) { if (!($send_at instanceof SendAt))
php
{ "resource": "" }
q19575
Mail.setBatchId
train
public function setBatchId($batch_id) { if (!($batch_id instanceof BatchId))
php
{ "resource": "" }
q19576
Mail.setAsm
train
public function setAsm($group_id, $groups_to_display = null) { if ($group_id instanceof Asm) { $asm = $group_id; $this->asm = $asm;
php
{ "resource": "" }
q19577
Mail.setIpPoolName
train
public function setIpPoolName($ip_pool_name) { if ($ip_pool_name instanceof IpPoolName) { $this->ip_pool_name = $ip_pool_name->getIpPoolName();
php
{ "resource": "" }
q19578
Mail.setBccSettings
train
public function setBccSettings($enable, $email = null) { if (!($this->mail_settings instanceof MailSettings)) { $this->mail_settings = new MailSettings();
php
{ "resource": "" }
q19579
Mail.enableBypassListManagement
train
public function enableBypassListManagement() { if (!$this->mail_settings instanceof MailSettings) { $this->mail_settings = new MailSettings();
php
{ "resource": "" }
q19580
Mail.disableBypassListManagement
train
public function disableBypassListManagement() { if (!($this->mail_settings instanceof MailSettings)) { $this->mail_settings = new MailSettings();
php
{ "resource": "" }
q19581
Mail.setFooter
train
public function setFooter($enable = null, $text = null, $html = null) { if (!$this->mail_settings instanceof MailSettings) { $this->mail_settings = new
php
{ "resource": "" }
q19582
Mail.enableSandBoxMode
train
public function enableSandBoxMode() { if (!($this->mail_settings instanceof MailSettings)) {
php
{ "resource": "" }
q19583
Mail.disableSandBoxMode
train
public function disableSandBoxMode() { if (!($this->mail_settings instanceof MailSettings)) {
php
{ "resource": "" }
q19584
Mail.setSpamCheck
train
public function setSpamCheck($enable = null, $threshold = null, $post_to_url = null) { if (!$this->mail_settings instanceof MailSettings) { $this->mail_settings = new
php
{ "resource": "" }
q19585
Mail.setGanalytics
train
public function setGanalytics( $enable = null, $utm_source = null, $utm_medium = null, $utm_term = null, $utm_content = null, $utm_campaign = null ) { if (!($this->tracking_settings instanceof TrackingSettings)) { $this->tracking_settings = new Tra...
php
{ "resource": "" }
q19586
Mail.jsonSerialize
train
public function jsonSerialize() { // Detect if we are using the new dynamic templates $template_id = $this->getTemplateId(); if ($template_id != null) { if (substr((string) $template_id->getTemplateId(), 0, 2) == "d-") { foreach ($this->personalization as $persona...
php
{ "resource": "" }
q19587
Ganalytics.jsonSerialize
train
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'utm_source' => $this->getCampaignSource(), 'utm_medium' => $this->getCampaignMedium(), 'utm_term' => $this->getCampaignTerm(),
php
{ "resource": "" }
q19588
Minify_CSS_UriRewriter.rewriteRelative
train
public static function rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array()) { // prepend path with current dir separator (OS-independent) $path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR); $path .= DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR); ...
php
{ "resource": "" }
q19589
Minify_SourceSet.getDigest
train
public static function getDigest($sources) { $info = array(); foreach ($sources as $source) { $info[] = array(
php
{ "resource": "" }
q19590
Minify_Build.uri
train
public function uri($uri, $forceAmpersand = false) { $sep = ($forceAmpersand
php
{ "resource": "" }
q19591
Minify_Cache_XCache.getSize
train
public function getSize($id) { if (! $this->_fetch($id)) { return false; } if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) { return
php
{ "resource": "" }
q19592
Minify_Cache_XCache._fetch
train
private function _fetch($id) { if ($this->_id === $id) { return true; } $ret = xcache_get($id); if (false === $ret) { $this->_id = null;
php
{ "resource": "" }
q19593
Minify_Controller_Page.createConfiguration
train
public function createConfiguration(array $options) { if (isset($options['file'])) { $sourceSpec = array( 'filepath' => $options['file'] ); $f = $options['file']; } else { // strip controller options $sourceSpec = array( ...
php
{ "resource": "" }
q19594
Minify_LessCssSource.getCache
train
private function getCache() { // cache for single run // so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache) if (isset($this->parsed)) { return $this->parsed; } // check from cache first $cache = ...
php
{ "resource": "" }
q19595
Minify_CommentPreserver._nextComment
train
private static function _nextComment($in) { if (false === ($start = strpos($in, '/*!')) || false === ($end = strpos($in, '*/', $start + 3))) { return array($in, false, false); } $beforeComment = substr($in, 0, $start); $comment = self::$prepend . '/*!' . substr($in, $sta...
php
{ "resource": "" }
q19596
Cli.getErrorReport
train
public function getErrorReport() { if (empty($this->errors)) { return ''; } $r = "Some arguments did not
php
{ "resource": "" }
q19597
Cli.openInput
train
public function openInput() { if (null === $this->_stdin) { return STDIN; } else {
php
{ "resource": "" }
q19598
Cli.openOutput
train
public function openOutput() { if (null === $this->_stdout) { return STDOUT; } else {
php
{ "resource": "" }
q19599
HTTP_ConditionalGet.check
train
public static function check($lastModifiedTime = null, $isPublic = false, $options = array()) { if (null !== $lastModifiedTime) { $options['lastModifiedTime'] = (int)$lastModifiedTime;
php
{ "resource": "" }