コード例 #1
4
ファイル: doc.php プロジェクト: sss201413/ecstore
 function command_dd()
 {
     $args = func_get_args();
     $options = $this->get_options();
     $dd = kernel::single('dev_docbuilder_dd');
     if (empty($args)) {
         $dd->export();
     } else {
         foreach ($args as $app_id) {
             $dd->export_tables($app_id);
         }
     }
     if ($filename = $options['result-file']) {
         ob_start();
         $dd->output();
         $out = ob_get_contents();
         ob_end_clean();
         if (!is_dir(dirname($filename))) {
             throw new Exception('cannot find the ' . dirname($filename) . 'directory');
         } elseif (is_dir($filename)) {
             throw new Exception('the result-file path is a directory.');
         }
         file_put_contents($options['result-file'], $out);
         echo 'data dictionary doc export success.';
     } else {
         $dd->output();
     }
 }
コード例 #2
1
/**
 * Smarty debug_console function plugin
 *
 * Type:     core<br>
 * Name:     display_debug_console<br>
 * Purpose:  display the javascript debug console window
 * @param array Format: null
 * @param Smarty
 */
function smarty_core_display_debug_console($params, &$smarty)
{
    // we must force compile the debug template in case the environment
    // changed between separate applications.
    if (empty($smarty->debug_tpl)) {
        // set path to debug template from SMARTY_DIR
        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
        if ($smarty->security && is_file($smarty->debug_tpl)) {
            $smarty->secure_dir[] = realpath($smarty->debug_tpl);
        }
        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
    }
    $_ldelim_orig = $smarty->left_delimiter;
    $_rdelim_orig = $smarty->right_delimiter;
    $smarty->left_delimiter = '{';
    $smarty->right_delimiter = '}';
    $_compile_id_orig = $smarty->_compile_id;
    $smarty->_compile_id = null;
    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
        ob_start();
        $smarty->_include($_compile_path);
        $_results = ob_get_contents();
        ob_end_clean();
    } else {
        $_results = '';
    }
    $smarty->_compile_id = $_compile_id_orig;
    $smarty->left_delimiter = $_ldelim_orig;
    $smarty->right_delimiter = $_rdelim_orig;
    return $_results;
}
コード例 #3
1
ファイル: popular.lib.php プロジェクト: ned3y2k/youngcart5
function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3)
{
    global $config, $g5;
    if (!$skin_dir) {
        $skin_dir = 'basic';
    }
    $date_gap = date("Y-m-d", G5_SERVER_TIME - $date_cnt * 86400);
    $sql = " select pp_word, count(*) as cnt from {$g5['popular_table']} where pp_date between '{$date_gap}' and '" . G5_TIME_YMD . "' group by pp_word order by cnt desc, pp_word limit 0, {$pop_cnt} ";
    $result = sql_query($sql);
    for ($i = 0; $row = sql_fetch_array($result); $i++) {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
    }
    ob_start();
    if (G5_IS_MOBILE) {
        $popular_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
        $popular_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
    } else {
        $popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir;
        $popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir;
    }
    include_once $popular_skin_path . '/popular.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
コード例 #4
1
ファイル: Engine.php プロジェクト: hecrj/sea_core
 public function render($template = null, array $arguments = null)
 {
     if (null === $template) {
         return false;
     }
     $parentTemplate = $this->currentTemplate;
     $this->currentTemplate = $this->totalTemplates = $this->totalTemplates + 1;
     $path = $this->finder->getPath($template);
     if (!is_file($path)) {
         throw new \RuntimeException('The requested view file doesn\'t exist in: <strong>' . $path . '</strong>', 404);
     }
     ob_start();
     try {
         $this->requireInContext($path, $arguments);
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     if (isset($this->parent[$this->currentTemplate])) {
         $this->data['content'] = ob_get_contents();
         ob_end_clean();
         $this->render($this->parent[$this->currentTemplate], $arguments);
     } else {
         ob_end_flush();
     }
     if ($parentTemplate == 0) {
         $this->clean();
     } else {
         $this->currentTemplate = $parentTemplate;
     }
 }
コード例 #5
1
ファイル: template.func.php プロジェクト: legeng/project-2
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;
    }
}
コード例 #6
1
ファイル: block_tag.class.php プロジェクト: klj123wan/czsz
 /**
  * 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;
 }
コード例 #7
0
/**
 * http://www.php.net/manual/en/function.phpinfo.php
 * code at adspeed dot com
 * 09-Dec-2005 11:31
 * This function parses the phpinfo output to get details about a PHP module.
 */
