示例#1
0
文件: request.php 项目: noonat/pipes
 function __construct($uri = null, $method = null, $params = null)
 {
     $this->server = new Hash();
     $this->server->merge($_SERVER);
     // set uri, method, and params from $_SERVER and $_REQUEST
     $this->uri = $uri ?: $this->server->get('REQUEST_URI', '/');
     $this->params = new Hash();
     $this->params->merge($params ?: $_REQUEST);
     $this->method = $method ?: $this->server->get('REQUEST_METHOD', 'GET');
     $this->method = strtoupper($this->method);
     if ($this->method === 'POST' && options()->get('requestMethodOverride', true)) {
         $method = strtoupper($this->params->get('_method', ''));
         if (in_array($method, array('DELETE', 'GET', 'PUT', 'POST'))) {
             $this->method = $method;
         }
     }
     // strip basePath from uri, if it is set and matches
     $basePath = rtrim(options()->get('requestBasePath', ''), '/');
     if ($basePath && strpos($this->uri, $basePath) === 0) {
         $this->uri = substr($this->uri, strlen($basePath)) ?: '/';
     }
     // split the uri into route and format
     $info = pathinfo($this->uri);
     $this->path = rtrim($info['dirname'], '/') . '/' . $info['filename'];
     if (!empty($info['extension'])) {
         $this->params->format = strtolower($info['extension']);
     } else {
         if (!$this->params->format) {
             $this->params->format = 'html';
         }
     }
     $this->format = $this->params->format;
 }
示例#2
0
 public function render()
 {
     # make sure we have a template
     if ($this->template === false) {
         throw new TemplateUndefined();
     }
     parent::render();
     # unpack the props
     extract($this->props);
     # trap the buffer
     ob_start();
     # include the template
     require \options('views') . '/' . $this->template . '.' . $this->extension;
     # get the buffer contents
     $parsed = ob_get_contents();
     # clean the buffer
     ob_clean();
     # if there is a layout
     if ($this->layout) {
         # push the content into the layout
         $content_for_layout = $parsed;
         # include the template
         include \options('views') . '/' . $this->layout . "." . $this->extension;
         # get the buffer contents
         $parsed = ob_get_contents();
     }
     # close the output buffer
     ob_end_clean();
     # echo the result
     echo $parsed;
 }
 public function login($uid = null)
 {
     if (null !== $uid) {
         $this->user->login(models\User::get($uid));
     }
     if ($this->user->isLoggedIn()) {
         $this->_redirect('/blog');
     }
     if ($this->POST) {
         $post = options($_POST);
         $get = options($_GET);
         try {
             // get user object
             $user = models\User::withCredentials(array('username' => (string) $post->username, 'password' => (string) $post->password));
             // log user in(to SessionUser)
             $this->user->login($user);
             // debug direct logged in status
             Session::message('<pre>' . var_export($this->user->isLoggedIn(), 1) . '</pre>');
             // message OK
             Session::success('Alright, alright, alright, you\'re logged in...');
             // back to blog
             return $this->_redirect($post->get('goto', $get->get('goto', 'blog')));
         } catch (\Exception $ex) {
         }
         // message FAIL
         Session::error('Sorry, buddy, that\'s not your username!');
     }
     $messages = Session::messages();
     return get_defined_vars();
 }
function process_request($ingredients)
{
    $url = NUT_API . urlencode(options($ingredients));
    $context = stream_context_create(array('http' => array('method' => 'GET', 'ignore_errors' => TRUE)));
    $json = file_get_contents($url, 0, $context);
    return json_encode(json_decode($json, true), JSON_PRETTY_PRINT);
}
示例#5
0
/**
 * Google Analytics snippet from HTML5 Boilerplate
 *
 * Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support('soil-google-analytics', 'UA-XXXXX-Y', 'wp_footer');
 */
