function getElement(DOMElement $parent, $tagname, $ns = NULL) { if ($ns !== NULL) { $el = $parent->getElementsByTagNameNS($ns, preg_replace('/^.*:/', '', $tagname))->item(0); } else { $el = $parent->getElementsByTagName($tagname)->item(0); } if (!$el) { $el = $parent->ownerDocument->createElementNS($ns, $tagname); $parent->appendChild($el); newline($parent); } return $el; }
function printMatrix($index) { /* print docID */ printf("%10s", 'vocab/doc'); foreach ($index['docCount'] as $key => $value) { printf('%10s ', $key); } newline(); /* print tf for each doc value */ foreach ($index['dictionary'] as $key => $value) { printf("%10s", $key); foreach ($index['docCount'] as $docID => $value) { printf("%10.2f ", $index['dictionary'][$key]['postings'][$docID]['tf']); } newline(); } }
<td>' . $row['username'] . '</td>'; if ($row['verified'] == TRUE) { $verified = "Yes"; } else { $verified = "No"; } $pagecontent .= '<td>' . $verified . '</td>'; $bannedby = new user($sql, "id", $row['bannedby']); if ($bannedby->load()) { $bannedby = $bannedby->username; } else { $bannedby = "Unknown user"; } $pagecontent .= '<td>' . $bannedby . '</td> <td>' . $row['bannedtime'] . '</td> <td>' . newline($row['bannedreason']) . '</td> <td> <a href="admin.php?action=bans&edit=' . $row['id'] . '" class="linkify">Edit ban</a> </td> </tr>'; } $pagecontent .= '</tbody></table> <script>$(document).ready(function() { $("#bannedusers").tablesorter(); } ); </script>'; } }
// get the entire file, input filename. // Actually, this function is very useful $text = file_get_contents("http://www.google.com"); // Do not forget the HTTP:// part. It's required // $text now is the source code of google.com // Copy Files copy($filename, "newfile.txt") or die("Could not copy!"); // Move files: you can also rename the directory. By this way, you moved the file rename("newfile.txt", "Newfile2.txt") or die("Could not rename!"); // Delete Files if (!unlink("Newfile2.txt")) { echo "Could not remove!"; } else { echo "Removed successfully!"; } newline(); // Updating Files: using the fwrite() function. // fseek() function: fseek($file, 0, SEEK_END); // move the seek pointer to file end, then move // backwards by 0 characters. fseek($file, 3, SEEK_SET); // move to the exact position of the whole file // In this case, it moves to the third character of the whole file fseek($file, 5, SEEK_CUR); // move the seek pointer 5 character // after current position. // Lock Files: it's important to lock a file when reading/writing. // So, other programs could not acccess it if (flock($file, LOCK_EX)) { // if we can lock the file. Then do the write
function struk_data_footer_kredit() { $data = array(); $bawah = ""; $nama = rdb('mst_anggota', 'Nama', 'Nama', "where ID='" . rdb('inv_penjualan', 'ID_Anggota', 'ID_Anggota', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'") . "'"); $urut = rdb('mst_anggota', 'No_Agt', 'No_Agt', "where ID='" . rdb('inv_penjualan', 'ID_Anggota', 'ID_Anggota', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'") . "'"); $alm = rdb('mst_anggota', 'Alamat', 'concat(Alamat," ",Kota) as Alamat', "where Nama='{$nama}'"); $ncby = rdb('inv_penjualan_jenis', 'Jenis_Jual', 'Jenis_Jual', "where ID='" . rdb('inv_penjualan', 'ID_Jenis', 'ID_Jenis', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'") . "'"); $bank = rdb('inv_penjualan', 'Deskripsi', 'Deskripsi', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'"); $rek = rdb('inv_penjualan', 'ID_Post', 'ID_Post', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'"); $tgir = rdb('inv_penjualan', 'Tgl_Cicilan', 'Tgl_Cicilan', "where NoUrut='" . $this->no_trans . "' and Tanggal='" . $this->tgl . "'"); $this->inv_model->tabel('inv_pembayaran'); $data = $this->inv_model->show_list_1where('no_transaksi', $this->no_trans); foreach ($data->result() as $row) { $bawah = str_repeat('-', 79) . newline() . sepasi(61 - strlen('Sub Total')) . 'Sub Total :' . sepasi(14 - strlen(number_format($row->total_belanja, 2))) . number_format($row->total_belanja, 2) . newline(2) . sepasi(61 - strlen('Corting')) . 'Corting :' . sepasi(14 - strlen(number_format($row->ppn, 2))) . number_format($row->ppn, 2) . newline() . sepasi(61) . str_repeat('-', 18) . '+' . newline() . sepasi(61 - strlen('Total')) . 'Total :' . sepasi(14 - strlen(number_format($row->total_bayar, 2))) . number_format($row->total_bayar, 2) . newline(2) . sepasi(61 - strlen('Uang Muka')) . 'Uang Muka :' . sepasi(14 - strlen(number_format($row->jml_dibayar, 2))) . number_format($row->jml_dibayar, 2) . newline(2) . sepasi(61) . str_repeat('-', 17) . '-' . newline() . sepasi(61 - strlen('Sisa')) . 'Sisa :' . sepasi(14 - strlen(number_format($row->kembalian, 2))) . number_format($row->kembalian, 2) . newline(2) . str_repeat('-', 79) . newline() . 'Pembayaran' . sepasi(14 - strlen('Pembayaran')) . ':' . $ncby . ' No. :' . $rek . ' ' . $bank . '[' . tglfromSql($tgir) . ']' . newline() . 'Nama Konsumen' . sepasi(14 - strlen('Nama Konsumen')) . ':' . $nama . ' [ ' . $urut . ' ]' . newline() . 'Alamat' . sepasi(14 - strlen('Alamat')) . ':' . $alm . newline(2); } return $bawah; }
function equation($the = [tex => 'e^{i\\pi}+1 = 0', id => 'Euler', label => 'Euler\'s identity']) { static $eqno = 0; static $eqarray = array(); //gossip($the); $result = ''; if (is_array($the)) { extract($the); $eqno++; $eqarray[$id] = $eqno; $result .= newline(); $result .= '<table width="100%" align="right" style="border-spacing: 5px">'; $result .= '<tr><td align="center" width="70%">' . PHP_EOL; $result .= X_tex($tex); if ($label != '') { $result .= '</td><td align="right"><i>' . $label . '</i>' . PHP_EOL; } $result .= '</td><td align="right">' . "[{$eqno}]" . PHP_EOL; $result .= '</td></tr></table>' . PHP_EOL; } else { $result .= X_labels($eqarray, func_get_args(), 'Equation'); } return $result; }
,<?php echo $album_row['album_id']; ?> );"><?php echo $mn_langpackage->mn_report; ?> </a> </span> <?php echo filt_word($album_row['album_name']); ?> </div> <?php } foreach ($photo_rs as $val) { newline('4'); $is_pri = check_pri($val['user_id'], $val['privacy']); ?> <div class="album_photo_box"> <a href='<?php echo $is_pri ? rewrite_fun("modules.php?app=photo&photo_id=" . $val['photo_id'] . "&album_id=" . $album_id . "&user_id=" . $user_id) : "javascript:void(0)"; ?> '> <img <?php if ($is_self == 'Y') { ?> title="<?php echo $a_langpackage->a_tip_pri; ?> " onmouseDown="menu_pop_show(event,this);" id='<?php echo $t_photo;
<?php function newline($x) { if ($x == 5) { for ($i = 0; $i < $x; $i++) { echo "----\n"; } } else { for ($i = 0; $i < $x; $i++) { echo "+++++\n"; } } } echo "line 1"; newline(6); echo "line 2"; ?> <?php function table($x) { echo "<table border = 2 bgcolor='pink'>"; for ($i = 0; $i < $x; $i++) { echo "<tr>"; echo "<td>"; if ($x == 5) { echo '--'; } else { echo '++'; }