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


PHP Get::state_shortcode方法代码示例

本文整理汇总了PHP中Get::state_shortcode方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::state_shortcode方法的具体用法?PHP Get::state_shortcode怎么用?PHP Get::state_shortcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Get的用法示例。


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

示例1: do_shortcode

/**
 * Handle Shortcode(s) in Content
 * ------------------------------
 */
function do_shortcode($content)
{
    if (strpos($content, '{{') === false) {
        return $content;
    }
    foreach (Get::state_shortcode() as $key => $value) {
        $key = preg_quote($key, '#');
        // %[a,b,c]: option(s) ... accept `a`, `b`, or `c`
        if (strpos($key, '%\\[') !== false) {
            $key = preg_replace_callback('#%\\\\\\[(.*?)\\\\\\]#', function ($matches) {
                return '(' . str_replace(array(',', '&\\#44;'), array('|', ','), $matches[1]) . ')';
            }, $key);
        }
        // %s: accept any value(s) without line break(s)
        // %m: accept any value(s) with/without line break(s)
        // %i: accept integer number(s)
        // %f: accept float number(s)
        // %b: accept boolean value(s)
        $key = str_replace(array('%s', '%m', '%i', '%f', '%b'), array('(.+?)', '([\\s\\S]+?)', '(\\d+?)', '((?:\\d*\\.)?\\d+?)', '\\b(TRUE|FALSE|YES|NO|Y|N|ON|OFF|true|false|yes|no|y|n|on|off|1|0|\\+|\\-)\\b'), $key);
        $content = preg_replace('#(?<!`)' . $key . '|' . $key . '(?!`)#', Converter::DW($value), $content);
    }
    return $content;
}
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:27,代码来源:ignite.php

示例2: function

<?php

/**
 * Shortcode Manager
 * -----------------
 */
Route::accept($config->manager->slug . '/shortcode', function () use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $shortcodes = Get::state_shortcode(null, array(), false);
    $G = array('data' => $shortcodes);
    Config::set(array('page_title' => $speak->shortcodes . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.shortcode.php'));
    if ($request = Request::post()) {
        $request = Filter::apply('request:__shortcode', $request);
        Guardian::checkToken($request['token']);
        $data = array();
        for ($i = 0, $keys = $request['key'], $count = count($keys); $i < $count; ++$i) {
            if (trim($keys[$i]) !== "") {
                $data[$keys[$i]] = $request['value'][$i];
            }
        }
        $P = array('data' => $data);
        File::serialize($data)->saveTo(STATE . DS . 'shortcode.txt', 0600);
        Notify::success(Config::speak('notify_success_updated', $speak->shortcode));
        Weapon::fire('on_shortcode_update', array($G, $P));
        Guardian::kick($config->url_current);
    }
    Shield::lot(array('segment' => 'shortcode', 'files' => Mecha::O($shortcodes)))->attach('manager');
});
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:30,代码来源:route.shortcode.php

示例3: function

/**
 * Include User Defined Function(s)
 * --------------------------------
 */
if ($function = File::exist(SHIELD . DS . $config->shield . DS . 'functions.php')) {
    include $function;
}
/**
 * Handle Shortcode(s) in Content
 * ------------------------------
 */
Filter::add('shortcode', function ($content) use($config, $speak) {
    if (strpos($content, '{{') === false) {
        return $content;
    }
    foreach (Get::state_shortcode() as $key => $value) {
        $key = preg_quote($key, '#');
        // %[a,b,c]: options ... accept `a`, `b`, or `c`
        if (strpos($key, '%\\[') !== false) {
            $key = preg_replace_callback('#%\\\\\\[(.*?)\\\\\\]#', function ($matches) {
                return '(' . str_replace(',', '|', $matches[1]) . ')';
            }, $key);
        }
        // %s: accept any values without line breaks
        // %S: accept any values with/without line breaks
        // %i: accept integer numbers
        // %f: accept float numbers
        // %b: accept boolean values
        $key = str_replace(array('%s', '%S', '%i', '%f', '%b'), array('(.+?)', '([\\s\\S]+?)', '(\\d+?)', '((?:\\d*\\.)?\\d+?)', '\\b(TRUE|FALSE|YES|NO|ON|OFF|true|false|yes|no|on|off|1|0)\\b'), $key);
        $value = str_replace(array('\\n', '\\r', '\\t'), array("\n", "\r", "\t"), $value);
        $content = preg_replace('#(?<!`)' . $key . '(?!`)#', $value, $content);
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:ignite.php


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