function load_script()
{
    $gaID = options('gaID');
    if (!$gaID) {
        return;
    }
    $loadGA = (!defined('WP_ENV') || \WP_ENV === 'production') && !current_user_can('manage_options');
    $loadGA = apply_filters('soil/loadGA', $loadGA);
    ?>
  <script>
    <?php 
    if ($loadGA) {
        ?>
      window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
    <?php 
    } else {
        ?>
      (function(s,o,i,l){s.ga=function(){s.ga.q.push(arguments);if(o['log'])o.log(i+l.call(arguments))}
      s.ga.q=[];s.ga.l=+new Date;}(window,console,'Google Analytics: ',[].slice))
    <?php 
    }
    ?>
    ga('create','<?php 
    echo $gaID;
    ?>
','auto');ga('send','pageview')
  </script>
  <?php 
    if ($loadGA) {
        ?>
    <script src="https://www.google-analytics.com/analytics.js" async defer></script>
  <?php 
    }
}
示例#6
0
 public function _chain($type, Closure $event = null, array $args = array())
 {
     $event or $event = function () {
     };
     $chain = static::event($type);
     $chain->first($event);
     return $chain->start($this, options($args));
 }
示例#7
0
/**
 * Add requested Google Fonts in head
 *
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support(
 *	'solero-google-fonts',
 *	[
 *		'Open Sans' => '400,700,400italic,700italic',
 *		'Noto Sans' => '400,400italic'
 *	]
 * );
 */
function load_fonts()
{
    $fonts = options('fonts');
    if (!$fonts) {
        return;
    }
    $query = '//fonts.googleapis.com/css?family=' . $fonts;
    wp_register_style('solero-google-fonts', $query, [], null);
    wp_enqueue_style('solero-google-fonts');
}
示例#8
0
 /**
  * Autodetect the layout
  * Looks for a file named "layout.$this->extension" in the views dir
  */
 protected function autofind_layout()
 {
     if ($this->extension != false) {
         $l = \options('views') . '/layout.' . $this->extension;
         if (file_exists($l)) {
             $this->set_layout('layout');
             return 'layout';
         }
     }
     return false;
 }
示例#9
0
 public static function context($name, $options = array())
 {
     // set context
     if (is_object($options) && is_callable($options)) {
         static::$contexts[$name] = $options;
     }
     // execute & return context
     if (isset(static::$contexts[$name])) {
         $ctx = static::$contexts[$name];
         return $ctx(get_called_class(), options($options));
     }
 }
示例#10
0
function options($self, $title, $prefix, $entityName, $withCsvOptions, $withMagmiDelete, $withEnable, $withDefaults, $pruneKeepDefaultValue, $sourceText, $plugin)
{
    $default_rows_for_sets = "attribute_set_name,attribute_code,attribute_group_name\n*,name,General\n*,description,General\n*,short_description,General\n*,sku,General\n*,weight,General\n*,news_from_date,General\n*,news_to_date,General\n*,status,General\n*,url_key,General\n*,visibility,General\n*,country_of_manufacture,General\n*,price,Prices\n*,group_price,Prices\n*,special_price,Prices\n*,special_from_date,Prices\n*,special_to_date,Prices\n*,tier_price,Prices\n*,msrp_enabled,Prices\n*,msrp_display_actual_price_type,Prices\n*,msrp,Prices\n*,tax_class_id,Prices\n*,price_view,Prices\n*,meta_title,Meta Information\n*,meta_keyword,Meta Information\n*,meta_description,Meta Information\n*,image,Images\n*,small_image,Images\n*,thumbnail,Images\n*,media_gallery,Images\n*,gallery,Images\n*,is_recurring,Recurring Profile\n*,recurring_profile,Recurring Profile\n*,custom_design,Design\n*,custom_design_from,Design\n*,custom_design_to,Design\n*,custom_layout_update,Design\n*,page_layout,Design\n*,options_container,Design\n*,gift_message_available,Gift Options";
    if (isset($title)) {
        ?>
<h3><?php 
        echo $title;
        ?>
</h3><?php 
    }
    if ($withEnable) {
        checkbox($self, $prefix, 'enable', true, "Enable {$entityName} import");
        startDiv($self, $prefix, 'enabled', $self->getParam($prefix . ":enable", "on") == "on");
    }
    if ($withCsvOptions) {
        csvOptions($self, $prefix);
    }
    ?>
    <h4>Import behavior</h4>
    <?php 
    if ($withDefaults) {
        text($self, $prefix, 'default_values', "", "Set default values for non-existing columns in {$sourceText} (JSON)");
    }
    if ($prefix == '5B5AAI') {
        textarea($self, $prefix, 'default_rows', $default_rows_for_sets, "Add these attribute associations to given CSV data, '*' for attribute set name  means 'for each attribute set from given CSV' (Format: CSV with titles, spearator ',', enclosure '\"').");
    }
    checkbox($self, $prefix, 'prune', true, "Prune {$entityName}s which are not in {$sourceText} from database");
    startDiv($self, $prefix, 'prune_opts');
    if ($prefix == '5B5ATI' || $prefix == '5B5AAI') {
        checkbox($self, $prefix, 'prune_keep_system_attributes', true, "Dont touch non-user attributes when pruning.");
    }
    text($self, $prefix, 'prune_only', '', "prune only {$entityName}s matching regexp");
    text($self, $prefix, 'prune_keep', $pruneKeepDefaultValue, "additionally, keep following {$entityName}s when pruning, even if not given in {$sourceText} (comma-separated)");
    endDiv($self);
    if ($withMagmiDelete) {
        checkbox($self, $prefix, 'magmi_delete', true, "Delete {$entityName}s marked \"magmi:delete\" = 1");
    }
    checkbox($self, $prefix, 'create', true, "Create {$entityName}s from {$sourceText} which are not in database");
    checkbox($self, $prefix, 'update', true, "Update {$entityName}s from {$sourceText} which are already in database");
    if ($prefix == '5B5ASI') {
        startDiv($self, $prefix, 'attribute_groups');
        options($self, null, '5B5AGI', 'attribute group', false, false, false, false, "General,Prices,Meta Information,Images,Recurring Profile,Design,Gift Options", '"magmi:groups"', $plugin);
        endDiv($self);
    }
    if ($withEnable) {
        endDiv($self);
    }
    javascript($self, $prefix, $withCsvOptions, $plugin);
}
示例#11
0
 public function __construct($uri = false, $method = false)
 {
     if ($uri === false) {
         if (array_key_exists('REQUEST_URI', $_SERVER)) {
             $this->uri = $_SERVER['REQUEST_URI'];
         }
     } else {
         $this->uri = $uri;
     }
     if ($method !== false) {
         $this->method = $method;
     }
     if (\options('methodoverride')) {
         $this->method_override();
     }
 }
示例#12
0
/**
 * Google Analytics snippet from HTML5 Boilerplate
 *
 * Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support('solero-google-analytics', 'UA-XXXXX-Y', 'wp_footer');
 */
function load_script()
{
    $gaID = options('gaID');
    if (!$gaID) {
        return;
    }
    $loadGA = (!defined('WP_ENV') || \WP_ENV === 'production') && !current_user_can('manage_options');
    $loadGA = apply_filters('solero/loadGA', $loadGA);
    $cookieGA = true;
    $cookieGA = apply_filters('solero/cookieGA', $cookieGA);
    ?>
	<script>
		<?php 
    if ($loadGA) {
        ?>
			window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
		<?php 
    } else {
        ?>
			(function(so,le,r,o){so.ga=function(){so.ga.q.push(arguments);if(le['log'])le.log(r+o.call(arguments))}
			so.ga.q=[];so.ga.o=+new Date;}(window,console,'Google Analytics: ',[].slice))
		<?php 
    }
    ?>
		ga('create','<?php 
    echo $gaID;
    ?>
','auto');
		<?php 
    if (!$cookieGA) {
        ?>
		ga('set', 'anonymizeIp', true);
		<?php 
    }
    ?>
		ga('send','pageview');
	</script>
	<?php 
    if ($loadGA) {
        ?>
		<script src="https://www.google-analytics.com/analytics.js" async defer></script>
	<?php 
    }
}
示例#13
0
文件: helpers.php 项目: noonat/pipes
function run($options = array())
{
    $options = options()->merge($options);
    $request = request();
    $response = response();
    foreach (routes() as $route) {
        if ($route->matches($request, $matches)) {
            route($route);
            $path = isset($matches['path']) ? $matches['path'] : $request->path;
            $data = $route->run($path, $matches);
            if ($data) {
                $response->write($data);
            }
            if ($options->get('flush', true)) {
                $response->flush();
            }
            return $route;
        }
    }
    return null;
}
示例#14
0
     saveform();
     break;
 case "qiangzhisave":
     qiangzhisave();
     break;
 case "addform":
     addform($action);
     break;
 case "qiangzhi":
     qiangzhi($action);
     break;
 case "modify":
     addform($action);
     break;
 case "options":
     options(intval($_GET["site_id"]));
     break;
 case "dell_links":
     dell_links(HtmlReplace($_GET["url"]));
     break;
 case "del":
     $site_id = intval($_GET["site_id"]);
     $db->query("delete from ve123_sites where site_id='" . $site_id . "'");
     break;
 case "add_in_site_link":
     $site_id = $_GET["site_id"];
     echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"98%\"><iframe src=\"start.php?action=add_in_site_link&site_id=" . $site_id . "\" height=\"450\" width=\"100%\"></iframe></td></tr></table><br>";
     break;
 case "add_all_lry":
     //收录全站
     $site_id = $_GET["site_id"];
示例#15
0
<?php

/**
 * Mailing List Plugin, Furasta.Org
 *
 * @author	Conor Mac Aoidh <*****@*****.**>
 * @licence	http://furasta.org/licence.txt The BSD Licence
 * @version	1
 */
$Template = Template::getInstance();
$mailing_list_options = options('mailing_list_options');
$page = @$_GET['page'];
switch ($page) {
    case 'options':
        require HOME . '_plugins/Mailing-List/admin/options.php';
        break;
    case 'mail':
    case 'send':
        $conds = array('Subject' => array('name' => $Template->e('mailing_list_subject'), 'required' => true), 'BCC' => array('name' => $Template->e('mailing_list_bcc'), 'required' => true), 'Content' => array('name' => $Template->e('mailing_list_content'), 'required' => true));
        $valid = validate($conds, '#mail-form', 'mail-form-submit');
        if ($page == 'send') {
            require HOME . '_plugins/Mailing-List/admin/send.php';
        } else {
            require HOME . '_plugins/Mailing-List/admin/mail.php';
        }
        break;
    default:
        require HOME . '_plugins/Mailing-List/admin/list.php';
}
    exit;
}
if (isset($_GET["rulemd5"])) {
    main_rule();
    exit;
}
if (isset($_GET["items-rules"])) {
    items();
    exit;
}
if (isset($_GET["diclaimers-rule"])) {
    disclaimer_rule();
    exit;
}
if (isset($_GET["options"])) {
    options();
    exit;
}
if (isset($_POST["mailfrom"])) {
    filehosting_rule_add();
    exit;
}
if (isset($_POST["del-zmd5"])) {
    autocompress_rule_delete();
    exit;
}
popup();
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
示例#17
0
文件: get.php 项目: Just-Man/PHP
            <select name="birthMount">
                <option value=""> Select </option>
                <?php 
echo options([JANUARY => 'JANUARY', FEBRUARY => 'FEBRUARY', MARCH => 'MARCH', APRIL => 'APRIL'], $birth_mount);
?>
            </select>
        </span>
        <span>
            <select name="birthDay" id="birthDays">
                <option value=""> Select </option>
                <?php 
echo options([d1 => '1', d2 => '2', d3 => '3', d4 => '4', d5 => '5', d6 => '6', d7 => '7'], $birth_day);
?>
            </select>
        </span>
        <span>
            <select name="birthYear" id="">
                <option  value=""> Select </option>
                <?php 
echo options([y1 => '1909', y2 => '1908', y3 => '1907', y4 => '1906', y5 => '1905', y6 => '1904', y7 => '1903', y8 => '1902', y9 => '1901', y10 => '1900'], $birth_year);
?>
            </select>
        </span>
    </span>
    <br>
    <span>
        <button type="submit">Add Employee</button>
    </span>
</form>
</body>
</html>
                value="<?php 
echo $search_to_date;
?>
" pattern="\d{4}\-\d{2}\-\d{2}" />
            
            <label class="control-label"> &nbsp; Tallers favorits ?</label> 
            <input type="checkbox" name="favourite" value="y" 
                 <?php 
echo !empty($search_favourite) && $search_favourite !== 'n' ? ' checked ' : '';
?>
 > 
            
            <label class="control-label"> &nbsp; Per edats </label>
            <select name="search_ages[]" class="form-control" multiple>
              <?php 
options($ages, $search_ages);
?>
            </select>   


     </div>


    
    <input type="hidden" name="page" value="1"/>    
    <input type="hidden" name="limit" id ="list-limit-id" value="<?php 
echo $limit;
?>
"/>
    <input type="hidden" name="expanded" id="list-expanded-id" value="<?php 
echo $expanded;
示例#19
0
<?php

require_once 'functions.php';
?>


<div class="plugin_description">
	This plugin imports (inserts, updates, deletes) a list of attribute sets before the products will be updated.
</div>
<?php 
options($this, 'Attribute import options', '5B5ATI', 'attribute', true, true, true, true, 'category_ids,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,description,gallery,gift_message_available,group_price,has_options,image,image_label,is_recurring,links_exist,links_purchased_separately,links_title,media_gallery,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,msrp_enabled,name,news_from_date,news_to_date,old_id,options_container,page_layout,price,price_type,price_view,recurring_profile,required_options,samples_title,shipment_type,short_description,sku,sku_type,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,tier_price,updated_at,url_key,url_path,visibility,weight,weight_type', 'CSV', $this->_plugin);
options($this, 'Attribute set import options', '5B5ASI', 'attribute set', true, true, true, true, 'Default', 'CSV', $this->_plugin);
options($this, 'Attribute association import options', '5B5AAI', 'attribute association', true, true, true, true, 'Default', 'CSV', $this->_plugin);
示例#20
0
        addform($action);
        break;
    case 'modify':
        addform($action);
        break;
    case 'update_qp':
        update_qp(intval($_GET['site_id']));
        break;
    case 'update_all_qp':
        update_all_qp();
        break;
    case 'links_to_sites':
        links_to_sites();
        break;
    case 'options':
        options(intval($_GET['site_id']));
        break;
    case 'dell_links':
        dell_links(HtmlReplace($_GET['url']));
        break;
    case 'update_all_site_id':
        update_all_site_id();
        break;
    case 'del':
        $site_id = intval($_GET['site_id']);
        $db->query("delete from ve123_sites where site_id='" . $site_id . "'");
        break;
    case 'dolistform':
        dolistform();
        break;
}
示例#21
0
<?php

