diff -r 000000000000 -r d970ebf37754 wp/wp-content/plugins/codecanyon-3027163-content-timeline-responsive-wordpress-plugin/content_timeline_class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-content/plugins/codecanyon-3027163-content-timeline-responsive-wordpress-plugin/content_timeline_class.php Wed Nov 06 03:21:17 2013 +0000 @@ -0,0 +1,365 @@ +main = $file; + $this->init(); + return $this; + } + + function init() { + $this->path = dirname( __FILE__ ); + $this->name = basename( $this->path ); + $this->url = plugins_url( "/{$this->name}/" ); + if( is_admin() ) { + + register_activation_hook( $this->main , array(&$this, 'activate') ); + + add_action('admin_menu', array(&$this, 'admin_menu')); + + // Ajax calls + add_theme_support( 'post-thumbnails' ); + add_action('wp_ajax_ctimeline_save', array(&$this, 'ajax_save')); + add_action('wp_ajax_ctimeline_preview', array(&$this, 'ajax_preview')); + add_action('wp_ajax_ctimeline_post_search', array(&$this, 'ajax_post_search')); + add_action('wp_ajax_ctimeline_post_get', array(&$this, 'ajax_post_get')); + add_action('wp_ajax_ctimeline_post_category_get', array(&$this, 'ajax_post_category_get')); + add_action('wp_ajax_ctimeline_frontend_get', array(&$this, 'ajax_frontend_get')); + add_action('wp_ajax_nopriv_ctimeline_frontend_get', array(&$this, 'ajax_frontend_get')); + + } + else { + add_action('wp', array(&$this, 'frontend_includes')); + add_shortcode('content_timeline', array(&$this, 'shortcode') ); + } + } + + function activate() { + global $wpdb; + + $table_name = $wpdb->base_prefix . 'ctimelines'; + + if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { + $royal_sliders_sql = "CREATE TABLE " . $table_name ." ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + name tinytext NOT NULL COLLATE utf8_general_ci, + settings text NOT NULL COLLATE utf8_general_ci, + items text NOT NULL COLLATE utf8_general_ci, + PRIMARY KEY (id) + );"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($royal_sliders_sql); + } + + } + + function admin_menu() { + $ctmenu = add_menu_page( 'Content Timeline', 'Content Timeline', 'manage_options', 'contenttimeline', array(&$this, 'admin_page')); + $submenu = add_submenu_page( 'contenttimeline', 'Content Timeline', 'Add New', 'manage_options', 'contenttimeline_edit', array(&$this, 'admin_edit_page')); + + add_action('load-'.$ctmenu, array(&$this, 'admin_menu_scripts')); + add_action('load-'.$submenu, array(&$this, 'admin_menu_scripts')); + add_action('load-'.$ctmenu, array(&$this, 'admin_menu_styles')); + add_action('load-'.$submenu, array(&$this, 'admin_menu_styles')); + } + + function admin_menu_scripts() { + wp_enqueue_script('post'); + wp_enqueue_script('farbtastic'); + wp_enqueue_script('thickbox'); + wp_enqueue_script('ctimeline-admin-js', $this->url . 'js/ctimeline_admin.js' ); + wp_enqueue_script('jQuery-easing', $this->url . 'js/frontend/jquery.easing.1.3.js' ); + wp_enqueue_script('jQuery-timeline', $this->url . 'js/frontend/jquery.timeline.js' ); + + wp_enqueue_script('jQuery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js' ); + wp_enqueue_script('jQuery-mousew', $this->url . 'js/frontend/jquery.mousewheel.min.js' ); + wp_enqueue_script('jQuery-customScroll', $this->url . 'js/frontend/jquery.mCustomScrollbar.min.js' ); + } + + function admin_menu_styles() { + wp_enqueue_style('farbtastic'); + wp_enqueue_style('thickbox'); + wp_enqueue_style( 'ctimeline-admin-css', $this->url . 'css/ctimeline_admin.css' ); + wp_enqueue_style( 'ctimeline-thick-css', $this->url . 'css/thickbox.css' ); + wp_enqueue_style( 'timeline-css', $this->url . 'css/frontend/timeline.css' ); + wp_enqueue_style( 'customScroll-css', $this->url . 'css/frontend/jquery.mCustomScrollbar.css' ); + } + + function ajax_save() { + $id = false; + $settings = ''; + $items = ''; + foreach( $_POST as $key => $value) { + if ($key != 'action') { + if ($key == 'timeline_id'){ + if ($value != '') { + $id = (int)$value; + } + } + else if ($key == 'timeline_title'){ + $name = stripslashes($value); + } + else if(strpos($key,'sort') === 0){ + $items .= $key . '::' . stripslashes($value) . '||'; + } + else { + $settings .= $key . '::' . stripslashes($value) . '||'; + } + } + } + if ($items != '') $items = substr($items,0,-2); + if ($settings != '') $settings = substr($settings,0,-2); + global $wpdb; + $table_name = $wpdb->base_prefix . 'ctimelines'; + if($id) { + $wpdb->update( + $table_name, + array( + 'name'=>$name, + 'settings'=>$settings, + 'items'=>$items), + array( 'id' => $id ), + array( + '%s', + '%s', + '%s'), + array('%d') + ); + } + else { + $wpdb->insert( + $table_name, + array( + 'name'=>$name, + 'settings'=>$settings, + 'items'=>$items), + array( + '%s', + '%s', + '%s') + + ); + $id = $wpdb->insert_id; + } + + + echo $id; + die(); + } + + function ajax_preview() { + $tid = false; + $tsettings = ''; + $titems = ''; + foreach( $_POST as $key => $value) { + if ($key != 'action') { + if ($key == 'timeline_id'){ + if ($value != '') { + $tid = (int)$value; + } + } + else if ($key == 'timeline_title'){ + $tname = $value; + } + else if(strpos($key,'sort') === 0){ + $titems .= $key . '::' . $value . '||'; + } + else { + $tsettings .= $key . '::' . $value . '||'; + } + } + } + if ($titems != '') $titems = substr($titems,0,-2); + if ($tsettings != '') $tsettings = substr($tsettings,0,-2); + + include_once($this->path . '/pages/content_timeline_preview.php'); + + die(); + } + + function ajax_post_search(){ + if(isset($_POST['query']) && !empty($_POST['query'])){ + $searchVal = strtolower($_POST['query']); + } + else { + $searchVal = ''; + } + + $query_args = array( 'posts_per_page' => -1, 'post_type' => 'any'); + $query = new WP_Query( $query_args ); + + foreach ( $query->posts as $match) { + if($searchVal != ''){ + if(strpos(strtolower($match->post_name), $searchVal) !== false){ + $thumbn = wp_get_attachment_image_src( get_post_thumbnail_id($match->ID) , 'full'); + echo '