*/ function addoremo_get_default_settings() { return array( // General. 'enabled' => 1, 'auto_content' => 0, 'selector' => '.read-more', 'collapsed_height' => 160, 'anim_speed' => 350, 'device' => 'all', 'mobile_breakpoint' => 767, 'remember' => 0, // Labels. 'more_text' => __( 'Read more', 'addoncraft-read-more-show-less' ), 'less_text' => __( 'Show less', 'addoncraft-read-more-show-less' ), 'show_arrow' => 1, // Appearance. 'style' => 'link', // link | button | pill. 'align' => 'left', // left | center | right. 'text_color' => '#4f46e5', 'button_bg' => '#4f46e5', 'button_hover' => '#4338ca', 'font_family' => '', 'font_weight' => '600', 'font_style' => 'normal', 'fade' => 1, 'fade_style' => 'solid', // solid | gradient. 'fade_color' => '#ffffff', 'fade_color2' => '#eef2ff', 'icon_size' => 14, 'down_arrow' => '', 'up_arrow' => '', ); } /** * Whitelisted font-family choices: key => CSS stack. * * @return array */ function addoremo_font_stacks() { return array( '' => '', 'system' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif', 'arial' => 'Arial, Helvetica, sans-serif', 'helvetica' => '"Helvetica Neue", Helvetica, Arial, sans-serif', 'verdana' => 'Verdana, Geneva, sans-serif', 'tahoma' => 'Tahoma, Geneva, sans-serif', 'trebuchet' => '"Trebuchet MS", Helvetica, sans-serif', 'segoe' => '"Segoe UI", Tahoma, Geneva, sans-serif', 'georgia' => 'Georgia, "Times New Roman", serif', 'times' => '"Times New Roman", Times, serif', 'palatino' => '"Palatino Linotype", "Book Antiqua", Palatino, serif', 'garamond' => 'Garamond, "Times New Roman", serif', 'courier' => '"Courier New", Courier, monospace', 'monospace' => 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace', ); } /** * Font-family labels. * * @return array */ function addoremo_font_labels() { return array( '' => __( 'Theme default (inherit)', 'addoncraft-read-more-show-less' ), 'system' => __( 'System UI', 'addoncraft-read-more-show-less' ), 'arial' => 'Arial', 'helvetica' => 'Helvetica Neue', 'verdana' => 'Verdana', 'tahoma' => 'Tahoma', 'trebuchet' => 'Trebuchet MS', 'segoe' => 'Segoe UI', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'palatino' => 'Palatino', 'garamond' => 'Garamond', 'courier' => 'Courier New', 'monospace' => 'Monospace', ); } /** * Merged settings (saved over defaults). * * @return array */ function addoremo_get_settings() { $saved = get_option( ADDOREMO_OPTION_KEY, array() ); if ( ! is_array( $saved ) ) { $saved = array(); } return wp_parse_args( $saved, addoremo_get_default_settings() ); } /** * Activation: seed defaults. * * @return void */ function addoremo_activate() { if ( false === get_option( ADDOREMO_OPTION_KEY, false ) ) { add_option( ADDOREMO_OPTION_KEY, addoremo_get_default_settings() ); } } register_activation_hook( __FILE__, 'addoremo_activate' ); /** * Boot. * * @return void */ function addoremo_init() { if ( is_admin() ) { new ADDOREMO_Settings(); } new ADDOREMO_Frontend(); } add_action( 'plugins_loaded', 'addoremo_init' ); /** * Settings link on the plugins row. * * @param array $links Links. * @return array */ function addoremo_plugin_action_links( $links ) { $url = admin_url( 'admin.php?page=' . ADDOREMO_Settings::PAGE_SLUG ); $link = '' . esc_html__( 'Settings', 'addoncraft-read-more-show-less' ) . ''; array_unshift( $links, $link ); return $links; } add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'addoremo_plugin_action_links' );