/**
 * Mailing List Plugin, Furasta.Org
 *
 * @author	Conor Mac Aoidh <*****@*****.**>
 * @licence	http://furasta.org/licence.txt The BSD Licence
 * @version	1
 */
if ($widget_id == 0) {
}
$Template = Template::getInstance();
$widget_options = options('mailing_list_widget_' . $id);
$opts = array('yes', 'no');
$content = '
<span class="header-img"><img src="' . SITE_URL . '_plugins/Mailing-List/img/options-large.png"/></span>
<h1 class="image-left">' . $Template->e('menu_mailing_options') . '</h1>

<form method="post" id="options-form">
	<table style="width:50%">
		<tr>
			<td>' . $Template->e('mailing_list_widget_name') . ': </td>
			<td><select name="collect_name">';
foreach ($opts as $opt) {
    $content .= '<option value="' . $opt . '"';
    if ($opt == $widget_options['collect_name']) {
        $content .= ' selected="selected"';
    }
    $content .= '>' . $Template->e($opt) . '</option>';
}
$content .= '</select></td>
示例#22
0
 public function handle_error($e)
 {
     $logo = 'data:image/png;base64,' . base64_encode(file_get_contents(__DIR__ . '/images/vicious.png'));
     if ($e instanceof NotFound) {
         $this->status(404);
         if (options('environment') == DEVELOPMENT) {
             $out = "<!DOCTYPE html>\n\t\t\t\t\t<html><head><title>404 Not Found</title>\n\t\t\t\t\t<style type='text/css'>\n          \tbody { font-family:helvetica,arial;font-size:18px; margin:50px; letter-spacing: .1em;}\n          \tdiv, h1 {margin:0px auto;width:500px;}\n\t\t\t\t\t\th1 { background-color:#FC63CD; color: #FFF; padding:125px 0px 10px 10px; background-image:url({$logo}); background-repeat:no-repeat;width:490px;}\n\t\t\t\t\t\th2 { background-color:#888; color:#FFF; margin: 0px; padding: 3px 10px;}\n\t\t\t\t\t\tpre { background-color:#FF0; color:#000; padding: 10px; margin: 0px; white-space: pre-wrap;}\n\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t<h1>I dunno what you&rsquo;re after.</h1>\n\t\t\t\t\t<div><h2>Try this:</h2><pre>get('" . request('uri') . "', function() {\n  return 'Hello World';\n});\n</pre></div>\n\t\t\t\t\t</body></html>";
         } else {
             if ($this->not_found_handler) {
                 $out = call_user_func($this->not_found_handler, $e);
             } else {
                 # standard apache 404 page
                 $out = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL ' . request('uri') . ' was not found on this server.</p></body></html>';
             }
         }
     } else {
         $this->status(500);
         if (options('environment') == DEVELOPMENT) {
             $backtrace = join('</pre></li><li><pre>', explode("\n", $e->trace_as_string()));
             $vars = array('GET' => $_GET, 'POST' => $_POST, 'SESSION' => isset($_SESSION) ? $_SESSION : array(), 'SERVER' => $_SERVER);
             foreach ($vars as $type => $sg) {
                 $html = "";
                 if (empty($sg)) {
                     $html .= "<tr class='empty'><th class='type'>{$type}</th><th colspan='2'>No {$type} data.</th></tr><tr><td class='blank'></td><td class='empty' colspan='2'>&nbsp;</td></tr>";
                 } else {
                     $html .= "<tr><th class='type'>{$type}</th><th>Variable</th><th>Value</th></tr>";
                     foreach ($sg as $k => $v) {
                         $html .= "<tr><td class='blank'></td><td class='key'>{$k}</td><td>" . wordwrap($v, 150, "<br />\n", true) . "</td></tr>";
                     }
                 }
                 $vars[$type] = $html;
             }
             $out = sprintf("<!DOCTYPE html>\n\t\t\t\t\t<html><head><title>500 Internal Server Error</title>\n\t\t\t\t\t<style type='text/css'>\n          \tbody { font-family:helvetica,arial;font-size:18px; margin:50px; letter-spacing: .1em;}\n\t\t\t\t\t\t#c { width: 960px; margin:0  auto; position: relative; }\n\t\t\t\t\t\t#h { display: table-cell; vertical-align: bottom; height: 109px; background-color:#FC63CD; color: #FFF; padding:0px 0px 10px 510px; background-image:url({$logo}); background-repeat:no-repeat;width:460px;}\n\t\t\t\t\t\th1, h2 { margin:0; }\n\t\t\t\t\t\th2 { font-size: 16px; color: white; }\n\t\t\t\t\t\th2 span { font-weight: normal; }\n\t\t\t\t\t\th3 { background-color:#888; color:#FFF; margin: 0px; padding: 3px 10px;}\n\t\t\t\t\t\tpre { background-color:#FF0; color:#000; padding: 10px; margin: 0px; font-size:12px; line-height: 1.5em; white-space: pre-wrap;}\n\t\t\t\t\t\tul {margin:0px; padding: 0px; list-style: none; }\n\t\t\t\t\t\tli { border-bottom: 1px solid white; }\n\t\t\t\t\t\ttable { width: 960px; border: 0px; border-spacing: 0px;  }\n\t\t\t\t\t\ttable th.type { font-size: 21px; font-weight: bold; width: 110px; border-right: 1px solid white;}\n\t\t\t\t\t\tth { text-align: left; background-color:#888; color:#FFF; padding: 0px 10px; height: 30px; font-weight: normal; font-size: 14px;}\n\t\t\t\t\t\ttd { border-bottom: 1px solid white; background-color:#FF0; color:#000; padding: 10px; margin: 0px; font-size:12px; line-height: 1.5em; }\n\t\t\t\t\t\ttd.key { width: 170px; border-right: 1px solid white; }\n\t\t\t\t\t\ttd.blank { background-color: white; border: none; }\n\t\t\t\t\t\ttr.empty td { border: none; }\n\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t<div id='c'>\n\t\t\t\t\t<div id='h'><h1>%s</h1><h2>file: <span>%s</span> line: <span>%s</span> location: <span>%s</span></h2></div>\n\t\t\t\t\t<div><pre>%s</pre></div>\n\t\t\t\t\t<h3>Backtrace</h3>\n\t\t\t\t\t<ul><li><pre>%s</pre></li></ul>\n\n\t\t\t\t\t\n\t\t\t\t\t<table>%s\n\t\t\t\t\t%s\n\t\t\t\t\t%s\n\t\t\t\t\t%s</table>\n\t\t\t\t\t<div style='clear: both'></div>\n\t\t\t\t\t</div></body></html>", str_replace(array("vicious\\", 'Vicious'), '', get_class($e)), pathinfo($e->file(), PATHINFO_BASENAME), $e->line(), request('uri'), $e->message(), $backtrace, $vars['GET'], $vars['POST'], $vars['SESSION'], $vars['SERVER']);
         } else {
             if ($this->error_handler) {
                 $out = call_user_func($this->error_handler, $e);
             } else {
                 # standard default 500 page
                 $out = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>500 Internal Server Error</title></head><body><h1>Internal Server Error</h1><p>Please try again later.</p></body></html>';
             }
         }
     }
     if ($out != null) {
         if (is_string($out)) {
             echo $out;
         } else {
             if ($out instanceof Renderable) {
                 $out->send_content_type_header();
                 $out->render();
             }
         }
     }
 }