function ckeditor_parse_php_info()
{
    ob_start();
    phpinfo(INFO_MODULES);
    $s = ob_get_contents();
    ob_end_clean();
    $s = strip_tags($s, '<h2><th><td>');
    $s = preg_replace('/<th[^>]*>([^<]+)<\\/th>/', "<info>\\1</info>", $s);
    $s = preg_replace('/<td[^>]*>([^<]+)<\\/td>/', "<info>\\1</info>", $s);
    $vTmp = preg_split('/(<h2>[^<]+<\\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
    $vModules = array();
    for ($i = 1; $i < count($vTmp); $i++) {
        if (preg_match('/<h2>([^<]+)<\\/h2>/', $vTmp[$i], $vMat)) {
            $vName = trim($vMat[1]);
            $vTmp2 = explode("\n", $vTmp[$i + 1]);
            foreach ($vTmp2 as $vOne) {
                $vPat = '<info>([^<]+)<\\/info>';
                $vPat3 = "/{$vPat}\\s*{$vPat}\\s*{$vPat}/";
                $vPat2 = "/{$vPat}\\s*{$vPat}/";
                if (preg_match($vPat3, $vOne, $vMat)) {
                    // 3cols
                    $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3]));
                } elseif (preg_match($vPat2, $vOne, $vMat)) {
                    // 2cols
                    $vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
                }
            }
        }
    }
    return $vModules;
}
コード例 #8
0
 function Explain($sql, $partial = false)
 {
     $save = $this->conn->LogSQL(false);
     if ($partial) {
         $sqlq = $this->conn->qstr($sql . '%');
         $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like {$sqlq}");
         if ($arr) {
             foreach ($arr as $row) {
                 $sql = reset($row);
                 if (crc32($sql) == $partial) {
                     break;
                 }
             }
         }
     }
     $qno = rand();
     $ok = $this->conn->Execute("EXPLAIN PLAN SET QUERYNO={$qno} FOR {$sql}");
     ob_start();
     if (!$ok) {
         echo "<p>Have EXPLAIN tables been created?</p>";
     } else {
         $rs = $this->conn->Execute("select * from explain_statement where queryno={$qno}");
         if ($rs) {
             rs2html($rs);
         }
     }
     $s = ob_get_contents();
     ob_end_clean();
     $this->conn->LogSQL($save);
     $s .= $this->Tracer($sql);
     return $s;
 }
コード例 #9
0
    function usage()
    {
        ob_start();
        ?>
This plug-in is designed to help you create input buttons which perform an action 'onClick'. The plug-in also can also optionally add a 'class' to the input button.

BASIC USAGE:

{exp:np_jsbutton value="Cancel" onclick='history.go(-1);'}

PARAMETERS:

value = 'Cancel' (no default - must be specified)
 - The input button text.
	
onclick = 'some javascript' (no default - must be specified)
 - The javascript that you want to execute on click.
	
RELEASE NOTES:

1.0 - Initial Release.

For updates and support check the developers website: http://nathanpitman.com/


<?php 
        $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }
コード例 #10
0
 function getcontacts($user, $password, &$result)
 {
     if (!$this->checklogin($user, $password)) {
         return 0;
     }
     $cookies = array();
     $bRet = $this->readcookies(COOKIEJAR, $cookies);
     if (!$bRet && !$cookies['JSESSIONID']) {
         return 0;
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR);
     curl_setopt($ch, CURLOPT_TIMEOUT, TIMEOUT);
     curl_setopt($ch, CURLOPT_URL, "http://www51.mail.sohu.com/webapp/contact");
     ob_start();
     curl_exec($ch);
     $content = ob_get_contents();
     ob_end_clean();
     curl_close($ch);
     $bRet = $this->_parsedata($content, $result);
     if (!$bRet) {
         return 0;
     }
     return 1;
 }
