Shrink the ajaxPageState data.

Paramètres

array $data: Settings for javascript.

3 calls to advagg_cleanup_settings_array()
advagg_ajax_render_alter dans ./advagg.module
Implements hook_ajax_render_alter().
advagg_pre_render_scripts dans ./advagg.module
Callback for pre_render to add elements needed for JavaScript to be rendered.
_advagg_process_html dans ./advagg.module
Replacement for template_process_html().

Fichier

./advagg.module, line 2513

Code

function advagg_cleanup_settings_array(array $data) {
    // Remove inline js from the ajaxPageState data.
    if (isset($data['ajaxPageState']['js'])) {
        foreach ((array) $data['ajaxPageState']['js'] as $key => $value) {
            if (advagg_remove_short_keys($key)) {
                if (is_array($data['ajaxPageState']['js']) && isset($data['ajaxPageState']['js'][$key])) {
                    unset($data['ajaxPageState']['js'][$key]);
                }
                elseif (is_object($data['ajaxPageState']['js']) && isset($data['ajaxPageState']['js']->{$key})) {
                    unset($data['ajaxPageState']['js']->{$key});
                }
            }
        }
    }
    // Remove inline css from the ajaxPageState data.
    if (isset($data['ajaxPageState']['css'])) {
        foreach ((array) $data['ajaxPageState']['css'] as $key => $value) {
            if (advagg_remove_short_keys($key, 6)) {
                if (is_object($data['ajaxPageState']['css']) && isset($data['ajaxPageState']['css']->{$key})) {
                    unset($data['ajaxPageState']['css']->{$key});
                }
                elseif (is_array($data['ajaxPageState']['css']) && isset($data['ajaxPageState']['css'][$key])) {
                    unset($data['ajaxPageState']['css'][$key]);
                }
            }
        }
    }
    // Remove settings from the js ajaxPageState data.
    if (isset($data['ajaxPageState']['js']['settings'])) {
        unset($data['ajaxPageState']['js']['settings']);
    }
    if (isset($data['ajaxPageState']['js']->settings)) {
        unset($data['ajaxPageState']['js']->settings);
    }
    return $data;
}