<commit_before><?php
lmb_require('limb/cms/src/controller/lmbAdminObjectController.class.php');
lmb_require('limb/cms/src/model/lmbCmsTextBlock.class.php');

class AdminTextBlockController extends lmbAdminObjectController
{
  protected $_form_name = 'object_form';
  protected $_object_class_name = 'lmbCmsTextBlock';

  public function doDisplay()
  {
    $this->blocks = $this->_getBlocks();
  }

  protected function _getBlocks()
  {
    $blocks = lmbCollection::toFlatArray(lmbActiveRecord::find('lmbCmsTextBlock'), 'identifier');

    $result = array();
    foreach($this->toolkit->getConf('text_blocks') as $identifier => $default_properties)
    {
      if(isset($blocks[$identifier]))
        $item = $blocks[$identifier];
      else
      {
        $item = new lmbCmsTextBlock();
        $item->import($default_properties);
        $item->setIdentifier($identifier);
      }

      $result[$identifier] = $item;
    }<commit_msg>[svn r7748] -- minor fixes<commit_after><?php
lmb_require('limb/cms/src/controller/lmbAdminObjectController.class.php');
lmb_require('limb/cms/src/model/lmbCmsTextBlock.class.php');

class AdminTextBlockController extends lmbAdminObjectController
{
  protected $_form_name = 'object_form';
  protected $_object_class_name = 'lmbCmsTextBlock';

  public function doDisplay()
  {
    $this->blocks = $this->_getBlocks();
  }

  protected function _getBlocks()
  {
    $blocks = lmbCollection::toFlatArray(lmbActiveRecord::find('lmbCmsTextBlock'), 'identifier');

    $result = array();
    foreach($this->toolkit->getConf('text_blocks') as $identifier => $default_properties)
    {
      if(isset($blocks[$identifier]))
        $item = $blocks[$identifier];
        $item['exists'] = true;
      else
      {
        $item = new lmbCmsTextBlock();
        $item->import($default_properties);
        $item->setIdentifier($identifier);
        $item['exists'] = false;
      }

      $result[$identifier] = $item;
    }
{'fraction_non_alphanumeric': 0.14841351074718526, 'fraction_numerical': 0.0020470829068577278, 'mean_word_length': 4.025706940874036, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '134903', 'n_tokens_mistral': 617, 'n_tokens_neox': 601, 'n_words': 89}