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


PHP F::Run方法代码示例

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


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

示例1: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description Data.Types.Input
 * @package Codeine
 * @version 8.x
 */
setFn('Write', function ($Call) {
    if (isset($Call['Dry'])) {
    } else {
        foreach ($Call['Nodes'] as $Name => $Node) {
            if (isset($Node['Type']) && F::Dot($Call['Data'], $Name) !== null) {
                $Call['Data'] = F::Dot($Call['Data'], $Name, F::Run('Data.Type.' . $Node['Type'], 'Write', $Call, $Node, ['Entity' => $Call['Entity'], 'Name' => $Name, 'Node' => $Node, 'Data' => $Call['Data'], 'Purpose' => isset($Call['Purpose']) ? $Call['Purpose'] : '', 'Value' => F::Dot($Call, 'Data.' . $Name), 'Old' => F::Dot($Call, 'Current.' . $Name)]));
            }
        }
    }
    return $Call;
});
setFn('Read', function ($Call) {
    foreach ($Call['Nodes'] as $Name => $Node) {
        if (isset($Node['Type']) && F::Dot($Call['Data'], $Name) !== null or isset($Node['External'])) {
            $Call['Data'] = F::Dot($Call['Data'], $Name, F::Run('Data.Type.' . $Node['Type'], 'Read', $Call, ['Entity' => $Call['Entity'], 'Name' => $Name, 'Node' => $Node, 'Data' => $Call['Data'], 'Purpose' => isset($Call['Purpose']) ? $Call['Purpose'] : '', 'Value' => F::Dot($Call['Data'], $Name)]));
        }
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:27,代码来源:Type.php

示例2: setFn

setFn('Do', function ($Call) {
    $IP = $_SERVER['REMOTE_ADDR'];
    foreach ($Call['IP']['Headers'] as $Header) {
        if (isset($_SERVER['HTTP_' . $Header])) {
            $IP = $_SERVER['HTTP_' . $Header];
            break;
        }
    }
    if ($IP == '127.0.0.1' && isset($Call['IP']['Pingback'])) {
        if (($IP = F::Run('IO', 'Read', $Call, ['Storage' => 'Cookie', 'Where' => 'DeveloperIP'])) == null) {
            $Pingback = F::Run('IO', 'Read', ['Storage' => 'Web', 'Where' => $Call['IP']['Pingback'], 'IO One' => true]);
            if (preg_match($Call['IP']['Regex'], $Pingback, $Pockets)) {
                $IP = $Pockets[0];
            } else {
                $IP = '127.0.0.1';
            }
            F::Run('IO', 'Write', $Call, ['Storage' => 'Cookie', 'Where' => 'DeveloperIP', 'Data' => $IP]);
            F::Log('Pingback IP: *' . $IP . '* from *' . $Call['IP']['Pingback'] . '*', LOG_INFO);
        } else {
            F::Log('Pingback IP: *' . $IP . '* from *Cookie*', LOG_INFO);
        }
    } else {
        if (isset($Call['IP']['Substitute'][$IP])) {
            F::Log('IP substituted from *' . $IP . '* to ' . $Call['IP']['Substitute'][$IP], LOG_INFO);
            $IP = $Call['IP']['Substitute'][$IP];
        }
    }
    $Call['HTTP']['IP'] = $IP;
    F::Log('User IP: ' . $IP, LOG_INFO);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:IP.php

示例3: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Check', function ($Call) {
    $Call['Scan'] = jd(F::Run('IO', 'Write', ['Storage' => 'Web', 'Where' => 'https://www.virustotal.com/vtapi/v2/url/scan', 'Data' => ['apikey' => '058a90c9a1ecb024cdc3f11dde2e90c469deb1760abe38994e20db0e4e15093f', 'url' => 'http://trickyplan.ru/img/logo.png']]), true);
    return $Call['Scan']['scan_id'];
});
setFn('Report', function ($Call) {
    $Report = jd(F::Run('IO', 'Write', ['Storage' => 'Web', 'Where' => 'http://www.virustotal.com/vtapi/v2/url/report', 'Data' => ['apikey' => '058a90c9a1ecb024cdc3f11dde2e90c469deb1760abe38994e20db0e4e15093f', 'resource' => $Call['Value']]]), true);
    if ($Report['response_code'] == 1) {
        if ($Report['positives'] == 0) {
            return 'Clean';
        } else {
            return 'Danger';
        }
    } else {
        return 'Scanning';
    }
});
开发者ID:trickyplan,项目名称:codeine,代码行数:24,代码来源:VirusTotal.php

示例4: 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

示例5: setFn

    $Call['Layouts'][] = ['Scope' => 'Parser', 'ID' => 'URL'];
    return $Call;
});
setFn('POST', function ($Call) {
    $Call['URL'] = $Call['Request']['Data']['URL'];
    $Call['Data'] = F::Run('Parser.URL', 'Parse', $Call);
    $Call['Output']['Content'][] = ['Type' => 'Block', 'Value' => j($Call['Data'])];
    return $Call;
});
setFn('Parse', function ($Call) {
    if ($Call['Schema'] = F::Run('Parser', 'Discovery', $Call)) {
        F::Log('Schema is ' . $Call['Schema'], LOG_INFO);
        $Schema = F::loadOptions('Parser/' . $Call['Schema']);
        $Call = F::Merge($Call, $Schema);
        $Result = F::Live($Call['Parser']['URL']['Backend'], ['Where' => ['ID' => $Call['URL']]]);
        $Result = array_pop($Result);
        $Call = F::Run('Parser', 'Do', $Call, ['Markup' => $Result]);
        $Slices = explode('/', $Call['Schema']);
        $Call['Entity'] = array_pop($Slices);
        $Call['Data']['Source'] = $Call['URL'];
        if (isset($Call['Parser']['Create']['Auto']) && $Call['Parser']['Create']['Auto']) {
            $Call['Data'] = F::Run('Entity', 'Create', $Call, ['One' => true]);
        }
        if (isset($Call['Data']['ID'])) {
            $Call = F::Run('System.Interface.HTTP', 'Redirect', $Call, ['Redirect' => '/control/' . $Call['Entity'] . '/Show/' . $Call['Data']['ID']]);
        }
    } else {
        $Call['Data'] = null;
    }
    return $Call['Data'];
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:URL.php

示例6: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 7.4.5
 */
setFn('Do', function ($Call) {
    $Elements = F::Run('Entity', 'Read', ['Entity' => 'Notify', 'Where' => ['User' => isset($Call['Session']['User']['ID']) ? $Call['Session']['User']['ID'] : $Call['SID'], 'read' => 0]]);
    if (!empty($Elements)) {
        foreach ($Elements as $Element) {
            F::Run('Entity', 'Update', $Call, ['Entity' => 'Notify', 'Where' => $Element['ID'], 'Data' => ['Read' => time()]]);
        }
        $Call['Output']['Content'] = $Elements;
    } else {
        $Call['Output']['Content'] = [];
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:20,代码来源:Subscribe.php

示例7: 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

示例8: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Detect', function ($Call) {
    $GeoIP = F::Run('System.GeoIP', 'LatLon', ['Value' => F::Run('System.Interface.HTTP.IP', 'Get')]);
    if (isset($GeoIP['Lat'])) {
        $Call['Session']['Lat'] = $GeoIP['Lat'];
        $Call['Session']['Long'] = $GeoIP['Lon'];
        $Cities = F::Run('Entity', 'Read', ['Entity' => 'Location']);
        $Sorted = [];
        foreach ($Cities as $Location) {
            $Sorted[$Location['ID']] = F::Run('Science.Geography.Distance', 'Calc', ['From' => $Call['Session'], 'To' => $Location]);
            F::Log('Distance to ' . $Location['Title'] . ' is ' . $Sorted[$Location['ID']] . ' km', LOG_INFO);
        }
        asort($Sorted);
        list($DeterminedLocation) = each($Sorted);
        F::Log('Location determined', LOG_INFO);
    } else {
        $DeterminedLocation = 1;
    }
    return $DeterminedLocation;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:27,代码来源:NearestGeoIP.php

示例9: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Get', function ($Call) {
    if (isset($Call['Data']['ID'])) {
        return F::Run('Entity', 'Count', ['Entity' => 'Comment', 'Where' => ['Entity' => $Call['Entity'], 'Object' => $Call['Data']['ID']]]);
    } else {
        return 0;
    }
});
开发者ID:trickyplan,项目名称:codeine,代码行数:15,代码来源:Count.php

示例10: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Do', function ($Call) {
    $Message['Scope'] = $Call['To'];
    // FIXME
    $Message['ID'] = $Call['Subject'];
    $Message['Data'] = F::Run('View', 'Load', $Call, ['Scope' => $Call['Entity'], 'ID' => 'Show/EMail']);
    $Message['Headers'] = array('Content-type:' => ' text/html; charset="utf-8"');
    F::Run('Code.Run.Delayed', 'Run', ['Run' => F::Merge($Call['Sender'], ['Call' => $Message])]);
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:17,代码来源:Send.php

示例11: count

                } else {
                    $Table[] = ['<l>' . $Call['Entity'] . '.Entity:' . $Name . '</l>', $OldValue, $NewValue];
                }
            }
            $Call['Output']['Content'][] = ['Type' => 'Table', 'Value' => $Table];
        }
        $Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'alert alert-success', 'Value' => count($New) . ' object touched'];
    }
    $Call = F::Hook('afterTouch', $Call);
    return $Call;
});
setFn('All', function ($Call) {
    $Call = F::Apply('Entity', 'Load', $Call);
    $Total = F::Run('Entity', 'Count', $Call);
    $Amount = ceil($Total / $Call['All']['Limit']);
    set_time_limit(10 * $Total);
    $Call = F::Apply('Code.Progress', 'Start', $Call);
    $Call['Progress']['Max'] = $Amount;
    for ($i = 0; $i < $Amount; $i++) {
        F::Run('Entity', 'Update', ['Entity' => $Call['Entity'], 'Where' => $Call['Where'], 'Data' => [], 'One' => false, 'Limit' => ['From' => $i * $Call['All']['Limit'], 'To' => ($i + 1) * $Call['All']['Limit']]]);
        $Call['Progress']['Now']++;
        $Call = F::Apply('Code.Progress', 'Log', $Call);
        F::Log('Touch Iteration № ' . ($i + 1) / $Amount, LOG_NOTICE);
    }
    $Call = F::Apply('Code.Progress', 'Finish', $Call);
    $Call['Output']['Content'][] = $Total . ' elements processed';
    return $Call;
});
setFn('Test', function ($Call) {
    F::Run(null, "All", $Call, ['Entity' => 'User', 'Where' => ['ID' => ['$gt' => 3]], 'Live Fields' => ['VKontakte.DOB']]);
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Touch.php

示例12: setFn

<?php

/* Codeine
 * @author BreathLess
 * @description  
 * @package Codeine
 * @version 7.x
 */
setFn('List Sitemap Indexes', function ($Call) {
    $Call['Output'] = ['Root' => 'sitemapindex', 'Content' => []];
    $Call['Sitemap Indexes'] = [];
    foreach ($Call['Sitemap']['Handlers'] as $Name => $Handler) {
        $SitemapsCount = F::Run($Handler['Driver'], 'Sitemaps Count', $Call, $Handler);
        $IndexesCount = ceil($SitemapsCount / $Call['Sitemap']['Limits']['Sitemap Per Index']);
        for ($SI = 1; $SI <= $IndexesCount; $SI++) {
            $Call['Sitemap Indexes'][] = $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . '/sitemap/' . $Name . '-' . $SI . '.xml';
            $Call['Output']['Content'][] = ['sitemap' => ['loc' => $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . '/sitemap/' . $Name . '-' . $SI . '.xml']];
        }
    }
    return $Call;
});
setFn('Show Sitemap Index', function ($Call) {
    $Call = F::Hook('beforeSitemapIndexShow', $Call);
    $Call['Output'] = ['Root' => 'sitemapindex', 'Content' => []];
    $Handler = $Call['Sitemap']['Handlers'][$Call['Index']];
    $Call = F::Apply($Handler['Driver'], null, $Call, $Handler);
    $Call = F::Hook('afterSitemapIndexShow', $Call);
    return $Call;
});
setFn('Sitemap', function ($Call) {
    $Call = F::Hook('beforeSitemapShow', $Call);
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:Sitemap.php

示例13: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Open', function ($Call) {
    return F::Run('IO.Storage.Redis', 'Open', $Call);
});
setFn('Read', function ($Call) {
    F::Log('Pull: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    if (($Result = $Call['Link']->lPop($Call['Scope'] . $Call['Queue'])) !== false) {
        return [jd($Result, true)];
    } else {
        return null;
    }
});
setFn('Write', function ($Call) {
    F::Log('Push: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    return $Call['Link']->rPush($Call['Scope'] . $Call['Queue'], j($Call['Data']));
});
setFn('Count', function ($Call) {
    F::Log('Count: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
    return $Call['Link']->lLen($Call['Scope'] . $Call['Queue']);
});
开发者ID:trickyplan,项目名称:codeine,代码行数:27,代码来源:Redis.php

示例14: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description  
 * @package Codeine
 * @version 8.x
 */
setFn('Run', function ($Call) {
    if (sys_getloadavg()[0] > $Call['Throttler']['CPU Limit']) {
        F::Run('System.Sleep', 'Do', ['Seconds' => $Call['Throttler']['Seconds']]);
        F::Log('Throttled on ' . $Call['Throttler']['Seconds'] . ' seconds', LOG_INFO);
    }
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:15,代码来源:Throttler.php

示例15: setFn

<?php

/* Codeine
 * @author bergstein@trickyplan.com
 * @description HTML Textfield Driver 
 * @package Codeine
 * @version 8.x
 */
setFn('Make', function ($Call) {
    if (is_array($Call['Value'])) {
        $Call['Value'] = implode(',', $Call['Value']);
    }
    return F::Run('View.HTML.Widget.Base', 'Make', $Call, ['Tag' => 'input', 'Type' => 'hidden']);
});
开发者ID:trickyplan,项目名称:codeine,代码行数:14,代码来源:Hidden.php


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