- made hooks documentation;

- some optimizations and make single functions for some hooks;
This commit is contained in:
nikitozzzzzzz
2018-03-02 09:55:49 +02:00
parent 6fc6db7886
commit 3d19aa00b8
64 changed files with 7287 additions and 1790 deletions
+56 -1
View File
@@ -32,8 +32,30 @@ if ( ! class_exists( 'Options' ) ) {
* @return mixed|string|void
*/
function get( $option_id ) {
if ( isset( $this->options[ $option_id ] ) )
if ( isset( $this->options[ $option_id ] ) ) {
/**
* UM hook
*
* @type filter
* @title um_get_option_filter__{$option_id}
* @description Change UM option on get by $option_id
* @input_vars
* [{"var":"$option","type":"array","desc":"Option Value"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_get_option_filter__{$option_id}', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_get_option_filter__{$option_id}', 'my_get_option_filter', 10, 1 );
* function my_get_option_filter( $option ) {
* // your code here
* return $option;
* }
* ?>
*/
return apply_filters( "um_get_option_filter__{$option_id}", $this->options[ $option_id ] );
}
switch ( $option_id ) {
case 'site_name':
@@ -90,5 +112,38 @@ if ( ! class_exists( 'Options' ) ) {
return $settings_defaults[ $option_id ];
}
/**
* Get core page ID
*
* @param string $key
*
* @return mixed|void
*/
function get_core_page_id( $key ) {
/**
* UM hook
*
* @type filter
* @title um_core_page_id_filter
* @description Change UM page slug
* @input_vars
* [{"var":"$slug","type":"array","desc":"UM page slug"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?php add_filter( 'um_core_page_id_filter', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_core_page_id_filter', 'my_core_page_id', 10, 1 );
* function my_core_page_id( $slug ) {
* // your code here
* return $slug;
* }
* ?>
*/
return apply_filters( 'um_core_page_id_filter', 'core_' . $key );
}
}
}