PluginProbe
Authorsy – Author Box, Multiple Authors, Guest Authors & Post Rating / trunk
Authorsy – Author Box, Multiple Authors, Guest Authors & Post Rating vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8
authorsy / core / settings / settings.php

settings.php in Authorsy – Author Box, Multiple Authors, Guest Authors & Post Rating trunk, at core/settings/settings.php

77 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Global settings for authorsy
4 *
5 * @package Authorsy
6 */
7
8 // Exit if accessed directly
9 defined( 'ABSPATH' ) || exit;
10
11 if ( ! function_exists( 'authorsy_get_option' ) ) {
12 /**
13 * Get option for authorsy
14 *
15 * @since 1.0.0
16 * @return mixed
17 */
18 function authorsy_get_option( $key = '', $default = false ) {
19 $options = get_option( 'authorsy_settings' );
20 $value = $default;
21
22 if ( isset( $options[$key] ) ) {
23 $value = ! empty( $options[$key] ) ? $options[$key] : $default;
24 }
25
26 return $value;
27 }
28 }
29
30 if ( ! function_exists( 'authorsy_update_option' ) ) {
31
32 /**
33 * Update option
34 *
35 * @param string $key
36 *
37 * @since 1.0.0
38 *
39 * @return boolean
40 */
41 function authorsy_update_option( $key = '', $value = false ) {
42 if ( ! $key ) {
43 return false;
44 }
45
46 // Get the current settings.
47 $options = get_option( 'authorsy_settings', [] );
48
49 // Set new settings value.
50 $options[$key] = $value;
51
52 // Update the settings.
53 $did_update = update_option( 'authorsy_settings', $options );
54
55 return $did_update;
56 }
57 }
58
59 if ( ! function_exists( 'authorsy_get_settings' ) ) {
60
61 /**
62 * Get settings
63 *
64 * Retrieve all plugin settings
65 *
66 * @since 1.0.0
67 *
68 * @return array Authorsy Settings
69 */
70 function authorsy_get_settings() {
71 // Get the option key.
72 $settings = get_option( 'authorsy_settings' );
73
74 return apply_filters( 'authorsy_get_settings', $settings );
75 }
76 }
77