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


PHP Warp类代码示例

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


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

示例1: getInstance

	public static function getInstance() {      

        if (!isset(self::$_instance)) {

            // init vars
            $path = dirname(__FILE__);
            self::$_instance = new Warp();

            // add default helper
            self::$_instance->addHelper(new PathWarpHelper());

            // set default paths
            self::$_instance['path']->register($path, 'warp');
            self::$_instance['path']->register($path.'/classes', 'classes');
            self::$_instance['path']->register($path.'/helpers', 'helpers');
            self::$_instance['path']->register($path.'/libraries', 'lib');
            self::$_instance['path']->register($path.'/css', 'css');
            self::$_instance['path']->register($path.'/js', 'js');
            self::$_instance['path']->register($path.'/layouts', 'layouts');
            self::$_instance['path']->register($path.'/menus', 'menu');
            self::$_instance['path']->register(dirname($path), 'template');
        }

        return self::$_instance;
    }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:warp.php

示例2: __construct

	public function __construct() {

		// set default name
		$this->warp = Warp::getInstance();
		$this->name = strtolower(basename(get_class($this), 'WarpHelper'));

	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:helper.php

示例3: Warp

 function &getInstance()
 {
     static $instance;
     if (!isset($instance)) {
         $instance = new Warp();
         $path = dirname(__FILE__);
         // add default helper
         $instance->addHelper(new WarpHelperPath());
         // set default paths
         $instance->path->register($path, 'warp');
         $instance->path->register($path . '/helpers', 'helpers');
         $instance->path->register($path . '/libraries', 'lib');
         $instance->path->register($path . '/css', 'css');
         $instance->path->register($path . '/js', 'js');
         $instance->path->register($path . '/layouts', 'layouts');
         $instance->path->register($path . '/menus', 'menu');
         $instance->path->register(dirname($path), 'template');
         $instance->loadHelper(array('legacy', 'template', 'menu'));
     }
     return $instance;
 }
开发者ID:smart-one,项目名称:3kita,代码行数:21,代码来源:warp.php

示例4: fetchElement

    function fetchElement($name, $value, &$node, $control_name)
    {
        // load config
        require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/config.php';
        // get warp and helpers
        $warp =& Warp::getInstance();
        $path =& $warp->getHelper('path');
        $check =& $warp->getHelper('checksum');
        // verify theme files
        $content = array();
        if (($checksums = $path->path('template:checksums')) && filesize($checksums)) {
            $check->verify($path->path('template:'), $log);
            if (count($log)) {
                $content[] = 'Some template files have been modified. <a href="#" class="verify-link">Click to show files.</a>';
                $content[] = '<ul class="verify">';
                foreach (array('modified', 'missing') as $type) {
                    if (isset($log[$type])) {
                        foreach ($log[$type] as $file) {
                            $content[] = '<li class="' . $type . '">' . $file . ($type == 'missing' ? ' (missing)' : null) . '</li>';
                        }
                    }
                }
                $content[] = '</ul>';
            } else {
                $content[] = 'Verification successful, no file modifications detected.';
            }
        } else {
            $content[] = 'Checksum file is missing! Your template is maybe compromised.';
        }
        ob_start();
        ?>
			
		<script type="text/javascript">
		
			window.addEvent('domready', function(){
				var ul = document.getElement("ul.verify");

				if (ul) {
					ul.setStyle('display', 'none');
				   	document.getElement("a.verify-link").addEvent("click", function(event){
						var event = new Event(event).stop();
						ul.setStyle('display', ul.getStyle('display') == 'none' ? 'block' : 'none');
					});
				}
			});
      
		</script>
		
		<?php 
        return implode("\n", $content) . ob_get_clean();
    }
开发者ID:navinpai,项目名称:GEC-Technix,代码行数:51,代码来源:verify.php

示例5: widget

 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     $title = $instance['title'];
     $warp = Warp::getInstance();
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $output = $warp['template']->get('sidebar.output', "");
     echo $output;
     echo $after_widget;
 }
