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


PHP F::loadOptions方法代码示例

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


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

示例1: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Achievements = F::loadOptions('Gamification.Achievement')['Achievements'];
    foreach ($Achievements as $Achievement) {
        $Award = F::Run('Entity', 'Read', ['Entity' => 'Gamification.Achievement', 'Where' => ['Award' => $Achievement, 'User' => $Call['User']], 'One' => true]);
        if ($Check = F::Run('Gamification.Achievement.' . $Achievement, 'Check', $Call) and !empty($Award)) {
            $Call['Output']['Content'][] = ['Type' => 'Template', 'Scope' => 'Gamification/Achievement/Show', 'ID' => 'Short', 'Data' => $Award];
        } else {
            $Call['Output']['Content'][] = ['Type' => 'Template', 'Scope' => 'Gamification/Achievement/Show', 'ID' => 'Default', 'Data' => ['Award' => $Achievement]];
        }
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:20,代码来源:List.php

示例2: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Filter', function ($Call) {
    // Determine Language
    // Load Stop words list
    $Call['Stop Words'] = F::loadOptions('Text.Stopwords.ru')['Stop Words'];
    $Call['Words'] = array_filter($Call['Words'], function ($Word) use($Call) {
        return !in_array($Word, $Call['Stop Words']);
    });
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:17,代码来源:StopWords.php

示例3: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $UserBalances = F::Run('Entity', 'Read', $Call, ['Entity' => 'User', 'Fields' => ['Balance']]);
    $UserBalances = F::Extract($UserBalances, 'Balance')['Balance'];
    $Call['Balance'] = ['Users' => array_sum($UserBalances)];
    return $Call;
});
setFn('Currency', function ($Call) {
    $Currencies = F::loadOptions('Finance.Currency')['Currencies'];
    foreach ($Currencies as $From => $Pair) {
        foreach ($Pair as $Currency => $Live) {
            $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'list-group-item', 'Value' => '1 ' . $From . ' = ' . F::Live($Live['Rate'], $Call) . ' ' . $Currency];
        }
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:23,代码来源:Control.php

示例4: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Call['Rights'] = F::loadOptions('Security.Access.Rights')['Access']['Rights'];
    return F::Run(null, $Call['HTTP']['Method'], $Call);
});
setFn('GET', function ($Call) {
    $User = F::Run('Entity', 'Read', $Call, ['Entity' => 'User', 'One' => true]);
    $Rights = (array) explode(',', $User['Rights']);
    $Call['Output']['Content']['Form'] = ['Type' => 'Form'];
    foreach ($Call['Rights'] as $RightName => $Right) {
        $Call['Output']['Form'][] = ['Type' => 'Form.Checkbox', 'Name' => 'Rights[' . $RightName . ']', 'TrueValue' => true, 'Label' => 'User.Rights:' . $RightName, 'Value' => in_array($RightName, $Rights)];
    }
    return $Call;
});
setFn('POST', function ($Call) {
    if (!isset($Call['Request']['Rights']) or null == $Call['Request']['Rights']) {
        $NewRights = '';
    } else {
        $NewRights = implode(',', array_keys($Call['Request']['Rights']));
    }
    F::Run('Entity', 'Update', ['Entity' => 'User', 'Where' => $Call['Where'], 'One' => true, 'Data' => ['Rights' => $NewRights]]);
    $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'alert alert-success', 'Value' => 'OK'];
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Rights.php

示例5: setFn

<?php

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

示例6: foreach

                $Table[] = ['Status', 'Offline'];
            } else {
                $Table[] = ['Status', 'Online'];
                $Table[] = ['Total', F::Run('Formats.Number.French', 'Do', ['Value' => $Stats[0]['_all']['total']['docs']['count']])];
                foreach ($SearchOptions['Search']['Provider'] as $Mount) {
                    if ($Mount['Driver'] == 'Search.Provider.Elastic') {
                        $Result = F::Run('IO', 'Read', ['Storage' => 'Web', 'Format' => 'Formats.JSON', 'Where' => $Host . '/' . $SearchOptions['Search']['Index'] . '/_search/?type=' . $Mount['Type'] . '&search_type=count']);
                        $Table[] = ['<l>' . $Mount['Scope'] . '.Control:Title</l>', F::Run('Formats.Number.French', 'Do', ['Value' => $Result[0]['hits']['total']])];
                    }
                }
            }
            $Call['Output']['Content'][] = ['Type' => 'Table', 'Value' => $Table];
        }
    }
    return $Call;
});
setFn('Menu', function ($Call) {
    $SearchOptions = F::loadOptions('Search');
    $ElasticOptions = F::loadOptions('Search.Provider.Elastic');
    $Hosts = $ElasticOptions['Elastic Search']['Options']['hosts'];
    $OnlineHosts = 0;
    foreach ($Hosts as $Host) {
        $Stats = F::Run('IO', 'Read', ['Storage' => 'Web', 'Format' => 'Formats.JSON', 'Where' => $Host . '/' . $SearchOptions['Search']['Index'] . '/_stats']);
        if ($Stats[0] === null) {
        } else {
            $OnlineHosts++;
        }
    }
    $Call['Count'] = $OnlineHosts . '/' . count($Hosts);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Control.php

示例7: setFn

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    if (!isset($Call['Bundle'])) {
        $Call['Bundle'] = isset($Call['Start']) ? $Call['Start'] : 'Project';
    }
    if (!isset($Call['Option'])) {
        $Call['Option'] = 'Do';
    }
    F::Log($Call['Bundle'] . ' ' . $Call['Option'] . ' started', LOG_NOTICE);
    $Call = F::loadOptions($Call['Bundle'] . '.Control', null, $Call);
    $Call = F::Apply($Call['Bundle'] . '.Control', $Call['Option'], $Call);
    $Call['Layouts'][] = ['Scope' => $Call['Bundle'], 'ID' => 'Control'];
    $Navigation = [];
    F::Log('Control Panel Navigation', LOG_NOTICE);
    if (isset($Call['Bundles'])) {
        foreach ($Call['Bundles'] as $Group => $Bundles) {
            if (in_array($Call['Bundle'], $Bundles)) {
                $Call['Group'] = $Group;
            }
            $GroupOptions = [];
            foreach ($Bundles as $Bundle) {
                $Options = ['ID' => $Bundle, 'Bundle' => strtr($Bundle, '.', '/'), 'URL' => '/control/' . $Bundle, 'Title' => '<l>' . $Bundle . '.Control:Title</l>', 'Group' => $Group, 'Status' => 'default'];
                if (isset($Call['Icons'][$Bundle])) {
                    $Options['Icon'] = $Call['Icons'][$Bundle];
                }
开发者ID:trickyplan,项目名称:codeine,代码行数:30,代码来源:Panel.php

示例8: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Run', function ($Call) {
    $Script = F::loadOptions($Call['Run'], null, [], 'Scripts');
    $VCall = $Call;
    $VCall['Environment'] = F::Environment();
    foreach ($Script as $Run) {
        $VCall = F::Live($Run, $VCall);
    }
    $Call['Output']['Content'] = [$VCall];
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:18,代码来源:Script.php

示例9: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 7.x
 */
setFn('Index', function ($Call) {
    $Model = F::loadOptions($Call['Entity'] . '.Entity');
    $Call = F::loadOptions('IO', null, $Call);
    foreach ($Model['Nodes'] as $Name => $Node) {
        if (isset($Node['Index']) && $Node['Index']) {
            F::Run('IO', 'Execute', $Call, ['Storage' => $Model['Storage'], 'Execute' => 'Create Index', 'Node' => $Name]);
        }
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:18,代码来源:Storage.php

示例10: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    if (F::Run('Code.Flow.Daemon', 'Running?', $Call) == true) {
        $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'alert alert-success', 'Value' => '<l>Code.Flow.Daemon:Status.Started</l>'];
    } else {
        $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'alert alert-danger', 'Value' => '<l>Code.Flow.Daemon:Status.Stopped</l>'];
    }
    $Call['Daemon'] = F::loadOptions('Code.Flow.Daemon');
    $Table = [['<l>Code.Flow.Daemon:Daemon.Title</l>', '<l>Code.Flow.Daemon:Daemon.Frequency</l>']];
    foreach ($Call['Daemon']['Daemons'] as $DaemonName => $DaemonRun) {
        $Table[] = [$DaemonName, 60 / $DaemonRun['Frequency']];
    }
    $Call['Output']['Content'][] = ['Type' => 'Table', 'Class' => 'table table-striped', 'Value' => $Table];
    return $Call;
});
setFn('Menu', function ($Call) {
    return ['Count' => F::Run('Code.Run.Delayed', 'Count', $Call)];
});
setFn('Log', function ($Call) {
    $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'console-inverse', 'Value' => shell_exec('tail -n50 /var/log/codeined.log')];
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:29,代码来源:Control.php

示例11: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    foreach ($Call['Sensors'] as $Sensor) {
        $Sensors[$Sensor] = F::Run(null, $Sensor, $Call);
    }
    return $Sensors;
});
setFn('Version', function ($Call) {
    return F::loadOptions('Version')['Project'];
});
开发者ID:trickyplan,项目名称:codeine,代码行数:17,代码来源:Monitor.php

示例12: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    // Check port present? Why i'm doing this?
    /* if (preg_match('/:/', $_SERVER['HTTP_HOST']))
       list ($_SERVER['HTTP_HOST'], $Call['HTTP']['Port']) = explode(':', $_SERVER['HTTP_HOST']);*/
    F::Log('Host Strategy *' . $Call['HTTP']['Host Strategy'] . '* selected', LOG_INFO);
    $Call = F::Apply($Call['HTTP']['Host Strategy'], 'Do', $Call);
    if (isset($Call['HTTP']['Domain'])) {
    } else {
        $Call['HTTP']['Domain'] = $Call['HTTP']['Host'];
    }
    F::Log('Host is *' . $Call['HTTP']['Host'] . '*', LOG_INFO);
    $Call = F::loadOptions($Call['HTTP']['Host'], null, $Call);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:22,代码来源:Host.php

示例13: setFn

/* Codeine
 * @author bergstein@trickyplan.com
 * @description <k> tag 
 * @package Codeine
 * @version 8.x
 */
setFn('Parse', function ($Call) {
    $Call['Parsed'] = F::Run('Text.Regex', 'All', ['Pattern' => $Call['Call Pattern'], 'Value' => $Call['Output']]);
    if (empty($Call['Parsed'])) {
    } else {
        $Call['Parsed'][0] = array_unique($Call['Parsed'][0]);
        $Call['Parsed'][1] = array_unique($Call['Parsed'][1]);
        foreach ($Call['Parsed'][1] as $IX => $Match) {
            if (mb_strpos($Match, ':') !== false) {
                list($Options, $Key) = explode(':', $Match);
                $Call = F::Dot($Call, $Options, F::loadOptions($Options));
                $Match = $Options . '.' . $Key;
            }
            if (mb_strpos($Match, ',') !== false) {
                $Submatches = explode(',', $Match);
                foreach ($Submatches as $Submatch) {
                    if (($Matched = F::Dot($Call, $Submatch)) !== null) {
                        $Match = $Submatch;
                        break;
                    }
                }
            }
            if (($Matched = F::Dot($Call, $Match)) !== null) {
                if (is_array($Matched)) {
                    $Matched = j($Matched);
                }
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Call.php

示例14: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 7.4
 */
setFn('Load', function ($Call) {
    if (!isset($Call['Entity'])) {
        F::Log('Entity not defined.', LOG_ERR);
        return null;
    }
    $Call['Nodes'] = $Call['Default Nodes'];
    $Call = F::Hook('beforeEntityLoad', $Call);
    $Model = F::loadOptions($Call['Entity'] . '.Entity');
    // FIX Validate
    if (!empty($Model)) {
        if (!isset($Model['EV'])) {
            $Model['EV'] = 1;
        }
        $Call = F::Merge($Call, $Model);
    } else {
        F::Log('Model for ' . $Call['Entity'] . ' not found', LOG_CRIT);
    }
    if (isset($Call['Nodes'])) {
        $Call['Nodes'] = F::Sort($Call['Nodes'], 'Weight', SORT_DESC);
    } else {
        F::Log('Nodes not loaded', LOG_WARNING);
    }
    $Call = F::Hook('afterEntityLoad', $Call);
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Entity.php

示例15: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
include_once 'phpQuery/phpQuery.php';
setFn('Do', function ($Call) {
    //    $Call['Markup'] = mb_convert_encoding($Call['Markup'], 'utf-8', 'cp1251');
    $Call = F::loadOptions('Parser/' . $Call['Schema'], null, $Call);
    $Data = $Call['Data'] = [];
    $Keys = 0;
    if (isset($Call['Nodes'])) {
        if (empty($Call['Nodes'])) {
            F::Log('Parser Nodes are *empty*', LOG_ERR);
        } else {
            F::Log('Loaded *' . count($Call['Nodes']) . '* Parser Nodes', LOG_INFO);
            phpQuery::newDocumentHTML($Call['Markup']);
            F::Log('Loaded *' . strlen($Call['Markup']) . '* bytes of markup', LOG_INFO);
            foreach ($Call['Nodes'] as $Key => $Rule) {
                if (isset($Rule['XPath'])) {
                    if (isset($XML)) {
                    } else {
                        $DOM = new DOMDocument('1.0', 'utf-8');
                        $DOM->loadHTML($Call['Markup']);
                        $DOMXPath = new DOMXPath($DOM);
                    }
                    $nodes = $DOMXPath->query($Rule['XPath']);
                    foreach ($nodes as $i => $node) {
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Parser.php


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