コード例 #11
0
 function b_wp_archives_monthly_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     ob_start();
     if ($block_style == 0) {
         // Simple Listing
         get_archives('monthly', '', 'html', '', '', $with_count);
     } else {
         // Dropdown Listing
         echo '<form name="archiveform' . $wp_num . '" action="">';
         echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
         echo '<option value="">' . _WP_BY_MONTHLY . '</option>';
         get_archives('monthly', '', 'option', '', '', $with_count);
         echo '</select>';
         echo '</form>';
     }
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
コード例 #12
0
        /**
         * The default template for displaying single post content
         *
         * @package Customizr
         * @since Customizr 3.0
         */
        function tc_post_content()
        {
            //check conditional tags : we want to show single post or single custom post types
            global $post;
            $tc_show_single_post_content = isset($post) && 'page' != $post->post_type && 'attachment' != $post->post_type && is_singular() && !tc__f('__is_home_empty');
            if (!apply_filters('tc_show_single_post_content', $tc_show_single_post_content)) {
                return;
            }
            //display an icon for div if there is no title
            $icon_class = in_array(get_post_format(), array('quote', 'aside', 'status', 'link')) ? apply_filters('tc_post_format_icon', 'format-icon') : '';
            ob_start();
            do_action('__before_content');
            ?>
    

          <section class="entry-content <?php 
            echo $icon_class;
            ?>
">
              <?php 
            the_content(__('Continue reading <span class="meta-nav">&rarr;</span>', 'customizr'));
            ?>
              <?php 
            wp_link_pages(array('before' => '<div class="pagination pagination-centered">' . __('Pages:', 'customizr'), 'after' => '</div>'));
            ?>
          </section><!-- .entry-content -->

        <?php 
            do_action('__after_content');
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_post_content', $html);
        }
コード例 #13
0
ファイル: views.class.php プロジェクト: ravenlp/FlavorPHP
 public function fetch($name, $type = NULL)
 {
     if ($type == "element") {
         $path = Absolute_Path . APPDIR . DIRSEP . "views" . DIRSEP . "elements" . DIRSEP . $name . ".php";
         $errorMsg = "The <strong>element</strong> '<em>" . $name . "</em>' does not exist.";
     } elseif ($type == "layout") {
         $path = Absolute_Path . APPDIR . DIRSEP . "views" . DIRSEP . "layouts" . DIRSEP . $this->layout . ".php";
         $errorMsg = "The <strong>layout</strong> '<em>" . $this->layout . "</em>' does not exist.";
     } else {
         $route = explode(".", $name);
         $path = Absolute_Path . APPDIR . DIRSEP . "views" . DIRSEP . $route[0] . DIRSEP . $route[1] . ".php";
         $errorMsg = "The <strong>view</strong> '<em>" . $name . "</em>' does not exist.";
     }
     if (file_exists($path) == false) {
         throw new Exception("FlavorPHP error: " . $errorMsg);
         return false;
     }
     foreach ($this->vars as $key => $value) {
         ${$key} = $value;
     }
     ob_start();
     include $path;
     $contents = ob_get_contents();
     ob_end_clean();
     return $contents;
 }
コード例 #14
0
 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     ob_start();
     CollectionsPrinter::printFunctionLinks();
     $layout = new Block(ob_get_contents(), STANDARD_BLOCK);
     ob_end_clean();
     $actionRows->add($layout, null, null, CENTER, CENTER);
     $type = HarmoniType::fromString(urldecode(RequestContext::value('type')));
     $repositoryManager = Services::getService("Repository");
     // Get the Repositories
     $allRepositories = $repositoryManager->getRepositoriesByType($type);
     // put the repositories into an array and order them.
     // @todo, do authorization checking
     $repositoryArray = array();
     while ($allRepositories->hasNext()) {
         $repository = $allRepositories->next();
         $repositoryArray[$repository->getDisplayName()] = $repository;
     }
     ksort($repositoryArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($repositoryArray, 2, 20, "printrepositoryShort", $harmoni);
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout();
     $actionRows->add($resultLayout, null, null, CENTER, CENTER);
 }
コード例 #15
0
/**
 * UTF8::from_unicode
 *
 * @package    JsonApiApplication
 * @author     JsonApiApplication Team
 * @copyright  (c) 2007-2012 JsonApiApplication Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _from_unicode($arr)
{
    ob_start();
    $keys = array_keys($arr);
    foreach ($keys as $k) {
        // ASCII range (including control chars)
        if ($arr[$k] >= 0 and $arr[$k] <= 0x7f) {
            echo chr($arr[$k]);
        } elseif ($arr[$k] <= 0x7ff) {
            echo chr(0xc0 | $arr[$k] >> 6);
            echo chr(0x80 | $arr[$k] & 0x3f);
        } elseif ($arr[$k] == 0xfeff) {
            // nop -- zap the BOM
        } elseif ($arr[$k] >= 0xd800 and $arr[$k] <= 0xdfff) {
            // Found a surrogate
            throw new UTF8_Exception("UTF8::from_unicode: Illegal surrogate at index: ':index', value: ':value'", array(':index' => $k, ':value' => $arr[$k]));
        } elseif ($arr[$k] <= 0xffff) {
            echo chr(0xe0 | $arr[$k] >> 12);
            echo chr(0x80 | $arr[$k] >> 6 & 0x3f);
            echo chr(0x80 | $arr[$k] & 0x3f);
        } elseif ($arr[$k] <= 0x10ffff) {
            echo chr(0xf0 | $arr[$k] >> 18);
            echo chr(0x80 | $arr[$k] >> 12 & 0x3f);
            echo chr(0x80 | $arr[$k] >> 6 & 0x3f);
            echo chr(0x80 | $arr[$k] & 0x3f);
        } else {
            throw new UTF8_Exception("UTF8::from_unicode: Codepoint out of Unicode range at index: ':index', value: ':value'", array(':index' => $k, ':value' => $arr[$k]));
        }
    }
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
コード例 #16
0
ファイル: Debug.php プロジェクト: markusju/itechintranet
 public static function dumpVarsToFileAndDie($vars)
 {
     ob_start();
     var_dump($vars);
     file_put_contents('/tmp/log.txt', file_get_contents('/tmp/log.txt') . "\n" . ob_get_contents());
     ob_end_clean();
 }
コード例 #17
0
 function filesystem_init($form_url, $method = '', $context = false, $fields = null)
 {
     global $wp_filesystem;
     if (!empty($this->creds)) {
         return true;
     }
     ob_start();
     /* dESiGNERz-CREW.iNFO for PRO users - first attempt to get credentials */
     if (false === ($this->creds = request_filesystem_credentials($form_url, $method, false, $context))) {
         $this->creds = array();
         $this->parent->ftp_form = ob_get_contents();
         ob_end_clean();
         /**
          * if we comes here - we don't have credentials
          * so the request for them is displaying
          * no need for further processing
          **/
         return false;
     }
     /* dESiGNERz-CREW.iNFO for PRO users - now we got some credentials - try to use them*/
     if (!WP_Filesystem($this->creds)) {
         $this->creds = array();
         /* dESiGNERz-CREW.iNFO for PRO users - incorrect connection data - ask for credentials again, now with error message */
         request_filesystem_credentials($form_url, '', true, $context);
         $this->parent->ftp_form = ob_get_contents();
         ob_end_clean();
         return false;
     }
     return true;
 }
コード例 #18
0
ファイル: Simple.php プロジェクト: Dulciane/jaws
 /**
  * Displays the captcha image
  *
  * @access  public
  * @param   int     $key    Captcha key
  * @return  mixed   Captcha raw image data
  */
 function image($key)
 {
     $value = Jaws_Utils::RandomText();
     $result = $this->update($key, $value);
     if (Jaws_Error::IsError($result)) {
         $value = '';
     }
     $bg = dirname(__FILE__) . '/resources/simple.bg.png';
     $im = imagecreatefrompng($bg);
     imagecolortransparent($im, imagecolorallocate($im, 255, 255, 255));
     // Write it in a random position..
     $darkgray = imagecolorallocate($im, 0x10, 0x70, 0x70);
     $x = 5;
     $y = 20;
     $text_length = strlen($value);
     for ($i = 0; $i < $text_length; $i++) {
         $fnt = rand(7, 10);
         $y = rand(6, 10);
         imagestring($im, $fnt, $x, $y, $value[$i], $darkgray);
         $x = $x + rand(15, 25);
     }
     header("Content-Type: image/png");
     ob_start();
     imagepng($im);
     $content = ob_get_contents();
     ob_end_clean();
     imagedestroy($im);
     return $content;
 }
コード例 #19
0
ファイル: connect.lib.php プロジェクト: davis00/test
function connect($skin_dir = 'basic')
{
    global $config, $g5;
    // 회원, 방문객 카운트
    $sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']}  where mb_id <> '{$config['cf_admin']}' ";
    $row = sql_fetch($sql);
    if (preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
        if (G5_IS_MOBILE) {
            $connect_skin_path = G5_THEME_MOBILE_PATH . '/' . G5_SKIN_DIR . '/connect/' . $match[1];
            if (!is_dir($connect_skin_path)) {
                $connect_skin_path = G5_THEME_PATH . '/' . G5_SKIN_DIR . '/connect/' . $match[1];
            }
            $connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
        } else {
            $connect_skin_path = G5_THEME_PATH . '/' . G5_SKIN_DIR . '/connect/' . $match[1];
            $connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
        }
        $skin_dir = $match[1];
    } else {
        if (G5_IS_MOBILE) {
            $connect_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/connect/' . $skin_dir;
            $connect_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/connect/' . $skin_dir;
        } else {
            $connect_skin_path = G5_SKIN_PATH . '/connect/' . $skin_dir;
            $connect_skin_url = G5_SKIN_URL . '/connect/' . $skin_dir;
        }
    }
    ob_start();
    include_once $connect_skin_path . '/connect.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
コード例 #20
0
ファイル: seccode.php プロジェクト: dotku/shopnc_cnnewyork
 function background()
 {
     $this->im = imagecreatetruecolor($this->width, $this->height);
     $backgrounds = $c = array();
     if (!$this->background || !$backgrounds) {
         for ($i = 0; $i < 3; $i++) {
             $start[$i] = mt_rand(200, 255);
             $end[$i] = mt_rand(100, 150);
             $step[$i] = ($end[$i] - $start[$i]) / $this->width;
             $c[$i] = $start[$i];
         }
         for ($i = 0; $i < $this->width; $i++) {
             $color = imagecolorallocate($this->im, $c[0], $c[1], $c[2]);
             imageline($this->im, $i, 0, $i, $this->height, $color);
             $c[0] += $step[0];
             $c[1] += $step[1];
             $c[2] += $step[2];
         }
         $c[0] -= 20;
         $c[1] -= 20;
         $c[2] -= 20;
     }
     ob_start();
     if (function_exists('imagepng')) {
         imagepng($this->im);
     } else {
         imagejpeg($this->im, '', 100);
     }
     imagedestroy($this->im);
     $bgcontent = ob_get_contents();
     ob_end_clean();
     $this->fontcolor = $c;
     return $bgcontent;
 }
コード例 #21
0
ファイル: PCRendererEmail.php プロジェクト: Natio/WebSherpa
 /**
  * 
  * @return string
  */
 public function render() {
     ob_start();
     require $this->file_path;
     $contents = ob_get_contents();
     ob_end_clean();
     return $contents;
 }   
コード例 #22
0
ファイル: vmpdf.php プロジェクト: cybershocik/Darek
 /** Function to create a nice vendor-styled PDF for the output of the given view.
     The $path and $dest arguments are directly passed on to TCPDF::Output. 
     To create a PDF directly from a given HTML (i.e. not through a view), one
     can directly use the VmVendorPDF class, see VirtueMartControllerInvoice::samplePDF */
 static function createVmPdf($view, $path = '', $dest = 'F', $meta = array())
 {
     if (!$view) {
         // TODO: use some default view???
         return;
     }
     if (!class_exists('VmVendorPDF')) {
         vmError('vmPdf: For the pdf, you must install the tcpdf library at ' . VMPATH_LIBS . DS . 'tcpdf');
         return 0;
     }
     $pdf = new VmVendorPDF();
     if (isset($meta['title'])) {
         $pdf->SetTitle($meta['title']);
     }
     if (isset($meta['subject'])) {
         $pdf->SetSubject($meta['subject']);
     }
     if (isset($meta['keywords'])) {
         $pdf->SetKeywords($meta['keywords']);
     }
     // Make the formatter available, just in case some specialized view wants/needs it
     $view->pdf_formatter = $pdf;
     $view->isPdf = true;
     $view->print = false;
     ob_start();
     $view->display();
     $html = ob_get_contents();
     ob_end_clean();
     $pdf->AddPage();
     $pdf->PrintContents($html);
     // Close and output PDF document
     // This method has several options, check the source code documentation for more information.
     $pdf->Output($path, $dest);
     return $path;
 }
コード例 #23
0
 /**
  * @param \PHPUnit_Framework_TestResult $result
  */
 public function printResult(\PHPUnit_Framework_TestResult $result)
 {
     if ($this->runner->shouldNotify()) {
         ob_start();
     }
     $testDox = trim(TestDox::get(spl_object_hash($result)));
     if (strlen($testDox)) {
         $this->write(PHP_EOL . PHP_EOL . $testDox);
     }
     parent::printResult($result);
     if ($this->runner->shouldNotify()) {
         $output = ob_get_contents();
         ob_end_clean();
         echo $output;
         if ($result->failureCount() + $result->errorCount() + $result->skippedCount() + $result->notImplementedCount() == 0) {
             $notificationResult = Notification::RESULT_PASSED;
         } else {
             $notificationResult = Notification::RESULT_FAILED;
         }
         $output = $this->removeAnsiEscapeCodesForColors($output);
         if (preg_match('/(OK \\(\\d+ tests?, \\d+ assertions?\\))/', $output, $matches)) {
             $notificationMessage = $matches[1];
         } elseif (preg_match('/(FAILURES!)\\s+(.*)/', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/(OK, but incomplete,.*!)\\s+(.*)/', $output, $matches)) {
             $notificationMessage = $matches[1] . PHP_EOL . $matches[2];
         } elseif (preg_match('/(No tests executed!)/', $output, $matches)) {
             $notificationMessage = $matches[1];
         } else {
             $notificationMessage = '';
         }
         $this->notification = new Notification($notificationResult, $notificationMessage);
     }
 }
コード例 #24
0
ファイル: renderer.php プロジェクト: bizanto/Hooked
 public function render($layout, $args = array())
 {
     // prevent render to recurse indefinitely
     static $count = 0;
     $count++;
     if ($count < self::MAX_RENDER_RECURSIONS) {
         // init vars
         $parts = explode($this->_separator, $layout);
         $this->_layout = preg_replace('/[^A-Z0-9_\\.-]/i', '', array_pop($parts));
         // render layout
         if ($__layout = JPath::find($this->_getPath(implode(DIRECTORY_SEPARATOR, $parts)), $this->_layout . $this->_extension)) {
             // import vars and layout output
             extract($args);
             ob_start();
             include $__layout;
             $output = ob_get_contents();
             ob_end_clean();
             $count--;
             return $output;
         }
         $count--;
         // raise warning, if layout was not found
         JError::raiseWarning(0, 'Renderer Layout "' . $layout . '" not found. (' . YUtility::debugInfo(debug_backtrace()) . ')');
         return null;
     }
     // raise warning, if render recurses indefinitly
     JError::raiseWarning(0, 'Warning! Render recursed indefinitly. (' . YUtility::debugInfo(debug_backtrace()) . ')');
     return null;
 }
コード例 #25
0
ファイル: CallController.php プロジェクト: hubs/yuncms
 private function _format($id, $data, $type)
 {
     switch ($type) {
         case '1':
             // json
             if (CHARSET == 'gbk') {
                 $data = array_iconv($data, 'gbk', 'utf-8');
             }
             return json_encode($data);
             break;
         case '2':
             // xml
             $xml = Loader::lib('Xml');
             return $xml->xml_serialize($data);
             break;
         case '3':
             // js
             Loader::func('dbsource:global');
             ob_start();
             include template_url($id);
             $html = ob_get_contents();
             ob_clean();
             return format_js($html);
             break;
     }
 }
コード例 #26
0
 /**
  * Replace the default WordPress [gallery] shortcode with a slideshow
  *
  * @param array  $attrs
  * @param string $content
  */
 public function process_shortcode($params = array(), $content = null)
 {
     // Extract parameters and provide defaults for the missing ones
     extract(shortcode_atts(array('ids' => null, 'transition' => $this->plugin->get_option(BXSG_Settings::$OPTION_DEFAULT_TRANSITION), 'exclude_featured' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_EXCLUDE_FEATURED_IMAGE), 'hide_carousel' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_HIDE_CAROUSEL), 'adaptive_height' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_ADAPTIVE_HEIGHT), 'auto_start' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_AUTO_START), 'speed' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_SPEED), 'duration' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_DURATION), 'extra_options' => $this->plugin->get_option(BXSG_Settings::$OPTION_GS_EXTRA_OPTIONS), 'shuffle' => 0, 'size' => 'full', 'thumb_size' => 'thumbnail'), $params));
     // If no ids are provided, we will take every image attached to the current post.
     // Else, we'll simply fetch them from the DB
     $ids = $ids ? explode(',', $ids) : array();
     $attachments = $this->get_attached_medias($ids, $exclude_featured);
     if ($shuffle == 1) {
         shuffle($attachments);
     }
     // Compute an ID for this particular gallery
     $gallery_id = 'bx-gallery-' . $this->current_gallery_id;
     $this->current_gallery_id += 1;
     // Build the HTML output
     ob_start();
     include BXSG_INCLUDES_DIR . '/gallery-shortcode.view.php';
     $out = ob_get_contents();
     ob_end_clean();
     // We enqueue the script for inclusion in the WordPress footer
     ob_start();
     include BXSG_INCLUDES_DIR . '/gallery-shortcode.script.php';
     $this->scripts[] = ob_get_contents();
     ob_end_clean();
     return $out;
 }
コード例 #27
0
 /**
  * Renders the page by injecting controller data inside a view template
  */
 public function render()
 {
     $viewFile = 'views/' . $this->name . '.php';
     if (!file_exists($viewFile)) {
         throw new Exception("view file [{$viewFile}] is missing");
     }
     // inject data and render template
     $this->buildPageData();
     extract($this->data);
     ob_start();
     if ((bool) ini_get('short_open_tag') === true) {
         include $viewFile;
     } else {
         $templateCode = file_get_contents($viewFile);
         $this->convertShortTags($templateCode);
         // Evaluating PHP mixed with HTML requires closing the PHP markup opened by eval()
         $templateCode = '?>' . $templateCode;
         echo eval($templateCode);
     }
     // get ouput
     $out = ob_get_contents();
     // get rid of buffer
     @ob_end_clean();
     return $out;
 }
コード例 #28
0
 /**
  * Execute barebones JSON middleware request
  */
 protected static function executeRequest(Request $request)
 {
     if (testAdapter == 'HTTP') {
         $uri = str_replace('http://localhost', testHttpUri, $request->getUri());
         $response = static::$adapter->send($request, $uri);
         self::$mem = 0;
     } else {
         self::$mem = memory_get_peak_usage();
         $response = self::$app->handle($request);
         self::$mem = memory_get_peak_usage() - self::$mem;
     }
     if (self::$debug) {
         echo "\nRequest: " . ($method = $request->getMethod()) . ' ' . $request->getUri() . "\n";
         if ($method == 'POST') {
             echo "Content: " . $request->getContent() . "\n";
         }
     }
     // always provide normal Response to test cases
     if ($response instanceof StreamedResponse) {
         ob_start();
         $response->sendContent();
         $content = ob_get_contents();
         ob_end_clean();
         $response = Response::create($content, $response->getStatusCode(), $response->headers->all());
     }
     if (self::$debug) {
         echo "\nResponse: " . $response . "\n";
     }
     return $response;
 }
