| @@ -26,56 +26,21 @@ | ||
| 26 | 26 | * |
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public static function activate() { |
| 30 | - // Insert the general settings | |
| 31 | - if ( false == get_option( 'ayg_general_settings' ) ) { | |
| 32 | - $defaults = array( | |
| 33 | - 'api_key' => '' | |
| 34 | - ); | |
| 35 | - | |
| 36 | - add_option( 'ayg_general_settings', $defaults ); | |
| 37 | - } | |
| 30 | + // Insert the plugin settings and default values for the first time | |
| 31 | + $defaults = ayg_get_default_settings(); | |
| 38 | 32 | |
| 39 | - // Insert the gallery settings | |
| 40 | - if ( false == get_option( 'ayg_gallery_settings' ) ) { | |
| 41 | - $defaults = array( | |
| 42 | - 'theme' => 'classic', | |
| 43 | - 'columns' => 3, | |
| 44 | - 'per_page' => 12, | |
| 45 | - 'thumb_ratio' => 56.25, | |
| 46 | - 'thumb_title' => 1, | |
| 47 | - 'thumb_title_length' => 0, | |
| 48 | - 'thumb_excerpt' => 1, | |
| 49 | - 'thumb_excerpt_length' => 75, | |
| 50 | - 'pagination' => 1, | |
| 51 | - 'pagination_type' => 'load_more' | |
| 52 | - ); | |
| 53 | - | |
| 54 | - add_option( 'ayg_gallery_settings', $defaults ); | |
| 33 | + foreach ( $defaults as $option_name => $values ) { | |
| 34 | + if ( false == get_option( $option_name ) ) { | |
| 35 | + add_option( $option_name, $values ); | |
| 36 | + } | |
| 55 | 37 | } |
| 38 | + | |
| 39 | + // Create custom database tables | |
| 40 | + ayg_db_create_custom_tables(); | |
| 56 | 41 | |
| 57 | - // Insert the player settings | |
| 58 | - if ( false == get_option( 'ayg_player_settings' ) ) { | |
| 59 | - $defaults = array( | |
| 60 | - 'player_ratio' => 56.25, | |
| 61 | - 'player_title' => 1, | |
| 62 | - 'player_description' => 1, | |
| 63 | - 'autoplay' => 0, | |
| 64 | - 'autoadvance' => 0, | |
| 65 | - 'loop' => 0, | |
| 66 | - 'controls' => 1, | |
| 67 | - 'modestbranding' => 1, | |
| 68 | - 'cc_load_policy' => 0, | |
| 69 | - 'iv_load_policy' => 0, | |
| 70 | - 'hl' => '', | |
| 71 | - 'cc_lang_pref' => '' | |
| 72 | - ); | |
| 73 | - | |
| 74 | - add_option( 'ayg_player_settings', $defaults ); | |
| 75 | - } | |
| 76 | - | |
| 77 | 42 | // Insert the plugin version |
| 78 | 43 | add_option( 'ayg_version', AYG_VERSION ); |
| 79 | 44 | } |
| 80 | 45 | |
| 81 | -} | |
| 46 | +} | |