--- a/portfolio-manager-powered-by-behance/classes/eds-bpm-admin.php
+++ b/portfolio-manager-powered-by-behance/classes/eds-bpm-admin.php
@@ -1,87 +1,87 @@
-<?php
-if ( ! defined( 'WPINC' ) ) {
- die;
-}
-
-
-include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-config.php';
-include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-project-manager.php';
-include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-category-manager.php';
-include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-configuration-manager.php';
-
-if(!class_exists("EDS_BPM_Admin")){
-class EDS_BPM_Admin{
-
- public function __construct(){
-
- }
-
- public function add_bpm_menu(){
- $project_manager = new EDS_BPM_Project_Manager();
- $category_manager = new EDS_BPM_Category_Manager();
- $config_manager = EDS_BPM_Configuration_Manager::get_instance();
-
- $page_hook1 = add_menu_page( /*$page_title*/__('Portfolio Manager - Projects', 'eds-bpm'),
- /*$menu_title*/ __('Portfolio Manager','eds-bpm'),
- /*$capability*/'manage_options',
- /*$menu_slug*/EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /*$function*/array($project_manager, 'initialize'),
- /*$icon_url*/plugin_dir_url(__FILE__).'../images/eds-bpm-16x16.png');
-
- add_action("admin_print_scripts-" . $page_hook1 , array( $this, 'eds_bpm_add_scripts'));
- add_action("admin_print_styles-". $page_hook1 , array( $this, 'eds_bpm_add_css') );
-
-
- $page_hook2 = add_submenu_page( /* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /*$page_title*/__('Portfolio Manager - Projects', 'eds-bpm'),
- /*$menu_title*/ __('All Projects','eds-bpm'),
- /*$capability*/'manage_options',
- /*$menu_slug*/EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /*$function*/array($project_manager, 'initialize'));
-
- add_action("admin_print_scripts-" . $page_hook2 , array( $this, 'eds_bpm_add_scripts'));
- add_action("admin_print_styles-". $page_hook2 , array( $this, 'eds_bpm_add_css') );
-
- $page_hook3 = add_submenu_page( /* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /*$page_title*/__('Portfolio Manager - New Project', 'eds-bpm'),
- /*$menu_title*/ __('Add New','eds-bpm'),
- /*$capability*/'manage_options',
- /*$menu_slug*/EDS_BPM_Config::$eds_bpm_new_project_slug,
- /*$function*/array($project_manager, 'initialize'));
-
- add_action("admin_print_scripts-" . $page_hook3 , array( $this, 'eds_bpm_add_scripts'));
- add_action("admin_print_styles-". $page_hook3 , array( $this, 'eds_bpm_add_css') );
-
-
- $page_hook4 = add_submenu_page(/* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /* $page_title */ __('Portfolio Manager - Categories', 'eds-bpm'),
- /* $menu_title */__('Categories', 'eds-bpm'),
- /* $capability */'manage_options',
- /* $menu_slug */EDS_BPM_Config::$eds_bpm_category_menu_slug,
- /* $function */ array($category_manager, 'initialize'));
-
- add_action("admin_print_scripts-" . $page_hook4 , array( $this, 'eds_bpm_add_scripts'));
- add_action("admin_print_styles-". $page_hook4 , array( $this, 'eds_bpm_add_css') );
-
-
- $page_hook5 = add_submenu_page(/* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
- /* $page_title */ __('Portfolio Manager - Settings', 'eds-bpm'),
- /* $menu_title */__('Settings', 'eds-bpm'),
- /* $capability */'manage_options',
- /* $menu_slug */EDS_BPM_Config::$eds_bpm_cofig_menu_slug,
- /* $function */ array($config_manager, 'init_configuration_page'));
-
- add_action("admin_print_scripts-" . $page_hook5, array( $this, 'eds_bpm_add_scripts'));
- add_action("admin_print_styles-". $page_hook5, array( $this, 'eds_bpm_add_css') );
-
- }
-
- public function eds_bpm_add_scripts(){
- do_action('eds_bpm_load_admin_scripts_on_page');
- }
-
- public function eds_bpm_add_css(){
- do_action('eds_bpm_load_admin_styles_on_page');
- }
-}
+<?php
+if ( ! defined( 'WPINC' ) ) {
+ die;
+}
+
+
+include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-config.php';
+include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-project-manager.php';
+include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-category-manager.php';
+include_once EDS_BPM_Loader::$abs_path . '/classes/eds-bpm-configuration-manager.php';
+
+if(!class_exists("EDS_BPM_Admin")){
+class EDS_BPM_Admin{
+
+ public function __construct(){
+
+ }
+
+ public function add_bpm_menu(){
+ $project_manager = new EDS_BPM_Project_Manager();
+ $category_manager = new EDS_BPM_Category_Manager();
+ $config_manager = EDS_BPM_Configuration_Manager::get_instance();
+
+ $page_hook1 = add_menu_page( /*$page_title*/__('Portfolio Manager - Projects', 'eds-bpm'),
+ /*$menu_title*/ __('Portfolio Manager','eds-bpm'),
+ /*$capability*/'manage_options',
+ /*$menu_slug*/EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /*$function*/array($project_manager, 'initialize'),
+ /*$icon_url*/plugin_dir_url(__FILE__).'../images/eds-bpm-16x16.png');
+
+ add_action("admin_print_scripts-" . $page_hook1 , array( $this, 'eds_bpm_add_scripts'));
+ add_action("admin_print_styles-". $page_hook1 , array( $this, 'eds_bpm_add_css') );
+
+
+ $page_hook2 = add_submenu_page( /* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /*$page_title*/__('Portfolio Manager - Projects', 'eds-bpm'),
+ /*$menu_title*/ __('All Projects','eds-bpm'),
+ /*$capability*/'manage_options',
+ /*$menu_slug*/EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /*$function*/array($project_manager, 'initialize'));
+
+ add_action("admin_print_scripts-" . $page_hook2 , array( $this, 'eds_bpm_add_scripts'));
+ add_action("admin_print_styles-". $page_hook2 , array( $this, 'eds_bpm_add_css') );
+
+ $page_hook3 = add_submenu_page( /* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /*$page_title*/__('Portfolio Manager - New Project', 'eds-bpm'),
+ /*$menu_title*/ __('Add New','eds-bpm'),
+ /*$capability*/'manage_options',
+ /*$menu_slug*/EDS_BPM_Config::$eds_bpm_new_project_slug,
+ /*$function*/array($project_manager, 'initialize'));
+
+ add_action("admin_print_scripts-" . $page_hook3 , array( $this, 'eds_bpm_add_scripts'));
+ add_action("admin_print_styles-". $page_hook3 , array( $this, 'eds_bpm_add_css') );
+
+
+ $page_hook4 = add_submenu_page(/* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /* $page_title */ __('Portfolio Manager - Categories', 'eds-bpm'),
+ /* $menu_title */__('Categories', 'eds-bpm'),
+ /* $capability */'manage_options',
+ /* $menu_slug */EDS_BPM_Config::$eds_bpm_category_menu_slug,
+ /* $function */ array($category_manager, 'initialize'));
+
+ add_action("admin_print_scripts-" . $page_hook4 , array( $this, 'eds_bpm_add_scripts'));
+ add_action("admin_print_styles-". $page_hook4 , array( $this, 'eds_bpm_add_css') );
+
+
+ $page_hook5 = add_submenu_page(/* $parent_slug */ EDS_BPM_Config::$eds_bpm_top_menu_slug,
+ /* $page_title */ __('Portfolio Manager - Settings', 'eds-bpm'),
+ /* $menu_title */__('Settings', 'eds-bpm'),
+ /* $capability */'manage_options',
+ /* $menu_slug */EDS_BPM_Config::$eds_bpm_cofig_menu_slug,
+ /* $function */ array($config_manager, 'init_configuration_page'));
+
+ add_action("admin_print_scripts-" . $page_hook5, array( $this, 'eds_bpm_add_scripts'));
+ add_action("admin_print_styles-". $page_hook5, array( $this, 'eds_bpm_add_css') );
+
+ }
+
+ public function eds_bpm_add_scripts(){
+ do_action('eds_bpm_load_admin_scripts_on_page');
+ }
+
+ public function eds_bpm_add_css(){
+ do_action('eds_bpm_load_admin_styles_on_page');
+ }
+}
}
No newline at end of file
--- a/portfolio-manager-powered-by-behance/classes/eds-bpm-behance.php
+++ b/portfolio-manager-powered-by-behance/classes/eds-bpm-behance.php
@@ -1,121 +1,121 @@
-<?php
-if ( ! defined( 'WPINC' ) ) {
- die;
-}
-include_once EDS_BPM_Loader::$abs_path. '/classes/eds-bpm-config.php';
-include_once EDS_BPM_Loader::$abs_path. '/includes/Be/ApiException.php';
-include_once EDS_BPM_Loader::$abs_path. '/includes/Be/Client.php';
-
-if(!class_exists("EDS_BPM_Behance")){
-class EDS_BPM_Behance{
-
- var $general_config = null;
-
- public function __construct(){
- $this->general_config = EDS_BPM_Config::get_general_config();
- }
-
- public function get_behance_project($id){
- $result = new stdClass();
- $id = trim($id);
-
- $result->data = $this->fetch_project_content($id);
- if($result->data==null || !isset($result->data))
- {
- $result->status = 'F';
- $result->data = null;
- $result->msg = __('Unable to retrieve Project from Behance.' , 'eds-bpm');
- }
- else if($result->data == -1)
- {
- $result->status = 'F';
- $result->data = null;
- $result->msg = __('You need to enter the Behance API Key in Portfolio Manager > Settings > General. Get one from' , 'eds-bpm');
- $result->msg .= ' <a href="https://www.behance.net/dev" target="_blank">'. __('here' , 'eds-bpm') . '</a>';
- }
- else
- {
- $result->status = 'S';
- $result->msg = __('Project content retrieved successfully.' , 'eds-bpm');
- }
- return $result;
-
- }
-
-
- private function fetch_project_content($projectID){
-
- $bAPIKey = $this->general_config['behance_api_key'];
-
- if(isset($bAPIKey) && $bAPIKey!='')
- {
- $clientID= trim($bAPIKey);
- try {
- $api = new Be_Client( $clientID);
- $data = $api->getProject( $projectID , true);
- return $data;
- }
- catch(Exception $e)
- {
- return null;
- }
- }
- else
- return -1;
- }
-
- public function get_user_projects( $user_id ) {
- $bAPIKey = $this->general_config['behance_api_key'];
- $userProjects = array();
- $pageNumber = 1;
- if(isset($bAPIKey) && $bAPIKey!='')
- {
- $clientID= trim($bAPIKey);
- try {
- $api = new Be_Client( $clientID);
- while(1) {
- $projects = $api->getUserProjects( $user_id, array("page" => $pageNumber), true);
- if( !empty( $projects )) {
- $userProjects = array_merge($userProjects, $projects);
- $pageNumber++;
- } else {
- break;
- }
- }
-
- return $userProjects;
- }
- catch(Exception $e)
- {
- return null;
- }
- }
- else
- return null;
-
- }
-
- public function get_project_comments($projectID) {
-
- $bAPIKey = $this->general_config['behance_api_key'];
-
- if(isset($bAPIKey) && $bAPIKey!='')
- {
- $clientID= trim($bAPIKey);
- try {
- $api = new Be_Client( $clientID);
- $data = $api->getProjectComments( $projectID, true);
- return $data;
- }
- catch(Exception $e)
- {
- return null;
- }
- }
- else
- return null;
- }
-
-
-}
+<?php
+if ( ! defined( 'WPINC' ) ) {
+ die;
+}
+include_once EDS_BPM_Loader::$abs_path. '/classes/eds-bpm-config.php';
+include_once EDS_BPM_Loader::$abs_path. '/includes/Be/ApiException.php';
+include_once EDS_BPM_Loader::$abs_path. '/includes/Be/Client.php';
+
+if(!class_exists("EDS_BPM_Behance")){
+class EDS_BPM_Behance{
+
+ var $general_config = null;
+
+ public function __construct(){
+ $this->general_config = EDS_BPM_Config::get_general_config();
+ }
+
+ public function get_behance_project($id){
+ $result = new stdClass();
+ $id = trim($id);
+
+ $result->data = $this->fetch_project_content($id);
+ if($result->data==null || !isset($result->data))
+ {
+ $result->status = 'F';
+ $result->data = null;
+ $result->msg = __('Unable to retrieve Project from Behance.' , 'eds-bpm');
+ }
+ else if($result->data == -1)
+ {
+ $result->status = 'F';
+ $result->data = null;
+ $result->msg = __('You need to enter the Behance API Key in Portfolio Manager > Settings > General. Get one from' , 'eds-bpm');
+ $result->msg .= ' <a href="https://www.behance.net/dev" target="_blank">'. __('here' , 'eds-bpm') . '</a>';
+ }
+ else
+ {
+ $result->status = 'S';
+ $result->msg = __('Project content retrieved successfully.' , 'eds-bpm');
+ }
+ return $result;
+
+ }
+
+
+ private function fetch_project_content($projectID){
+
+ $bAPIKey = $this->general_config['behance_api_key'];
+
+ if(isset($bAPIKey) && $bAPIKey!='')
+ {
+ $clientID= trim($bAPIKey);
+ try {
+ $api = new Be_Client( $clientID);
+ $data = $api->getProject( $projectID , true);
+ return $data;
+ }
+ catch(Exception $e)
+ {
+ return null;
+ }
+ }
+ else
+ return -1;
+ }
+
+ public function get_user_projects( $user_id ) {
+ $bAPIKey = $this->general_config['behance_api_key'];
+ $userProjects = array();
+ $pageNumber = 1;
+ if(isset($bAPIKey) && $bAPIKey!='')
+ {
+ $clientID= trim($bAPIKey);
+ try {
+ $api = new Be_Client( $clientID);
+ while(1) {
+ $projects = $api->getUserProjects( $user_id, array("page" => $pageNumber), true);
+ if( !empty( $projects )) {
+ $userProjects = array_merge($userProjects, $projects);
+ $pageNumber++;
+ } else {
+ break;
+ }
+ }
+
+ return $userProjects;
+ }
+ catch(Exception $e)
+ {
+ return null;
+ }
+ }
+ else
+ return null;
+
+ }
+
+ public function get_project_comments($projectID) {
+
+ $bAPIKey = $this->general_config['behance_api_key'];
+
+ if(isset($bAPIKey) && $bAPIKey!='')
+ {
+ $clientID= trim($bAPIKey);
+ try {
+ $api = new Be_Client( $clientID);
+ $data = $api->getProjectComments( $projectID, true);
+ return $data;
+ }
+ catch(Exception $e)
+ {
+ return null;
+ }
+ }
+ else
+ return null;
+ }
+
+
+}
}
No newline at end of file
--- a/portfolio-manager-powered-by-behance/classes/eds-bpm-category-manager.php
+++ b/portfolio-manager-powered-by-behance/classes/eds-bpm-category-manager.php
@@ -58,26 +58,31 @@
break;
case 'save':
+ check_admin_referer('eds_bpm_nonce');
$this->save_category();
wp_redirect($url);exit;
break;
case 'publish':
+ check_admin_referer('eds_bpm_nonce');
$this->publish_category();
wp_redirect($url);exit;
break;
case 'unpublish':
+ check_admin_referer('eds_bpm_nonce');
$this->unpublish_category();
wp_redirect($url);exit;
break;
case 'delete':
+ check_admin_referer('eds_bpm_nonce');
$this->delete_category();
wp_redirect($url);exit;
break;
case 'trash':
+ check_admin_referer('eds_bpm_nonce');
$this->trash_category();
wp_redirect($url);exit;
break;
--- a/portfolio-manager-powered-by-behance/classes/eds-bpm-config.php
+++ b/portfolio-manager-powered-by-behance/classes/eds-bpm-config.php
@@ -1,169 +1,169 @@
-<?php
-if ( ! defined( 'WPINC' ) ) {
- die;
-}
-
-if(!class_exists("EDS_BPM_Config")){
-class EDS_BPM_Config{
-
- public static $project_table = "bpm_projects";
- public static $category_table = "bpm_categories";
-
- public static $eds_bpm_top_menu_slug = "eds-bpm-top-menu";
- public static $eds_bpm_new_project_slug = "eds-bpm-new-project";
- public static $eds_bpm_category_menu_slug = "eds-bpm-cat-menu";
-
- public static $eds_bpm_cofig_menu_slug = "eds-bpm-config-menu";
-
- public static $general_config_key = "eds-bpm-general-config";
- public static $advanced_config_key = "eds-bpm-advanced-config";
- public static $general_section = "eds-bpm-general-section";
- public static $advanced_section = "eds-bpm-advanced-section";
-
- public static $navigation_button_config_key = "eds-bpm-navigation-btn";
- public static $navigation_button_section = "eds-bpm-navigation-btn-section";
-
- public static $result_per_page = 10;
-
- public static $advanced_config = null;
- public static $general_config = null;
- public static $navigation_button_config = null;
-
- public static function get_js_messages() {
- return array(
- 'chooseImage' => __('Choose Image', 'eds-bpm'),
- 'selectCategory' => __('Please select atleast one Category','eds-bpm'),
- 'deleteSelectedCategory' => __('Are you sure, you wish to delete the selected category(s)?','eds-bpm'),
- 'permanentDeleteSelectedCategory' => __('Are you sure, you wish to permanently delete the selected category?','eds-bpm'),
- 'selectOneProject' => __('Please select atleast one Project','eds-bpm'),
- 'deleteSelectedProject' => __('Are you sure, you wish to delete the selected project(s)?','eds-bpm'),
- 'permanentDeleteSelectedProject' => __('Are you sure, you wish to permanently delete the selected project(s)?','eds-bpm'),
- 'provideUserId' => __('Please provide user id.','eds-bpm'),
- 'importingProjects' => __('Importing Projects...','eds-bpm'),
- 'projectsImported' => __('Project(s) Imported.','eds-bpm'),
- 'unableImportingProjects' => __('Unable to import projects, please check the Behance User Id and Behance API key in settings.','eds-bpm'),
- 'problemImportingProjects' => __('A problem occured while importing projects. Please try again later.','eds-bpm'),
- 'noProjectAvailable' => __('No Project available to save. kindly import the projects first.','eds-bpm'),
- 'savingProjects' => __('Saving Projects, It might take some time...','eds-bpm'),
- 'projectsSaved' => __('Projects saved successfully, refreshing page now.','eds-bpm'),
- 'problemSavingProjects' => __('Problem occured while saving projects. Please try again after some time. If the problem persist, please','eds-bpm'),
- 'contactPluginAdministor' => __('contact plugin administrator','eds-bpm'),
- 'behanceProjectId' => __('Please enter Behance Project ID','eds-bpm'),
- 'inputNumericValue' => __('Please enter a numeric value','eds-bpm'),
- 'portfolioManager' => __('Portfolio Manager - Powered by Behance','eds-bpm'),
- 'authorName' => __('Eleopard Design Studios Pvt. Ltd.','eds-bpm')
- );
- }
-
- public static function get_advanced_config(){
- if(self::$advanced_config ==null){
- self::$advanced_config = array();
-
- if(get_option( self::$advanced_config_key ) === false){
- self::$advanced_config = array_merge( array(
- 'project_background_color' => '#f1f1f1',
- 'loading_icon_color' => '#333333',
- 'show_project_title' => 'yes',
- 'show_creative_fields' =>'yes',
- 'show_project_by' => 'yes',
- 'show_about_project' => 'yes',
- 'show_publish_date' => 'yes',
- 'show_views' => 'yes',
- 'show_appreciations' => 'yes',
- 'show_comments' => 'yes',
- 'show_tags' => 'yes',
- 'show_tools_used' => 'yes',
- 'show_copyright_info' => 'yes',
- 'eds_bpm_custom_css' => '',
- 'show_project_comments' => ''
- ), self::$advanced_config );
- }else
- self::$advanced_config = (array) get_option( EDS_BPM_Config::$advanced_config_key);
- }
-
- return self::$advanced_config;
- }
-
-
- public static function get_navigation_button_config(){
- if(self::$navigation_button_config ==null){
- self::$navigation_button_config = array();
-
- if(get_option( self::$navigation_button_config_key ) === false){
- self::$navigation_button_config = array_merge( array(
- 'show_prev_next_btn' => 'yes',
- 'prev_next_project_order' => 'doc',
- 'prev_btn_text' =>'Prev',
- 'prev_btn_text_color' => '#ffffff',
- 'prev_btn_bg_color' => '#333333',
- 'next_btn_text' => 'Next',
- 'next_btn_text_color' => '#ffffff',
- 'next_btn_bg_color' => '#333333',
- 'prev_next_btn_style' => 'default',
- 'prev_next_btn_position' => 'top',
- 'prev_next_btn_icon' => 'yes'
- ), self::$navigation_button_config );
- }else
- self::$navigation_button_config = (array) get_option( EDS_BPM_Config::$navigation_button_config_key);
- }
-
- return self::$navigation_button_config;
- }
-
- public static function get_general_config(){
- if(self::$general_config ==null){
-
- self::$general_config = array();
-
- if(get_option( self::$general_config_key ) === false){
- self::$general_config = array_merge( array(
- 'behance_api_key' => '',
- 'result_per_page' => self::$result_per_page,
- 'view_project_on_behance' => '',
- 'open_in_different_tab' => 'yes'
- ), self::$general_config );
- }else{
- self::$general_config = (array) get_option( EDS_BPM_Config::$general_config_key);
- }
-
- }
-
- return self::$general_config;
- }
-
-
- public static function get_current_page_url() {
- $pageURL = 'http';
- if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
- $pageURL .= "://";
- if ($_SERVER["SERVER_PORT"] != "80") {
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
- } else {
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
- }
- return $pageURL;
- }
-
- public static function trim_all( $str , $what = NULL , $with = ' ' )
- {
- if( $what === NULL )
- {
- // Character Decimal Use
- // "