Created
March 22, 2017 08:04
-
-
Save adamdickinson/952a21a062612f91a6a4b95438ee3de7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists( 'fcbkbttn_settings' ) ) { | |
function fcbkbttn_settings() { | |
global $fcbkbttn_options, $fcbkbttn_plugin_info, $fcbkbttn_options_default; | |
$fcbkbttn_options_default = array( | |
'plugin_option_version' => $fcbkbttn_plugin_info["Version"], | |
'link' => '', | |
'my_page' => 1, | |
'like' => 1, | |
'layout_option' => 'button_count', | |
'like_action' => 'like', | |
'color_scheme' => 'light', | |
'share' => 0, | |
'faces' => 0, | |
'width' => 450, | |
'where' => 'before', | |
'display_option' => 'standard', | |
'count_icon' => 1, | |
'extention' => 'png', | |
'fb_img_link' => plugins_url( "images/standard-facebook-ico.png", __FILE__ ), | |
'locale' => 'en_US', | |
'html5' => 0, | |
'use_multilanguage_locale' => 0, | |
'display_for_excerpt' => 0, | |
'display_settings_notice' => 1, | |
'first_install' => strtotime( "now" ), | |
'suggest_feature_banner' => 1 | |
); | |
/* Install the option defaults */ | |
if ( ! get_option( 'fcbk_bttn_plgn_options' ) ) { | |
if ( false !== get_option( 'fcbk_bttn_plgn_options_array' ) ) { | |
$old_options = get_option( 'fcbk_bttn_plgn_options_array' ); | |
foreach ( $fcbkbttn_options_default as $key => $value ) { | |
if ( isset( $old_options['fcbk_bttn_plgn_' . $key ] ) ) | |
$fcbkbttn_options_default[ $key ] = $old_options['fcbk_bttn_plgn_' . $key ]; | |
} | |
update_option( 'fcbk_bttn_plgn_options', $fcbkbttn_options_default ); | |
delete_option( 'fcbk_bttn_plgn_options_array' ); | |
} | |
add_option( 'fcbk_bttn_plgn_options', $fcbkbttn_options_default ); | |
} | |
/* Get options from the database */ | |
$fcbkbttn_options = get_option( 'fcbk_bttn_plgn_options' ); | |
if ( ! isset( $fcbkbttn_options['plugin_option_version'] ) || $fcbkbttn_options['plugin_option_version'] != $fcbkbttn_plugin_info["Version"] ) { | |
if ( stristr( $fcbkbttn_options['fb_img_link'], 'standart-facebook-ico.jpg' ) || stristr( $fcbkbttn_options['fb_img_link'], 'standart-facebook-ico.png' ) ) | |
$fcbkbttn_options['fb_img_link'] = plugins_url( "images/standard-facebook-ico.png", __FILE__ ); | |
if ( 'standart' == $fcbkbttn_options['display_option'] ) | |
$fcbkbttn_options['display_option'] = 'standard'; | |
if ( stristr( $fcbkbttn_options['fb_img_link'], 'img/' ) ) | |
$fcbkbttn_options['fb_img_link'] = plugins_url( str_replace( 'img/', 'images/', $fcbkbttn_options['fb_img_link'] ), __FILE__ ); | |
$fcbkbttn_options_default['display_settings_notice'] = 0; | |
/* show pro features */ | |
$fcbkbttn_options['hide_premium_options'] = array(); | |
$fcbkbttn_options = array_merge( $fcbkbttn_options_default, $fcbkbttn_options ); | |
$fcbkbttn_options['plugin_option_version'] = $fcbkbttn_plugin_info["Version"]; | |
update_option( 'fcbk_bttn_plgn_options', $fcbkbttn_options ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment