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


PHP extract函数代码示例

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


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

示例1: partial

 public function partial($partial, $__time = false, $params = null, $group = 'kumbia.partials')
 {
     //        if (PRODUCTION && $__time && !Cache::driver()->start($__time, $partial, $group)) {
     //            return;
     //        }
     //Verificando el partials en el dir app
     $__file = $this->viewPath . "/_shared/partials/{$partial}.phtml";
     //        if (!is_file($__file)) {
     //            //Verificando el partials en el dir core
     //            $__file = CORE_PATH . "views/partials/$partial.phtml";
     //        }
     if ($params) {
         if (is_string($params)) {
             $params = Util::getParams(explode(',', $params));
         }
         // carga los parametros en el scope
         extract($params, EXTR_OVERWRITE);
     }
     // carga la vista parcial
     if (!(include $__file)) {
         throw new \Exception('Vista Parcial "' . $__file . '" no se encontro');
     }
     // se guarda en la cache de ser requerido
     //        if (PRODUCTION && $__time) {
     //            Cache::driver()->end();
     //        }
 }
开发者ID:Ashrey,项目名称:kumbia_pimple,代码行数:27,代码来源:View.php

示例2: render

 function render($atts)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     extract(shortcode_atts(array('limit' => 3, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'tag_slug' => '', 'header_color' => ''), $atts));
     $buffy = '';
     //output buffer
     $td_unique_id = td_global::td_generate_unique_id();
     $td_query =& td_data_source::get_wp_query($atts);
     //by ref  do the query
     //get the js for this block
     $buffy .= $this->get_block_js($atts, $td_query);
     $buffy .= '<div class="td_block_wrap td_block7">';
     //get the block title
     $buffy .= $this->get_block_title($atts);
     //get the sub category filter for this block
     $buffy .= $this->get_block_sub_cats($atts, $td_unique_id);
     $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
     //inner content of the block
     $buffy .= $this->inner($td_query->posts);
     $buffy .= '</div>';
     //get the ajax pagination for this block
     $buffy .= $this->get_block_pagination($atts, $td_unique_id);
     $buffy .= '</div> <!-- ./block1 -->';
     return $buffy;
 }
开发者ID:Vatia13,项目名称:wordpress,代码行数:26,代码来源:td_block_7.php

示例3: cp

 /**
  * s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     $paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation.";
     $paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases.";
     $paypal["s2member_log"][] = var_export($_REQUEST, true);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     if ($custom_success_redirection) {
         $paypal["s2member_log"][] = "Redirecting Customer to a custom URL: " . $custom_success_redirection . ".";
         wp_redirect($custom_success_redirection);
     } else {
         $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
         echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || c_ws_plugin__s2member_utils_conds::pro_is_installed() && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]) ? '<br /><br />' . _x('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars());
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:39,代码来源:paypal-return-in-no-tx-data.inc.php

示例4: smarty_function_link_list

function smarty_function_link_list($params, &$smarty1)
{
    global $smarty;
    global $db;
    global $cfg;
    $tbl_link = $cfg['tbl_link'];
    if (empty($params['template'])) {
        $template = "link_list.html";
    }
    if (empty($params['count'])) {
        $count = 5;
    }
    if (empty($params['catalog_id'])) {
        print "function article_detail required catalog_id";
        return;
    }
    extract($params);
    if ($smarty->is_cached($template, $catalog_id)) {
        $smarty->display($template, $catalog_id);
        return;
    }
    $sql = "select name , url , descri ,logo ,sort_order from {$tbl_link} where catalog = {$catalog_id} order by sort_order desc limit {$count}";
    $rs = $db->Execute($sql);
    $links = array();
    while ($arr = $rs->FetchRow()) {
        array_push($links, $arr);
    }
    $rs->close();
    $smarty->assign("links", $links);
    $smarty->display($template, $catalog_id);
}
开发者ID:BGCX261,项目名称:zhishuicms-svn-to-git,代码行数:31,代码来源:function.link_list.php

示例5: render

 public function render()
 {
     extract($this->pageVars);
     ob_start();
     require $this->template;
     echo ob_get_clean();
 }
开发者ID:rogerioalbino,项目名称:mvc,代码行数:7,代码来源:AbstractView.php

示例6: get_absolute_link

/**
 * Retourne le lien absolu
 */