コード例 #29
0
ファイル: Output.php プロジェクト: ballistiq/revive-adserver
 /**
  * Stop the cache
  *
  * @access public
  */
 function end()
 {
     $data = ob_get_contents();
     ob_end_clean();
     $this->save($data, $this->_id, $this->_group);
     echo $data;
 }
コード例 #30
0
 /**
  * Parse the template file and return it as string
  *
  * @return string The template markup
  */
 public function inherit()
 {
     $strBuffer = '';
     // Start with the template itself
     $this->strParent = $this->strTemplate;
     // Include the parent templates
     while ($this->strParent !== null) {
         $strCurrent = $this->strParent;
         $strParent = $this->strDefault ?: $this->getTemplatePath($this->strParent, $this->strFormat);
         // Reset the flags
         $this->strParent = null;
         $this->strDefault = null;
         ob_start();
         include $strParent;
         // Capture the output of the root template
         if ($this->strParent === null) {
             $strBuffer = ob_get_contents();
         } elseif ($this->strParent == $strCurrent) {
             $this->strDefault = $this->getTemplatePath($this->strParent, $this->strFormat, true);
         }
         ob_end_clean();
     }
     // Reset the internal arrays
     $this->arrBlocks = array();
     // Add start and end markers in debug mode
     if (\Config::get('debugMode')) {
         $strRelPath = str_replace(TL_ROOT . '/', '', $this->getTemplatePath($this->strTemplate, $this->strFormat));
         $strBuffer = "\n<!-- TEMPLATE START: {$strRelPath} -->\n{$strBuffer}\n<!-- TEMPLATE END: {$strRelPath} -->\n";
     }
     return $strBuffer;
 }