public function shortcodeLocale(Event $event, array $atts, $content, $tag)
    {
        $option = array_keys((array)$atts);
        $locale = I18n::locale();
        $languages = quickapps('languages');
        $out = '';

        if (!isset($languages[$locale])) {
            return $out;
        }

        if (empty($option)) {
            $option = 'code';
        } else {
            $option = $option[0];
        }

        if ($info = $languages[$locale]) {
            switch ($option) {
                case 'code':
                    $out = $info['code'];
                    break;

                case 'name':
                    $out = $info['name'];
                    break;

                case 'direction':
                    $out = $info['direction'];
                    break;
            }
        }

        return $out;
    }
public function shortcodeLocale(Event $event, array $atts, $content, $tag)
    {
        $option = array_keys((array)$atts);
        $locale = I18n::locale();
        $languages = quickapps('languages');
        $out = '';

        if (!isset($languages[$locale])) {
            return $out;
        }

        if (empty($option)) {
            $option = 'code';
        } else {
            $option = $option[0];
        }

        if ($info = $languages[$locale]) {
            switch ($option) {
                case 'code':
                    $out = $info['code'];
                    break;

                case 'name':
                    $out = $info['name'];
                    break;

                case 'direction':
                    $out = $info['direction'];
                    break;
            }
        }

        return $out;
    }
public function shortcodeLocale ( Event $ event , array $ atts , $ content , $ tag ) { $ option = array_keys ( ( array ) $ atts ) ; $ locale = I18n :: locale ( ) ; $ languages = quickapps ( 'languages' ) ; $ out = '' ; if ( ! isset ( $ languages [ $ locale ] ) ) { return $ out ; } if ( empty ( $ option ) ) { $ option = 'code' ; } else { $ option = $ option [ 0 ] ; } if ( $ info = $ languages [ $ locale ] ) { switch ( $ option ) { case 'code' : $ out = $ info [ 'code' ] ; break ; case 'name' : $ out = $ info [ 'name' ] ; break ; case 'direction' : $ out = $ info [ 'direction' ] ; break ; } } return $ out ; }
Implements the "locale" shortcode.

{locale code /}
{locale name /}
{locale direction /}

@param \Cake\Event\Event $event The event that was fired
@param array $atts An associative array of attributes, or an empty string if
no attributes are given
@param string $content The enclosed content (if the shortcode is used in its
enclosing form)
@param string $tag The shortcode tag
@return string
Implements the locale shortcode .