当前位置: 首页>>代码示例>>PHP>>正文


PHP functions::data_uri方法代码示例

本文整理汇总了PHP中functions::data_uri方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::data_uri方法的具体用法?PHP functions::data_uri怎么用?PHP functions::data_uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在functions的用法示例。


在下文中一共展示了functions::data_uri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: outputPeopleSingle

 private static function outputPeopleSingle($userarray = array(), $wid = "people-user", $class = "")
 {
     if (empty($userarray)) {
         return BLURB_SORRY_PEOPLE_SEARCH . "<!-- outputPeopleSingle -->\r\n";
     }
     $stdout = "";
     // ---------------------------------------------------------------------------
     // REARRANGE DATA INTO CONVENIENT OUTPUT ARRAYS
     // Input: $userarray[username][fieldname] = array(record)
     // Output: $personEntry[fieldname] = array(record)
     // ---------------------------------------------------------------------------
     $entry = array_pop($userarray);
     if (empty($entry)) {
         return "";
     }
     // ---------------------------------------------------------------------------
     // OUTPUT TO SCREEN
     // ---------------------------------------------------------------------------
     // see also: http://microformats.org/wiki/hcard
     // see also tutorial at: http://www.xfront.com/microformats/
     // see also: http://www.w3.org/2002/12/cal/rfc2426
     //
     // hCard markup:
     // adr
     // post-office-box
     // extended-address
     // street-address
     // locality
     // region
     // postal-code
     // country-name
     // type={dom,intl*,postal*,parcel*,work*,home,pref}
     // value
     // agent
     // bday
     // category
     // class
     // email
     // type={internet*,x400,pref...}
     // value
     // fn
     // geo
     // latitude
     // longitude
     // key
     // label
     // logo
     // mailer
     // n
     // family-name
     // given-name
     // additional-name
     // honorific-prefix
     // honorific-suffix
     // nickname
     // note
     // org
     // organization-name
     // organization-unit
     // photo [image should be square, dimensions 32px-96px, preferrably 64x64px]
     // rev
     // role
     // sort-string
     // sound
     // tel
     // type={voice*,home,msg,work,fax,cell,video,pager,bbs,modem,car,isdn,pcs,pref}
     // value
     // title
     // tz
     // uid
     // url
     $stdout .= " <div" . (!empty($wid) ? " id='" . $wid . "'" : "") . " class='vcard people-box large roundcorners mediumgrayborder shadow" . (!empty($class) ? " " . $class : "") . "'>\r\n" . " <div class='img'><a href='people/index.php'>\r\n" . " <img src='" . $entry["nw_image_large"] . "' alt='' class='darkshadow'></a></div>\r\n" . " <img class='photo hidden' " . "src='" . functions::data_uri($entry["nw_image_small"], 'image/png') . "' alt=''>\r\n" . " <div>\r\n";
     $stdout .= " <h2 class='fn n'>" . "<span class='given-name'>" . $entry["nw_firstname"] . "</span> " . "<span class='additional-name'>" . $entry["nw_namevon"] . "</span> " . "<span class='family-name sort-string'>" . $entry["nw_lastname"] . "</span>" . "</h2>\r\n";
     $stdout .= !empty($entry["nw_leaveofabsence"]) ? " <p class='leaveofabsence'>" . $entry["nw_leaveofabsence"] . "</p>\r\n" : "";
     $stdout .= " <table>\r\n" . " <tr>\r\n" . " <td>\r\n" . " <dl>\r\n" . " <dt>Position</dt>\r\n" . " <dd class='title'>" . str_replace("&nbsp;", " ", $entry["nw_employeeTitle"]) . "</dd>\r\n" . ($entry["nw_group"] == "Administration" ? " <dt>Group</dt>\r\n" : " <dt>Field of research:</dt>\r\n") . " <dd class='group org'>" . "<span class='hidden organization-name'>Nordita</span>" . "<span class='organization-unit'>" . str_replace("&nbsp;", " ", $entry["nw_group"]) . "</span>" . "</dd>\r\n" . " </dl>\r\n" . " </td>\r\n" . " <td>\r\n" . " <dl>\r\n" . " <dt>E-mail</dt>\r\n" . " <dd class='email'>" . (!empty($entry["nw_email"]) ? $entry["nw_email"] : "&#8211;") . "</dd>\r\n" . " </dl>\r\n" . " <dl>\r\n" . " <dt>Homepage</dt>\r\n" . " <dd class='homepage'>" . (!empty($entry["nw_homepage"]) ? "<span class='url'>" . preg_replace("#/</a#", "</a", $entry["nw_homepage"]) . "</span>" : "&#8211;") . "</dd>\r\n" . " </dl>\r\n" . " <dl>\r\n" . " <dt>Room</dt>\r\n" . " <dd class='office'>" . (!empty($entry["nw_office"]) ? $entry["nw_office"] : "&#8211;") . "</dd>\r\n" . " </dl>\r\n" . " <dl>\r\n" . " <dt>Phone (office)</dt>\r\n" . " <dd class='tel phone'>" . (!empty($entry["nw_phone_linked"]) ? "<abbr class='type' title='work'><span class='value'>" . str_replace("&nbsp;", " ", $entry["nw_phone_linked"]) . "</span></abbr>" : "&#8211;") . "</dd>\r\n" . " </dl>\r\n" . " <dl>\r\n" . " <dt>Fax number</dt>\r\n" . " <dd class='tel fax'>" . "<abbr class='type' title='fax'><span class='value'>" . (!empty($entry["nw_fax"]) ? str_replace("&nbsp;", " ", $entry["nw_fax"]) : "&#8211;") . "</span></abbr>" . "</dd>\r\n" . " </dl>\r\n" . " </td>\r\n" . " <td>\r\n" . " <dl>\r\n" . " <dt>Postal address</dt>\r\n" . " <dd class='address'>" . (false ? "<img class='logo hidden' alt='' src='" . LOGO_STAR_85x85 . "'>" : "") . "\r\n";
     if ($entry["nw_city"] == "Stockholm") {
         $building = mb_strtoupper($entry["nw_building"]);
         $stdout .= " " . (defined("ADDRESS_STH_PREFIX_" . $building) ? constant("ADDRESS_STH_PREFIX_" . $building) : ADDRESS_STH_PREFIX_13) . "<br><em>" . str_replace("&nbsp;", " ", $entry["nw_fullname"]) . "</em>" . "<br>" . ADDRESS_STH_POSTAL_STREET . "<br>" . ADDRESS_STH_POSTAL_POSTALCODE . " " . ADDRESS_STH_LOCALITY . "<br>" . ADDRESS_STH_COUNTRY . "\r\n";
         // hCard markup (hidden with css)
         if (true) {
             $stdout .= "<span class='hidden adr'>\r\n" . " <span class='type'>postal</span><span class='hidden type'>intl</span>" . "<span class='hidden type'>pref</span>\r\n" . " <span class='street-address'>" . ADDRESS_STH_POSTAL_STREET . "</span>\r\n" . " <br><span class='postal-code'>" . ADDRESS_STH_POSTAL_POSTALCODE . "</span>\r\n" . " <span class='locality'>" . ADDRESS_STH_LOCALITY . "</span>\r\n" . " <br><span class='country-name'>" . ADDRESS_STH_COUNTRY . "</span>\r\n" . "</span>\r\n";
         }
         if (false) {
             $stdout .= "<span class='hidden adr'>\r\n" . " <span class='type'>work</span><span class='type'>intl</span>\r\n" . (defined("ADDRESS_STH_WORK_STREET_" . $building) ? " <span class='street-address'>" . constant("ADDRESS_STH_WORK_STREET_" . $building) . "</span>\r\n" : " <span class='street-address'>" . ADDRESS_STH_WORK_STREET_13 . "</span>") . " <span class='postal-code'>" . ADDRESS_STH_WORK_POSTALCODE . "</span>\r\n" . " <span class='locality'>" . ADDRESS_STH_LOCALITY . "</span>\r\n" . " <span class='country-name'>" . ADDRESS_STH_COUNTRY . "</span>\r\n" . "</span>\r\n";
         }
         if (false) {
             $stdout .= "<span class='hidden adr'>\r\n" . " <span class='type'>parcel</span><span class='type'>intl</span>\r\n" . " <span class='street-address'>" . ADDRESS_STH_PARCEL_STREET . "</span>\r\n" . " <span class='postal-code'>" . ADDRESS_STH_PARCEL_POSTALCODE . "</span>\r\n" . " <span class='locality'>" . ADDRESS_STH_LOCALITY . "</span>\r\n" . " <span class='country-name'>" . ADDRESS_STH_COUNTRY . "</span>\r\n" . "</span>\r\n";
         }
     } else {
         $stdout .= str_replace("&nbsp;", " ", $entry["nw_fullname"]) . "<br>" . VISITING_ADDRESS_COPENHAGEN_LINES . "\r\n";
     }
     $stdout .= " </dd>\r\n" . " </dl>\r\n" . ($entry["nw_building"] == "dk" || empty($_SERVER["REQUEST_URI"]) ? "" : "<p style='border-top:1px solid #999;padding-top:1em;margin-top:3em;font-style:italic'>" . "<a type='text/directory' rel='nofollow' href='" . "vcf/index.php?uri=" . urlencode("http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]) . "'>" . "<img src='img/_icons/vcard.png' alt='' style='float:left;padding-right:10px;padding-top:2px'> " . "Download<br>vCard</a></p>") . " </td>\r\n" . " </tr>\r\n" . " </table>\r\n";
     $stdout .= " </div>\r\n" . " </div>\r\n" . "\r\n";
     if (!empty($entry["nw_cv"]["text"])) {
         $stdout .= " <div class='col-content-left cvitem'>\r\n" . $entry["nw_cv"]["text"] . " </div>\r\n" . " <div class='col-content-right'>\r\n" . " </div>\r\n" . "";
     }
     return $stdout;
 }
开发者ID:,项目名称:,代码行数:98,代码来源:

示例2: outputQrcodeCreate

 public static function outputQrcodeCreate($text = "", $pixelsize = QRCODE_DEFAULT_PIXELSIZE, $level = QRCODE_DEFAULT_LEVEL, $imagewidth = QRCODE_DEFAULT_IMAGEWIDTH, $ext = "")
 {
     //TODO: No use is currently made of $imagewidth
     $stdout = "";
     $files = array();
     if (!isset(self::$errorlevels[$level])) {
         $level = QRCODE_DEFAULT_LEVEL;
     }
     // Include only this file, remaining required files will be included from it
     if (!class_exists("qrstr", FALSE)) {
         require_once PATH_PHPQRCODE . "/qrlib.php";
     }
     $margin = QRCODE_DEFAULT_MARGIN;
     // boundary width in number of code squares
     $saveandprint = FALSE;
     // TRUE = save to file and display in browser; FALSE = save to file only; redundant if $outfile=FALSE
     $back_color = 0xffffff;
     $fore_color = 0x0;
     $cmyk = TRUE;
     $filename = "qrcode-" . time();
     if (!empty($ext) && in_array($ext, self::$filetypes)) {
         print self::outputQrcodeToBrowser($text, PATH_PHPQRCACHE . "qrcode." . $ext, $ext, $level, $pixelsize, $margin, $back_color, $fore_color);
         die;
     }
     $outfile = PATH_PHPQRCACHE . $filename . ".png";
     QRcode::png($text, $outfile, $level, $pixelsize, $margin, $saveandprint, $back_color, $fore_color);
     /* -- KEEP FOR REFERENCE -- */
     /*
         $outfile = PATH_PHPQRCACHE.$filename.".eps";
         QRcode::eps($text,$outfile,$level,$pixelsize,$margin,$saveandprint,$back_color,$fore_color,$cmyk);
     
         $outfile = PATH_PHPQRCACHE.$filename.".svg";
         QRcode::svg($text,$outfile,$level,$pixelsize,$margin,$saveandprint,$back_color,$fore_color);
     
         $outfile = PATH_PHPQRCACHE.$filename.".txt";
         QRcode::text($text,$outfile,$level,$pixelsize,$margin);
     */
     foreach (self::$filetypes as $filetype) {
         $files[] = "  <a href='" . $_SERVER["PHP_SELF"] . "?" . "qr-text=" . urlencode($text) . "&amp;qr-ext=" . urlencode($filetype) . "&amp;qr-width=" . urlencode($imagewidth) . "&amp;qr-level=" . urlencode($level) . "'>" . "<strong>" . strtoupper($filetype) . "</strong></a>\r\n";
     }
     $imagedata = getimagesize(PATH_PHPQRCACHE . $filename . ".png");
     $width = $imagedata[0] >= 250 ? 250 : $imagedata[0];
     $stdout .= "<dl>\r\n" . "  <dt>Download your QR Code in various file formats:</dt>\r\n" . "  <dd>" . implode(" - ", $files) . "</dd>\r\n" . "  <dd><a href='" . functions::data_uri(PATH_PHPQRCACHE . $filename . ".png", "image/png") . "'>" . "<img src='" . functions::data_uri(PATH_PHPQRCACHE . $filename . ".png", "image/png") . "' " . "style='" . "width:" . $width . "px;height:" . $width . "px;" . "border:1px solid #999;margin-top:1em'>" . "</a></dd>\r\n" . "  <dd>QR Code image, " . $imagedata[0] . "x" . $imagedata[1] . " pixel</dd>\r\n" . "  <dd>Each module is " . $pixelsize . " pixels wide</dd>\r\n" . "  <dd><div class='box grayborder padding' style='width:225px;margin-top:1em;font-family:monospace'>" . $text . "</dd>\r\n" . "</dl>\r\n";
     return $stdout;
 }
开发者ID:,项目名称:,代码行数:45,代码来源:


注:本文中的functions::data_uri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。