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


PHP ob_clean函数代码示例

本文整理汇总了PHP中ob_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_clean函数的具体用法?PHP ob_clean怎么用?PHP ob_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _wprp_upgrade_plugin

/**
 * Update a plugin
 *
 * @access private
 * @param mixed $plugin
 * @return array
 */
function _wprp_upgrade_plugin($plugin)
{
    include_once ABSPATH . 'wp-admin/includes/admin.php';
    if (!_wprp_supports_plugin_upgrade()) {
        return array('status' => 'error', 'error' => 'WordPress version too old for plugin upgrades');
    }
    $skin = new WPRP_Plugin_Upgrader_Skin();
    $upgrader = new Plugin_Upgrader($skin);
    $is_active = is_plugin_active($plugin);
    // Do the upgrade
    ob_start();
    $result = $upgrader->upgrade($plugin);
    $data = ob_get_contents();
    ob_clean();
    if (!$result && !is_null($result) || $data) {
        return array('status' => 'error', 'error' => 'file_permissions_error');
    } elseif (is_wp_error($result)) {
        return array('status' => 'error', 'error' => $result->get_error_code());
    }
    if ($skin->error) {
        return array('status' => 'error', 'error' => $skin->error);
    }
    // If the plugin was activited, we have to re-activate it
    // @todo Shouldn't this use activate_plugin?
    if ($is_active) {
        $current = get_option('active_plugins', array());
        $current[] = plugin_basename(trim($plugin));
        sort($current);
        update_option('active_plugins', $current);
    }
    return array('status' => 'success');
}
开发者ID:redferriswheel,项目名称:ZachFonville,代码行数:39,代码来源:wprp.plugins.php

示例2: pc_tag

 /**
  * PC标签中调用数据
  * @param array $data 配置数据
  */
 public function pc_tag($data)
 {
     $siteid = isset($data['siteid']) && intval($data['siteid']) ? intval($data['siteid']) : get_siteid();
     $r = $this->db->select(array('pos' => $data['pos'], 'siteid' => $siteid));
     $str = '';
     if (!empty($r) && is_array($r)) {
         foreach ($r as $v) {
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '<div id="block_id_' . $v['id'] . '" class="admin_block" blockid="' . $v['id'] . '">';
             }
             if ($v['type'] == '2') {
                 extract($v, EXTR_OVERWRITE);
                 $data = string2array($data);
                 if (!defined('HTML')) {
                     ob_start();
                     include $this->template_url($id);
                     $str .= ob_get_contents();
                     ob_clean();
                 } else {
                     include $this->template_url($id);
                 }
             } else {
                 $str .= $v['data'];
             }
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '</div>';
             }
         }
     }
     return $str;
 }
开发者ID:klj123wan,项目名称:czsz,代码行数:35,代码来源:block_tag.class.php

示例3: template

function template($filename, $flag = TEMPLATE_DISPLAY)
{
    global $_W;
    $source = IA_ROOT . "/web/themes/{$_W['template']}/{$filename}.html";
    $compile = IA_ROOT . "/data/tpl/web/{$_W['template']}/{$filename}.tpl.php";
    if (!is_file($source)) {
        $source = IA_ROOT . "/web/themes/default/{$filename}.html";
        $compile = IA_ROOT . "/data/tpl/web/default/{$filename}.tpl.php";
    }
    if (!is_file($source)) {
        exit("Error: template source '{$filename}' is not exist!");
    }
    if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
        template_compile($source, $compile);
    }
    switch ($flag) {
        case TEMPLATE_DISPLAY:
        default:
            extract($GLOBALS, EXTR_SKIP);
            include $compile;
            break;
        case TEMPLATE_FETCH:
            extract($GLOBALS, EXTR_SKIP);
            ob_clean();
            ob_start();
            include $compile;
            $contents = ob_get_contents();
            ob_clean();
            return $contents;
            break;
        case TEMPLATE_INCLUDEPATH:
            return $compile;
            break;
    }
}
开发者ID:legeng,项目名称:project-2,代码行数:35,代码来源:template.func.php

