'success' ) ); // Return JS OBJ: response_data = { response: "success" } in "dismiss.js"
// This function call wp_die( '', '', array( 'response' => null, ) )
}
/** JSS */
public function opsd_js_load_files( $where_to_load ) {
$in_footer = true;
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
wp_enqueue_script( 'opsd-dismiss', opsd_plugin_url( '/core/any/js/dismiss.js' ), array( 'opsd-global-vars' ), '1.1', $in_footer );
}
}
/** CSS */
public function opsd_enqueue_css_files( $where_to_load ) {
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
wp_enqueue_style( 'opsd-dismiss', opsd_plugin_url( '/core/any/css/dismiss.css' ), array(), OPSD_VERSION_NUM );
}
}
/** Check if this section dismissed or not.
*
* @param string $section_html_id
* @return boolean
*/
public function is_dismissed( $section_html_id ) {
if ( '1' == get_user_option( 'opsd_win_' . $section_html_id ) )
return true;
else
return false;
}
}
function opsd_dismiss() {
return OPSD_Dismiss::init();
}
opsd_dismiss(); // Run
/** Check if specific section dismissed or not
*
* @param type $section_html_id
* @return boolean
*/
function opsd_section_is_dismissed( $section_html_id ) {
$opsd_dismiss = opsd_dismiss();
return $opsd_dismiss->is_dismissed( $section_html_id );
}
/** Show dismiss X button
*
* @param string $title
* @param array $attributes_arr - array of attributes, like: array( 'class' => 'opsd_dismiss' )
* @param bool $echo
* @return string of dismiss button
*/
function opsd_x_dismiss_button( $title = '×', $attributes_arr = array(), $echo = true ) {
$defaults = array(
'style' => ''
, 'class' => 'opsd_dismiss'
, 'title' => esc_js( __( 'Close', 'secure-downloads' ) )
);
$attributes_arr = wp_parse_args( $attributes_arr, $defaults );
$attr_echo = array();
foreach ( $attributes_arr as $attr_name => $attr_value ) {
$attr_echo[] = esc_attr( $attr_name ) . '="' . esc_attr( $attr_value ) . '"';
}
$attr_echo = implode( ' ', $attr_echo );
if ( ! $echo ) { ob_start(); }
?> >