| 1 |
<?php |
| 2 |
/** |
| 3 |
* Get Code Embed Parameters |
| 4 |
* |
| 5 |
* Fetch options - if none exist set them. If the old options exist, move them over |
| 6 |
* |
| 7 |
* @package Artiss-Code-Embed |
| 8 |
* @since 1.5 |
| 9 |
* |
| 10 |
* @return string Array of default options |
| 11 |
*/ |
| 12 |
|
| 13 |
function ace_get_embed_paras() { |
| 14 |
|
| 15 |
$options = get_option( 'artiss_code_embed' ); |
| 16 |
$changed = false; |
| 17 |
|
| 18 |
// If array doesn't exist, set defaults |
| 19 |
|
| 20 |
if ( !is_array( $options ) ) { |
| 21 |
$options = array( 'opening_ident' => '%', 'keyword_ident' => 'CODE', 'closing_ident' => '%' ); |
| 22 |
$changed = true; |
| 23 |
} |
| 24 |
|
| 25 |
// If the old options exist, import and delete them |
| 26 |
|
| 27 |
if ( get_option( 'simple_code_embed' ) ) { |
| 28 |
$old_option = get_option( 'simple_code_embed' ); |
| 29 |
$options[ 'keyword_ident' ] = $old_option[ 'prefix']; |
| 30 |
delete_option( 'simple_code_embed' ); |
| 31 |
$changed = true; |
| 32 |
} |
| 33 |
|
| 34 |
// Update the options, if changed, and return the result |
| 35 |
|
| 36 |
if ( $changed ) { update_option( 'artiss_code_embed', $options );} |
| 37 |
|
| 38 |
return $options; |
| 39 |
} |
| 40 |
?> |