' . esc_attr__( 'Click here', 'supportcandy' ) . ''
);
?>
$ticket_widget ) {
if ( ! class_exists( $ticket_widget['class'] ) ) {
continue;
}
$style = ! $ticket_widget['is_enable'] ? 'background-color:#eec7ca;color:#dc2222' : '';
?>
$widget ) {
$ticket_widgets[ $key ]['is_enable'] = $is_enable;
}
update_option( 'wpsc-ticket-widget', $ticket_widgets );
wp_die();
}
/**
* After new agent role added add that role in ticket widgets
*
* @param integer $role_id - agent role id.
* @return void
*/
public static function after_add_agent_role( $role_id ) {
$ticket_widgets = get_option( 'wpsc-ticket-widget', array() );
foreach ( $ticket_widgets as $key => $widget ) {
$widget['allowed-agent-roles'][] = $role_id;
$ticket_widgets[ $key ] = $widget;
}
update_option( 'wpsc-ticket-widget', $ticket_widgets );
}
/**
* After agent role cloned, add the new role to every ticket widget the source role was allowed on.
*
* @param integer $new_role_id - newly cloned agent role id.
* @param integer $source_role_id - source agent role id that was cloned.
* @return void
*/
public static function after_clone_agent_role( $new_role_id, $source_role_id ) {
$ticket_widgets = get_option( 'wpsc-ticket-widget', array() );
foreach ( $ticket_widgets as $key => $widget ) {
$allowed_agent_roles = isset( $widget['allowed-agent-roles'] ) ? $widget['allowed-agent-roles'] : array();
if ( in_array( $source_role_id, $allowed_agent_roles ) ) {
$widget['allowed-agent-roles'][] = $new_role_id;
$ticket_widgets[ $key ] = $widget;
}
}
update_option( 'wpsc-ticket-widget', $ticket_widgets );
}
}
endif;
WPSC_Ticket_Widgets::init();