开发者ID:navetisyan,项目名称:asatryans,代码行数:14,代码来源:sidebar.php

示例6: getInput

 protected function getInput()
 {
     // copy callback
     $this->copyAjaxCallback();
     // load config
     require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php';
     // get warp
     $warp = Warp::getInstance();
     $warp['system']->document->addScript($warp['path']->url('config:js/config.js'));
     $warp['system']->document->addScript($warp['path']->url('config:js/admin.js'));
     $warp['system']->document->addStyleSheet($warp['path']->url('config:css/config.css'));
     $warp['system']->document->addStyleSheet($warp['path']->url('config:css/admin.css'));
     // render config
     return $warp['template']->render('config:layouts/config');
 }
开发者ID:shamusdougan,项目名称:Fulham_Chelsea_Web,代码行数:15,代码来源:config.php

示例7: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     // copy callback
     $this->copyAjaxCallback();
     // load config
     require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php';
     // get warp
     $warp = Warp::getInstance();
     $warp['system']->document->addScript($warp['path']->url('lib:jquery/jquery.js'));
     $warp['system']->document->addScript($warp['path']->url('config:js/config.js'));
     $warp['system']->document->addScript($warp['path']->url('config:js/admin.js'));
     $warp['system']->document->addStyleSheet($warp['path']->url('config:css/config.css'));
     $warp['system']->document->addStyleSheet($warp['path']->url('config:css/admin.css'));
     // render config
     return $warp['template']->render('config:layouts/config');
 }
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:16,代码来源:config.php

示例8: defined

<?php