function get_absolute_link($relative_link, $url)
{
    /* return if already absolute URL */
    if (parse_url($relative_link, PHP_URL_SCHEME) != '') {
        return $relative_link;
    }
    /* queries and anchors */
    if ($relative_link[0] == '#' || $relative_link[0] == '?') {
        return $url . $relative_link;
    }
    /* parse base URL and convert to local variables:
       $scheme, $host, $path */
    extract(parse_url($url));
    /* remove non-directory element from path */
    $path = preg_replace('#/[^/]*$#', '', $path);
    /* destroy path if relative url points to root */
    if ($relative_link[0] == '/') {
        $path = '';
    }
    /* dirty absolute URL */
    $abs = $host . $path . '/' . $relative_link;
    /* replace '//' or '/./' or '/foo/../' with '/' */
    $re = array('#(/\\.?/)#', '#/(?!\\.\\.)[^/]+/\\.\\./#');
    for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) {
    }
    /* absolute URL is ready! */
    return $scheme . '://' . $abs;
}
开发者ID:akoenig,项目名称:wallabag,代码行数:31,代码来源:pochePictures.php

示例7: set

 public function set($var, $value = null)
 {
     // parse variable name
     extract($this->_parse($var));
     if (!empty($name)) {
         // set default hash to method
         if ($hash == 'default') {
             $hash = 'method';
         }
         // set a array value ?
         if (strpos($name, '.') !== false) {
             $parts = explode('.', $name);
             $name = array_shift($parts);
             $array =& $this->_call(array($this->_class, 'getVar'), array($name, array(), $hash, 'array'));
             $val =& $array;
             foreach ($parts as $i => $part) {
                 if (!isset($array[$part])) {
                     $array[$part] = array();
                 }
                 if (isset($parts[$i + 1])) {
                     $array =& $array[$part];
                 } else {
                     $array[$part] = $value;
                 }
             }
             $value = $val;
         }
         $this->_call(array($this->_class, 'setVar'), array($name, $value, $hash));
     }
     return $this;
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:31,代码来源:request.php

示例8: 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

示例9: 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

示例10: formNote

 /**
  * Helper to show a "note" based on a hidden value.
  *
  * @access public
  *
  * @param string|array $name If a string, the element name.  If an
  * array, all other parameters are ignored, and the array elements
  * are extracted in place of added parameters.
  *
  * @param array $value The note to display.  HTML is *not* escaped; the
  * note is displayed as-is.
  *
  * @return string The element XHTML.
  */
 public function formNote($name, $value = null)
 {
     $info = $this->_getInfo($name, $value);
     extract($info);
     // name, value, attribs, options, listsep, disable
     return $value;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:21,代码来源:FormNote.php

示例11: widget

 /**
  * Outputs the HTML for this widget.
  *
  * @param array  An array of standard parameters for widgets in this theme 
  * @param array  An array of settings for this widget instance 
  * @return void Echoes it's output
  **/
 public function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $count = esc_attr($instance['count']);
     $count = 0 < $count && $count < 10 ? $count : 2;
     $loop = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $count, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_event_start', 'meta_query' => array(array('key' => '_event_end', 'value' => time(), 'compare' => '>'))));
     if ($loop->have_posts()) {
         echo $before_widget;
         if ($instance['title']) {
             echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
         }
         echo '<ul>';
         while ($loop->have_posts()) {
             $loop->the_post();
             global $post;
             $output = '<span class="meta">' . date(get_option('date_format'), get_post_meta(get_the_ID(), '_event_start', true)) . '</span> <a href="' . get_permalink() . '">' . get_the_title() . '</a>';
             $read_more = apply_filters('em4wp_events_manager_upcoming_widget_output', $output, $post);
             if ($read_more) {
                 echo '<li>' . $read_more . '</li>';
             }
         }
         if ($instance['more_text']) {
             echo '<li><a href="' . get_post_type_archive_link('event') . '">' . esc_attr($instance['more_text']) . '</a></li>';
         }
         echo '</ul>';
         echo $after_widget;
     }
     wp_reset_postdata();
 }
开发者ID:forsitemedia,项目名称:events-manager-for-wp,代码行数:36,代码来源:class-em4wp-upcoming-events.php

示例12: content

 protected function content($atts, $content = null)
 {
     $title = $address = $size = $zoom = $pin_image = $type = $el_position = $width = $el_class = '';
     extract(shortcode_atts(array('title' => '', 'full_width' => '', 'address' => '', 'size' => 200, 'zoom' => 14, 'pin_image' => '', 'type' => 'm', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     $output = '';
     if ($address == '') {
         return null;
     }
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $size = str_replace(array('px', ' '), array('', ''), $size);
     $map_coords = map_embed($address);
     $img_url = wp_get_attachment_image_src($pin_image, 'full');
     if ($full_width == "yes") {
         $output .= "\n\t" . '<div class="wpb_gmaps_widget full-width wpb_content_element ' . $width . $el_class . '">';
     } else {
         $output .= "\n\t" . '<div class="wpb_gmaps_widget wpb_content_element ' . $width . $el_class . '">';
     }
     $output .= "\n\t\t" . '<div class="wpb_wrapper">';
     $output .= $title != '' ? "\n\t\t\t" . '<h3 class="wpb_heading wpb_video_heading">' . $title . '</h3>' : '';
     $output .= '<div class="wpb_map_wraper"><div class="map-canvas" style="width:100%;height:' . $size . 'px;" data-address="' . $address . '" data-lat="' . $map_coords['lat'] . '" data-long="' . $map_coords['long'] . '" data-zoom="' . $zoom . '" data-maptype="' . $type . '" data-pinimage="' . $img_url[0] . '"></div></div>';
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_maps;
     $include_maps = true;
     return $output;
 }
开发者ID:rabisahar,项目名称:Spring,代码行数:28,代码来源:media.php

示例13: run

 public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     if ('think' == $engine) {
         // 采用Think模板引擎
         if ($this->checkCache($_data['file'])) {
             // 缓存有效
             // 分解变量并载入模板缓存
             extract($_data['var'], EXTR_OVERWRITE);
             //载入模版缓存文件
             include C('CACHE_PATH') . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX');
         } else {
             $tpl = Think::instance('ThinkTemplate');
             // 编译并加载模板文件
             $tpl->fetch($_data['file'], $_data['var']);
         }
     } else {
         // 调用第三方模板引擎解析和输出
         $class = 'Template' . ucwords($engine);
         if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
             // 内置驱动
             $path = CORE_PATH;
         } else {
             // 扩展驱动
             $path = EXTEND_PATH;
         }
         if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
             $tpl = new $class();
             $tpl->fetch($_data['file'], $_data['var']);
         } else {
             // 类没有定义
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
 }
开发者ID:yunsite,项目名称:e-tuan001-com,代码行数:35,代码来源:ParseTemplateBehavior.class.php

示例14: sp_carousel_item_addon

function sp_carousel_item_addon($atts)
{
    extract(spAddonAtts(array("title" => '', "bg" => '', 'content' => '', "button_text" => '', "button_url" => '', "button_size" => '', "button_type" => '', "button_icon" => ''), $atts));
    if ($button_icon) {
        $button_text = '<i class="fa ' . $button_icon . '"></i> ' . $button_text;
    }
    $has_bg = '';
    if ($bg) {
        $has_bg = ' sppb-item-has-bg';
    }
    $output = '<div class="sppb-item' . $has_bg . '">';
    if ($bg) {
        $output .= '<img src="' . $bg . '" alt="' . $title . '">';
    }
    $output .= '<div class="sppb-carousel-item-inner">';
    $output .= '<div class="sppb-carousel-caption">';
    $output .= '<div class="sppb-carousel-pro-text">';
    if ($title || $content) {
        if ($title != '') {
            $output .= '<h2>' . $title . '</h2>';
        }
        $output .= '<p>' . $content . '</p>';
        if ($button_text && $button_url) {
            $output .= '<a href="' . $button_url . '" class="sppb-btn sppb-btn-' . $button_type . ' sppb-btn-' . $button_size . '" role="button">' . $button_text . '</a>';
        }
    }
    $output .= '</div>';
    $output .= '</div>';
    $output .= '</div>';
    $output .= '</div>';
    return $output;
}
开发者ID:naka211,项目名称:myloyal,代码行数:32,代码来源:site.php

示例15: getCalendarWidget

 public function getCalendarWidget()
 {
     $instance = array('order' => '12', 'name' => 'Events', 'size' => 'span8', 'title' => 'Events', 'parent' => '0', 'number' => '16', 'first' => true, 'resizable' => 1, 'see_all' => 'See All', 'itemno' => '7', 'template_id' => '16', 'block_id' => 'aq_block_16');
     extract($instance);
     global $icy_options;
     require_once __DIR__ . "/../views/frontend/calendar-widget.php";
 }
开发者ID:javierdlahoz,项目名称:dcbia-wp,代码行数:7,代码来源:EventController.php


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