';
self::$wordpress_plugin_page = ''.__('Wordpress Plugin Page', 'animate').'';
self::$demo_link = ''.__('Full Documantation & Demo','animate').'';
}
public static function init(){
// load styles
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
$animate_tinymce = new Animate_TinyMCE();
// widjet class
add_action('in_widget_form', array(__CLASS__,'extend_widget_form'),11,3);
add_filter('widget_update_callback', array(__CLASS__,'update_widget_animation_class'),11,2);
}
public static function register_menu_page(){
$admin_page = add_menu_page( __('Animate', 'animate'), __('Animate', 'animate'), 'manage_options', 'animate_dashboard', array(__CLASS__, 'load_page'), plugins_url('/images/icon-20x20.png', __FILE__), '99.2' );
/**
* Filter: 'animate_manage_options_capability' - Allow changing the capability users need to view the settings pages
*
* @api string unsigned The capability
*/
$manage_options_cap = apply_filters( 'animate_manage_options_capability', 'manage_options' );
//call register settings function
add_action('admin_init', array(__CLASS__, 'page_init' )); //call register settings function
}
public static function load_page() {
$page = filter_input( INPUT_GET, 'page' );
switch ( $page ) {
case 'animate_dashboard':
default:
require_once( ANIMATE_DIR . 'admin/pages/dashboard.php' );
break;
}
}
public static function page_init() {
register_setting( 'animate-options', 'animate_option_boxClass');
register_setting( 'animate-options', 'animate_option_animateClass');
register_setting( 'animate-options', 'animate_option_offset' );
register_setting( 'animate-options', 'animate_option_mobile' );
register_setting( 'animate-options', 'animate_option_live' );
register_setting( 'animate-options', 'animate_option_customCSS' );
}
public static function plugin_row_meta($input, $file){
if ( ANIMATE_SLUG != $file ) {
return $input;
}
$links = array(
self::$wordpress_plugin_page,
self::$demo_link,
self::$donate_link,
);
$input = array_merge( $input, $links );
return $input;
}
/**
* Adds form fields to Widget
* @static
* @param $widget
* @param $return
* @param $instance
* @return array
* @since 1.0
*/
public static function extend_widget_form( $widget, $return, $instance ) {
if ( !isset( $instance['animateclasses'] ) ) $instance['animateclasses'] = null;
$fields = '';
$Lightspeed = Array('lightSpeedIn','lightSpeedOut');
$Rotating_Entrances = Array('rotateIn','rotateInDownLeft','rotateInDownRight','rotateInUpLeft','rotateInUpRight');
$Rotating_Exits = Array('rotateOut','rotateOutDownLeft','rotateOutDownRight','rotateOutUpLeft','rotateOutUpRight');
$Specials = Array('hinge','rollIn','rollOut');
$Zoom_Entrances = Array('zoomIn','zoomInDown','zoomInLeft','zoomInRight','zoomInUp');
$Zoom_Exits = Array('zoomOut','zoomOutDown','zoomOutLeft','zoomOutRight','zoomOutUp');
$preset_values = Array($Lightspeed, $Rotating_Entrances, $Rotating_Exits, $Specials, $Zoom_Entrances, $Zoom_Exits);
$selectTitles = Array( __("Attention Seekers","animate"),
__("Bouncing Entrances","animate"),
__("Bouncing Exits","animate"),
__("Fading Entrances","animate"),
__("Fading Exits","animate"),
__("Flippers","animate"),
__("Lightspeed","animate"),
__("Rotating Entrances","animate"),
__("Rotating Exits","animate"),
__("Specials","animate"),
__("Zoom Entrances","animate"),
__("Zoom Exits","animate"));
$fields .= "\t\n";
$fields .= "\t\n";
$fields .= "\n";
do_action( 'widget_css_classes_form', $fields, $instance );
echo $fields;
return $instance;
}
public static function update_widget_animation_class( $instance, $new_instance ) {
$instance['animateclasses'] = $new_instance['animateclasses'];
do_action( 'widget_css_classes_update', $instance, $new_instance );
return $instance;
}
/**
* Add a link to the settings page to the plugins list
*
* @staticvar string $this_plugin holds the directory & filename for the plugin
*
* @param array $links array of links for the plugins, adapted when the current plugin is found.
* @param string $file the filename for the current plugin, which the filter loops through.
*
* @return array $links
*/
function add_action_link( $links, $file ) {
if ( ANIMATE_SLUG === $file ) {
$settings_link = '' . __( 'Settings', 'animate' ) . '';
array_unshift( $links, $settings_link );
}
return $links;
}
}
}