Beispiel #1
0
 public function getAttributionOptions($fieldName = null, $keyValue = null)
 {
     $human_fields = explode(',', Setting::get('human_fields'));
     array_walk($human_fields, 'trim');
     $fields = array_combine($human_fields, $human_fields);
     return $fields;
 }
Beispiel #2
0
 public function __construct()
 {
     parent::__construct();
     SettingsManager::setContext('Mohsin.Txt', 'robots');
     BackendMenu::setContext('October.System', 'system', 'settings');
     if (!Setting::get('use_robots')) {
         $this->enabled = false;
     }
 }
Beispiel #3
0
 public function getAttributionOptions($fieldName = null, $keyValue = null)
 {
     $human_fields = array_map('trim', explode(',', Setting::get('human_fields')));
     $fields = array_combine($human_fields, $human_fields);
     if ($fieldName !== null) {
         unset($fields[$fieldName]);
         array_unshift($fields, $fieldName);
     }
     return $fields;
 }
Beispiel #4
0
<?php

use Cms\Classes\Page;
use Mohsin\Txt\Models\Robot;
use Mohsin\Txt\Models\Human;
use Mohsin\Txt\Models\Setting;
Route::get('robots.txt', function () {
    if (!Setting::get('use_robots') || !Robot::first()) {
        return Redirect::to(Page::url(Setting::get('redirectpage')));
    }
    return Response::make(Robot::first()->generateTxt(), 200, array('Content-Type' => 'text/plain'));
});
Route::get('humans.txt', function () {
    if (!Setting::get('use_humans') || !Human::first()) {
        return Redirect::to(Page::url(Setting::get('redirectpage')));
    }
    return Response::make(Human::first()->generateTxt(), 200, array('Content-Type' => 'text/plain'));
});