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


PHP setFn函数代码示例

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


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

示例1: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('beforeOperation', function ($Call) {
    if (isset($Call['EV'])) {
        $Call['Data']['EV'] = $Call['EV'];
    } else {
        $Call['Data']['EV'] = 0;
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:16,代码来源:EV.php

示例2: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Calculate', function ($Call) {
    if (preg_match_all('/href=\\=/', $Call['Value'], $Pockets)) {
        return count($Pockets) * $Call['Antispam']['Link']['Weight'];
    } else {
        return 0;
    }
});
开发者ID:trickyplan,项目名称:codeine,代码行数:15,代码来源:Links.php

示例3: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    if (isset($Call['Request'])) {
        foreach ($Call['HTTP']['Filter']['Request']['Rules'] as $FilterName => $Filter) {
            foreach ($Filter['Match'] as $Match) {
                if (F::Diff($Match, $Call['Request']) === null) {
                    if ($Filter['Decision']) {
                    } else {
                        F::Log('HTTP Request Filter *' . $FilterName . '* matched', LOG_WARNING, 'Security');
                        return false;
                    }
                }
            }
        }
    }
    return true;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:24,代码来源:Request.php

示例4: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description Exec Parslet 
 * @package Codeine
 * @version 6.0
 */
setFn('Parse', function ($Call) {
    foreach ($Call['Parsed'][2] as $IX => $Match) {
        $Root = simplexml_load_string('<root ' . $Call['Parsed'][1][$IX] . '></root>');
        $Engine = isset($Root->attributes()->engine) ? (string) $Root->attributes()->engine : 'Date';
        // TODO Due bug 13744 at w3c validator, time tag temporary diabled.
        // $Outer = '<time datetime="'.date(DATE_ISO8601, $Match).'">'.date($Format, $Inner).'</time>';
        $Outer = ['Value' => $Match];
        if (isset($Root->attributes()->format)) {
            $Outer['Format'] = (string) $Root->attributes()->format;
        }
        $Outer = F::Run('Formats.Date.' . $Engine, 'Format', $Outer);
        $Call['Output'] = str_replace($Call['Parsed'][0][$IX], $Outer, $Call['Output']);
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:23,代码来源:Datetime.php

示例5: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Catch', function ($Call) {
    $Call['Run'] = ['Service' => 'Error.Page', 'Method' => 'Do', 'Call' => ['Code' => 403]];
    return $Call;
});
setFn('Do', function ($Call) {
    $Call['Page']['Title'] = $Call['Code'];
    $Call['Page']['Description'] = 'TODO';
    $Call['Page']['Keywords'] = array('TODO');
    $Call['Layouts'] = [['Scope' => 'Default', 'ID' => 'Main'], ['Scope' => 'Project', 'ID' => 'Zone']];
    if (isset($Call['Reason'])) {
        $Call['Output']['Content'] = [['Type' => 'Template', 'Scope' => 'Error/' . $Call['Code'], 'ID' => $Call['Reason']]];
    } else {
        $Call['Output']['Content'] = [['Type' => 'Template', 'Scope' => 'Error', 'ID' => $Call['Code']]];
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:24,代码来源:Page.php

示例6: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Call = F::Apply(null, 'Input', $Call);
    $Call = F::Apply(null, 'Render', $Call);
    $Call = F::Apply(null, 'Output', $Call);
    return $Call;
});
setFn('Input', function ($Call) {
    return $Call;
});
setFn('Render', function ($Call) {
    return $Call;
});
setFn('Output', function ($Call) {
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:23,代码来源:Ad.php

示例7: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description: Simple HTML Renderer
 * @package Codeine
 * @version 8.x
 */
setFn('Render', function ($Call) {
    $finfo = new finfo(FILEINFO_MIME);
    if (is_array($Call['Output']['Content'])) {
        $Call['Output']['Content'] = implode('', $Call['Output']['Content']);
    }
    $Call['Output'] = $Call['Output']['Content'];
    $Call['HTTP']['Headers']['Content-type:'] = $finfo->buffer($Call['Output']);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:17,代码来源:RAW.php

示例8: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 7.6,2
 */
setFn('Widget', function ($Call) {
    return F::Apply($Call['Modes'][$Call['Mode']], 'Widget', $Call);
});
setFn('Check', function ($Call) {
    if (!isset($Call['CAPTCHA']['Bypass'])) {
        if (!F::Run($Call['Modes'][$Call['Mode']], 'Check', $Call)) {
            F::Log('CAPTCHA Failed from IP ' . F::Live($Call['HTTP']['IP']), LOG_ERR, 'Security');
            $Call['Failure'] = true;
            $Call = F::Hook('CAPTCHA.Failed', $Call);
        }
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:21,代码来源:CAPTCHA.php

示例9: foreach

        foreach ($Locations as $Location) {
            if (!isset($Call['Location']['Slug']) or null === $Call['Location']['Slug']) {
                $Location['URL'] = '/' . $Location['Slug'];
            } else {
                if (preg_match('@^/' . $Call['Location']['Slug'] . '@Ssuu', $Call['HTTP']['URL'])) {
                    $Location['URL'] = str_replace($Call['Location']['Slug'], $Location['Slug'], $Call['HTTP']['URL']);
                } else {
                    $Location['URL'] = '/' . $Location['Slug'];
                }
            }
            $Location['URL'] = $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . $Location['URL'];
            if (isset($Call['Location']['ID']) && $Location['ID'] == $Call['Location']['ID']) {
                $Call['Output']['Content'][] = '<option selected value="' . $Location['Slug'] . '"><a href="' . $Location['Slug'] . '">' . $Location['Title'] . '</a></option>';
            } else {
                $Call['Output']['Content'][] = '<option value="' . $Location['Slug'] . '"><a href="' . $Location['Slug'] . '">' . $Location['Title'] . '</a></option>';
            }
        }
    }
    return $Call;
});
setFn('Select', function ($Call) {
    if ($Call['Location'] != $Call['Session']['Location']) {
        F::Run('Session', 'Write', $Call, ['Session Data' => ['Location' => $Call['Location']]]);
    }
    if (isset($_SERVER['HTTP_REFERER'])) {
        $Call = F::Apply('System.Interface.HTTP', 'Redirect', $Call, ['Location' => $_SERVER['HTTP_REFERER']]);
    } else {
        $Call = F::Apply('System.Interface.HTTP', 'Redirect', $Call, ['Location' => '/']);
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Select.php

示例10: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Call['HTTP']['Agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    F::Log($Call['HTTP']['Agent'], LOG_INFO);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:13,代码来源:Agent.php

示例11: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Write', function ($Call) {
    $Output = $Call['Data'][0];
    $Output = preg_replace('/\\*(.*)\\*/SsUu', '$1', implode(PHP_EOL, (array) $Output));
    return $Output;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:13,代码来源:RAW.php

示例12: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    time_nanosleep($Call['Seconds'], $Call['Seconds'] - round($Call['Seconds']) * 1000000000);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:12,代码来源:Nano.php

示例13: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    if (is_string($Call['Value'])) {
        $Call['Value'] = strip_tags($Call['Value']);
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:14,代码来源:StripTags.php

示例14: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Call = F::Hook('beforeIncreaseDo', $Call);
    $Call = F::Run('Entity', 'Load', $Call);
    if (isset($Call['Nodes'][$Call['Key']]['Widgets']['Write']) or isset($Call['Nodes'][$Call['Key']]['Widgets']['Update'])) {
        $Data = F::Run('Entity', 'Read', $Call, ['One' => true]);
        $Data = F::Dot($Data, $Call['Key'], F::Dot($Data, $Call['Key']) + $Call['Value']);
        F::Run('Entity', 'Update', $Call, ['Data' => $Data]);
        $Call['Output']['Content'][] = 'OK';
    }
    $Call = F::Hook('afterIncreaseDo', $Call);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:20,代码来源:Increase.php

示例15: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 7.0
 */
setFn('Parse', function ($Call) {
    foreach ($Call['Parsed'][0] as $Ix => $Match) {
        $Round = simplexml_load_string($Match);
        // FIXME Абстрагировать этот пиздец
        $Call['Output'] = str_replace($Call['Parsed'][0][$Ix], round((double) $Round, (int) $Round->attributes()->precision), $Call['Output']);
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:16,代码来源:Round.php


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