_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q248900 | PHPMailer.AddrAppend | validation | function AddrAppend($type, $addr) {
$addr_str = $type . ": ";
$addr_str .= $this->AddrFormat($addr[0]);
if(count($addr) > 1)
{
for($i = 1; $i < count($addr); $i++)
$addr_str .= ", " . $this->AddrFormat($addr[$i]);
}
$addr_str .= $this->LE;
... | php | {
"resource": ""
} |
q248901 | PHPMailer.AddrFormat | validation | function AddrFormat($addr) {
if(empty($addr[1]))
$formatted = $addr[0];
else
{
$formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .
$addr[0] . ">";
}
return $formatted;
} | php | {
"resource": ""
} |
q248902 | PHPMailer.SetWordWrap | validation | function SetWordWrap() {
if($this->WordWrap < 1)
return;
switch($this->message_type)
{
case "alt":
// fall through
case "alt_attachments":
$this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
b... | php | {
"resource": ""
} |
q248903 | PHPMailer.CreateBody | validation | function CreateBody() {
$result = "";
$this->SetWordWrap();
switch($this->message_type)
{
case "alt":
$result .= $this->GetBoundary($this->boundary[1], "",
"text/plain", "");
$result .= $this->En... | php | {
"resource": ""
} |
q248904 | PHPMailer.AddAttachment | validation | function AddAttachment($path, $name = "", $encoding = "base64",
$type = "application/octet-stream") {
if(!@is_file($path))
{
$this->SetError($this->Lang("file_access") . $path);
return false;
}
$filename = basename($path);
if($... | php | {
"resource": ""
} |
q248905 | PHPMailer.AttachAll | validation | function AttachAll() {
// Return text of body
$mime = array();
// Add all attachments
for($i = 0; $i < count($this->attachment); $i++)
{
// Check for string attachment
$bString = $this->attachment[$i][5];
if ($bString)
$string ... | php | {
"resource": ""
} |
q248906 | PHPMailer.EncodeFile | validation | function EncodeFile ($path, $encoding = "base64") {
if(!@$fd = fopen($path, "rb"))
{
$this->SetError($this->Lang("file_open") . $path);
return "";
}
$magic_quotes = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
$file_buffer = fread($fd, ... | php | {
"resource": ""
} |
q248907 | PHPMailer.EncodeQP | validation | function EncodeQP ($str) {
$encoded = $this->FixEOL($str);
if (substr($encoded, -(strlen($this->LE))) != $this->LE)
$encoded .= $this->LE;
// Replace every high ascii, control and = characters
$encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
... | php | {
"resource": ""
} |
q248908 | PHPMailer.InlineImageExists | validation | function InlineImageExists() {
$result = false;
for($i = 0; $i < count($this->attachment); $i++)
{
if($this->attachment[$i][6] == "inline")
{
$result = true;
break;
}
}
return $result;
} | php | {
"resource": ""
} |
q248909 | PHPMailer.RFCDate | validation | function RFCDate() {
$tz = date("Z");
$tzs = ($tz < 0) ? "-" : "+";
$tz = abs($tz);
$tz = ($tz/3600)*100 + ($tz%3600)/60;
$result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
return $result;
} | php | {
"resource": ""
} |
q248910 | PHPMailer.ServerVar | validation | function ServerVar($varName) {
global $HTTP_SERVER_VARS;
global $HTTP_ENV_VARS;
if(!isset($_SERVER))
{
$_SERVER = $HTTP_SERVER_VARS;
if(!isset($_SERVER["REMOTE_ADDR"]))
$_SERVER = $HTTP_ENV_VARS; // must be Apache
}
if(iss... | php | {
"resource": ""
} |
q248911 | PHPMailer.ServerHostname | validation | function ServerHostname() {
if ($this->Hostname != "")
$result = $this->Hostname;
elseif ($this->ServerVar('SERVER_NAME') != "")
$result = $this->ServerVar('SERVER_NAME');
else
$result = "localhost.localdomain";
return $result;
} | php | {
"resource": ""
} |
q248912 | clsOpenTBS.TbsInitArchive | validation | function TbsInitArchive() {
$TBS =& $this->TBS;
$TBS->OtbsCurrFile = false;
$this->TbsStoreLst = array();
$this->TbsCurrIdx = false;
$this->TbsNoField = array(); // idx of sub-file having no TBS fields
$this->IdxToCheck = array(); // index of files to check
$this->PrevVals = array(); // Previous values... | php | {
"resource": ""
} |
q248913 | clsOpenTBS.TbsLoadSubFileAsTemplate | validation | function TbsLoadSubFileAsTemplate($SubFileLst) {
if (!is_array($SubFileLst)) $SubFileLst = array($SubFileLst);
$ok = true;
$TBS = false;
foreach ($SubFileLst as $SubFile) {
$idx = $this->FileGetIdx($SubFile);
if ($idx===false) {
$ok = $this->RaiseError('Cannot load "'.$SubFile.'". The file is not ... | php | {
"resource": ""
} |
q248914 | clsOpenTBS.TbsStorePark | validation | function TbsStorePark() {
if ($this->TbsCurrIdx!==false) {
$this->TbsStoreLst[$this->TbsCurrIdx] = array('src'=>$this->TBS->Source, 'onshow'=>true);
$this->TBS->Source = '';
$this->TbsCurrIdx = false;
}
} | php | {
"resource": ""
} |
q248915 | clsOpenTBS.TbsStoreLoad | validation | function TbsStoreLoad($idx, $file=false) {
$this->TBS->Source = $this->TbsStoreGet($idx, false);
$this->TbsCurrIdx = $idx;
if ($file===false) $file = $this->TbsGetFileName($idx);
$this->TBS->OtbsCurrFile = $file;
} | php | {
"resource": ""
} |
q248916 | clsOpenTBS.TbsStoreGet | validation | function TbsStoreGet($idx, $caller) {
$this->LastReadNotStored = false;
if ($idx===$this->TbsCurrIdx) {
return $this->TBS->Source;
} elseif (isset($this->TbsStoreLst[$idx])) {
$txt = $this->TbsStoreLst[$idx]['src'];
if ($caller===false) $this->TbsStoreLst[$idx]['src'] = ''; // save memory space
return... | php | {
"resource": ""
} |
q248917 | clsOpenTBS.TbsQuickLoad | validation | function TbsQuickLoad($NameLst) {
if (!is_array($NameLst)) $NameLst = array($NameLst);
$nbr = 0;
$TBS = &$this->TBS;
foreach ($NameLst as $FileName) {
$idx = $this->FileGetIdx($FileName);
if ( (!isset($this->TbsStoreLst[$idx])) && (!isset($this->TbsNoField[$idx])) ) {
$txt = $this->FileRead($idx, tr... | php | {
"resource": ""
} |
q248918 | clsOpenTBS.TbsSearchInFiles | validation | function TbsSearchInFiles($files, $str, $returnFirstFound = true) {
$keys_ok = array();
// transform the list of files into a list of available idx
$keys_todo = array();
$idx_keys = array();
foreach($files as $k=>$f) {
$idx = $this->FileGetIdx($f);
if ($idx!==false) {
$keys_todo[$k] = $idx;
$i... | php | {
"resource": ""
} |
q248919 | clsOpenTBS.TbsSheetCheck | validation | function TbsSheetCheck() {
if (count($this->OtbsSheetSlidesDelete)>0) $this->RaiseError("Unable to delete the following sheets because they are not found in the workbook: ".(str_replace(array('i:','n:'),'',implode(', ',$this->OtbsSheetSlidesDelete))).'.');
if (count($this->OtbsSheetSlidesVisible)>0) $this->RaiseErr... | php | {
"resource": ""
} |
q248920 | clsOpenTBS.TbsMergeVarFields | validation | function TbsMergeVarFields($PrmVal, $FldVal) {
$this->TBS->meth_Merge_AutoVar($PrmVal, true);
$PrmVal = str_replace($this->TBS->_ChrVal, $FldVal, $PrmVal);
return $PrmVal;
} | php | {
"resource": ""
} |
q248921 | clsOpenTBS.TbsSheetSlide_DeleteDisplay | validation | function TbsSheetSlide_DeleteDisplay($id_or_name, $ok, $delete) {
if (is_null($ok)) $ok = true; // default value
$ext = $this->ExtEquiv;
$ok = (boolean) $ok;
if (!is_array($id_or_name)) $id_or_name = array($id_or_name);
foreach ($id_or_name as $item=>$action) {
if (!is_bool($action)) {
$item = $ac... | php | {
"resource": ""
} |
q248922 | clsOpenTBS.TbsPrepareMergeCell | validation | function TbsPrepareMergeCell(&$Txt, &$Loc) {
if ($this->ExtEquiv=='docx') {
// Move the locator just inside the <w:tcPr> element.
// See OnOperation() for other process
$xml = clsTbsXmlLoc::FindStartTag($Txt, 'w:tcPr', $Loc->PosBeg, false);
if ($xml) {
$Txt = substr_replace($Txt, '', $Loc->PosBeg, $L... | php | {
"resource": ""
} |
q248923 | clsOpenTBS.Ext_DeductFormat | validation | function Ext_DeductFormat(&$Ext, $Search) {
if (strpos(',odt,ods,odg,odf,odp,odm,ott,ots,otg,otp,', ',' . $Ext . ',') !== false) return 'odf';
if (strpos(',docx,xlsx,xlsm,pptx,', ',' . $Ext . ',') !== false) return 'openxml';
if (!$Search) return false;
if ($this->FileExists('content.xml')) {
// OpenOffice d... | php | {
"resource": ""
} |
q248924 | clsOpenTBS.Ext_GetMainIdx | validation | function Ext_GetMainIdx() {
if ( ($this->ExtInfo!==false) && isset($this->ExtInfo['main']) ) {
return $this->FileGetIdx($this->ExtInfo['main']);
} else {
return false;
}
} | php | {
"resource": ""
} |
q248925 | clsOpenTBS.XML_DeleteElements | validation | function XML_DeleteElements(&$Txt, $TagLst, $OnlyInner=false) {
$nbr_del = 0;
foreach ($TagLst as $tag) {
$t_open = '<'.$tag;
$t_close = '</'.$tag;
$p1 = 0;
while (($p1=$this->XML_FoundTagStart($Txt, $t_open, $p1))!==false) {
// get the end of the tag
$pe1 = strpos($Txt, '>', $p1);
if ($pe1=... | php | {
"resource": ""
} |
q248926 | clsOpenTBS.XML_DeleteColumnElements | validation | function XML_DeleteColumnElements(&$Txt, $Tag, $SpanAtt, $ColLst, $ColMax) {
$ColNum = 0;
$ColPos = 0;
$ColQty = 1;
$Continue = true;
$ModifNbr = 0;
while ($Continue && ($Loc = clsTbsXmlLoc::FindElement($Txt, $Tag, $ColPos, true)) ) {
// get colmun quantity covered by the element (1 by default)
if ... | php | {
"resource": ""
} |
q248927 | clsOpenTBS.Misc_ColNum | validation | function Misc_ColNum($ColRef, $IsODF) {
if ($IsODF) {
$p = strpos($ColRef, '.');
if ($p!==false) $ColRef = substr($ColRef, $p); // delete the table name wich is in prefix
$ColRef = str_replace( array('.','$'), '', $ColRef);
$ColRef = explode(':', $ColRef);
$ColRef = $ColRef[0];
}
$num = 0;
$ran... | php | {
"resource": ""
} |
q248928 | clsOpenTBS.Misc_CellRef | validation | function Misc_CellRef($Col, $Row) {
$r = '';
$x = $Col;
do {
$x = $x - 1;
$c = ($x % 26);
$x = ($x - $c)/26;
$r = chr(65 + $c) . $r; // chr(65)='A'
} while ($x>0);
return $r.$Row;
} | php | {
"resource": ""
} |
q248929 | clsOpenTBS.OpenXML_Rels_ReplaceTarget | validation | function OpenXML_Rels_ReplaceTarget($RelsPath, $OldTarget, $NewTarget) {
$idx = $this->FileGetIdx($RelsPath);
if ($idx===false) $this->RaiseError("Cannot edit target in '$RelsPath' because the file is not found.");
$txt = $this->TbsStoreGet($idx, 'Replace target in rels file');
$att = 'Target="'.$OldTarget... | php | {
"resource": ""
} |
q248930 | clsOpenTBS.OpenXML_CTypesPrepareExt | validation | function OpenXML_CTypesPrepareExt($FileOrExt, $ct='') {
$ext = $this->Misc_FileExt($FileOrExt);
$this->OpenXML_CTypesInit();
$lst =& $this->OpenXmlCTypes['Extension'];
if (isset($lst[$ext]) && ($lst[$ext]!=='') ) return;
if (($ct==='') && isset($this->ExtInfo['pic_ext'][$ext])) $ct = 'image/'.$this->Ext... | php | {
"resource": ""
} |
q248931 | clsOpenTBS.OpenXML_ChartGetInfoFromFile | validation | function OpenXML_ChartGetInfoFromFile($idx, $Txt=false) {
if ($idx===false) return false;
$file = $this->CdFileLst[$idx]['v_name'];
$relative = (substr_count($file, '/')==1) ? '' : '../';
$o = $this->OpenXML_Rels_GetObj($file, $relative.'charts/');
if ($o->ChartLst===false) {
if ($Txt===false) $Txt = $... | php | {
"resource": ""
} |
q248932 | clsOpenTBS.OpenMXL_GarbageCollector | validation | function OpenMXL_GarbageCollector() {
if ( (count($this->IdxToCheck)==0) && (count($this->OtbsSheetSlidesDelete)==0) ) return;
// Key for Pictures
$pic_path = $this->ExtInfo['pic_path'];
$pic_path_len = strlen($pic_path);
// Key for Rels
$rels_ext = '.rels';
$rels_ext_len = strlen($rels_ext);
// Lis... | php | {
"resource": ""
} |
q248933 | clsOpenTBS.MsExcel_ConvertToExplicit_Item | validation | function MsExcel_ConvertToExplicit_Item(&$Txt, $Tag, $Att, $CellRow) {
$tag_pc = strlen($Tag) + 1;
$rpl = '<'.$Tag.' '.$Att.'="';
$rpl_len = strlen($rpl);
$rpl_nbr = 0;
$p = 0;
$empty_first_pos = false;
$empty_nbr = 0;
$item_num = 0;
$rpl_nbr = 0;
while (($p=clsTinyButStrong::f_Xml_FindTagStart($T... | php | {
"resource": ""
} |
q248934 | clsOpenTBS.MsExcel_SheetIsIt | validation | function MsExcel_SheetIsIt($FileName) {
$this->MsExcel_SheetInit();
foreach($this->MsExcel_Sheets as $o) {
if ($FileName=='xl/'.$o->file) return true;
}
return false;
} | php | {
"resource": ""
} |
q248935 | clsOpenTBS.MsExcel_GetDrawingLst | validation | function MsExcel_GetDrawingLst() {
$lst = array();
$dir = '../drawings/';
$dir_len = strlen($dir);
$o = $this->OpenXML_Rels_GetObj($this->TBS->OtbsCurrFile, $dir);
foreach($o->TargetLst as $t) {
if ( (substr($t, 0, $dir_len)===$dir) && (substr($t, -4)==='.xml') ) $lst[] = 'xl/drawings/'.substr($t, $dir_l... | php | {
"resource": ""
} |
q248936 | clsOpenTBS.MsPowerpoint_InitSlideLst | validation | function MsPowerpoint_InitSlideLst($Master = false) {
if ($Master) {
$RefLst = &$this->OpenXmlSlideMasterLst;
} else {
$RefLst = &$this->OpenXmlSlideLst;
}
if ($RefLst!==false) return $RefLst;
$PresFile = 'ppt/presentation.xml';
$prefix = ($Master) ? 'slideMasters/' : 'slides/';
$o = $this->Op... | php | {
"resource": ""
} |
q248937 | clsOpenTBS.MsPowerpoint_Clean | validation | function MsPowerpoint_Clean(&$Txt) {
$this->MsPowerpoint_CleanRpr($Txt, 'a:rPr');
$Txt = str_replace('<a:rPr/>', '', $Txt);
$this->MsPowerpoint_CleanRpr($Txt, 'a:endParaRPr');
$Txt = str_replace('<a:endParaRPr/>', '', $Txt); // do not delete, can change layout
// join split elements
$Txt = str_replace('</... | php | {
"resource": ""
} |
q248938 | clsOpenTBS.MsPowerpoint_SearchInSlides | validation | function MsPowerpoint_SearchInSlides($str, $returnFirstFound = true) {
// init the list of slides
$this->MsPowerpoint_InitSlideLst(); // List of slides
// build the list of files in the expected structure
$files = array();
foreach($this->OpenXmlSlideLst as $i=>$s) $files[$i+1] = $s['idx'];
// search
$f... | php | {
"resource": ""
} |
q248939 | clsOpenTBS.MsPowerpoint_SlideIsIt | validation | function MsPowerpoint_SlideIsIt($FileName) {
$this->MsPowerpoint_InitSlideLst();
foreach ($this->OpenXmlSlideLst as $i => $s) {
if ($FileName==$s['file']) return true;
}
return false;
} | php | {
"resource": ""
} |
q248940 | clsOpenTBS.MsWord_Clean | validation | function MsWord_Clean(&$Txt) {
$Txt = str_replace('<w:lastRenderedPageBreak/>', '', $Txt); // faster
$this->XML_DeleteElements($Txt, array('w:proofErr', 'w:noProof', 'w:lang', 'w:lastRenderedPageBreak'));
$this->MsWord_CleanSystemBookmarks($Txt);
$this->MsWord_CleanRsID($Txt);
$this->MsWord_CleanDuplicatedLay... | php | {
"resource": ""
} |
q248941 | clsOpenTBS.MsWord_InitHeaderFooter | validation | function MsWord_InitHeaderFooter() {
if ($this->MsWord_HeaderFooter!==false) return;
$types_ok = array('default' => true, 'first' => false, 'even' => false);
// Is there a different header/footer for odd an even pages ?
$idx = $this->FileGetIdx('word/settings.xml');
if ($idx!==false) {
$Txt = $this... | php | {
"resource": ""
} |
q248942 | clsOpenTBS.OpenDoc_GetPage | validation | function OpenDoc_GetPage($Tag, $Txt, $Pos, $Forward, $LevelStop) {
$this->OpenDoc_StylesInit();
$p = $Pos;
while ( ($loc = clsTbsXmlLoc::FindStartTagHavingAtt($Txt, 'text:style-name', $p, $Forward))!==false) {
$style = $loc->GetAttLazy('text:style-name');
if ( ($style!==false) && isset($this->OpenDoc_S... | php | {
"resource": ""
} |
q248943 | clsOpenTBS.OpenDoc_GetDraw | validation | function OpenDoc_GetDraw($Tag, $Txt, $Pos, $Forward, $LevelStop) {
return $this->XML_BlockAlias_Prefix('draw:', $Txt, $Pos, $Forward, $LevelStop);
} | php | {
"resource": ""
} |
q248944 | clsOpenTBS.OpenDoc_ChartInit | validation | function OpenDoc_ChartInit() {
$this->OpenDocCharts = array();
$idx = $this->Ext_GetMainIdx();
$Txt = $this->TbsStoreGet($idx, 'OpenDoc_ChartInit');
$p = 0;
while($drEl = clsTbsXmlLoc::FindElement($Txt, 'draw:frame', $p)) {
$src = $drEl->GetInnerSrc();
$objEl = clsTbsXmlLoc::FindStartTag($src, 'draw... | php | {
"resource": ""
} |
q248945 | clsOpenTBS.OpenDoc_MsExcelCompatibility | validation | function OpenDoc_MsExcelCompatibility(&$Txt) {
$el_tbl = 'table:table';
$el_col = 'table:table-column'; // Column definition
$el_row = 'table:table-row';
$el_cell = 'table:table-cell';
$att_rep_col = 'table:number-columns-repeated';
$att_rep_row = 'table:number-rows-repeated';
$loop = array($att_... | php | {
"resource": ""
} |
q248946 | clsTbsXmlLoc._GetAttValPos | validation | function _GetAttValPos($Att) {
if ($this->pST_Src===false) $this->pST_Src = substr($this->Txt, $this->PosBeg, $this->pST_PosEnd - $this->PosBeg + 1 );
$a = ' '.$Att.'="';
$p0 = strpos($this->pST_Src, $a);
if ($p0!==false) {
$p1 = $p0 + strlen($a);
$p2 = strpos($this->pST_Src, '"', $p1);
if ($p2!==false... | php | {
"resource": ""
} |
q248947 | clsTbsXmlLoc._ApplyDiffFromStart | validation | function _ApplyDiffFromStart($Diff) {
$this->pST_PosEnd += $Diff;
$this->pST_Src = false;
if ($this->pET_PosBeg!==false) $this->pET_PosBeg += $Diff;
$this->PosEnd += $Diff;
} | php | {
"resource": ""
} |
q248948 | clsTbsXmlLoc._ApplyDiffToAll | validation | function _ApplyDiffToAll($Diff) {
$this->PosBeg += $Diff;
$this->PosEnd += $Diff;
$this->pST_PosEnd += $Diff;
if ($this->pET_PosBeg!==false) $this->pET_PosBeg += $Diff;
} | php | {
"resource": ""
} |
q248949 | clsTbsXmlLoc.ReplaceSrc | validation | function ReplaceSrc($new) {
$len = $this->GetLen(); // avoid PHP error : Strict Standards: Only variables should be passed by reference
$this->Txt = substr_replace($this->Txt, $new, $this->PosBeg, $len);
$diff = strlen($new) - $len;
$this->PosEnd += $diff;
$this->pST_Src = false;
if ($new==='') {
$this->... | php | {
"resource": ""
} |
q248950 | clsTbsXmlLoc.GetInnerSrc | validation | function GetInnerSrc() {
return ($this->pET_PosBeg===false) ? false : substr($this->Txt, $this->pST_PosEnd + 1, $this->pET_PosBeg - $this->pST_PosEnd - 1 );
} | php | {
"resource": ""
} |
q248951 | clsTbsXmlLoc.UpdateParent | validation | function UpdateParent($Cascading=false) {
if ($this->Parent) {
$this->Parent->ReplaceSrc($this->Txt);
if ($Cascading) $this->Parent->UpdateParent($Cascading);
}
} | php | {
"resource": ""
} |
q248952 | clsTbsXmlLoc.Delete | validation | function Delete($Contents=true) {
$this->FindEndTag();
if ($Contents || $this->SelfClosing) {
$this->ReplaceSrc('');
} else {
$inner = $this->GetInnerSrc();
$this->ReplaceSrc($inner);
}
} | php | {
"resource": ""
} |
q248953 | clsTbsXmlLoc.FindName | validation | function FindName() {
if ($this->Name==='') {
$p = $this->PosBeg;
do {
$p++;
$z = $this->Txt[$p];
} while ( ($z!==' ') && ($z!=="\r") && ($z!=="\n") && ($z!=='>') && ($z!=='/') );
$this->Name = substr($this->Txt, $this->PosBeg + 1, $p - $this->PosBeg - 1);
}
return $this->Name;
} | php | {
"resource": ""
} |
q248954 | clsTbsXmlLoc.FindEndTag | validation | function FindEndTag($Encaps=false) {
if (is_null($this->SelfClosing)) {
$pe = $this->PosEnd;
$SelfClosing = (substr($this->Txt, $pe-1, 1)=='/');
if (!$SelfClosing) {
if ($Encaps) {
$loc = clsTinyButStrong::f_Xml_FindTag($this->Txt , $this->FindName(), null, $pe, true, -1, false, false);
if ($lo... | php | {
"resource": ""
} |
q248955 | clsTbsXmlLoc.switchToRelative | validation | function switchToRelative() {
$this->FindEndTag();
// Save info
$this->rel_Txt = &$this->Txt;
$this->rel_PosBeg = $this->PosBeg;
$this->rel_Len = $this->GetLen();
// Change the univers
$src = $this->GetSrc();
$this->Txt = &$src;
// Change positions
$this->_ApplyDiffToAll(-$this->PosBeg);
} | php | {
"resource": ""
} |
q248956 | clsTbsXmlLoc.FindStartTagByPrefix | validation | static function FindStartTagByPrefix(&$Txt, $TagPrefix, $PosBeg, $Forward=true) {
$x = '<'.$TagPrefix;
$xl = strlen($x);
if ($Forward) {
$PosBeg = strpos($Txt, $x, $PosBeg);
} else {
$PosBeg = strrpos(substr($Txt, 0, $PosBeg+2), $x);
}
if ($PosBeg===false) return false;
// Read the actual tag nam... | php | {
"resource": ""
} |
q248957 | clsTbsXmlLoc.FindElement | validation | static function FindElement(&$TxtOrObj, $Tag, $PosBeg, $Forward=true) {
$XmlLoc = clsTbsXmlLoc::FindStartTag($TxtOrObj, $Tag, $PosBeg, $Forward);
if ($XmlLoc===false) return false;
$XmlLoc->FindEndTag();
return $XmlLoc;
} | php | {
"resource": ""
} |
q248958 | clsTbsZip.FileGetState | validation | function FileGetState($NameOrIdx) {
$idx = $this->FileGetIdx($NameOrIdx);
if ($idx===false) {
$idx = $this->FileGetIdxAdd($NameOrIdx);
if ($idx===false) {
return false;
} else {
return 'a';
}
} elseif (isset($this->ReplInfo[$idx])) {
if ($this->ReplInfo[$idx]===false) {
return 'd';
... | php | {
"resource": ""
} |
q248959 | clsTinyButStrong.meth_Conv_Prepare | validation | function meth_Conv_Prepare(&$Loc, $StrConv) {
$x = strtolower($StrConv);
$x = '+'.str_replace(' ','',$x).'+';
if (strpos($x,'+esc+')!==false) {$this->f_Misc_ConvSpe($Loc); $Loc->ConvStr = false; $Loc->ConvEsc = true; }
if (strpos($x,'+wsp+')!==false) {$this->f_Misc_ConvSpe($Loc); $Loc->ConvWS = true; }
if (strpo... | php | {
"resource": ""
} |
q248960 | clsTinyButStrong.meth_Conv_Str | validation | function meth_Conv_Str(&$Txt,$ConvBr=true) {
if ($this->Charset==='') { // Html by default
$Txt = htmlspecialchars($Txt);
if ($ConvBr) $Txt = nl2br($Txt);
} elseif ($this->_CharsetFct) {
$Txt = call_user_func($this->Charset,$Txt,$ConvBr);
} else {
$Txt = htmlspecialchars($Txt,ENT_COMPAT,$this->Charset);
if... | php | {
"resource": ""
} |
q248961 | clsTinyButStrong.f_Misc_UpdateArray | validation | static function f_Misc_UpdateArray(&$array, $numerical, $v, $d) {
if (!is_array($v)) {
if (is_null($v)) {
$array = array();
return;
} else {
$v = array($v=>$d);
}
}
foreach ($v as $p=>$a) {
if ($numerical===true) { // numerical keys
if (is_string($p)) {
// syntax: item => true/false
$i = ... | php | {
"resource": ""
} |
q248962 | MahasiswaController.actionIndex | validation | public function actionIndex()
{
$searchModel = new MahasiswaSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$field = [
'fileImport' => 'File Import',
];
$modelImport = DynamicModel::validateData($field, [
[['fi... | php | {
"resource": ""
} |
q248963 | clsTinyButStrong.meth_Misc_Alert | validation | function meth_Misc_Alert($Src,$Msg,$NoErrMsg=false,$SrcType=false) {
$this->ErrCount++;
if ($this->NoErr || (php_sapi_name==='cli') ) {
$t = array('','','','','');
} else {
$t = array('<br /><b>','</b>','<em>','</em>','<br />');
$Msg = htmlentities($Msg);
}
if (!is_string($Src)) {
if ($SrcType===false) $Sr... | php | {
"resource": ""
} |
q248964 | Helper.objectToArray | validation | public function objectToArray($object, $array = [])
{
$reflectionClass = new \ReflectionClass(get_class($object));
foreach ($reflectionClass->getProperties() as $property) {
$property->setAccessible(true);
$name = trim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$... | php | {
"resource": ""
} |
q248965 | Message.setQuickReplies | validation | public function setQuickReplies($quickReplie)
{
$model = new QuickReplie();
$type = !empty($quickReplie['type']) ? $quickReplie['type'] : 'text';
$model->setContentType($type);
if (!empty($quickReplie['title'])) {
$model->setPayload($quickReplie['payload']);
}
... | php | {
"resource": ""
} |
q248966 | Message.url | validation | public function url($text, $title, $url)
{
$payload = [
'template_type' => 'button',
'text' => $text,
'buttons' => [
[
'title' => $title,
'url' => $url
]
],
];
$this->setA... | php | {
"resource": ""
} |
q248967 | Message.postback | validation | public function postback($text, $title, $postback)
{
$payload = [
'template_type' => 'button',
'text' => $text,
'buttons' => [
[
'type' => 'postback',
'title' => $title,
'payload' => $postback
... | php | {
"resource": ""
} |
q248968 | Message.login | validation | public function login($text, $url)
{
$payload = [
'template_type' => 'button',
'text' => $text,
'buttons' => [
[
'type' => 'account_link',
'url' => $url
]
],
];
$this->set... | php | {
"resource": ""
} |
q248969 | Message.quickReplies | validation | public function quickReplies($text, $quickReplies)
{
$this->setText($text);
foreach ($quickReplies as $quickReplie) {
$this->setQuickReplies($quickReplie);
}
return $this;
} | php | {
"resource": ""
} |
q248970 | Message.quickReplie | validation | public function quickReplie($text, $title, $postback, $image = null)
{
$this->setText($text);
$payload = [
'title' => $title,
'payload' => $postback,
];
if (!empty($image)) {
$payload['image'] = $image;
}
$this->setQuickReplies($... | php | {
"resource": ""
} |
q248971 | Messenger.api | validation | public function api($url, $body = null, $type = self::TYPE_POST)
{
$body['access_token'] = $this->accessToken;
$this->setBody($body);
$headers = [
'Content-Type: application/json',
];
if ($type == self::TYPE_GET) {
$url .= '?'.http_build_query($body... | php | {
"resource": ""
} |
q248972 | DateTimeNormalizer.supportsNormalization | validation | public function supportsNormalization($data, $format = null)
{
return is_object($data) && ($data instanceof \DateTime) && (self::FORMAT === $format);
} | php | {
"resource": ""
} |
q248973 | DateTimeNormalizer.denormalize | validation | public function denormalize($data, $class, $format = null, array $context = array())
{
$value = $data;
if (is_array($data)) {
if (!isset($data['@value']) || !isset($data['@type'])) {
throw new RuntimeException(
"Cannot denormalize the data as it isn't... | php | {
"resource": ""
} |
q248974 | SerializerListener.onKernelView | validation | public function onKernelView(GetResponseForControllerResultEvent $event)
{
$request = $event->getRequest();
$result = $event->getControllerResult();
if (!$request->attributes->get('__hydra_serialize')) {
return;
}
if (is_array($result) || ($result instanceof \Ar... | php | {
"resource": ""
} |
q248975 | SerializerListener.isHydraOperation | validation | private function isHydraOperation(\ReflectionMethod $method)
{
$annotation = $this->annotationReader->getMethodAnnotation(
$method,
'ML\HydraBundle\Mapping\Operation'
);
return null !== $annotation;
} | php | {
"resource": ""
} |
q248976 | AnnotationDriver.documentRouteAndOperations | validation | private function documentRouteAndOperations($metadata, Reflector $element)
{
if ((null !== ($annotation = $this->getAnnotation($element, 'ML\HydraBundle\Mapping\Id'))) ||
(null !== ($annotation = $this->getAnnotation($element, 'ML\HydraBundle\Mapping\Route')))) {
// TODO Check that t... | php | {
"resource": ""
} |
q248977 | AnnotationDriver.documentProperties | validation | private function documentProperties(ClassMetadata $metadata, ReflectionClass $class)
{
/*
$interfaces = $class->getInterfaces();
$linkRelationMethods = array();
foreach ($interfaces as $interface) {
if (null !== $this->getAnnotation($interface, $linkRelationAnnot)) {
... | php | {
"resource": ""
} |
q248978 | AnnotationDriver.getAnnotation | validation | private function getAnnotation(Reflector $element, $annotation)
{
if ($element instanceof ReflectionClass) {
return $this->reader->getClassAnnotation($element, $annotation);
} elseif ($element instanceof ReflectionMethod) {
return $this->reader->getMethodAnnotation($element, ... | php | {
"resource": ""
} |
q248979 | HydraController.serialize | validation | public function serialize($entity)
{
if (!$this->container->has('hydra.serializer')) {
throw new \LogicException('The HydraBundle is not registered in your application.');
}
return $this->container->get('hydra.serializer')->serialize($entity, self::FORMAT);
} | php | {
"resource": ""
} |
q248980 | HydraController.deserialize | validation | public function deserialize($data, $entity)
{
if (!$this->container->has('hydra.serializer')) {
throw new \LogicException('The HydraBundle is not registered in your application.');
}
$serializer = $this->container->get('hydra.serializer');
if (is_object($entity)) {
... | php | {
"resource": ""
} |
q248981 | HydraController.validate | validation | public function validate($entity)
{
if (!$this->container->has('validator')) {
throw new \LogicException('The validator service is not available.');
}
$errors = $this->container->get('validator')->validate($entity);
if (count($errors) === 0) {
return false;
... | php | {
"resource": ""
} |
q248982 | PropertyDefinition.addOperation | validation | public function addOperation(OperationDefinition $operation)
{
if (false === $this->supportsOperation($operation->getName())) {
$this->operations[] = $operation;
}
return $this;
} | php | {
"resource": ""
} |
q248983 | PropertyDefinition.supportsOperation | validation | public function supportsOperation($operationName)
{
foreach ($this->operations as $operation) {
if ($operation->getName() === $operationName) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q248984 | PropertyDefinition.setValue | validation | public function setValue($entity, $value)
{
if (false === ($entity instanceof $this->class)) {
// FIXXME Improve this message
throw new \Exception(
"Can't set the entity's {$this->name} property as the entity is not an instance of {$this->class}."
);
... | php | {
"resource": ""
} |
q248985 | PropertyDefinition.getValue | validation | public function getValue($entity)
{
if (null === $this->getter) {
// FIXXME Improve this message
throw new \Exception(
"Can't get the entity's {$this->name} property as no getter has been found."
);
} elseif (false === ($entity instanceof $this->cl... | php | {
"resource": ""
} |
q248986 | PropertyDefinition.findGetter | validation | private function findGetter()
{
$reflClass = new \ReflectionClass($this->class);
$camelProp = $this->camelize($this->name);
// Try to find a getter
$getter = 'get'.$camelProp;
$isser = 'is'.$camelProp;
$hasser = 'has'.$camelProp;
$classHasProperty = $reflClas... | php | {
"resource": ""
} |
q248987 | PropertyDefinition.findSetter | validation | private function findSetter()
{
$reflClass = new \ReflectionClass($this->class);
$setter = 'set' . $this->camelize($this->name);
$classHasProperty = $reflClass->hasProperty($this->name);
if ($reflClass->hasMethod($setter) && $reflClass->getMethod($setter)->isPublic()) {
... | php | {
"resource": ""
} |
q248988 | PropertyDefinition.findAdderAndRemover | validation | private function findAdderAndRemover()
{
$reflClass = new \ReflectionClass($this->class);
$singulars = (array) StringUtil::singularify($this->camelize($this->name));
foreach ($singulars as $singular) {
$addMethod = 'add'.$singular;
$removeMethod = 'remove'.$singular;... | php | {
"resource": ""
} |
q248989 | PropertyDefinition.isAccessible | validation | private function isAccessible(\ReflectionClass $class, $methodName, $parameters)
{
if ($class->hasMethod($methodName)) {
$method = $class->getMethod($methodName);
if ($method->isPublic() && $method->getNumberOfRequiredParameters() === $parameters) {
return true;
... | php | {
"resource": ""
} |
q248990 | ClassMetadataFactory.getAllMetadata | validation | public function getAllMetadata()
{
// FIXXME Should this be implemented here or in the driver (chain)?
$metadata = array();
foreach ($this->driver->getAllClassNames() as $className) {
$metadata[] = $this->getMetadataFor($className);
}
$this->validate($metadata);
... | php | {
"resource": ""
} |
q248991 | ClassMetadataFactory.getMetadataFor | validation | public function getMetadataFor($className)
{
if (isset($this->loadedMetadata[$className])) {
return $this->loadedMetadata[$className];
}
$realClassName = ClassUtils::getRealClass($className);
if (isset($this->loadedMetadata[$realClassName])) {
// We do not h... | php | {
"resource": ""
} |
q248992 | ClassMetadataFactory.loadMetadata | validation | protected function loadMetadata($className)
{
if (false === isset($this->loadedMetadata[$className])) {
if (null === ($class = $this->driver->loadMetadataForClass($className))) {
// FIXXME Improve this
throw new \Exception("Can't load metadata for $className");
... | php | {
"resource": ""
} |
q248993 | ClassMetadataFactory.completeMetadata | validation | protected function completeMetadata(ClassMetadata $class)
{
$className = $class->getName();
if (null === $class->getIri()) {
$class->setIri($this->namingStrategy->classIriFragment($className));
}
if (null === $class->getExposeAs()) {
$class->setExposeAs($thi... | php | {
"resource": ""
} |
q248994 | Serializer.serialize | validation | public function serialize($data, $format, array $context = array())
{
if ('jsonld' !== $format) {
throw new UnexpectedValueException('Serialization for the format ' . $format . ' is not supported');
}
if (false === is_object($data)) {
throw new \Exception('Only objec... | php | {
"resource": ""
} |
q248995 | Serializer.deserialize | validation | public function deserialize($data, $type, $format, array $context = array())
{
if ('jsonld' !== $format) {
throw new UnexpectedValueException('Deserialization for the format ' . $format . ' is not supported');
}
$reflectionClass = new \ReflectionClass($type);
if (null !... | php | {
"resource": ""
} |
q248996 | Serializer.doDeserialize | validation | private function doDeserialize($data, $entity)
{
$metadata = $this->hydraApi->getMetadataFor(get_class($entity));
if (null === $metadata) {
// TODO Improve this error message
throw new \Exception(sprintf('"%s" cannot be serialized as it is not documented.', get_class($data))... | php | {
"resource": ""
} |
q248997 | ClassMetadata.setPropertyValue | validation | public function setPropertyValue($entity, $property, $value)
{
$this->reflFields[$property]->setValue($entity, $value);
} | php | {
"resource": ""
} |
q248998 | JsonLdResponse.processData | validation | public function processData($data = array())
{
// return an empty object instead of an empty array
if (is_array($data) && 0 === count($data)) {
$data = new \stdClass();
}
if (!is_string($data)) {
$options = 0;
if (PHP_VERSION_ID >= 50400)
... | php | {
"resource": ""
} |
q248999 | HydraExtension.loadMappingInformation | validation | protected function loadMappingInformation(array $config, ContainerBuilder $container)
{
// FIXXME Remove $this->drivers if possible
// reset state of drivers map. They are only used by this methods and children.
$this->drivers = array();
if ($config['auto_mapping']) {
// automat... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.