示例#23
0
				<td><input type="text" name="num" value="<?php 
echo $this->config->user_item('search/num');
?>
" placeholder="案号" title="案号" /></td>
			</tr>
			<tr>
				<td>
					<select name="labels[]" class="chosen" data-placeholder="标签" multiple="multiple"><?php 
echo options($this->project->getAllLabels(), $this->config->user_item('search/labels'));
?>
</select>
				</td>
			</tr>
			<tr>
				<td><select name="people[]" multiple="multiple" class="chosen allow-new" data-placeholder="职员"><?php 
echo options($this->staff->getArray(), $this->config->user_item('search/people'), NULL, true);
?>
</select></td>
			</tr>
			<tr><td><input type="text" name="first_contact[from]" value="<?php 
echo $this->config->user_item('search/first_contact/from');
?>
" class="date" placeholder="首次接待日期自" /></td></tr>
			<tr><td><input type="text" name="first_contact[to]" value="<?php 
echo $this->config->user_item('search/first_contact/to');
?>
" class="date" placeholder="首次接待日期至" /></td></tr>
			<tr>
				<td class="submit">
					<button type="submit" name="search" tabindex="0">搜索</button>
					<button type="submit" name="search_cancel" tabindex="1"<?php 
示例#24
0
文件: Helper.php 项目: noikiy/inovi
 function t($key, $params = array(), $echo = true)
 {
     $lng = session('web')->getLanguage();
     if ($lng == options()->getDefaultLanguage()) {
         if (true === $echo) {
             echo $key;
         } else {
             return $key;
         }
     }
     $db = dm('translation');
     $res = $db->where('name = ' . sha1($key))->where('language = ' . $lng)->get();
     if (count($res)) {
         $row = $db->first($res);
         $translation = assignParams($row->getValue(), $params);
         if (true === $echo) {
             echo $translation;
         } else {
             return $translation;
         }
     }
     if (true === $echo) {
         echo $key;
     } else {
         return $key;
     }
 }
