本文整理汇总了PHP中Floxim\Floxim\System\Fx::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::log方法的具体用法?PHP Fx::log怎么用?PHP Fx::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recountFiles
public function recountFiles()
{
$modified_params = $this->getModifiedParams();
$fxPath = fx::path();
foreach ($modified_params as $field => $params) {
$all_params = $this[$field];
foreach ($params as $pk => $pv) {
if (self::checkValueIsFile($pv['new'])) {
fx::log($pv, 'is file');
$ib = $this['infoblock'];
$site_id = $ib ? $ib['site_id'] : fx::env('site_id');
$file_name = $fxPath->fileName($pv['new']);
$new_path = $fxPath->abs('@content_files/' . $site_id . '/visual/' . $file_name);
$move_from = $fxPath->abs($pv['new']);
if (file_exists($move_from)) {
fx::files()->move($move_from, $new_path);
$all_params[$pk] = $fxPath->removeBase($fxPath->http($new_path));
}
}
if ($pv['old']) {
$old_path = $fxPath->abs(FX_BASE_URL . $pv['old']);
if (self::checkValueIsFile($old_path)) {
fx::files()->rm($old_path);
}
}
}
$this[$field] = $all_params;
}
}
示例2: route
public function route($url = null, $context = null)
{
$thumbs_path = fx::path()->http('@thumbs');
if (substr($url, 0, strlen($thumbs_path)) !== $thumbs_path) {
return null;
}
$dir = substr($url, strlen($thumbs_path));
preg_match("~/([^/]+)(/.+\$)~", $dir, $parts);
$config = $parts[1];
$source_path = $parts[2];
$source_abs = fx::path($source_path);
if (!file_exists($source_abs)) {
echo 'nof';
return null;
}
$target_dir = dirname(fx::path($url));
if (!file_exists($target_dir) || !is_dir($target_dir)) {
echo 'notarg';
return null;
}
$config = $config . '.async-false.output-true';
$config = \Floxim\Floxim\System\Thumb::readConfigFromPathString($config);
fx::image($source_path, $config);
fx::log('thumb done');
fx::complete();
die;
}
示例3: install
public function install(\Floxim\Floxim\Component\Infoblock\Entity $ib, $ctr, $params)
{
if (!isset($params['form_id']) || !$params['form_id']) {
$form = fx::data('floxim.form.form')->create(array('name' => 'My new form'));
$form->save();
$ib->digSet('params.form_id', $form['id']);
$ib->save();
fx::log('ib savd', $ib, $params, $form);
}
}
示例4: getData
public function getData()
{
$data = parent::getData();
$types_by_id = $data->getValues('type', 'id');
unset($types_by_id['']);
if (count($types_by_id) == 0) {
return $data;
}
$base_component = fx::component($this->component_id);
$base_type = $base_component['keyword'];
$base_table = $base_component->getContentTable();
$types = array();
foreach ($types_by_id as $id => $type) {
if ($type != $base_type) {
if (!isset($types[$type])) {
$types[$type] = array();
}
$types[$type][] = $id;
}
}
foreach ($types as $type => $ids) {
if (!$type) {
continue;
}
$type_tables = array_reverse(fx::data($type)->getTables());
$missed_tables = array();
foreach ($type_tables as $table) {
if ($table == $base_table) {
break;
}
$missed_tables[] = $table;
}
$base_missed_table = array_shift($missed_tables);
if (!$base_missed_table) {
fx::log('empty base table');
continue;
}
$q = "SELECT * FROM `{{" . $base_missed_table . "}}` \n";
foreach ($missed_tables as $mt) {
$q .= " INNER JOIN `{{" . $mt . '}}` ON `{{' . $mt . '}}`.id = `{{' . $base_missed_table . "}}`.id\n";
}
$q .= "WHERE `{{" . $base_missed_table . "}}`.id IN (" . join(", ", $ids) . ")";
$extensions = fx::db()->getIndexedResults($q);
foreach ($data as $data_index => $data_item) {
if (isset($extensions[$data_item['id']])) {
$data[$data_index] = array_merge($data_item, $extensions[$data_item['id']]);
}
}
}
return $data;
}
示例5: up
protected function up()
{
$new_fields = array(array('keyword' => 'is_published', 'name_en' => 'Is published?', 'name_ru' => '', 'type' => '5', 'not_null' => '0', 'priority' => '267', 'searchable' => '0', 'default' => '1', 'type_of_edit' => '1', 'checked' => '1', 'form_tab' => '0'), array('keyword' => 'is_branch_published', 'name_en' => 'Is branch published?', 'name_ru' => '', 'type' => '5', 'not_null' => '0', 'priority' => '268', 'searchable' => '0', 'default' => '1', 'type_of_edit' => '3', 'checked' => '1', 'form_tab' => '0'));
$content_id = fx::data('component', 'content')->get('id');
foreach ($new_fields as $field_props) {
$field_props['component_id'] = $content_id;
$field = fx::data('field')->create($field_props);
$field->save();
fx::log('add field', $field);
}
fx::data('component')->dropStoredStaticCache();
fx::db()->query('update {{floxim_main_content}} set is_published = 1, is_branch_published = 1');
fx::cache('meta')->delete('schema');
}
示例6: addSave
public function addSave($input)
{
$result = array('status' => 'ok');
$data['name'] = trim($input['name']);
$data['keyword'] = $this->getFullKeyword($input);
$widget = fx::data('widget')->create($data);
if (!$widget->validate()) {
$result['status'] = 'error';
$result['errors'] = $widget->getValidateErrors();
$result['text'] = 'Error';
fx::log('invald', $result);
return $result;
}
$widget->save();
fx::console('widget scaffold --id=' . $widget['id']);
$result['reload'] = '#admin.widget.all';
return $result;
}
示例7: addSave
public function addSave($input)
{
$result = array('status' => 'ok');
$lang = fx::data('lang')->create(array('en_name' => $input['en_name'], 'native_name' => $input['native_name'], 'lang_code' => $input['lang_code']));
if (!$lang->validate()) {
$result['status'] = 'error';
$result['errors'] = $lang->getValidateErrors();
return $result;
}
try {
fx::log('saving', $lang);
$lang->save();
fx::log('svd', $lang);
} catch (Exception $e) {
$result['status'] = 'error';
$result['text'][] = $e->getMessage();
}
return $result;
}
示例8: beforeInsert
protected function beforeInsert()
{
$entities = $this->getMultilangEntities();
fx::log('ess', $entities);
foreach ($entities as $e) {
$fields = fx::data($e)->getMultiLangFields();
fx::log('fld', $e, $fields);
if (count($fields) > 0) {
$q = "ALTER TABLE `{{" . $e . "}}` ";
$parts = array();
foreach ($fields as $f) {
$parts[] = "ADD COLUMN `" . $f . "_" . $this['lang_code'] . "` VARCHAR(255) ";
}
$q .= join(", ", $parts);
fx::log('qr', $q);
fx::db()->query($q);
}
}
}
示例9: doColumns
public function doColumns()
{
$cols = $this->getParam('cols', 'n-w');
$parts = explode("-", $cols);
$res = array();
$count_wide = 0;
foreach ($parts as $col_num => $col) {
$res[] = array('keyword' => 'col_' . ($col_num + 1), 'size' => $col === 'n' ? 'narrow' : 'wide', 'width' => $col);
if ($col === 'w') {
$count_wide++;
}
}
return array('areas' => $res, 'cols' => $cols, 'count_wide' => $count_wide);
$form = $this->ajaxForm();
$form->addFields(array('test' => array('type' => 'text', 'label' => "Test", 'value' => 'ok'), 'livesearch' => array('type' => 'livesearch', 'label' => 'Complex', 'values' => array('test' => 'Test <b>So</b> Cool!<br /><span style='font-size:12px; color:#999;'>not joking</span>', 'west' => 'West'), 'value' => array('test'), 'is_multiple' => true, 'params' => array('multiple' => true)), 'cnt' => array('type' => 'livesearch', 'label' => 'Section', 'is_multiple' => true, 'params' => array('content_type' => 'floxim.nav.section'))));
if ($form->isSent()) {
fx::log($form, $form->getValues());
}
$this->assign('form', $form);
}
示例10: init
public function init()
{
fx::template()->import('floxim.layout.wrapper');
fx::listen('before_save', function ($e) {
$entity = $e['entity'];
if (!$entity instanceof \Floxim\Floxim\Component\InfoblockVisual\Entity) {
return;
}
if (!preg_match("~column_new-in-(\\d+)~", $entity['area'], $column_infoblock_id)) {
return;
}
$column_infoblock_id = $column_infoblock_id[1];
$column = fx::data('floxim.layout.column')->create(array('infoblock_id' => $column_infoblock_id));
if (preg_match("~(before|after)-(\\d+)~", $entity['area'], $rel_col)) {
$column['__move_' . $rel_col[1]] = $rel_col[2];
}
fx::log($rel_col, $column);
$column->save();
$entity['area'] = $column['area_keyword'];
});
}
示例11: route
/**
* Perform all registered routers, to return most suitable controller
* @param string $url
* @param array $context
* @return fx_controller
*/
public function route($url = null, $context = array())
{
if (is_null($url)) {
$url = getenv('REQUEST_URI');
}
if (!isset($context['site_id'])) {
$env_site = fx::env('site');
$context['site_id'] = $env_site ? $env_site['id'] : null;
}
foreach ($this->routers as $router_key => $r) {
$result = $r['router']->route($url, $context);
if ($result !== null && $result !== false) {
$log_option = fx::config('dev.log_routes');
if (is_bool($log_option) && $log_option || is_array($log_option) && in_array($router_key, $log_option) || is_string($log_option) && $log_option === $router_key) {
fx::log('routed', $router_key, $url);
}
if ($result instanceof \Floxim\Floxim\System\Controller) {
$result = $result->process();
}
return $result;
}
}
}
示例12: getTemplateRecordAtts
public function getTemplateRecordAtts($collection, $index)
{
$entity_meta = array($this->get('id'), $this->getType(false));
$linkers = null;
if (is_object($collection) && $collection->linkers) {
$linkers = $collection->linkers;
if (isset($collection->linkers[$index])) {
$linker = $linkers[$index];
$entity_meta[] = $linker['id'];
$entity_meta[] = $linker['type'];
}
}
$entity_atts = array('data-fx_entity' => $entity_meta, 'class' => 'fx_entity' . (is_object($collection) && $collection->is_sortable ? ' fx_sortable' : ''));
if (!$this->isVisible()) {
$entity_atts['class'] .= ' fx_entity_hidden' . (!$collection || count($collection) === 1 ? '_single' : '');
}
$com = $this->getComponent();
$entity_atts['data-fx_entity_name'] = fx::util()->ucfirst($com->getItemName('one'));
$is_placeholder = $this->isAdderPlaceholder();
if ($is_placeholder) {
$entity_atts['class'] .= ' fx_entity_adder_placeholder';
}
if (isset($this['_meta'])) {
$c_meta = $this['_meta'];
if ($is_placeholder) {
$c_meta['has_page'] = $this->hasPage();
$c_meta['publish'] = $this->getDefaultPublishState();
}
$entity_atts['data-fx_entity_meta'] = $c_meta;
}
// fields to edit in panel
$att_fields = array();
$forced = $this->getForcedEditableFields();
if (is_array($forced) && count($forced)) {
foreach ($forced as $field_keyword) {
$field_meta = $this->getFieldMeta($field_keyword);
if (!is_array($field_meta)) {
continue;
}
// !!! hardcode
if ($is_placeholder && $field_keyword === 'is_published') {
$field_meta['current_value'] = $this->getDefaultPublishState();
} else {
$field_meta['current_value'] = $this[$field_keyword];
}
$att_fields[] = $field_meta;
}
}
if ($linkers && $linkers->linkedBy) {
if (!$linker) {
fx::log($collection, $linkers);
return $entity_atts;
}
$linker_field = $linker->getFieldMeta($linkers->linkedBy);
$linker_collection_field = $linkers->selectField;
if (!$is_placeholder && $linker_collection_field && $linker_collection_field['params']['content_type']) {
$linker_type = $linker_collection_field['params']['content_type'];
} else {
$linker_type = $this['type'];
$linker_field['params']['conditions'] = array(array('type', $linker_type));
}
$linker_field['params']['content_type'] = $linker_type;
$linker_field['label'] = fx::alang('Select') . ' ' . mb_strtolower(fx::component($linker_type)->getItemName('add'));
if (!$linker_collection_field || !$linker_collection_field['allow_select_doubles']) {
$linker_field['params']['skip_ids'] = array();
foreach ($collection->getValues('id') as $col_id) {
if ($col_id !== $this['id']) {
$linker_field['params']['skip_ids'][] = $col_id;
}
}
}
$linker_field['current_value'] = $linker[$linkers->linkedBy];
$att_fields[] = $linker_field;
}
if (!$this['id'] && (!$this['parent_id'] || !$this['infoblock_id']) && !$this->hasPage()) {
$att_fields = array_merge($this->getStructureFields(), $att_fields);
}
foreach ($att_fields as $field_key => $field_meta) {
$field_meta['in_att'] = true;
// real field
if (isset($field_meta['id']) && isset($field_meta['content_id'])) {
$field_keyword = $field_meta['id'] . '_' . $field_meta['content_id'];
} else {
$field_keyword = $field_key;
$field_meta['id'] = $field_key;
}
$template_field = new \Floxim\Floxim\Template\Field($field_meta['current_value'], $field_meta);
$entity_atts['data-fx_force_edit_' . $field_keyword] = $template_field->__toString();
}
return $entity_atts;
}
示例13: getLayoutInfoblock
public function getLayoutInfoblock($page)
{
if (!is_object($page)) {
fx::log(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
}
$path = $page->getPath()->copy()->reverse();
foreach ($path as $c_page) {
if (method_exists($c_page, 'getLayoutInfoblock')) {
$layout_ib = $c_page->getLayoutInfoblock();
break;
}
}
if ($layout_ib->getVisual()->get('is_stub') || !$layout_ib->getTemplate()) {
$suitable = new Template\Suitable();
//$infoblocks = $page->getPageInfoblocks();
$infoblocks = fx::data('infoblock')->getForPage($page);
// delete all parent layouts from collection
$infoblocks->findRemove(function ($ib) use($layout_ib) {
return $ib->isLayout() && $ib['id'] !== $layout_ib['id'];
});
$suitable->suit($infoblocks, fx::env('layout_id'));
return $infoblocks->findOne(function ($ib) {
return $ib->isLayout();
});
}
return $layout_ib;
}
示例14: addDefaultSourceDirs
public function addDefaultSourceDirs()
{
$template_name = $this->getTemplateName();
if (!$this->isAliased()) {
$dir = self::nameToPath($this->getTemplateName());
$dirs = array($dir);
foreach ($dirs as $dir) {
try {
$this->addSourceDir($dir);
} catch (\Exception $e) {
fx::log('Error while adding template source dir', $e->getMessage());
}
}
}
if (isset(self::$source_paths[$template_name])) {
foreach (self::$source_paths[$template_name] as $sp) {
try {
$this->addSource($sp);
} catch (\Exception $ex) {
}
}
}
}
示例15: wrapOutput
/**
* wrap ib's output
*/
protected function wrapOutput($output)
{
$wrapper = $this->getPropInherited('visual.wrapper');
if (!$wrapper) {
return $output;
}
$tpl_wrap = fx::template($wrapper);
if (!$tpl_wrap) {
return $output;
}
$tpl_wrap->isWrapper(true);
$wrap_params = $this->getPropInherited('visual.wrapper_visual');
if (!is_array($wrap_params)) {
$wrap_params = array();
}
$wrap_params['content'] = $output;
$wrap_params['infoblock'] = $this;
$is_admin = fx::isAdmin();
try {
$result = $tpl_wrap->render($wrap_params);
} catch (\Exception $e) {
fx::log('error while wrapping ib #' . $this['id'], $e->getMessage());
$result = $output;
}
if ($is_admin) {
$this->infoblock_meta['wrapper_params'] = $tpl_wrap->getRegisteredParams();
}
$this->output_is_subroot = $tpl_wrap->is_subroot;
return $result;
}