Example #1
1
 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     if (!empty($this->slug) && $this->slug !== '__generate__') {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($this->title), 'dash')), '-', true);
     if (empty($slug)) {
         $t = new Album();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     $s = new Slug();
     while ($s->where('id', "album.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('album.{$slug}')");
     $this->slug = $slug;
 }
Example #2
0
 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     if (!empty($this->old_slug)) {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     if (empty($this->title)) {
         $info = pathinfo($this->filename);
         $base = $info['filename'];
     } else {
         $base = $this->title;
     }
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($base), 'dash')), '-', true);
     if ($slug === $this->slug) {
         return true;
     }
     if (empty($slug)) {
         $t = new Content();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     $s = new Slug();
     // Need to lock the table here to ensure that requests arriving at the same time
     // still get unique slugs
     if ($this->has_db_permission('lock tables')) {
         $this->db->query("LOCK TABLE {$s->table} WRITE");
         $locked = true;
     } else {
         $locked = false;
     }
     while ($s->where('id', "content.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('content.{$slug}')");
     if ($locked) {
         $this->db->query('UNLOCK TABLES');
     }
     if (empty($this->old_slug)) {
         if (!empty($this->slug) && $this->slug !== '__generate__') {
             $this->old_slug = ',' . $this->slug . ',';
         } else {
             if (!empty($this->title)) {
                 $this->old_slug = ',' . $slug . ',';
             }
         }
     }
     $this->slug = $slug;
 }
 public function go()
 {
     //$feed = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/_add-ons/wordpress/wp_posts.xml');
     //$items = simplexml_load_string($feed);
     $posts_object = simplexml_load_file($_SERVER['DOCUMENT_ROOT'] . '/_add-ons/wordpress/roobottom_old_posts.xml');
     $posts = object_to_array($posts_object);
     $yaml_path = $_SERVER['DOCUMENT_ROOT'] . '/_content/01-blog/';
     foreach ($posts['table'] as $post) {
         if ($post['column'][8] == "publish") {
             $slug = Slug::make($post['column'][5]);
             $slug = preg_replace('/[^a-z\\d]+/i', '-', $slug);
             if (substr($slug, -1) == '-') {
                 $slug = substr($slug, 0, -1);
             }
             $date = date('Y-m-d-Hi', strtotime($post['column'][3]));
             $file = $date . "-" . $slug . ".md";
             if (!File::exists($yaml_path . $file)) {
                 $yaml = [];
                 $yaml['title'] = $post['column'][5];
                 $content = $post['column'][4];
                 $markdown = new HTML_To_Markdown($content, array('header_style' => 'atx'));
                 File::put($yaml_path . $file, YAML::dump($yaml) . '---' . "\n" . $markdown);
             }
             echo $slug . "-" . $date;
             echo "<br/><hr/><br/>";
         }
     }
     return "ok";
 }
Example #4
0
 public function parseUrl($request)
 {
     if ($this->getUrlFormat() === self::PATH_FORMAT) {
         $rawPathInfo = $request->getPathInfo();
         if (Settings::get('SEO', 'slugs_enabled') && ($p = Slug::getPath($rawPathInfo))) {
             $rawPathInfo = trim($p, '/');
             Yii::app()->punish = 0;
         }
         $pathInfo = $this->removeUrlSuffix($rawPathInfo, $this->urlSuffix);
         foreach ($this->_rules as $i => $rule) {
             if (is_array($rule)) {
                 $this->_rules[$i] = $rule = Yii::createComponent($rule);
             }
             if (($r = $rule->parseUrl($this, $request, $pathInfo, $rawPathInfo)) !== false) {
                 return isset($_GET[$this->routeVar]) ? $_GET[$this->routeVar] : $r;
             }
         }
         if ($this->useStrictParsing) {
             throw new AweException(404, Yii::t('yii', 'Unable to resolve the request "{route}".', array('{route}' => $pathInfo)));
         } else {
             return $pathInfo;
         }
     } else {
         if (isset($_GET[$this->routeVar])) {
             return $_GET[$this->routeVar];
         } else {
             if (isset($_POST[$this->routeVar])) {
                 return $_POST[$this->routeVar];
             } else {
                 return '';
             }
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table(DB_OBJECTS, function ($table) {
         $table->string('url')->nullable();
     });
     DB::table(DB_FIELDS)->where('name', 'slug')->delete();
     //add slug column to all tables that don't have it
     $objects = DB::table(DB_OBJECTS)->get();
     foreach ($objects as $object) {
         //add slug column
         if (Schema::hasColumn($object->name, 'slug')) {
             DB::table($object->name)->whereNull('slug')->update(['slug' => '']);
             DB::update('ALTER TABLE `' . $object->name . '` MODIFY `slug` VARCHAR(255) NOT NULL');
             Schema::table($object->name, function ($table) {
                 //$table->unique('slug');
             });
         } else {
             Schema::table($object->name, function ($table) {
                 $table->string('slug');
                 //->unique();
             });
             //set slug values
             Slug::setForObject($object);
         }
         //add created_by column, not sure why this wasn't added earlier
         if (!Schema::hasColumn($object->name, 'created_by')) {
             Schema::table($object->name, function ($table) {
                 $table->integer('created_by');
             });
         }
     }
 }
Example #6
0
 public function setNameField($data, $value)
 {
     if ($data->get(self::SLUG) == null) {
         $data->set(self::SLUG, Slug::create($value));
     }
     return $value;
 }
Example #7
0
 public function actionUpdate($id)
 {
     $page = $this->loadModel($id);
     if (isset($_POST['Page'])) {
         if (Settings::get('SEO', 'slugs_enabled')) {
             if (isset($page->slug)) {
                 if (isset($page->slug->slug) && $_POST['Page']['slug'] != $page->slug->slug) {
                     if ($_POST['Page']['slug'] == '') {
                         $page->slug->delete();
                         $page->slug = NULL;
                     } else {
                         $page->slug->change($_POST['Page']['slug']);
                     }
                 }
             } else {
                 $page->slug = Slug::create($_POST['Page']['slug'], array('view', 'id' => $id));
                 $page->save();
             }
         }
         try {
             if ($page->save()) {
                 $this->redirect(array('view', 'id' => $page->id));
             }
         } catch (Exception $e) {
             $page->addError('', $e->getMessage());
         }
     }
     $this->render('update', array('page' => $page));
 }
Example #8
0
 /**
  * When the model boots, register a created event listener that will create a slug,
  * using the model's id as the salt value for the generation of thee slug.
  */
 public static function boot()
 {
     parent::boot();
     static::created(function ($model) {
         $model->slug = Slug::create($model->id);
         $model->save();
     });
 }
 public function updateSlug($attr = 'title')
 {
     if ($attr == 'title') {
         $this->slug = Slug::fromTitle($this->title);
     } else {
         $this->slug = Slug::fromId($this->id);
     }
 }
 public function generateMarkerSlug()
 {
     $markers = Marker::all();
     foreach ($markers as $marker) {
         $marker->slug = \Slug::make($marker->name);
         $marker->save();
     }
 }
 public function testBuildMethodThroughFacade()
 {
     $this->assertEquals('the_show_must_go_on', Slug::build('The Show Must Go On', '_'));
     $this->assertEquals('ничего_на_свете_лучше_нету', Slug::build('Ничего на свете лучше нету', '_', 1, false));
     $this->assertEquals('чем-бродить-друзьям-по-белу-свету', Slug::build('Чем бродить друзьям по белу свету', '-', 1, false));
     $this->assertEquals('Тем_кто_дружен', Slug::build('Тем, кто дружен', '_', 1, true));
     $this->assertEquals('Ne-strashny-trevogi', Slug::build('Не страшны тревоги...', '-', 2, true));
     $this->assertEquals('nam_lyubye_dorogi_dorogi', Slug::build('Нам любые дороги дороги!', '_', 2, false));
 }
 /**
  * Returns the URL for a given $taxonomy and $taxonomy_slug
  *
  * @param string  $folder  Folder to use
  * @param string  $taxonomy  Taxonomy to use
  * @param string  $taxonomy_slug  Taxonomy slug to use
  * @return string
  */
 public static function getURL($folder, $taxonomy, $taxonomy_slug)
 {
     $url = Config::getSiteRoot() . '/' . $folder . '/' . $taxonomy . '/';
     $url .= Config::getTaxonomySlugify() ? Slug::make($taxonomy_slug) : $taxonomy_slug;
     // if taxonomies are not case-sensitive, make it lowercase
     if (!Config::getTaxonomyCaseSensitive()) {
         $url = strtolower($url);
     }
     return Path::tidy($url);
 }
 /**
  * Create or recreate slugs in a column.
  *
  * @param $fromColumn Column to work with. String from this column will be converted to a slug.
  * @param bool $force When true, forces recreation of a slug, even if it exists.
  * @return $this
  */
 public function reslug($fromColumn = false, $force = false)
 {
     $slugColumn = config('seoslug.slugColumnName');
     if ($fromColumn === false) {
         $fromColumn = $this->slugFrom;
     }
     // If slug needs to be created or recreated
     if (empty($this->{$slugColumn}) || $force) {
         $this->{$slugColumn} = \Slug::build($this->{$fromColumn});
     }
     return $this;
 }
 public function run()
 {
     Category::create(['title' => 'Офисная бумага', 'alias' => Slug::make('Офисная бумага', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => 'бумага бумага бумага бумага ']);
     Category::create(['title' => 'Ризография', 'alias' => Slug::make('Ризография', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => 'ручки ручки ручки ручки ручки ручки ручки ']);
     Category::create(['title' => 'Картрижди', 'alias' => Slug::make('Картрижди', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника']);
     $category = Category::create(['title' => 'Канцтовары', 'alias' => Slug::make('Канцтовары', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника']);
     Category::create(['title' => 'Бумага для заметок', 'alias' => Slug::make('Бумага для заметок', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника', 'parent_id' => $category->id]);
     Category::create(['title' => 'Дыроколы', 'alias' => Slug::make('Дыроколы', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника', 'parent_id' => $category->id]);
     Category::create(['title' => 'Ежедневники', 'alias' => Slug::make('Ежедневники', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника', 'parent_id' => $category->id]);
     Category::create(['title' => 'Полиграфические материалы', 'alias' => Slug::make('Полиграфические материалы', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника']);
     Category::create(['title' => 'Офисная техника', 'alias' => Slug::make('Офисная техника', '-'), 'image' => 'https://placeimg.com/640/480/tech', 'description' => ' техника техника техника техника']);
 }
Example #15
0
 public function update($id)
 {
     $category = $this->category->find($id);
     if (Input::get('slug') === "") {
         Input::merge(['slug' => \Slug::make(Input::get('name'))]);
     }
     $category->fill(Input::all());
     if ($category->updateUniques()) {
         return Redirect::route('admin.works.categories.index')->with('success', Lang::get('admin/blogs/messages.create.success'));
     } else {
         return Redirect::back()->withInput(['only' => []])->withErrors($category->errors());
     }
 }
Example #16
0
 public function update($id)
 {
     $news = $this->news->find($id);
     if (Input::get('slug') === "") {
         Input::merge(['slug' => \Slug::make(Input::get('title'))]);
     }
     $news->fill(Input::all());
     if ($news->updateUniques()) {
         return Redirect::route('admin.news.edit', $news->id)->with('success', Lang::get('admin/news/messages.create.success'));
     } else {
         return Redirect::back()->withInput()->withErrors($news->errors());
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $table = $this->argument('table');
     $column = $this->argument('column');
     try {
         $allRows = \DB::table($table)->select($column)->get();
         foreach ($allRows as $row) {
             \DB::table($table)->where($column, $row->{$column})->update([config('seoslug.slugColumnName') => \Slug::build($row->{$column})]);
         }
     } catch (Exception $e) {
         $this->error($e->getMessage());
     }
     $this->info('Table ' . $table . 'has been reslugged successfully');
 }
Example #18
0
 public static function setForObject($object)
 {
     $slug_source = Slug::source($object->id);
     $instances = DB::table($object->name)->get();
     $slugs = [];
     foreach ($instances as $instance) {
         if ($slug_source === null) {
             $slug = Slug::make($instance->created_at->format('Y-m-d'), $slugs);
         } else {
             $slug = Slug::make($instance->{$slug_source}, $slugs);
         }
         DB::table($object->name)->where('id', $instance->id)->update(['slug' => $slug]);
         $slugs[] = $slug;
     }
 }
 /**
  * Заносим в БД новую категорию, после проверки ввода
  * @param AdminCategoryRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postCreate(AdminCategoryRequest $request)
 {
     $data = $request->all();
     //Если алиас не задан, то генерируем его
     if (!$request->has('alias')) {
         $data['alias'] = \Slug::make($request->input('title'));
     }
     //Проверяем есть ли такой же алиас в БД
     if ($this->model->where('alias', '=', $data['alias'])->first()) {
         //Алиас такой существует, выводим ошибку
         return redirect()->back()->with('error', 'Такой алиас существует!!!');
     }
     //Создаем новую запись в БД
     $this->model->create($data);
     return redirect()->route('admin.category.index')->with('success', 'Категория создана!');
 }
Example #20
0
 public function update($id)
 {
     $work = $this->work->find($id);
     if (Input::get('slug') === "") {
         Input::merge(['slug' => \Slug::make(Input::get('title'))]);
     }
     $work->fill(Input::all());
     $work->need_big_preview = Input::get('need_big_preview');
     if ($work->updateUniques()) {
         if (Input::get('categories')) {
             $work->categories()->sync(Input::get('categories'));
         }
         return Redirect::route('admin.works.edit', $work->id)->with('success', Lang::get('admin/works/messages.create.success'));
     } else {
         return Redirect::back()->withInput()->withErrors($work->errors());
     }
 }
 /**
  * Обработка данных из формы и сохранение в БД
  * @param AdminArticleRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postCreate(AdminArticleRequest $request)
 {
     $data = $request->all();
     //Если алиас не задан, то генерируем его
     if (!$request->has('alias')) {
         $data['alias'] = \Slug::make($request->input('title'));
         //Проверяем есть ли такой же алиас в БД
         if ($this->model->where('alias', '=', $data['alias'])->first()) {
             //Алиас такой существует, выводим ошибку
             return redirect()->back()->with('error', 'Такой алиас существует!!!');
         }
     }
     $data['user_id'] = $request->user()->id;
     //Создаем запись в БД
     $this->model->create($data);
     return redirect()->route('admin.article.index')->with('success', 'Материал добавлен!');
 }
 public function run()
 {
     $faker = Faker::create();
     $title = $faker->sentence();
     News::create(['created_at' => $faker->date($format = 'Y-m-d', $max = 'now'), 'title' => $title, 'alias' => Slug::make($title, '-'), 'body' => $faker->text($maxNbChars = 800), 'image' => '/public/files/Фото для сайта/Фото на новости/thumb-up.jpeg']);
     foreach (range(1, 22) as $index) {
         $title = $faker->sentence();
         News::create(['created_at' => $faker->date($format = 'Y-m-d', $max = 'now'), 'title' => $title, 'alias' => Slug::make($title, '-'), 'body' => $faker->text($maxNbChars = 800), 'image' => $faker->imageUrl($width = 640, $height = 480)]);
         // foreach(range(1, 10) as $cindex)
         // {
         //     Comment::create([
         //         'created_at' => $faker->date($format = 'Y-m-d', $max = 'now'),
         //         'author' => $faker->name,
         //         'body' => $faker->text($maxNbChars = 200),
         //         'news_id' => $index,
         //     ]);
         // }
     }
 }
Example #23
0
 public function update($id)
 {
     $post = $this->post->find($id);
     if (Input::get('slug') === "") {
         Input::merge(['slug' => \Slug::make(Input::get('title'))]);
     }
     $post->fill(Input::all());
     if ($post->updateUniques()) {
         if (Input::get('rubrics')) {
             $post->rubrics()->sync(Input::get('rubrics'));
         }
         if (Input::get('tags')) {
             $post->retag(explode(",", Input::get('tags')));
         }
         return Redirect::route('admin.blogs.edit', $post->id)->with('success', Lang::get('admin/blogs/messages.create.success'));
     } else {
         return Redirect::back()->withInput()->withErrors($post->errors());
     }
 }
Example #24
0
File: pi.pages.php Project: nob/joi
 /**
  * Lists entries based on passed parameters
  *
  * @return array|string
  */
 public function listing()
 {
     $folders = $this->fetchParam('folder', $this->fetchParam('folders', ltrim($this->fetchParam('from', URL::getCurrent()), "/")));
     $folders = $folders === "/" ? "" : $folders;
     if ($this->fetchParam('taxonomy', false, null, true, null)) {
         $taxonomy_parts = Taxonomy::getCriteria(URL::getCurrent());
         $taxonomy_type = $taxonomy_parts[0];
         $taxonomy_slug = Config::get('_taxonomy_slugify') ? Slug::humanize($taxonomy_parts[1]) : urldecode($taxonomy_parts[1]);
         $content_set = ContentService::getContentByTaxonomyValue($taxonomy_type, $taxonomy_slug, $folders);
     } else {
         $content_set = ContentService::getContentByFolders($folders);
     }
     // filter
     $content_set->filter(array('show_all' => $this->fetchParam('show_hidden', false, null, true, false), 'since' => $this->fetchParam('since'), 'until' => $this->fetchParam('until'), 'show_past' => $this->fetchParam('show_past', TRUE, NULL, TRUE), 'show_future' => $this->fetchParam('show_future', FALSE, NULL, TRUE), 'type' => 'pages', 'conditions' => trim($this->fetchParam('conditions', ""))));
     // sort
     $content_set->sort($this->fetchParam('sort_by', 'order_key'), $this->fetchParam('sort_dir'));
     // grab total entries for setting later
     $total_entries = $content_set->count();
     // limit
     $limit = $this->fetchParam('limit', null, 'is_numeric');
     $offset = $this->fetchParam('offset', 0, 'is_numeric');
     $paginate = $this->fetchParam('paginate', true, null, true, false);
     if ($limit || $offset) {
         if ($limit && $paginate && !$offset) {
             // pagination requested, isolate the appropriate page
             $content_set->isolatePage($limit, URL::getCurrentPaginationPage());
         } else {
             // just limit
             $content_set->limit($limit, $offset);
         }
     }
     // manually supplement
     $content_set->supplement(array('total_found' => $total_entries));
     // check for results
     if (!$content_set->count()) {
         return array('no_results' => true);
     }
     // if content is used in this entries loop, parse it
     $parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
     return Parse::tagLoop($this->content, $content_set->get($parse_content));
 }
Example #25
0
 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($this->title), 'dash')), '-', true);
     if (empty($slug)) {
         $t = new Text();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     if ($this->slug === $slug || !empty($this->slug) && $this->slug !== '__generate__') {
         return;
     }
     $s = new Slug();
     // Need to lock the table here to ensure that requests arriving at the same time
     // still get unique slugs
     if ($this->has_db_permission('lock tables')) {
         $this->db->query("LOCK TABLE {$s->table} WRITE");
         $locked = true;
     } else {
         $locked = false;
     }
     $page_type = is_numeric($this->page_type) ? $this->page_type : 0;
     $prefix = $page_type === 1 ? 'page' : 'essay';
     while ($s->where('id', "{$prefix}.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('{$prefix}.{$slug}')");
     if ($locked) {
         $this->db->query('UNLOCK TABLES');
     }
     $this->slug = $slug;
 }
Example #26
0
    /**
     * Returns a ContentSet object with the appropriate content
     *
     * @param array  $settings  Settings for filtering content and such
     * @return ContentSet
     */
    private function getContentSet($settings)
    {
        // create a unique hash for these settings
        $content_hash = Helper::makeHash($settings);

        if ($this->blink->exists($content_hash)) {
            // blink content exists, use that
            $content_set = new ContentSet($this->blink->get($content_hash));
        } else {
            // no blink content exists, get data the hard way
            if ($settings['taxonomy']) {
                $taxonomy_parts  = Taxonomy::getCriteria(URL::getCurrent());
                $taxonomy_type   = $taxonomy_parts[0];
                $taxonomy_slug   = Config::get('_taxonomy_slugify') ? Slug::humanize($taxonomy_parts[1]) : urldecode($taxonomy_parts[1]);

                $content_set = ContentService::getContentByTaxonomyValue($taxonomy_type, $taxonomy_slug, $settings['folders']);
            } else {
                $content_set = ContentService::getContentByFolders($settings['folders']);
            }

            // filter
            $content_set->filter($settings);

            // grab total entries for setting later
            $total_entries = $content_set->count();

            // pre-sort supplement
            $content_set->supplement(array('total_found' => $total_entries) + $settings);

            // sort
            $content_set->multisort($settings['sort']);            
            
            // post-sort supplement
            $content_set->supplement(array(
                'group_by_date' => trim($this->fetchParam("group_by_date", null, null, false, false))
            ), true);

            // store content as blink content for future use
            $this->blink->set($content_hash, $content_set->extract());
        }

        return $content_set;
    }
Example #27
0
 Route::get('/', array('as' => 'home', 'uses' => 'ObjectController@index'));
 Route::get('/logout', 'LoginController@getLogout');
 Route::post('/upload/image', 'FileController@image');
 # Test routes
 Route::get('/schema/save', 'ObjectController@saveSchema');
 Route::get('/schema/load', 'ObjectController@loadSchema');
 Route::get('/image/test', 'FileController@test');
 Route::get('/slug/test', function () {
     $phrases = ['', 'and', 'this is a normal test', 'this is a really really really long test because it\'s amazing and great and am i at 50 YET???'];
     foreach ($phrases as $phrase) {
         echo '<p>' . $phrase . ' becomes <em>' . Slug::make($phrase, ['', 'normal-test', 'normal-test-1']) . '</em></p>';
     }
 });
 Route::get('/slug/object/{object_id}', function ($object_id) {
     $object = DB::table(DB_OBJECTS)->find($object_id);
     Slug::setForObject($object);
     die('object was ' . $object->name);
 });
 Route::get('cleanup', function () {
     FieldController::cleanup();
     FileController::findOrphans();
     FileController::cleanup();
 });
 # Complex instance routing, optionally with linked_id for related objects
 Route::get('/{object_name}/delete/{instance_id}', 'InstanceController@delete');
 Route::get('/{object_name}', 'InstanceController@index');
 Route::get('/{object_name}/export', 'InstanceController@export');
 Route::get('/{object_name}/create/{linked_id?}', 'InstanceController@create');
 Route::post('/{object_name}/reorder', 'InstanceController@reorder');
 Route::post('/{object_name}/{linked_id?}', 'InstanceController@store');
 Route::get('/{object_name}/{instance_id}/{linked_id?}', 'InstanceController@edit');
    if (array_get($value, 'required', false) === TRUE) {
        $wrapper_classes[] = 'required';
        $wrapper_attributes[] = 'required';
    }
    if ($fieldtype === 'password') {
        $wrapper_classes[] = 'input-text';
        $wrapper_attributes[] = "data-bind='visible: showChangePassword, css: {required: showChangePassword}'";
    }
    if ($fieldtype === 'show_password') {
        $wrapper_attributes[] = "data-bind='visible: showChangePassword() !== true'";
        if (!array_get($value, 'display')) {
            $value['display'] = Localization::fetch('password');
        }
    }
    // If no display label is set, we'll prettify the fieldname itself
    $value['display'] = array_get($value, 'display', Slug::prettify($key));
    ?>

        <div class="<?php 
    echo implode($wrapper_classes, ' ');
    ?>
" <?php 
    echo implode($wrapper_attributes, ' ');
    ?>
>
          <?php 
    print Fieldtype::render_fieldtype($fieldtype, $key, $value, $val, tabindex(), $input_key, null, $error);
    ?>
        </div>

      <?php 
Example #29
0
 /**
  * Cleans up a file name
  *
  * @param string  $path  Path and file name to clean up
  * @return string
  */
 public static function cleanFilename($path)
 {
     $extension = self::getExtension($path);
     $path = str_replace('.' . $extension, '', $path);
     return Slug::make($path) . '.' . $extension;
 }
Example #30
0
 public function testWithNoTransliterate()
 {
     $slug = Slug::make('essai Français')->setTransliterate(false);
     $good_slug = 'essai-français';
     $this->assertEquals($good_slug, $slug);
 }