Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
let config = Encore.getWebpackConfig(); | |
config.watchOptions = { poll: true, ignored: /node_modules/ }; | |
config.plugins.push( | |
new BrowserSyncPlugin( | |
{ | |
host: 'aro.tech', | |
proxy: 'aro.tech', | |
files: [ // watch on changes | |
{ | |
match: ['public/build/**/*.js'], |
<?php | |
protected function create(array $data) | |
{ | |
$slug = str_slug($data['first_name'] . '.' . $data['last_name']); | |
$next = 2; | |
// Loop until we can query for the slug and it returns false | |
while (User::where('slug', '=', $slug)->first()) { | |
$slug = $slug . '-' . $next; | |
$next++; |
Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
server { | |
listen 80; | |
server_name maxmobiles.lo *.maxmobiles.lo; | |
root /var/www/maxmobiles.lo; | |
error_log /var/www/maxmobiles.lo/log/error.log warn; | |
location / { | |
index index.html index.php; ## Allow a static html file to be shown first |
<?php | |
// The drupal_set_message() function is being deprecated! | |
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x | |
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. | |
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. | |
// In some custom code. | |
\Drupal::messenger()->addMessage('Say something else'); |
<?php | |
/** | |
* Copyright (c) 2016 PMG <https://www.pmg.com> | |
* | |
* License: MIT | |
*/ | |
use Symfony\Component\PropertyAccess\PropertyAccess; | |
use Symfony\Component\PropertyAccess\PropertyAccessorInterface; | |
use Symfony\Component\Form\FormEvents; |
# | |
# | |
# The Seedbox From Scratch Script | |
# By Notos ---> https://github.com/Notos/ | |
# | |
# | |
###################################################################### | |
# | |
# Copyright (c) 2013 Notos (https://github.com/Notos/) | |
# |
<?php | |
/** | |
* File: SimpleImage.php | |
* Author: Simon Jarvis | |
* Modified by: Miguel Fermín | |
* Based in: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php | |
* | |
* This program is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU General Public License | |
* as published by the Free Software Foundation; either version 2 |
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | |
// Manually authenticate user in controller | |
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles()); | |
$this->get('security.token_storage')->setToken($token); | |
$this->get('session')->set('_security_main', serialize($token)); |
<?php | |
/** | |
* Rules we follow are from PSR-2 as well as the rectified PSR-2 guide. | |
* | |
* - https://github.com/FriendsOfPHP/PHP-CS-Fixer | |
* - https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md | |
* - https://github.com/php-fig-rectified/fig-rectified-standards/blob/master/PSR-2-R-coding-style-guide-additions.md | |
* | |
* If something isn't addressed in either of those, some other common community rules are |