示例#25
0
</label><br />


            <input type="checkbox" id="discard" name="discard"
                   <?php 
if ($css->get_cfg('discard_invalid_properties')) {
    echo 'checked="checked"';
}
?>
 />
            <label for="discard"><?php 
echo $lang[$l][43];
?>
</label>
            <select name="css_level"><?php 
echo options(array('CSS2.1', 'CSS2.0', 'CSS1.0'), $css->get_cfg('css_level'), true);
?>
</select><br />


            <input type="checkbox" id="timestamp" name="timestamp"
                   <?php 
if ($css->get_cfg('timestamp')) {
    echo 'checked="checked"';
}
?>
 />
   			<label for="timestamp"><?php 
echo $lang[$l][57];
?>
</label><br />
示例#26
0
			in:
				<select name="degreesSelectFrom" id="degreesSelectFrom">
					<option>--Choose option to convert from--</option>
					<?php 
echo options(['c' => 'C', 'f' => 'F'], $degrees);
?>
				</select>
				
			</span>
			<br />
			<span>
			Convert degrees to:
				<select name="degreesSelectTo" id="degreesSelectTo">
					<option>--Choose option to convert to--</option>
					<?php 
echo options(['c' => 'C', 'f' => 'F'], $degrees);
?>
				</select>
				
			</span>

			<input type="submit" id="submit" />
			
			<p>
				<?php 
