function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '') { global $cpath, $timeFormat, $dateFormat_week; # Strip all dollar signs from printable array entries; regex functions will mutilate them foreach ($arr as $key => $val) { $arr[$key] = str_replace('$', '$', $val); } $return = ''; $event_text = stripslashes(urldecode($arr['event_text'])); # build tooltip $title = makeTitle($arr, $time); # for iCal pseudo tag <http> comptability if (ereg('<([[:alpha:]]+://)([^<>[:space:]]+)>', $event_text, $matches)) { $full_event_text = $matches[1] . $matches[2]; $event_text = $matches[2]; } else { $full_event_text = $event_text; //$event_text = strip_tags($event_text, '<b><i><u><img>'); } if (!empty($link_class)) { $link_class = ' class="' . $link_class . '"'; } if (!empty($event_text)) { //$event_text=str_replace("\n","£",$event_text); $title = strip_tags(str_replace('<br />', "\n", $title)); if ($lines > 0) { $event_text = word_wrap($event_text, $length, $lines); } if (!ereg('([[:alpha:]]+://[^<>[:space:]]+)', $full_event_text, $res) || $arr['description']) { $escaped_date = addslashes($event_date); $escaped_time = addslashes($time); $escaped_uid = addslashes($uid); $event_data = addslashes(serialize($arr)); // fix for URL-length bug in IE: populate and submit a hidden form on click static $popup_data_index = 0; $return = "\n\t\t\t\t<script language='Javascript' type='text/javascript'><!--\n\t\t\t\tvar eventData = new EventData('{$escaped_date}', '{$escaped_time}', '{$escaped_uid}','{$cpath}','{$event_data}');\n\t\t\t\tdocument.popup_data[{$popup_data_index}] = eventData;\n\t\t\t\t// --></script>"; $return .= '<a' . $link_class . ' title="' . $title . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">'; $popup_data_index++; } else { $return .= '<a' . $link_class . ' title="' . $title . '" href="' . $res[1] . '">'; } $return .= $pre_text . $event_text . $post_text . '</a>' . "\n"; //$return = str_replace("£","\n",$return); } return $return; }
public function _parse_single($key, $val, $string) { $newval = $val; $find = "/" . $this->l_delim . "" . $key . ".*" . $this->r_delim . "/U"; preg_match($find, $string, $matches); if (!empty($matches)) { $temp = trim($matches[0], "{}"); $res = explode(":", $temp); // var_dump($res); if (count($res) > 1) { switch ($res[1]) { case "allcaps": $newval = strtoupper($val); break; case "money": $newval = number_format((int) $val, 2, ".", ","); break; case "caps": $newval = ucwords(strtolower($val)); break; case "nocaps": $newval = strtolower($val); break; case "ucfirst": $newval = ucfirst($val); break; case "bool1": $newval = $val == 1 ? "True" : "False"; break; case "bool2": $newval = $val == 1 ? "Yes" : "No"; break; case "bool3": $newval = $val == 1 ? "Active" : "Inactive"; break; case "climit": $int = count($res) < 3 ? 128 : $res[2]; $newval = character_limiter($val, $int); break; case "htmlchars": $newval = quotes_to_entities($val); break; case "wlimit": $int = count($res) < 3 ? 25 : $res[2]; $newval = word_limiter($val, $int); break; case "wrap": $int = count($res) < 3 ? 76 : $res[2]; $newval = word_wrap($val, $int); break; case "hilite": $str = count($res) < 3 ? "" : $res[2]; $color = count($res) < 4 ? "#990000" : $res[3]; $newval = highlight_phrase($val, $str, "<span style=\"color:{$color}\">", "</span>"); break; case "safe_mailto": $alt_text = count($res) < 3 ? "" : $res[2]; $newval = safe_mailto($val, $alt_text); break; case "url_title": $sep = count($res) < 3 ? "dash" : $res[2]; $newval = url_title($val, $sep); break; case "remove_img": $newval = strip_image_tags($val); break; case "hash": $hash = count($res) < 3 ? "md5" : $res[2]; $newval = dohash($val, $hash); break; case "stripslashes": $newval = stripslashes($val); break; case "strip_tags": $allowed = count($res) < 3 ? "" : $res[2]; $newval = strip_tags($val, $allowed); break; /** other output string format options here **/ } return str_replace($matches[0], $newval, $string); } } return parent::_parse_single($key, $val, $string); }
function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class, $url) { $event_text = stripslashes(urldecode($arr["event_text"])); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>", $event_text, $matches)) { $full_event_text = $matches[1] . $matches[2]; $event_text = $matches[2]; } else { $full_event_text = $event_text; $event_text = strip_tags($event_text, '<b><i><u>'); } if (isset($arr["organizer"])) { $organizer = addslashes($arr["organizer"]); } if (isset($arr["attendee"])) { $attendee = addslashes($arr["attendee"]); } if (isset($arr["location"])) { $location = addslashes($arr["location"]); } if (isset($arr["status"])) { $status = addslashes($arr["status"]); } if (isset($arr["description"])) { $description = addslashes(stripslashes(urldecode($arr["description"]))); } if (isset($arr["url"])) { $url = addslashes(stripslashes(urldecode($arr["url"]))); } if (!empty($event_text)) { if ($lines > 0) { $event_text = word_wrap($event_text, $wrap, $lines); } if (!ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, $res) || $description) { $escaped_event = addslashes($full_event_text); $escaped_calendar = addslashes($calendar_name); $escaped_start = addslashes($start); $escaped_end = addslashes($end); // fix for URL-length bug in IE: populate and submit a hidden form on click static $popup_data_index = 0; echo <<<END <script language="Javascript" type="text/javascript"><!-- var eventData = new EventData('{$escaped_event}', '{$escaped_calendar}', '{$escaped_start}', '{$escaped_end}', '{$description}', '{$status}', '{$location}', '{$organizer}', '{$attendee}', '{$url}'); document.popup_data[{$popup_data_index}] = eventData; // --></script> END; echo '<a class="' . $link_class . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">'; $popup_data_index++; } else { echo '<a class="' . $link_class . '" href="' . $res[1] . '">'; } echo $pre_text . $event_text . $post_text . '</a>' . "\n"; } }
<div class="body" style="padding-left:20px"> <!--getting the current url--> <?php //returns current url as string $data = current_url(); $data2 = word_wrap($data, 100); //replacing slaches with dashes in url $data2 = str_replace('/', '-', $data); ?> <!--javascript confirm box for confirming bookmard adding--> <script type="text/javascript"> function confirmBookmark() { var r=confirm("Do you really want to Bookmark This Ad?") if (r==true) return true; else return false; } </script> <!--end of cinfirm box--> <!--form for bookmark keyword and button--> <form action ="<?php echo site_url('Full_ads/bookmarking/' . $data2); ?> " method="post" id="search-form_3" onsubmit="return(confirmBookmark());"> <?php echo form_error('bkmark');
function get_vtodo() { global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines, $show_completed, $show_todos; preg_match("!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_completed off -->!is", $this->page, $match1); preg_match("!<\\!-- switch show_important on -->(.*)<\\!-- switch show_important off -->!is", $this->page, $match2); preg_match("!<\\!-- switch show_normal on -->(.*)<\\!-- switch show_normal off -->!is", $this->page, $match3); $completed = trim($match1[1]); $important = trim($match2[1]); $normal = trim($match3[1]); $nugget2 = ''; if (is_array($master_array['-2'])) { foreach ($master_array['-2'] as $vtodo_times) { foreach ($vtodo_times as $val) { $vtodo_text = stripslashes(urldecode($val["vtodo_text"])); if ($vtodo_text != "") { if (isset($val["description"])) { $description = stripslashes(urldecode($val["description"])); } else { $description = ""; } $completed_date = $val['completed_date']; $event_calna = $val['calname']; $status = $val["status"]; $priority = $val['priority']; $start_date = $val["start_date"]; $due_date = $val['due_date']; $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text); $vtodo_array = base64_encode(serialize($vtodo_array)); $vtodo_text = word_wrap(strip_tags(str_replace('<br />', ' ', $vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines); $data = array('{VTODO_TEXT}', '{VTODO_ARRAY}'); $rep = array($vtodo_text, $vtodo_array); // Reset this TODO's category. $temp = ''; if ($status == 'COMPLETED' || isset($val['completed_date']) && isset($val['completed_time'])) { if ($show_completed == 'yes') { $temp = $completed; } } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) { $temp = $important; } else { $temp = $normal; } // Do not include TODOs which do not have the // category set. if ($temp != '') { $nugget1 = str_replace($data, $rep, $temp); $nugget2 .= $nugget1; } } } } } // If there are no TODO items, completely hide the TODO list. if ($nugget2 == '' || $show_todos != 'yes') { $this->page = preg_replace('!<\\!-- switch vtodo on -->(.*)<\\!-- switch vtodo off -->!is', '', $this->page); } else { $this->page = preg_replace('!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_normal off -->!is', $nugget2, $this->page); } }
public function test_default_word_wrap_charlim() { $string = "Here is a longer string of text that will help us demonstrate the default charlim of this function."; $this->assertEquals(strpos(word_wrap($string), "\n"), 73); }
<?php function word_wrap($string, $lineWidth) { $exploded = explode(' ', $string); $spaceWidth = 1; $spaceLeft = $lineWidth; $currentLine = ''; $results = array(); for ($i = 0; $i < count($exploded); $i++) { $word = $exploded[$i]; if (strlen($word) + $spaceWidth > $spaceLeft) { $exploded[$i] = '<br>' . $word; $spaceLeft = $lineWidth - strlen($word); $results[] = $currentLine; $currentLine = ''; } else { $spaceLeft = $spaceLeft - (strlen($word) + $spaceWidth); $currentLine = $currentLine . ' ' . $word; } } return $results; //return implode(' ', $exploded); } word_wrap("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris condimentum eleifend massa vitae auctor. Suspendisse vel consectetur elit. Maecenas facilisis, justo ac suscipit faucibus, odio turpis laoreet est, eget suscipit diam tortor vulputate erat.", 50);
function format_field($value, $type, $ticket = NULL) { global $CONFIG; global $AppUI; global $canEdit; switch ($type) { case "user": if ($value) { $output = query2result("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$value}'"); } else { $output = "-"; } break; case "status": if ($canEdit) { $output = create_selectbox("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value); } else { $output = chooseSelectedValue("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value); } break; case "priority_view": $priority = $CONFIG["priority_names"][$value]; $color = $CONFIG["priority_colors"][$value]; if ($value == 3) { $priority = "<strong>{$priority}</strong>"; } if ($value == 4) { $priority = "<blink><strong>{$priority}</strong></blink>"; } $output = "<font color=\"{$color}\">{$priority}</font>"; break; case "priority_select": if ($canEdit) { $output = create_selectbox("priority_toggle", $CONFIG["priority_names"], $value); } else { $output = chooseSelectedValue("priority_toggle", $CONFIG["priority_names"], $value); } break; case "assignment": $options[0] = "-"; $query = "SELECT user_id as id, CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id ORDER BY name"; $result = do_query($query); while ($row = result2hash($result)) { $options[$row["id"]] = $row["name"]; } if ($canEdit) { $output = create_selectbox("assignment_toggle", $options, $value); } else { $output = chooseSelectedValue("assignment_toggle", $options, $value); } break; case "view": if ($CONFIG["index_link"] == "latest") { $latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1"); if ($latest_value) { $value = $latest_value; } } $output = "<a href=index.php?m=ticketsmith&a=view&ticket={$value}>{$value} "; $output .= "<img src=images/icons/pencil.gif border=0></a>"; break; case "attach": $output = "<A href=index.php?m=ticketsmith&a=attach&ticket={$value}>"; $output .= "Link</a>"; break; case "doattach": $output = "<A href=index.php?m=ticketsmith&a=attach&newparent={$value}&dosql=reattachticket&ticket={$ticket}>"; $output .= "Link</a>"; break; case "open_date": $output = get_time_ago($value); if ($CONFIG["warning_active"]) { if (time() - $value > $CONFIG["warning_age"] * 3600) { $output = "<font color=\"" . $CONFIG["warning_color"] . "\"><xb>" . $output . "</strong></font>"; } } break; case "activity_date": if (!$value) { $output = "<em>" . $AppUI->_('none') . "</em>"; } else { $output = get_time_ago($value); } $latest_followup_type = query2result("SELECT type FROM tickets WHERE parent = '{$ticket}' ORDER BY timestamp DESC LIMIT 1"); if ($latest_followup_type) { $latest_followup_type = preg_replace("/(\\w+)\\s.*/", "\\1", $latest_followup_type); $output .= " [{$latest_followup_type}]"; } break; case "elapsed_date": $output = date($CONFIG["date_format"], $value); $time_ago = get_time_ago($value); $output .= " <em>({$time_ago})</em>"; break; case "body": if ($CONFIG["wordwrap"]) { $value = word_wrap($value, 78); } $value = htmlspecialchars($value); $output = "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n"; $output .= "<tr><td bgcolor=\"" . $CONFIG["ticket_color"] . "\">\n<tt><pre>\n"; $url_find = "/(http|https|ftp|news|telnet|finger)(:\\/\\/[^ \">\\t\\r\\n]*)/"; $url_replace = "<a href=\"\\1\\2\" target=\"new\">"; $url_replace .= "<span style=\"font-size: 10pt;\">\\1\\2</span></a>"; $value = preg_replace($url_find, $url_replace, $value); $output .= stripslashes($value); $output .= "\n</pre></tt>\n</td></tr>\n</table>\n"; break; case "followup": $output = "\n<tt>\n"; $output .= "<textarea style='font-family: monospace;' name=\"followup\" wrap=\"hard\" cols=\"72\" rows=\"20\">\n"; $signature = query2result("SELECT user_signature FROM users WHERE user_id = '{$AppUI->user_id}'"); if ($signature) { $output .= "\n"; $output .= "-- \n"; $output .= $signature; } $output .= "\n\n"; $output .= "---- " . $AppUI->_('Original message') . " ----\n\n"; if ($CONFIG["wordwrap"]) { $value = word_wrap($value, 70, true); } $value = htmlspecialchars($value); $output .= $value; $output .= "\n</textarea>\n"; $output .= "</tt>\n"; break; case "subject": $value = preg_replace("/\\s*Re:\\s*/i", "", $value); $value = preg_replace("/(\\[\\#\\d+\\])(\\w+)/", "\\2", $value); $value = "Re: " . $value; $value = htmlspecialchars($value); @($output .= "<input type=\"text\" name=\"subject\" value=\"{$value}\" size=\"70\">\n"); break; case "cc": $value = htmlspecialchars($value); $output = "<input type=\"text\" name=\"cc\" value=\"{$value}\" size=\"70\">"; break; case "recipient": $value = htmlspecialchars($value); $output = "<input type=\"text\" name=\"recipient\" value=\"{$value}\" size=\"70\">"; break; case "original_author": if ($value) { $value = preg_replace('/\\"/', '', $value); $output = htmlspecialchars($value); } else { $output = "<em>(" . $AppUI->_('original ticket author') . ")</em>"; } break; case "email": if ($value) { $value = preg_replace('/\\"/', '', $value); $output = htmlspecialchars($value); } else { $output = "<em>" . $AppUI->_('none') . "</em>"; } break; case 'ticket_company': $q = new DBQuery(); $q->addTable('companies'); $q->addQuery('companies.*'); $q->addWhere('companies.company_id = ' . $value); $sql = $q->prepare(); if (!db_loadObject($sql, $obj)) { // it all dies! } $output = '<a href="index.php?m=companies&a=view&company_id=' . $value . '">' . $obj->company_name . '</a>'; break; case 'ticket_project': $q = new DBQuery(); $q->addTable('projects'); $q->addQuery('projects.*'); $q->addWhere('projects.project_id = ' . $value); $sql = $q->prepare(); if (!db_loadObject($sql, $obj)) { // it all dies! } $output = '<a href="index.php?m=projects&a=view&project_id=' . $value . '">' . $obj->project_name . '</a>'; break; default: $output = $value ? htmlspecialchars($value) : "<em>" . $AppUI->_('none') . "</em>"; } return $output; }
$vtodo_text = stripslashes(urldecode($val["vtodo_text"])); if ($vtodo_text != "") { if (isset($val["description"])) { $description = urldecode($val["description"]); } else { $description = ""; } $completed_date = $val['completed_date']; $event_calna = $val['calname']; $status = $val["status"]; $priority = $val['priority']; $start_date = $val["start_date"]; $due_date = $val['due_date']; $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text); $vtodo_array = base64_encode(serialize($vtodo_array)); $vtodo_text = word_wrap(strip_tags(str_replace('<br>', ' ', $vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines); $vtodo_link = "<a class=\"psf\" href=\"javascript:openTodoInfo('{$vtodo_array}')\">"; if ($status == 'COMPLETED' || isset($val['completed_date']) && isset($val['completed_time'])) { if ($show_completed == 'yes') { $vtodo_text = "<S>{$vtodo_text}</S>"; echo "<tr><td>{$vtodo_link}<img src=\"images/completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n"; echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n"; } } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) { echo "<tr><td>{$vtodo_link}<img src=\"images/important.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n"; echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n"; } else { echo "<tr><td>{$vtodo_link}<img src=\"images/not_completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n"; echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n"; } }
public function text_helper() { $this->load->helper('text'); $string = "Here is a nice text string consisting of eleven words."; $string = word_limiter($string, 4, "..."); $this->htmlp($string); $string = "Here is a nice text string consisting of eleven words."; $string = character_limiter($string, 20, "..."); $this->htmlp($string); $string = ascii_to_entities($string); $this->htmlp($string); $string = convert_accented_characters($string); $this->htmlp($string); $string = "darn shit sucks dinner"; $disallowed = array('darn', 'shucks', 'golly', 'phooey'); $string = word_censor($string, $disallowed, 'Beep!'); $this->htmlp($string); $string = highlight_code($string); $this->htmlp($string); $string = "Here is a nice text string about nothing in particular."; $this->htmlp(highlight_phrase($string, "nice text", '<span style="color:#990000;">', '</span>')); $string = "Here is a simple string of text that will help us demonstrate this function."; $this->htmlp(word_wrap($string, 25)); $str = 'this_string_is_entirely_too_long_and_might_break_my_design.jpg'; $this->htmlp(ellipsize($str, 32, 0.5)); }
<th>Phone</th> <th>Name</th> <th>Message</th> <th>status</th> <th>Registered</th> <th>Action</th> </tr> </thead> <?php if (isset($testimonies)) { foreach ($testimonies as $testimony) { $icon = $testimony['status'] == 0 ? '<span><i class="material-icons red-text">error</i></span>' : '<span><i class="material-icons blue-text">verified_user</i></span>'; echo '<tr> <td>' . $testimony['phone'] . '</td> <td>' . $testimony['name'] . '</td> <td>' . word_wrap($testimony['message']) . '</td> <td>' . $icon . '</td> <td>' . $testimony['dateadd'] . '</td> <td><a href="' . site_url('home/actiontestimony/confirm/' . $testimony['id']) . '" title="confirm and publish testimony"><i class="material-icons blue-text">done_all</i></a> <a href="' . site_url('home/actiontestimony/refute/' . $testimony['id']) . '" title="Refuse and delete testimony"><i class="material-icons red-text">delete_forever</i></a> </td> </tr>'; ?> <?php } } ?> </table> </div> </div> </div>
function erzeuge_umbruch($text, $breite) { //bricht text nach breite zeichen um if (strstr($text, "> ")) { // Alte Version für Quotes beibehalten //text in feld einlesen mit \n als trennzeichen $arr_text = explode("\n", $text); //fuer jeden Feldeintrag Zeilenumbruch hinzufuegen while (list($k, $zeile) = @each($arr_text)) { //nur Zeilen umbrechen die nicht gequotet sind if (!strstr($zeile, "> ")) { $arr_text[$k] = wordwrap($zeile, $breite, "\n", 0); } } return implode("\n", $arr_text); } else { // neue version, verhaut die umbrüche nicht mehr $text = word_wrap($text, $breite, $returns = "AUTO", $spacer = "", $joiner = ' '); return $text; } }
public function testWordWrap() { $output = word_wrap('The quick brown fox jumps over the lazy dog.', 15); $this->assertRegExp('/lazy dog/', $output); }
function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '') { global $cpath, $master_array; $event_text = stripslashes(urldecode($arr["event_text"])); if (empty($start)) { $title = $event_text; } else { $title = $arr['event_start'] . ' - ' . $arr['event_end'] . ': ' . $event_text; } # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>", $event_text, $matches)) { $full_event_text = $matches[1] . $matches[2]; $event_text = $matches[2]; } else { $full_event_text = $event_text; $event_text = strip_tags($event_text, '<b><i><u><img>'); } if (!empty($event_text)) { if ($lines > 0) { $event_text = word_wrap($event_text, $length, $lines); } if (!ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, $res) || $arr['description']) { $escaped_date = addslashes($event_date); $escaped_time = addslashes($time); $escaped_uid = addslashes($uid); $event_data = addslashes(serialize($master_array[$event_date][$time][$uid])); // fix for URL-length bug in IE: populate and submit a hidden form on click static $popup_data_index = 0; $return = "\n <script language=\"Javascript\" type=\"text/javascript\"><!--\n var eventData = new EventData('{$escaped_date}', '{$escaped_time}', '{$escaped_uid}','{$cpath}','{$event_data}');\n document.popup_data[{$popup_data_index}] = eventData;\n // --></script>"; $return .= '<a class="' . $link_class . '" title="' . $title . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">'; $popup_data_index++; } else { $return .= '<a class="' . $link_class . '" title="' . $title . '" href="' . $res[1] . '">'; } $return .= $pre_text . $event_text . $post_text . '</a>' . "\n"; } return $return; }
<td scope="col"><a href="<?php echo site_url(); ?> admin/clientservices/<?php echo $clist['clientId']; ?> /notall"><?php echo $clist['userName']; ?> </a></td> <td scope="col"><?php echo $clist['serviceName']; ?> </td> <td scope="col"><?php echo word_wrap($clist['serviceDescription'], 76); //echo wordwrap($clist['serviceDescription'], 20, "\n", true); ?> </td> <td scope="col"><?php echo $clist['startingDate']; ?> </td> <td scope="col"><?php echo $clist['endingDate']; ?> </td> <td scope="col"> <select class="selActions" id="<?php echo $clist['id']; ?>
function getAttachmentUrl($apli, $post_id, $att_id, $att_path, $att_type, $att_size, $att_inline = 0, $compteur, $visible = 0, $Mmod) { global $icon_dir, $img_dir, $forum; global $mimetype_default, $mime_dspfmt, $mime_renderers; global $DOCUMENTROOT; load_mimetypes(); $att_name = substr(strstr(basename($att_path), '.'), 1); $att_name = substr(strstr(basename($att_name), '.'), 1); $att_path = $DOCUMENTROOT . $att_path; if (!is_file($att_path)) { return ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non trouvÈ") . ' : ' . $att_name . '</span>'; } if ($att_inline) { if (isset($mime_dspfmt[$att_type])) { $display_mode = $mime_dspfmt[$att_type]; } else { $display_mode = $mime_dspfmt[$mimetype_default]; } } else { $display_mode = ATT_DSP_LINK; } if ($Mmod) { global $userdata; $marqueurM = "&Mmod=" . substr($userdata[2], 8, 6); } else { $marqueurM = ""; } $att_url = "getfile.php?att_id={$att_id}&apli={$apli}" . $marqueurM . "&att_name=" . rawurlencode($att_name); if ($visible != 1) { $visible_wrn = ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non visible") . '</span>'; } switch ($display_mode) { case ATT_DSP_IMG: // display as an embedded image $size = @getImageSize("{$att_path}"); // $img_size = verifsize( $size ); $img_size = 'style="max-width: 100%; height:auto;"'; $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_IMG]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_PLAINTEXT: // display as embedded text, PRE-formatted $att_contents = str_replace("\\", "\\\\", htmlSpecialChars(join('', file($att_path)), ENT_COMPAT | ENT_HTML401, cur_charset)); $att_contents = word_wrap($att_contents); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_PLAINTEXT]); eval("\$ret=\"{$text}\";"); break; case ATT_DSP_HTML: // display as embedded HTML text //au choix la source ou la page $att_contents = word_wrap(nl2br(scr_html(join("", file($att_path))))); //$att_contents = removeHack (join ("", file ($att_path))); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_HTML]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_SWF: // Embedded Macromedia Shockwave Flash $size = @getImageSize("{$att_path}"); $img_size = verifsize($size); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_SWF]); eval("\$ret=stripSlashes(\"{$text}\");"); break; default: // display as link $Fichier = new FileManagement(); // essai class PHP7 // $Fichier = new File(""); // $att_size = $Fichier->Pretty_Size($att_size); $att_size = $Fichier->file_size_format($att_size, 1); $att_icon = att_icon($att_name); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_LINK]); eval("\$ret=stripSlashes(\"{$text}\");"); break; } return $ret; }
?> </td> <td><?php echo word_wrap($meta->name, 10); ?> </td> <td><?php echo word_wrap($meta->title, 10); ?> </td> <td><?php echo word_wrap($meta->meta_description, 10); ?> </td> <td><?php echo word_wrap($meta->meta_keyword, 10); ?> </td> <td><li><a href="<?php echo admin_url('managemetas/editmetas/' . $meta->id); ?> "><img src="<?php echo base_url(); ?> images/edit-new.png" alt="Edit" title="Edit" /></a></li></td> </tr> <?php } //Foreach End }
function get_vtodo() { global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines; preg_match('!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_completed off -->!Uis', $this->page, $match1); preg_match('!<\\!-- switch show_important on -->(.*)<\\!-- switch show_important off -->!Uis', $this->page, $match2); preg_match('!<\\!-- switch show_normal on -->(.*)<\\!-- switch show_normal off -->!Uis', $this->page, $match3); $completed = trim($match1[1]); $important = trim($match2[1]); $normal = trim($match3[1]); $nugget2 = ''; $todo_popup_data_index = 0; if (is_array(@$master_array['-2'])) { foreach ($master_array['-2'] as $vtodo_times) { foreach ($vtodo_times as $val) { if (isset($val['vtodo_text']) && !empty($val['vtodo_text'])) { $vtodo_text = sanitizeForWeb(stripslashes(urldecode($val['vtodo_text']))); if (isset($val['description']) && !empty($val['description'])) { $description = sanitizeForWeb(stripslashes(urldecode($val['description']))); } else { $description = ''; } $completed_date = $val['completed_date']; $event_calna = $val['calname']; $status = $val['status']; $priority = $val['priority']; $start_date = $val['start_date']; $due_date = $val['due_date']; $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text); $vtodo_array = base64_encode(urlencode(serialize($vtodo_array))); $todo_text = str_replace('"', '\\"', $vtodo_text); $todo = <<<HEREDOC <script language="Javascript" type="text/javascript"> <!-- var todoData = new TodoData("{$vtodo_array}", "{$todo_text}"); document.todo_popup_data[{$todo_popup_data_index}] = todoData; // --> </script> HEREDOC; $todo .= '<a class="psf" title="' . @$title . '" href="#" onclick="openTodoInfo(' . $todo_popup_data_index . '); return false;">'; $todo_popup_data_index++; $vtodo_array = $todo; $vtodo_text = word_wrap(str_replace('<br />', ' ', $vtodo_text), 21, $phpiCal_config->tomorrows_events_lines); $data = array('{VTODO_TEXT}', '{VTODO_ARRAY}'); $rep = array($vtodo_text, $vtodo_array); // Reset this TODO's category. $temp = ''; if ($status == 'COMPLETED' || $val['completed_date'] != '' && $val['completed_time'] != '') { if ($phpiCal_config->show_completed == 'yes') { $temp = $completed; } } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) { $temp = $important; } else { $temp = $normal; } // Do not include TODOs which do not have the // category set. if ($temp != '') { $nugget1 = str_replace($data, $rep, $temp); $nugget2 .= $nugget1; } } } } } // If there are no TODO items, completely hide the TODO list. if ($nugget2 == '' || $phpiCal_config->show_todos != 'yes') { $this->page = preg_replace('!<\\!-- switch vtodo on -->.*<\\!-- switch vtodo off -->!Uis', '', $this->page); } else { $this->page = preg_replace('!<\\!-- switch show_completed on -->.*<\\!-- switch show_normal off -->!Uis', $nugget2, $this->page); } }
linkify_to_images($value->image_thumb); ?> " alt="<?php echo $value->name; ?> "> </a> <p class="snipp-title"> <a title="<?php echo $value->name; ?> " href="<?php linkify_to_item($value->a_item_id, $value->name); ?> "><?php echo character_limiter(word_wrap($value->name), 40); ?> </a> </p> <span class="item-card-location label label-success"><?php echo $value->location != '' ? $value->location : 'none'; ?> </span> </div> <div class="row"> <div class="col-md-12"> <div class="btn-group btn-block"> <?php if (isset($offered_items) && $offered_items != true) { ?>
function composite_paragraph($text, $target, $rect) { $draw = new ImagickDraw(); $draw->setFont('Helvetica.ttf'); $draw->setFontSize(72); $lines = word_wrap($text, 50); $fm = $target->queryFontMetrics($draw, $lines[0], false); $line_height = 50; while ($fm['textWidth'] > $rect->width) { $draw->setFontSize($draw->getFontSize() - 1); $fm = $target->queryFontMetrics($draw, $lines[0], false); } for ($i = 0; $i < count($lines); $i++) { $draw->setFillColor('black'); $target->annotateImage($draw, $rect->x + 1, $rect->y + 1 + $i * $line_height, 0, $lines[$i]); $draw->setFillColor('white'); $target->annotateImage($draw, $rect->x, $rect->y + $i * $line_height, 0, $lines[$i]); } }
function preview($rows, $report_name = '') { $html = ' <table width="100%" border="0"> <tr> <td colspan="3" align="center">' . $report_name . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tbody><tr> <td width="10%"><strong>Employee ID</strong></td> <td width="9%"><strong>Name</strong></td> <td width="4%"><strong>Sex</strong></td> <td width="10%"><strong>Position/<br /> Designation</strong></td> <td width="13%"><strong>Office / Department</strong></td> <td width="11%"><strong>Employment Status</strong></td> <td width="6%"><strong>Salary Grade</strong></td> <td width="9%"><strong>Eligibility</strong></td> <td width="11%"><strong>Education</strong></td> <td width="8%"><strong>Birthday</strong></td> <td width="9%"><strong>Address</strong></td></tr>'; $office = new Orm_office(); foreach ($rows as $row) { $office->get_by_office_id($row->office_id); $type_employment = $this->options->type_employment(); $birth_date = $row->birth_date; if ($row->birth_date == '0000-00-00') { $birth_date = ''; } $html .= ' <tr> <td>' . $row->id . '</td> <td>' . $row->lname . ',' . $row->fname . ' ' . $row->mname . '</td> <td>' . $row->sex . '</td> <td>' . $row->position . '</td> <td>' . $office->office_name . '</td> <td>' . $type_employment[$row->permanent] . '</td> <td>' . $row->salary_grade . '-' . $row->step . '</td> <td>' . $row->eligibility . '</td> <td>' . $row->education . '</td> <td>' . $birth_date . '</td> <td>' . $row->res_address . '</td> </tr>'; } $html .= ' <tr><td><p> </p></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td><td> </td></tr> </tbody></table>'; // Signatories $sr_prepared = $this->Settings->get_selected_field('sr_prepared'); $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position'); $sr_certified = $this->Settings->get_selected_field('sr_certified'); $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position'); $html .= ' <table width="100%" border="0"> <tr> <td width="38%"> </td> <td width="23%"> </td> <td width="39%"> </td> </tr> <tr> <td align="center">PREPARED BY:</td> <td> </td> <td align="center">CERTIFIED CORRECT:</td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center">' . $sr_prepared . '</td> <td> </td> <td align="center">' . $sr_certified . '</td> </tr> <tr> <td align="center">' . $sr_prepared_position . '</td> <td> </td> <td align="center">' . $sr_certified_position . '</td> </tr> </table> '; $this->load->library('MPDF52/mpdf'); //$this->mpdf->WriteHTML('<p>Hello There hahahaha</p>'); //$this->mpdf->Output('mpdf.pdf','I'); // LOAD a stylesheet $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $this->mpdf->WriteHTML($html); $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; exit; $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L', 'mm', 'Letter'); // add a page $pdf->AddPage(); // set the sourcefile //$pdf->setSourceFile('dtr/template/service_record/service_record.pdf'); // import page 1 //$tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm //$pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(15, 60); $pdf->SetFont('Arial', '', 16); $pdf->Cell(0, 3, "Report Name", '', 1, 'C', false); //$pdf->Ln(4); //$e = new Employee_m(); //$e->get_by_employee_id( $employee_id ); $pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee No.:".$e->id ,'',1,'L',false); //$pdf->Ln(2); //$pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee Name:".$e->lname.', '.$e->fname.' '.$e->mname ,'',1,'L',false); $pdf->Ln(4); $pdf->Cell(0, 8, "Emp ID Name Sex Position/Designation Office Employment Status Salary Grade Eligibility Education Birth Day Address", '1', 1, 'L', false); $pdf->Ln(4); $i = 1; $this->load->helper('text'); //$pdf->Cell(30,12, word_wrap('msayado maahhn ndhah ahhhehe so ano gagawin mo now', 10) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'0',1,'L',false); foreach ($rows as $row) { $pdf->SetFont('Arial', '', 11); $pdf->SetX(10); //$pdf->Write(0, $row->id); $pdf->Cell(15, 12, $row->id, '1', 0, 'L', false); $pdf->SetX(29); //$pdf->Write(0, $row->lname.', '.$row->fname.''.$row->mname); $pdf->Cell(30, 12, word_wrap($row->lname . ', ' . $row->fname . '' . $row->mname, 10), '1', 1, 'L', false); $pdf->SetFont('Arial', '', 8); $pdf->SetX(62); $pdf->Write(0, $row->sex); $pdf->SetX(75); //$pdf->Write(0, $row->company); $pdf->Write(0, $row->position); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(160); $pdf->Write(0, $row->movement); //$pdf->SetX(150); //$pdf->Write(0, $row->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(185); //$pdf->Write(0, $row->status); if ($row->govt_service == 1) { $row->govt_service = 'Yes'; } else { $row->govt_service = 'No'; } $pdf->SetX(190); //$pdf->Write(0, $row->govt_service); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } $pdf->Cell(0, 8, "--------------------------------------------------------- Nothing Follows ---------------------------------------------------------", '', 1, 'C', false); // Signatories $pdf->Ln(15); $pdf->SetX(20); $pdf->Cell(90, 5, "PREPARED BY:", '0', 0, 'C', false); $pdf->Cell(90, 5, "CERTIFIED CORRECT:", '0', 1, 'C', false); $pdf->Ln(10); $sr_prepared = $this->Settings->get_selected_field('sr_prepared'); $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position'); $sr_certified = $this->Settings->get_selected_field('sr_certified'); $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position'); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared, '0', 0, 'C', false); //4th param border $pdf->Cell(90, 5, $sr_certified, '0', 1, 'C', false); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared_position, '0', 0, 'C', false); $pdf->Cell(90, 5, $sr_certified_position, '0', 1, 'C', false); // Output $pdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; }
<div class="row"> <div class="col-lg-6"> <div class="panel panel-warning"> <div class="panel-heading"> Current News : </div> <div class="panel-body"> <p><?php if (isset($latest_news)) { $this->load->helper('text'); echo word_wrap($latest_news['news_text'], 50); } ?></p> </div> <div class="panel-footer"> <?php if (isset($latest_news)) { $this->load->helper('date'); $datestring = "%d-%m-%Y %h:%i:%s %a"; echo mdate($datestring, $latest_news['create_date']); } ?> </div>
echo $plugin->name; ?> </a> v<?php echo $this->functions->parseVersion($plugin->version->local, false); ?> <br /> By: <a href="<?php echo $plugin->author->link; ?> " rel="external"><?php echo $plugin->author->name; ?> </a> </td> <td><?php echo str_replace("\n", '<br />', word_wrap($plugin->description, 60)); ?> </td> <td class="align-right"> <a href="<?php echo $plugin->link; ?> " rel="external" title="Visit Plugin Home Page"> <img src="<?php echo $base_url; ?> img/icons/link_16.png" alt="" class="nb" /> </a> <a href="<?php echo site_url('admin/extend/install/' . $name); ?>
// Pull out only this months ereg("([0-9]{6})([0-9]{2})", $key, $regs); if ($regs[1] == $parse_month) { $getdate = $key; $dayofmonth = strtotime($getdate); $dayofmonth = localizeDate($rss_month_date, $dayofmonth); // Pull out each day foreach ($new_val2 as $new_val) { // Pull out each time foreach ($new_val as $new_key2 => $val) { if ($val["event_text"]) { $event_start = @$val["event_start"]; $event_start = date($timeFormat, @strtotime("{$event_start}")); $event_text = stripslashes(urldecode($val["event_text"])); $event_text = strip_tags($event_text, '<b><i><u>'); $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); $description = stripslashes(urldecode($val["description"])); $description = strip_tags($description, '<b><i><u>'); $rss_title = htmlspecialchars("{$dayofmonth}: {$event_text}"); $rss_link = htmlspecialchars("{$default_path}/day.php?getdate={$getdate}&cal={$cal}"); $rss_description = htmlspecialchars("{$dayofmonth} {$event_start}: {$description}"); $rss .= '<item>' . "\n"; $rss .= '<title>' . $rss_title . '</title>' . "\n"; $rss .= '<link>' . $rss_link . '</link>' . "\n"; $rss .= '<description>' . $rss_description . '</description>' . "\n"; $rss .= '</item>' . "\n"; $events_week++; } if ($events_week < 1) { $rss .= '<item>' . "\n"; $rss .= '<title>' . $no_events_month_lang . '</title>' . "\n";
function get_vtodo() { preg_match("!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_completed off -->!is", $this->page, $match1); preg_match("!<\\!-- switch show_important on -->(.*)<\\!-- switch show_important off -->!is", $this->page, $match2); preg_match("!<\\!-- switch show_normal on -->(.*)<\\!-- switch show_normal off -->!is", $this->page, $match3); $completed = trim($match1[1]); $important = trim($match2[1]); $normal = trim($match3[1]); $nugget2 = ''; $todo_popup_data_index = 0; if (is_array($this->master_array['-2'])) { foreach ($this->master_array['-2'] as $vtodo_times) { foreach ($vtodo_times as $val) { $vtodo_text = stripslashes(urldecode($val["vtodo_text"])); if ($vtodo_text != "") { if (isset($val["description"])) { $description = stripslashes(urldecode($val["description"])); } else { $description = ""; } $completed_date = $val['completed_date']; $event_calna = $val['calname']; $status = $val["status"]; $priority = $val['priority']; $start_date = $val["start_date"]; $due_date = $val['due_date']; $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text); $vtodo_array = base64_encode(urlencode(serialize($vtodo_array))); $todo = "\n\t\t\t\t\t\t<script language=\"Javascript\" type=\"text/javascript\"><!--\n\t\t\t\t\t\tvar todoData = new TodoData('{$vtodo_array}','{$vtodo_text}');\n\t\t\t\t\t\tdocument.todo_popup_data[{$todo_popup_data_index}] = todoData;\n\t\t\t\t\t\t// --></script>"; $todo .= '<a class="psf" title="' . $title . '" href="#" onclick="openTodoInfo(' . $todo_popup_data_index . '); return false;">'; $todo_popup_data_index++; $vtodo_array = $todo; $vtodo_text = word_wrap(strip_tags(str_replace('<br />', ' ', $vtodo_text), '<b><i><u>'), 21, $this->tomorrows_events_lines); $data = array('{VTODO_TEXT}', '{VTODO_ARRAY}'); $rep = array($vtodo_text, $vtodo_array); // Reset this TODO's category. $temp = ''; if ($status == 'COMPLETED' || isset($val['completed_date']) && isset($val['completed_time'])) { if ($this->show_completed == 'yes') { $temp = $completed; } } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) { $temp = $important; } else { $temp = $normal; } // Do not include TODOs which do not have the // category set. if ($temp != '') { $nugget1 = str_replace($data, $rep, $temp); $nugget2 .= $nugget1; } } } } } // If there are no TODO items, completely hide the TODO list. if ($nugget2 == '' || $this->show_todos != 'yes') { $this->page = preg_replace('!<\\!-- switch vtodo on -->(.*)<\\!-- switch vtodo off -->!is', '', $this->page); } else { $this->page = preg_replace('!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_normal off -->!is', $nugget2, $this->page); } }