';
}
/**
* Checkbox Callback
*
* Renders checkboxes.
*
* @param array $args Arguments passed by the setting
*/
public static function checkbox( $args ) {
$checked = isset( static::$_options[ $args['id'] ] ) ? checked( 1, static::$_options[ $args['id'] ], false ) : '';
$html = '';
$html .= '';
echo $html;
}
/**
* Multicheck Callback
*
* Renders multiple checkboxes.
*
* @param array $args Arguments passed by the setting
*/
public static function multicheck( $args ) {
if ( ! empty( $args['options'] ) ) {
foreach ( $args['options'] as $key => $option ):
if ( isset( static::$_options[ $args['id'] ][ $key ] ) ) {
$enabled = $option;
} else {
$enabled = null;
}
echo ' ';
echo '
';
endforeach;
echo '
' . $args['desc'] . '
'; } } /** * Radio Callback * * Renders radio boxes. * * @param array $args Arguments passed by the setting */ public static function radio( $args ) { foreach ( $args['options'] as $key => $option ) : $checked = false; if ( isset( static::$_options[ $args['id'] ] ) && static::$_options[ $args['id'] ] == $key ) { $checked = true; } elseif ( isset( $args['std'] ) && $args['std'] == $key && ! isset( static::$_options[ $args['id'] ] ) ) { $checked = true; } echo ' '; echo '' . $args['desc'] . '
'; } /** * Text Callback * * Renders text fields. * * @param array $args Arguments passed by the setting */ public static function text( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; $html = ''; $html .= ''; echo $html; } /** * Number Callback * * Renders number fields. * * @param array $args Arguments passed by the setting */ public static function number( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } $max = isset( $args['max'] ) ? $args['max'] : 999999; $min = isset( $args['min'] ) ? $args['min'] : 0; $step = isset( $args['step'] ) ? $args['step'] : 1; $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; $html = ''; $html .= ''; echo $html; } /** * Textarea Callback * * Renders textarea fields. * * @param array $args Arguments passed by the setting */ public static function textarea( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } $html = ''; $html .= ''; echo $html; } /** * Password Callback * * Renders password fields. * * @param array $args Arguments passed by the setting */ public static function password( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; $html = ''; $html .= ''; echo $html; } /** * Missing Callback * * If a function is missing for settings callbacks alert the user. * * @param array $args Arguments passed by the setting * * @return void */ public static function missing( $args ) { printf( __( 'The callback function used for the %s setting is missing.', 'content-control' ), $args['id'] ); } /** * Select Callback * * Renders select fields. * * @param array $args Arguments passed by the setting */ public static function select( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } if ( isset( $args['placeholder'] ) ) { $placeholder = $args['placeholder']; } else { $placeholder = ''; } if ( isset( $args['chosen'] ) ) { $chosen = 'class="'. static::$_prefix . '-chosen"'; } else { $chosen = ''; } $html = ''; foreach ( $args['options'] as $option => $name ) : $selected = selected( $option, $value, false ); $html .= ''; endforeach; $html .= ''; $html .= ''; echo $html; } /** * Dashicon Callback * * Renders select fields with dashicon preview. * * @param array $args Arguments passed by the setting */ public static function dashicon( $args ) { if ( isset( static::$_options[ $args['id'] ] ) ) { $value = static::$_options[ $args['id'] ]; } else { $value = isset( $args['std'] ) ? $args['std'] : ''; } $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; $html = '