示例4: exportXML

 /**
  * Export to XML format (print to browser)
  *
  * @param string $objName
  * @return void
  */
 public function exportXML($objName)
 {
     // get the current UI bizobj
     /* @var $bizForm EasyForm */
     $bizForm = BizSystem::getObject($objName);
     // get the existing bizform object
     $bizObj = $bizForm->getDataObj();
     $recList = array();
     $bizObj->fetchRecords("", $recList, -1, -1, false);
     $xmlString = "<?xml version='1.0' standalone='yes'?>\n";
     $xmlString .= "<BizDataObj Name=\"" . $bizObj->m_Name . "\">\n";
     foreach ($recList as $rec) {
         $xmlRecord = "\t<Record>\n";
         foreach ($rec as $fld => $val) {
             $xmlRecord .= "\t\t<Field Name=\"{$fld}\" Value=\"{$val}\" />\n";
         }
         $xmlRecord .= "\t</Record>\n";
         $xmlString .= $xmlRecord;
     }
     $xmlString .= "</BizDataObj>";
     // output variables
     $name = str_replace(".", "_", $bizObj->m_Name) . ".xml";
     $size = strlen($xmlString);
     $type = "text/plain";
     ob_clean();
     header("Cache-Control: ");
     // leave blank to avoid IE errors
     header("Pragma: ");
     // leave blank to avoid IE errors
     header("Content-Disposition: attachment; filename=\"{$name}\"");
     header("Content-length: {$size}");
     header("Content-type: {$type}");
     echo $xmlString;
     exit;
 }
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:41,代码来源:ioService.php

示例5: display

 function display()
 {
     ob_clean();
     if (!$this->get('f')) {
         return;
     }
     $from = $this->get('f');
     if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
         $node = 'urn:xmpp:microblog:0';
     } else {
         return;
     }
     $pd = new \modl\PostnDAO();
     $cd = new \modl\ContactDAO();
     $this->view->assign('contact', $cd->get($from, true));
     $this->view->assign('uri', Route::urlize('blog', array($from)));
     if (isset($from) && isset($node)) {
         $messages = $pd->getPublic($from, $node, 10, 0);
         $this->view->assign('messages', $messages);
     }
     if (isset($messages[0])) {
         header("Content-Type: application/atom+xml; charset=UTF-8");
         $this->view->assign('date', date('c'));
     }
 }
开发者ID:Trim,项目名称:movim,代码行数:25,代码来源:Syndication.php

示例6: importFromRedshop

 function importFromRedshop()
 {
     @ob_clean();
     echo $this->getHtmlPage();
     $this->token = hikashop_getFormToken();
     flush();
     if (isset($_GET['import']) && $_GET['import'] == '1') {
         $time = microtime(true);
         $processed = $this->doImport();
         if ($processed) {
             $elasped = microtime(true) - $time;
             if (!$this->refreshPage) {
                 echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=redshop&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>';
             }
             echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>';
         } else {
             echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>';
         }
     } else {
         echo $this->getStartPage();
     }
     if ($this->refreshPage) {
         echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>";
     }
     echo '</body></html>';
     exit;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:27,代码来源:reds.php

示例7: perform

 /**
  * Execute the login view
  */
 public function perform()
 {
     $this->initVars();
     // create capcha picture and public key
     $this->model->action('common', 'captchaMake', array('captcha_pic' => &$this->tplVar['captcha_pic'], 'public_key' => &$this->tplVar['public_key'], 'configPath' => &$this->config['config_path']));
     // Check login data
     if (isset($_POST['dologin'])) {
         // validate captcha turing/public keys
         if (FALSE == $this->model->action('common', 'captchaValidate', array('turing_key' => (string) $_POST['captcha_turing_key'], 'public_key' => (string) $_POST['captcha_public_key'], 'configPath' => (string) $this->config['config_path']))) {
             $this->resetFormData();
             return TRUE;
         }
         // verify user and password. If those dosent match
         // reload the login page
         $login = $this->model->action('user', 'checkLogin', array('login' => (string) $_POST['login'], 'passwd' => (string) $_POST['password']));
         // If login was successfull reload the destination page
         if ($login == TRUE) {
             ob_clean();
             // get url vars to switch to the destination page
             $url = $this->model->session->get('url');
             $this->model->session->del('url');
             @header('Location: ' . SMART_CONTROLLER . '?' . $url);
             exit;
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:29,代码来源:ViewLogin.php

示例8: download

function download($verze)
{
    $verze_ = $GLOBALS['download_dir'] . $verze;
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . basename($verze_));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($verze_));
    ob_clean();
    flush();
    readfile($verze_);
    $relace = mysql_connect('localhost', 'host', 'h0st207p');
    if (!$relace) {
        die('Could not connect: ' . mysql_error());
    }
    if (!mysql_select_db('host', $relace)) {
        die('Could not select database');
    }
    $sql = 'SELECT stazeno FROM sfepy_downloads WHERE verze="' . $verze . '"';
    $data = mysql_query($sql, $relace);
    if (!$data) {
        die('DB Error, could not query the database: ' . mysql_error());
    }
    list($stazeno) = mysql_fetch_row($data);
    $stazeno = $stazeno + 1;
    $sql = 'UPDATE sfepy_downloads SET stazeno="' . $stazeno . '" WHERE verze="' . $verze . '"';
    mysql_query($sql, $relace);
    mysql_free_result($data);
}
开发者ID:rosendo100,项目名称:sfepy,代码行数:32,代码来源:downloads.php

示例9: cms7_exception_handler

function cms7_exception_handler($e)
{
    ob_clean();
    echo '<b>A Fatal error has occured</b><br/>';
    echo $e->getMessage() . '<br/>';
    echo '<pre>', print_r($e, TRUE), '</pre>';
}
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:7,代码来源:bootstrap.php

示例10: create

 function create($width = '120', $height = '40', $characters = '6')
 {
     ob_clean();
     $code = $this->generateCode($characters);
     /* font size will be 75% of the image height */
     $font_size = $height * 0.7;
     $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
     /* set the colours */
     $background_color = imagecolorallocate($image, 220, 220, 220);
     $text_color = imagecolorallocate($image, 10, 30, 80);
     $noise_color = imagecolorallocate($image, 150, 180, 220);
     /* generate random dots in background */
     for ($i = 0; $i < $width * $height / 3; $i++) {
         imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color);
     }
     /* generate random lines in background */
     for ($i = 0; $i < $width * $height / 150; $i++) {
         imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color);
     }
     /* create textbox and add text */
     $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
     $x = ($width - $textbox[4]) / 2;
     $y = ($height - $textbox[5]) / 2;
     $y -= 5;
     imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function');
     /* output captcha image to browser */
     header('Content-Type: image/jpeg');
     imagejpeg($image);
     imagedestroy($image);
     $this->Controller->Session->write('security_code', $code);
 }
