<commit_before><?php

/*
 * This file is part of the sfAltumoPlugin library.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
 
namespace sfAltumoPlugin\Action;



/**
* This class adds miscellaneous generic functions to sfActions. It is meant to be
* extended by a module's actions.
*
* @author <NAME> <<EMAIL>>
*/
class CmsActions extends BaseActions {

    
    public function preExecute(){

        $this->addCmsFunctions();
        
    }
    
    
    protected function userCanEditCmsFragments(){
        
        return $this->getUser()->isAuthenticated();
        
    }
    
    
    protected function addCmsFunctions(){

        $user_can_edit_cms_fragments = $this->userCanEditCmsFragments();
        
        $this->cms_fragment = function( $tag, $chrome_attributes = '' ){
            
            $chrome_attributes = \Altumo\Validation\Strings::assertString(
                $chrome_attributes,
                '$chrome_attributes expects a string'
            );
            
            $fragment = \CmsFragmentPeer::retrieveByTag( $tag );
            
            if( is_null($fragment) ){
                $fragment = \CmsFragmentPeer::getStubCmsFragment( $tag );
            }

            return $fragment->getHtml( $chrome_attributes );

        };

        
    }


    /**
    * Enables the Cms editor.
    */
    public function enableCmsEditor(){
        
        $this->getResponse()->addJavascript( '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' );
        $this->getResponse()->addJavascript( '/sfAltumoPlugin/js/lib/vendor/altEdit/jquery-altEdit.js' );
        
        $this->getResponse()->addStylesheet( '/sfAltumoPlugin/js/lib/vendor/altEdit/css/altEdit.css' );
        
    }

}<commit_msg>Removed application specific cms includes<commit_after><?php

/*
 * This file is part of the sfAltumoPlugin library.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
 
namespace sfAltumoPlugin\Action;



/**
* This class adds miscellaneous generic functions to sfActions. It is meant to be
* extended by a module's actions.
*
* @author <NAME> <<EMAIL>>
*/
class CmsActions extends BaseActions {

    
    public function preExecute(){

        $this->addCmsFunctions();
        
    }
    
    
    protected function userCanEditCmsFragments(){
        
        return $this->getUser()->isAuthenticated();
        
    }
    
    
    protected function addCmsFunctions(){

        $user_can_edit_cms_fragments = $this->userCanEditCmsFragments();
        
        $this->cms_fragment = function( $tag, $chrome_attributes = '' ){
            
            $chrome_attributes = \Altumo\Validation\Strings::assertString(
                $chrome_attributes,
                '$chrome_attributes expects a string'
            );
            
            $fragment = \CmsFragmentPeer::retrieveByTag( $tag );
            
            if( is_null($fragment) ){
                $fragment = \CmsFragmentPeer::getStubCmsFragment( $tag );
            }

            return $fragment->getHtml( $chrome_attributes );

        };

        
    }

}
{'fraction_non_alphanumeric': 0.11225728155339806, 'fraction_numerical': 0.0009101941747572816, 'mean_word_length': 2.122159090909091, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 33, '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': '3363078', 'n_tokens_mistral': 953, 'n_tokens_neox': 919, 'n_words': 205}