_mce_set_direction

The timeline below displays how wordpress function _mce_set_direction has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Sets the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has
 * the text direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality'
 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
 * 'theme_advanced_buttons1' array keys. These keys are then returned
 * in the $mce_init (TinyMCE settings) array.
 *
 * @since 2.1.0
 * @access private
 *
 * @param array $mce_init MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($mce_init)
{
    if (is_rtl()) {
        $mce_init['directionality'] = 'rtl';
        $mce_init['rtl_ui'] = true;
        if (!empty($mce_init['plugins']) && !str_contains($mce_init['plugins'], 'directionality')) {
            $mce_init['plugins'] .= ',directionality';
        }
        if (!empty($mce_init['toolbar1']) && !preg_match('/\bltr\b/', $mce_init['toolbar1'])) {
            $mce_init['toolbar1'] .= ',ltr';
        }
    }
    return $mce_init;
}

WordPress Version: 6.1

/**
 * Sets the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has
 * the text direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality'
 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
 * 'theme_advanced_buttons1' array keys. These keys are then returned
 * in the $mce_init (TinyMCE settings) array.
 *
 * @since 2.1.0
 * @access private
 *
 * @param array $mce_init MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($mce_init)
{
    if (is_rtl()) {
        $mce_init['directionality'] = 'rtl';
        $mce_init['rtl_ui'] = true;
        if (!empty($mce_init['plugins']) && strpos($mce_init['plugins'], 'directionality') === false) {
            $mce_init['plugins'] .= ',directionality';
        }
        if (!empty($mce_init['toolbar1']) && !preg_match('/\bltr\b/', $mce_init['toolbar1'])) {
            $mce_init['toolbar1'] .= ',ltr';
        }
    }
    return $mce_init;
}

WordPress Version: 6.1

/**
 * Set the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has
 * the text direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality'
 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
 * 'theme_advanced_buttons1' array keys. These keys are then returned
 * in the $mce_init (TinyMCE settings) array.
 *
 * @since 2.1.0
 * @access private
 *
 * @param array $mce_init MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($mce_init)
{
    if (is_rtl()) {
        $mce_init['directionality'] = 'rtl';
        $mce_init['rtl_ui'] = true;
        if (!empty($mce_init['plugins']) && strpos($mce_init['plugins'], 'directionality') === false) {
            $mce_init['plugins'] .= ',directionality';
        }
        if (!empty($mce_init['toolbar1']) && !preg_match('/\bltr\b/', $mce_init['toolbar1'])) {
            $mce_init['toolbar1'] .= ',ltr';
        }
    }
    return $mce_init;
}

WordPress Version: 4.2

/**
 * Set the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has
 * the text direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality'
 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
 * 'theme_advanced_buttons1' array keys. These keys are then returned
 * in the $input (TinyMCE settings) array.
 *
 * @since 2.1.0
 * @access private
 *
 * @param array $input MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($input)
{
    if (is_rtl()) {
        $input['directionality'] = 'rtl';
        if (!empty($input['plugins']) && strpos($input['plugins'], 'directionality') === false) {
            $input['plugins'] .= ',directionality';
        }
        if (!empty($input['toolbar1']) && !preg_match('/\bltr\b/', $input['toolbar1'])) {
            $input['toolbar1'] .= ',ltr';
        }
    }
    return $input;
}

WordPress Version: 4.0

/**
 * Set the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has
 * the text direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality'
 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
 * 'theme_advanced_buttons1' array keys. These keys are then returned
 * in the $input (TinyMCE settings) array.
 *
 * @since 2.1.0
 * @access private
 *
 * @param array $input MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($input)
{
    if (is_rtl()) {
        $input['directionality'] = 'rtl';
        $input['plugins'] .= ',directionality';
        $input['toolbar1'] .= ',ltr';
    }
    return $input;
}

WordPress Version: 3.9

/**
 * Set the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has the text
 * direction set to 'rtl'.
 *
 * Fills in the 'directionality' setting, enables the 'directionality' plugin,
 * and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array
 * keys. These keys are then returned in the $input (TinyMCE settings) array.
 *
 * @access private
 * @since 2.1.0
 *
 * @param array $input MCE settings array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($input)
{
    if (is_rtl()) {
        $input['directionality'] = 'rtl';
        $input['plugins'] .= ',directionality';
        $input['toolbar1'] .= ',ltr';
    }
    return $input;
}

WordPress Version: 3.7

/**
 * Set the localized direction for MCE plugin.
 *
 * Will only set the direction to 'rtl', if the WordPress locale has the text
 * direction set to 'rtl'.
 *
 * Fills in the 'directionality', 'plugins', and 'theme_advanced_button1' array
 * keys. These keys are then returned in the $input array.
 *
 * @access private
 * @package WordPress
 * @subpackage MCE
 * @since 2.1.0
 *
 * @param array $input MCE plugin array.
 * @return array Direction set for 'rtl', if needed by locale.
 */
function _mce_set_direction($input)
{
    if (is_rtl()) {
        $input['directionality'] = 'rtl';
        $input['plugins'] .= ',directionality';
        $input['theme_advanced_buttons1'] .= ',ltr';
    }
    return $input;
}