ACF_Internal_Post_Type::format_code_for_export
Formats code used for PHP exports.
Метод класса: ACF_Internal_Post_Type{}
Хуков нет.
Возвращает
Строку.
Использование
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->format_code_for_export( $code );
- $code(строка)
- The code being formatted.
По умолчанию:''
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Internal_Post_Type::format_code_for_export() ACF Internal Post Type::format code for export ACF 6.4.2
public function format_code_for_export( $code = '' ) {
if ( ! is_string( $code ) ) {
return '';
}
$str_replace = array(
' ' => "\t",
"'!!__(!!\'" => "__( '",
"!!\', !!\'" => "', '",
"!!\')!!'" => "' )",
'array (' => 'array(',
);
$preg_replace = array(
'/([\t\r\n]+?)array/' => 'array',
'/[0-9]+ => array/' => 'array',
);
$code = str_replace( array_keys( $str_replace ), array_values( $str_replace ), $code );
$code = preg_replace( array_keys( $preg_replace ), array_values( $preg_replace ), $code );
return $code;
}