开发者ID:hqubaisi,项目名称:Fivedollarwork,代码行数:31,代码来源:captcha.php

示例11: index

 public function index()
 {
     ob_clean();
     $image_handle = imagecreatetruecolor(150, 60);
     $white = imagecolorallocate($image_handle, 255, 255, 255);
     $rndm = imagecolorallocate($image_handle, rand(64, 192), rand(64, 192), rand(64, 192));
     imagefill($image_handle, 0, 0, $white);
     $fontName = PUBLICPATH . "/fonts/elephant.ttf";
     $myX = 15;
     $myY = 30;
     $angle = 0;
     for ($x = 0; $x <= 100; $x++) {
         $myX = rand(1, 148);
         $myY = rand(1, 58);
         imageline($image_handle, $myX, $myY, $myX + rand(-5, 5), $myY + rand(-5, 5), $rndm);
     }
     $myCryptBase = tep_create_random_value(50, 'digits');
     $secure_image_hash_string = "";
     for ($x = 0; $x <= 4; $x++) {
         $dark = imagecolorallocate($image_handle, rand(5, 128), rand(5, 128), rand(5, 128));
         $capChar = substr($myCryptBase, rand(1, 35), 1);
         $secure_image_hash_string .= $capChar;
         $fs = rand(20, 26);
         $myX = 15 + ($x * 28 + rand(-5, 5));
         $myY = rand($fs + 2, 55);
         $angle = rand(-30, 30);
         ImageTTFText($image_handle, $fs, $angle, $myX, $myY, $dark, $fontName, $capChar);
     }
     $this->session->set_userdata('secure_image_hash_string', $secure_image_hash_string);
     header("Content-type: image/jpeg");
     imagejpeg($image_handle, "", 95);
     imagedestroy($image_handle);
     die;
 }
开发者ID:rongandat,项目名称:ookcart-project,代码行数:34,代码来源:secure_image.php