if ($_POST) {
    echo $output . $result;
}
?>
			</p>
			
示例#27
0
			<tr>
				<td>
					<input type="hidden" name="project" value="<?php 
echo $this->config->user_item('search/project');
?>
" class="tagging" style="width: 238px;" data-placeholder="事务" data-ajax="/project/match/" data-initselection='<?php 
echo $this->config->user_item('search/project') ? json_encode($this->project->fetch($this->config->user_item('search/project'))) : '';
?>
' />
				</td>
			</tr>
			<tr>
				<td>
					<select name="completed" class="chosen" data-placeholder="日志/日程">
						<?php 
echo options(array(0 => '日程', 1 => '日志'), $this->config->user_item('search/completed'), '', true, false, false);
?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="submit">
					<button type="submit" name="search" tabindex="0">搜索</button>
					<button type="submit" name="search_cancel" tabindex="1"<?php 
if (!array_reduce($this->search_items, function ($result, $item) {
    return $result || $this->config->user_item('search/' . $item);
}, false)) {
    ?>
 class="hidden"<?php 
}
?>
示例#28
0
文件: aleph.php 项目: lastguest/aleph
/**
 * TEMPLATE
 */
function template($name, $params = array())
{
    static $templates = array();
    $use_cache = !!options('templates.cache.enabled');
    $template_dir = rtrim(options('templates.dir') ?: __DIR__ . '/templates', '/');
    $name = trim($name, '/');
    $template_file = "{$template_dir}/{$name}.html";
    if ($use_cache) {
        $cache_dir = rtrim(options('templates.cache.dir') ?: __DIR__ . '/cache', '/');
        if (!is_dir($cache_dir)) {
            @mkdir($cache_dir);
        }
        $template_cache = "{$cache_dir}/{$name}.php";
        if (file_exists($template_cache)) {
            $templates[$template_file] = file_get_contents($template_cache);
        }
    }
    if (!isset($templates[$template_file])) {
        $getParam = function ($tok) {
            return function_exists(trim(strtok($tok, '('))) ? $tok : '@$' . trim(str_replace('.', '->', $tok));
        };
        $compiled = array();
        $state = 'html';
        $tokens = preg_split('~({{|}}|{%|%}|{#|#}|{&|&})~m', file_get_contents($template_file), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        foreach ($tokens as $tok) {
            if ($state == 'skip') {
                if ($tok == '#}') {
                    $state = 'html';
                }
                continue;
            }
            switch ($tok) {
                case '{{':
                    $state = 'echo';
                    $compiled[] = '<?=';
                    break;
                case '}}':
                    $state = 'html';
                    $compiled[] = '?>';
                    break;
                case '{#':
                    $state = 'skip';
                    break;
                case '#}':
                    $state = 'html';
                    break;
                case '{%':
                    $state = 'code';
                    $compiled[] = '<?php ';
                    break;
                case '%}':
                    $state = 'html';
                    $compiled[] = ' ?>';
                    break;
                case '{&':
                    $state = 'php';
                    $compiled[] = '<?php ' . "\n";
                    break;
                case '&}':
                    $state = 'html';
                    $compiled[] = "\n" . '?>';
                    break;
                default:
                    switch ($state) {
                        case 'skip':
                            break;
                        case 'code':
                            $keywords = array_filter(preg_split('~\\s+~', $tok));
                            $statement = array_shift($keywords);
                            switch ($statement) {
                                case 'for':
                                    if (strpos($keywords[2], '..') !== false) {
                                        $what = 'range(' . preg_replace('~\\s*\\.\\.\\s*~', ',', $keywords[2]) . ')';
                                    } else {
                                        $what = $getParam($keywords[2]);
                                    }
                                    $compiled[] = 'foreach(' . $what . '?:array() as $' . $keywords[0] . '){';
                                    break;
                                case 'end':
                                    $compiled[] = '}';
                                    break;
                            }
                            break;
                        case 'echo':
                            $state = 'html';
                            $compiled[] = $getParam($tok);
                            break;
                        case 'php':
                            $compiled[] = trim($tok);
                            break;
                        case 'html':
                            $compiled[] = $tok;
                            break;
                    }
                    break;
            }
        }
        $templates[$template_file] = implode('', $compiled);
        if ($use_cache) {
            file_put_contents($template_cache, $templates[$template_file]);
        }
    }
    $source = $templates[$template_file];
    return call_user_func(function () use($source, $params) {
        extract($params);
        ob_start();
        eval('?>' . $source);
        $___BUFF___ = ob_get_contents();
        ob_end_clean();
        return $___BUFF___;
    });
}
示例#29
0
?>
">
				<label for="">Favorite Color</label>
				<?php 
echo checkboxesOrRadios([COLOR_RED => 'Red', COLOR_GREEN => 'Green', COLOR_BLUE => 'Blue'], $colors, 'color[]');
?>
			</div>
			<div class="<?php 
echo getFieldClass($validationErrors, 'form_of_address');
?>
">
				<label for="form_of_address">Password</label>
				<select name="form_of_address" id="">
					<option value="">--Choose Form Of Address--</option>
					<?php 
echo options([FORM_OF_ADDRESS_MR => 'Mr.', FORM_OF_ADDRESS_MRS => 'Mrs.', FORM_OF_ADDRESS_MS => 'Ms.'], $formOfAddress);
?>
				</select>
				<?php 
echo displayErrors($validationErrors, 'form_of_address');
?>
			</div>
			<div>
				<label for="text">Text</label>
				<textarea rows="" cols="" name="text" id="text"><?php 
echo htmlentities($text);
?>
</textarea>
			</div>
			<div>
				<input type="submit" />
示例#30
0
文件: Router.php 项目: schpill/thin
 public static function language()
 {
     $isCMS = null !== container()->getPage();
     $session = session('web');
     if (true === $isCMS) {
         if (count($_POST)) {
             if (ake('cms_lng', $_POST)) {
                 $session->setLanguage($_POST['cms_lng']);
             } else {
                 $language = $session->getLanguage();
                 $language = null === $language ? Cms::getOption('default_language') : $language;
                 $session->setLanguage($language);
             }
         } else {
             $language = $session->getLanguage();
             $language = null === $language ? Cms::getOption('default_language') : $language;
             $session->setLanguage($language);
         }
     } else {
         $route = Utils::get('appDispatch');
         $language = $session->getLanguage();
         if (null === $language || $language != $route->getLanguage()) {
             $language = null === $route->getLanguage() ? options()->getDefaultLanguage() : $route->getLanguage();
             $session->setLanguage($language);
         }
         $module = $route->getModule();
         $controller = $route->getController();
         $action = $route->getAction();
         $module = is_string($action) ? Inflector::lower($module) : $module;
         $controller = is_string($action) ? Inflector::lower($controller) : $controller;
         $action = is_string($action) ? Inflector::lower($action) : $action;
         $config = array();
         $config['language'] = $language;
         $config['module'] = $module;
         $config['controller'] = $controller;
         $config['action'] = $action;
         $configLanguage = new Container();
         $configLanguage->populate($config);
         container()->setLanguage(new Language($configLanguage));
     }
 }