/**
* @package   yoo_shelf Template
* @file      error.php
* @version   1.0.0 August 2011
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH
* @license   YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// include config
include_once dirname(__FILE__) . '/config.php';
// get warp
$warp = Warp::getInstance();
// set messages
$title = $this->title;
$error = $this->error->code;
$message = $this->error->message;
// set 404 messages
if ($error == '404') {
    $title = JText::_('404 PAGE TITLE');
    $message = JText::sprintf('404 PAGE MESSAGE', $warp['system']->url, $warp['config']->get('site_name'));
}
// render error layout
echo $warp['template']->render('error', compact('title', 'error', 'message'));
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:27,代码来源:error.php

示例9: getInput

    protected function getInput()
    {
        // load config
        require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/config.php';
        // get warp
        $warp = Warp::getInstance();
        // get presets
        $presets = $warp->config->get('_presets', array());
        ob_start();
        ?>
		
			<select id="selectPreset" style="width:200px;">
				<option value="-1">Please choose a preset...</option>
				<?php 
        foreach ($presets as $key => $preset) {
            ?>
					<option value="<?php 
            echo $key;
            ?>
"><?php 
            echo $preset['name'];
            ?>
</option>
				<?php 
        }
        ?>
			</select>
			
			<script type="text/javascript">
			
				window.addEvent('domready', function(){
				   document.getElement("#selectPreset").addEvent("change", function(){
						
						var warp_presets = <?php 
        echo json_encode($presets);
        ?>
;
						var select 		 = this;
						
						if (select.value == -1) return;

						var preset = warp_presets[select.value];
						var elements = document.getElements(".panel [name^=jform]");
						
						for(var i=0;i<elements.length;i++){
							var node  = elements[i];
							var $name = node.name.replace("jform[params][",'').replace("]",'');

							if(preset.options[$name] || preset.options[$name]===0){
								if(node.type=='radio') {
									if(node.value==preset.options[$name]) node.setProperty('checked',true);
								} else {
									node.value = preset.options[$name];
								}
							}

						}

						//select.selectedIndex = 0;
					});
				});
       
			</script>
		
		<?php 
        return ob_get_clean();
    }
开发者ID:smart-one,项目名称:3kita,代码行数:67,代码来源:preset.php

示例10: render


//.........这里部分代码省略.........
     $scope = $mainframe->scope;
     //record the scope
     $mainframe->scope = $module->module;
     //set scope to Component name
     // Get module parameters
     $params = new JParameter($module->params);
     // Get module path
     $module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module);
     $path = JPATH_BASE . DS . 'modules' . DS . $module->module . DS . $module->module . '.php';
     // Load the module
     if (!$module->user && file_exists($path) && empty($module->content)) {
         $lang =& JFactory::getLanguage();
         $lang->load($module->module);
         $content = '';
         ob_start();
         require $path;
         $module->content = ob_get_contents() . $content;
         ob_end_clean();
     }
     // Load the module chrome functions
     if (!$chrome) {
         $chrome = array();
     }
     KLoader::load('lib.joomla.application.module.helper');
     $load =& JModuleHelper::_load();
     if (!$this->_modules) {
         $this->_modules_backup = $this->_modules = $load;
     }
     $this->_modules[] = $module;
     $load = $this->_modules;
     require_once JPATH_BASE . DS . 'templates' . DS . 'system' . DS . 'html' . DS . 'modules.php';
     $chromePath = JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'modules.php';
     if (!isset($chrome[$chromePath])) {
         if (file_exists($chromePath)) {
             require_once $chromePath;
         }
         $chrome[$chromePath] = true;
     }
     //make sure a style is set
     if (!isset($attribs['style'])) {
         $attribs['style'] = 'rounded';
     }
     //dynamically add outline style
     if (JRequest::getBool('tp')) {
         $attribs['style'] .= ' outline';
     }
     $tpl = KFactory::get('lib.joomla.application')->getTemplate();
     $yoofix = false;
     $warpfive = 'templates/' . $tpl . '/layouts/module.php';
     if (JFile::exists(JPATH_ROOT . '/' . $warpfive)) {
         $tpl_dir = JPATH_ROOT . "/templates/{$tpl}";
         //include warp
         require_once $tpl_dir . '/warp/warp.php';
         $warp = Warp::getInstance();
         $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/helpers', 'helpers');
         $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/layouts', 'layouts');
         $warp->getHelper('path')->register($tpl_dir . '/layouts', 'layouts');
         $template = KFactory::tmp($this->getTemplate())->addFilters(array('alias'));
         $template->getFilter('alias')->append(array('$this' => '$warp_helper_template'));
         $data = array('warp_helper_template' => $warp->getHelper("template"), '$warp' => $warp);
         $module->menu = false;
         $yoofix = true;
     }
     foreach (explode(' ', $attribs['style']) as $style) {
         $chromeMethod = 'modChrome_' . $style;
         //Warp 5.5 fix
         if ($yoofix) {
             $module->parameter = new JParameter($module->params);
             $data['module'] = $module;
             $data['params'] = array();
             //@TODO count this
             $count = 1;
             $index = 0;
             $data['params']['count'] = $count;
             $data['params']['order'] = $index + 1;
             $data['params']['first'] = $data['params']['order'] == 1;
             $data['params']['last'] = $data['params']['order'] == $count;
             $data['params']['suffix'] = $module->parameter->get('moduleclass_sfx', '');
             $data['params']['menu'] = false;
             // get class suffix params
             $parts = preg_split('/[\\s]+/', $data['params']['suffix']);
             foreach ($parts as $part) {
                 if (strpos($part, '-') !== false) {
                     $yoostyles = explode('-', $part, 2);
                     $data['params'][$yoostyles[0]] = $yoostyles[1];
                 }
             }
             $module->content = $template->loadPath($warpfive, $data)->render(true);
         } elseif (function_exists($chromeMethod)) {
             $module->style = $attribs['style'];
             ob_start();
             $chromeMethod($module, $params, $attribs);
             $module->content = ob_get_contents();
             ob_end_clean();
         }
     }
     $mainframe->scope = $scope;
     //revert the scope
     return $module->content;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:101,代码来源:html.php

示例11: __construct

 function __construct()
 {
     // set default name
     $this->warp =& Warp::getInstance();
     $this->name = strtolower(substr(get_class($this), strlen(__CLASS__)));
 }
开发者ID:navinpai,项目名称:GEC-Technix,代码行数:6,代码来源:helper.php

示例12: start_el

 public function start_el(&$output, $item, $depth, $args)
 {
     // get warp
     $warp = Warp::getInstance();
     // init vars
     $data = array();
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $options = $warp['system']->getMenuItemOptions($item->ID);
     // set id
     $data['data-id'] = $item->ID;
     // is current item ?
     if (in_array('current-menu-item', $classes) || in_array('current_page_item', $classes)) {
         $data['data-menu-active'] = 2;
         // home/fronpage item
     } elseif ($item->url == 'index.php' && (is_home() || is_front_page())) {
         $data['data-menu-active'] = 2;
     }
     // has columns ?
     if (!empty($options['columns'])) {
         $data['data-menu-columns'] = (int) $options['columns'];
     }
     // has columnwidth ?
     if (!empty($options['columnwidth'])) {
         $data['data-menu-columnwidth'] = (int) $options['columnwidth'];
     }
     // has image ?
     if (!empty($options['image'])) {
         $upload = wp_upload_dir();
         $data['data-menu-image'] = trailingslashit($upload['baseurl']) . $options['image'];
     }
     // set item attributes
     $attributes = '';
     foreach ($data as $name => $value) {
         $attributes .= sprintf(' %s="%s"', $name, esc_attr($value));
     }
     // create item output
     $id = apply_filters('nav_menu_item_id', '', $item, $args);
     $output .= '<li' . (strlen($id) ? sprintf(' id="%s"', esc_attr($id)) : '') . $attributes . '>';
     // set link attributes
     $attributes = '';
     foreach (array('attr_title' => 'title', 'target' => 'target', 'xfn' => 'rel', 'url' => 'href') as $var => $attr) {
         if (!empty($item->{$var})) {
             $attributes .= sprintf(' %s="%s"', $attr, esc_attr($item->{$var}));
         }
     }
     // escape link title
     $item->title = htmlspecialchars($item->title, ENT_COMPAT, "UTF-8");
     // is separator ?
     if ($item->url == '#') {
         $format = '%s<span%s><span>%s</span></span>%s';
         $attributes = ' class="separator"';
     } else {
         $format = '%s<a%s><span>%s</span></a>%s';
     }
     // create link output
     $item_output = sprintf($format, $args->before, $attributes, $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after, $args->after);
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
开发者ID:navetisyan,项目名称:asatryans,代码行数:58,代码来源:system.php

示例13: mytheme_comment

        function mytheme_comment($comment, $args, $depth)
        {
            global $user_identity;
            $GLOBALS['comment'] = $comment;
            $warp = Warp::getInstance();
            $_GET['replytocom'] = get_comment_ID();
            ?>
					<li>
						<article id="comment-<?php 
            comment_ID();
            ?>
" class="comment <?php 
            echo $comment->user_id > 0 ? 'comment-byadmin' : '';
            ?>
">
					 
							<header class="comment-head">
							
								<?php 
            echo get_avatar($comment, $size = '50', get_bloginfo('template_url') . '/images/comments_avatar.png');
            ?>
								
								<h4 class="author"><?php 
            echo get_comment_author_link();
            ?>
</h4>
							
								<p class="meta">
									<time datetime="<?php 
            echo get_comment_date('Y-m-d');
            ?>
" pubdate><?php 
            printf(__('%1$s at %2$s', 'warp'), get_comment_date(), get_comment_time());
            ?>
</time>
									| <a class="permalink" href="<?php 
            echo htmlspecialchars(get_comment_link($comment->comment_ID));
            ?>
">#</a>
									<?php 
            edit_comment_link(__('Edit'), '| ', '');
            ?>
								</p>
							
							</header>
							
							<div class="comment-body">
							
								<div class="content"><?php 
            comment_text();
            ?>
</div>
								
								<?php 
            if (comments_open()) {
                ?>
								<p class="reply"><a href="#" rel="<?php 
                comment_ID();
                ?>
"><?php 
                echo __('Reply', 'warp');
                ?>
</a></p>
								<?php 
            }
            ?>
									
								<?php 
            if ($comment->comment_approved == '0') {
                ?>
								<p class="moderation"><?php 
                _e('Your comment is awaiting moderation.', 'warp');
                ?>
</p>
								<?php 
            }
            ?>
								
							</div>
							
						</article>
					<?php 
            unset($_GET['replytocom']);
            // </li> is rendered by system
        }
开发者ID:navetisyan,项目名称:asatryans,代码行数:85,代码来源:comments.php

示例14: _buildPath

 function _buildPath($matches, $base = null, $filepath = null)
 {
     static $_base;
     static $_filepath;
     if (isset($base)) {
         $_base = $base;
     }
     if (isset($filepath)) {
         $_filepath = $filepath;
     }
     // prefix with base and remove '../' segments where possible
     $path = $_base . $matches[1];
     $last = '';
     while ($path != $last) {
         $last = $path;
         $path = preg_replace('`(^|/)(?!\\.\\./)([^/]+)/\\.\\./`', '$1', $path);
     }
     // map image to file path
     if (preg_match('/\\.(gif|png|jpg)$/i', $matches[1])) {
         $warp =& Warp::getInstance();
         $warp->cache->images[sprintf('url(%s)', $path)] = realpath(rtrim($_filepath, '/') . '/' . $matches[1]);
     }
     return sprintf('url(%s)', $path);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:24,代码来源:cache.php

示例15: getInput

    protected function getInput()
    {
        // load config
        require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/config.php';
        // get warp and helpers
        $warp =& Warp::getInstance();
        $path =& $warp->getHelper('path');
        $check =& $warp->getHelper('checksum');
        // verify theme files
        $content = array('<div style="margin: 5px 0px;float: left;">');
        if (($checksums = $path->path('template:checksums')) && filesize($checksums)) {
            $check->verify($path->path('template:'), $log);
            if (count($log)) {
                $content[] = 'Some template files have been modified. <a href="#" class="verify-link">Click to show files.</a>';
                $content[] = '<ul class="verify">';
                foreach (array('modified', 'missing') as $type) {
                    if (isset($log[$type])) {
                        foreach ($log[$type] as $file) {
                            $content[] = '<li class="' . $type . '">' . $file . ($type == 'missing' ? ' (missing)' : null) . '</li>';
                        }
                    }
                }
                $content[] = '</ul>';
            } else {
                $content[] = 'Verification successful, no file modifications detected.';
            }
        } else {
            $content[] = 'Checksum file is missing! Your template is maybe compromised.';
        }
        $content[] = '</div>';
        ob_start();
        ?>

		<style type="text/css">

			ul.verify {
				margin: 5px 0px 0px 0px;
				padding: 5px;
				background: #EEE;
				-moz-border-radius: 5px;
				-webkit-border-radius: 5px;
				border-radius: 5px;
			}

			ul.verify li {
				margin: 5px;
				padding: 0px;
			}

			ul.verify li.missing {
				color: red;
			}

		</style>
			
		<script type="text/javascript">
		
			window.addEvent('domready', function(){
				var ul = document.getElement("ul.verify");

				if (ul) {
					ul.setStyle('display', 'none');
				   	document.getElement("a.verify-link").addEvent("click", function(event){
						var event = new Event(event).stop();
						ul.setStyle('display', ul.getStyle('display') == 'none' ? 'block' : 'none');
					});
				}
			});
      
		</script>
		
		<?php 
        return implode("\n", $content) . ob_get_clean();
    }
开发者ID:smart-one,项目名称:3kita,代码行数:74,代码来源:verify.php


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