<commit_before><?php

namespace Ayudat\Seolo;

use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

use Ayudat\Seolo\SeoloText;

class SeoloController extends Controller
{
    public function saveAlt(Request $request)
    {
        $request['content'] = trim(strip_tags($request['content']));
        if (strlen($request['content']))
        {
            //save or update
            $theKey = 'seolo-alt.' . $request['key'];
            $text = SeoloText::where('key', $theKey)->get();
            if (!isset($text[0]))
            {
                $text[0] = new SeoloText;
                $text[0]->key = $theKey;
            }
            $text[0]->content = $request['content'];
            $text[0]->save();
        }
        echo $request['content'];
    }

    public function saveText(Request $request)
    {
        // check html
        $request['content'] = trim($request['content']);
        $string = "<div>{$request['content']}</div>";
        libxml_use_internal_errors(true);
        libxml_clear_errors();
        simplexml_load_string($string);

        if (!count(libxml_get_errors()) && strlen($request['content']))
        {
            $text = SeoloText::where('key', $request['key'])->get();
            $text[0]->content = $request['content'];
            if ('save' == $request['action']) $text[0]->save();
        } else {
            echo 'html_error';
        }
    }<commit_msg>corrección para <br> al salvar texto<commit_after><?php

namespace Ayudat\Seolo;

use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

use Ayudat\Seolo\SeoloText;

class SeoloController extends Controller
{
    public function saveAlt(Request $request)
    {
        $request['content'] = trim(strip_tags($request['content']));
        if (strlen($request['content']))
        {
            //save or update
            $theKey = 'seolo-alt.' . $request['key'];
            $text = SeoloText::where('key', $theKey)->get();
            if (!isset($text[0]))
            {
                $text[0] = new SeoloText;
                $text[0]->key = $theKey;
            }
            $text[0]->content = $request['content'];
            $text[0]->save();
        }
        echo $request['content'];
    }

    public function saveText(Request $request)
    {
        // check html
        $request['content'] = trim($request['content']);
        $request['content'] = str_replace('<br>', '<br/>', $request['content']);
        $string = "<div>{$request['content']}</div>";
        libxml_use_internal_errors(true);
        libxml_clear_errors();
        simplexml_load_string($string);

        if (!count(libxml_get_errors()) && strlen($request['content']))
        {
            $text = SeoloText::where('key', $request['key'])->get();
            $text[0]->content = $request['content'];
            if ('save' == $request['action']) $text[0]->save();
        } else {
            echo 'html_error';
        }
    }
{'fraction_non_alphanumeric': 0.17840216655382532, 'fraction_numerical': 0.004739336492890996, 'mean_word_length': 2.2401315789473686, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7522501', 'n_tokens_mistral': 863, 'n_tokens_neox': 864, 'n_words': 149}