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


PHP Fx::complete方法代码示例

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


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

示例1: route

 public function route($url = null, $context = null)
 {
     $thumbs_path = fx::path()->http('@thumbs');
     $thumbs_path_trimmed = fx::path()->removeBase($thumbs_path);
     if (substr($url, 0, strlen($thumbs_path_trimmed)) !== $thumbs_path_trimmed) {
         return null;
     }
     $dir = substr($url, strlen($thumbs_path_trimmed));
     preg_match("~/([^/]+)(/.+\$)~", $dir, $parts);
     $config = $parts[1];
     $source_path = $parts[2];
     $source_abs = fx::path($source_path);
     if (!file_exists($source_abs)) {
         return null;
     }
     $target_dir = dirname(fx::path('@home/' . $url));
     if (!file_exists($target_dir) || !is_dir($target_dir)) {
         return null;
     }
     $config = $config . '.async-false.output-true';
     $config = \Floxim\Floxim\System\Thumb::readConfigFromPathString($config);
     fx::image($source_path, $config);
     fx::complete();
     die;
 }
开发者ID:floxim,项目名称:floxim,代码行数:25,代码来源:Thumb.php

示例2:

<?php

use Floxim\Floxim\System\Fx as fx;
// if request directs right to /floxim/index.php
// e.g. admin interface
// current dir /vendor/floxim/floxim/
//require_once(dirname(__FILE__) . '/../../../boot.php');
$boot = $_SERVER['DOCUMENT_ROOT'] . '/boot.php';
require_once $boot;
register_shutdown_function(function () {
    if (!fx::env()->get('complete_ok')) {
        $ob_level = ob_get_level();
        $res = '';
        for ($i = 0; $i < $ob_level; $i++) {
            $res .= ob_get_clean();
        }
        if (fx::config('dev.on')) {
            echo fx::page()->postProcess($res);
        }
        fx::log('down', $res, $_SERVER, $_POST);
    }
});
$result = fx::router()->route();
if ($result) {
    $result = $result instanceof \Floxim\Floxim\System\Controller ? $result->process() : $result;
    if (fx::env('ajax')) {
        fx::page()->addAssetsAjax();
    }
    echo $result;
    fx::complete();
}
开发者ID:floxim,项目名称:floxim,代码行数:31,代码来源:index.php

示例3: doLivesearch

 public function doLivesearch()
 {
     $input = $_POST;
     $params = isset($input['params']) ? (array) $input['params'] : array();
     $id_field = isset($params['id_field']) ? $params['id_field'] : 'id';
     if (isset($params['relation_field_id'])) {
         $entity_data = array();
         $field = fx::data('field')->getById((int) $params['relation_field_id']);
         if (isset($input['form_data'])) {
             $form_data = (array) $input['form_data'];
             $entity_data = isset($form_data['content']) ? $form_data['content'] : array();
             $entity_type = isset($form_data['content_type']) ? $form_data['content_type'] : null;
         }
         if (!$entity_type) {
             $entity_type = isset($params['linking_entity_type']) ? $params['linking_entity_type'] : $field['component']['keyword'];
         }
         $entity_finder = fx::data($entity_type);
         $entity_id = isset($params['entity_id']) && $params['entity_id'] ? (int) $params['entity_id'] : null;
         if ($entity_id) {
             $entity = $entity_finder->getById($entity_id);
         } else {
             $entity = $entity_finder->create();
         }
         $entity->setFieldValues($entity_data);
         $finder = $field->getTargetFinder($entity);
         if (isset($params['content_type'])) {
             $finder->hasType($params['content_type']);
         }
     } else {
         if (!isset($input['content_type'])) {
             return;
         }
         $content_type = $input['content_type'];
         $finder = fx::data($content_type);
         if ($finder instanceof \Floxim\Main\Content\Finder and $content_type != 'user') {
             $finder->where('site_id', fx::env('site')->get('id'));
         }
     }
     if (isset($input['skip_ids']) && is_array($input['skip_ids'])) {
         $finder->where($id_field, $input['skip_ids'], 'NOT IN');
     }
     if (isset($input['ids'])) {
         $finder->where($id_field, $input['ids']);
     }
     if (isset($input['conditions'])) {
         $finder->livesearchApplyConditions($input['conditions']);
     }
     $term = isset($input['term']) ? $input['term'] : '';
     $limit = isset($input['limit']) ? $input['limit'] : 20;
     $res = $finder->livesearch($term, $limit, $id_field);
     // sort items in the original way
     if (isset($input['ids'])) {
         $results = fx::collection($res['results']);
         $res['results'] = array();
         foreach ($input['ids'] as $id) {
             $item = $results->findOne($id_field, $id);
             if ($item) {
                 $res['results'][] = $item;
             }
         }
     }
     fx::complete($res);
 }
开发者ID:floxim,项目名称:module-main,代码行数:63,代码来源:Controller.php


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