示例12: createXLSAdv

 function createXLSAdv(&$rows, $row_labels = null, $row_headers = null, $title = null)
 {
     ob_clean();
     ob_start();
     require_once JPATH_COMPONENT_SITE . DS . 'libraries' . DS . 'pear' . DS . 'PEAR.php';
     require_once JPATH_COMPONENT_SITE . DS . 'libraries' . DS . 'Excel' . DS . 'Writer.php';
     // Creating a workbook
     $workbook = new Spreadsheet_Excel_Writer();
     $worksheet = $workbook->addWorksheet($title);
     $BIFF = new Spreadsheet_Excel_Writer_BIFFwriter();
     $format = new Spreadsheet_Excel_Writer_Format($BIFF);
     $format->setBold(1);
     $format->setAlign('center');
     for ($k = 0; $k < count($row_labels); $k++) {
         $worksheet->write(0, $k, $row_headers[$row_labels[$k]], $format);
     }
     for ($i = 0; $i < count($rows); $i++) {
         for ($k = 0; $k < count($row_labels); $k++) {
             $worksheet->write($i + 1, $k, $rows[$i][$row_labels[$k]]);
         }
     }
     $workbook->close();
     $attachment = ob_get_contents();
     @ob_end_clean();
     echo $attachment;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:admin.xlscreator.php

示例13: PageLoad

    public function PageLoad()
    {
        ob_clean();
        $this->presenter->PageLoad();
        $config = Configuration::Instance();
        $feed = new FeedWriter(ATOM);
        $title = $config->GetKey(ConfigKeys::APP_TITLE);
        $feed->setTitle("{$title} Reservations");
        $url = $config->GetScriptUrl();
        $feed->setLink($url);
        $feed->setChannelElement('updated', date(DATE_ATOM, time()));
        $feed->setChannelElement('author', array('name' => $title));
        foreach ($this->reservations as $reservation) {
            /** @var FeedItem $item */
            $item = $feed->createNewItem();
            $item->setTitle($reservation->Summary);
            $item->setLink($reservation->ReservationUrl);
            $item->setDate($reservation->DateCreated->Timestamp());
            $item->setDescription(sprintf('<div><span>Start</span> %s</div>
										  <div><span>End</span> %s</div>
										  <div><span>Organizer</span> %s</div>
										  <div><span>Description</span> %s</div>', $reservation->DateStart->ToString(), $reservation->DateEnd->ToString(), $reservation->Organizer, $reservation->Description));
            $feed->addItem($item);
        }
        $feed->genarateFeed();
    }
开发者ID:hugutux,项目名称:booked,代码行数:26,代码来源:AtomSubscriptionPage.php

示例14: ierror

function ierror($msg, $code)
{
    global $logger;
    if ($code == 301 || $code == 302) {
        if (ob_get_length() !== FALSE) {
            ob_clean();
        }
        // default url is on html format
        $url = html_entity_decode($msg);
        $logger->warning($code . ' ' . $url, 'i.php', array('url' => $_SERVER['REQUEST_URI']));
        header('Request-URI: ' . $url);
        header('Content-Location: ' . $url);
        header('Location: ' . $url);
        exit;
    }
    if ($code >= 400) {
        $protocol = $_SERVER["SERVER_PROTOCOL"];
        if ('HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol) {
            $protocol = 'HTTP/1.0';
        }
        header("{$protocol} {$code} {$msg}", true, $code);
    }
    //todo improve
    echo $msg;
    $logger->error($code . ' ' . $msg, 'i.php', array('url' => $_SERVER['REQUEST_URI']));
    exit;
}
开发者ID:donseba,项目名称:Piwigo,代码行数:27,代码来源:i.php

示例15: test_initialize_obs_content

 public function test_initialize_obs_content()
 {
     // TODO: fix this test
     $this->markTestSkipped('The test needs fixed');
     /** @var $thisPlugin action_plugin_door43obs_PopulateOBS */
     $thisPlugin = plugin_load('action', 'door43obs_PopulateOBS');
     if (ob_get_contents()) {
         ob_clean();
     }
     $thisPlugin->initialize_obs_content();
     $result = ob_get_clean();
     // test the return value
     $expect = sprintf($thisPlugin->getLang('obsCreatedSuccess'), self::$destNs, '/' . self::$destNs . '/obs');
     $this->assertEquals($expect, $result);
     // check for files
     $this->assertFileExists($this->destNsDir . '/home.txt');
     $this->assertFileExists($this->destNsDir . '/obs.txt');
     $this->assertFileExists($this->destNsDir . '/sidebar.txt');
     $this->assertFileExists($this->destNsDir . '/obs/app_words.txt');
     $this->assertFileExists($this->destNsDir . '/obs/back-matter.txt');
     $this->assertFileExists($this->destNsDir . '/obs/front-matter.txt');
     $this->assertFileExists($this->destNsDir . '/obs/cover-matter.txt');
     $this->assertFileExists($this->destNsDir . '/obs/sidebar.txt');
     $this->assertFileExists($this->destNsDir . '/obs/stories.txt');
     // currently not checking all 50 files, just the first and last
     $this->assertFileExists($this->destNsDir . '/obs/01.txt');
     $this->assertFileExists($this->destNsDir . '/obs/50.txt');
 }
开发者ID:richmahn,项目名称:Door43,代码行数:28,代码来源:PopulateOBS.test.php


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