Changeset 2147664
- Timestamp:
- 08/29/2019 09:59:31 AM (6 years ago)
- Location:
- breadcrumbs-shortcode/trunk
- Files:
-
- 2 edited
-
default_library_puvox.php (modified) (11 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
breadcrumbs-shortcode/trunk/default_library_puvox.php
r2119362 r2147664 28 28 $this->is_development = defined("_puvox_machine_") ; // set in devmachine (in "my_superglobals.php" and in "EnvVariables") 29 29 if($this->is_development) $this->display_errors(); 30 $this->ip = $this->get_visitor_ip(); 31 $this->isMobile = false; 32 $this->isWP = $wp=defined("ABSPATH"); 30 33 31 34 // #### Because this is a trait, we don't use "__FILE__" & "__DIR__" here, but "Reflection". #### … … 36 39 $this->plugin_FILE = $reflection->getFileName(); // set plugin's main file path 37 40 $this->plugin_DIR = dirname($this->plugin_FILE); // set plugin's dir path 38 $this->plugin_URL = plugin_dir_url($this->plugin_FILE); // get plugin's dir URL 39 $this->wp_URL = network_home_url('/'); // WP installation home 40 $this->wp_FOLDER = network_home_url('/', 'relative'); // WP folder 41 $this->home_URL = home_url('/'); // current sub/site home url 42 $this->home_FOLDER = home_url('/', 'relative'); // current sub/site home folder 41 42 // if this class is (or not) used as just helper library 43 if ($this->isWP) 44 { 45 $this->plugin_URL = plugin_dir_url($this->plugin_FILE); // get plugin's dir URL 46 $this->wp_URL = network_home_url('/'); // WP installation home 47 $this->wp_FOLDER = network_home_url('/', 'relative'); // WP folder 48 $this->home_URL = home_url('/'); // current sub/site home url 49 $this->home_FOLDER = home_url('/', 'relative'); // current sub/site home folder 50 } 51 else 52 { 53 if (property_exists($this, 'urls')) 54 { 55 $this->urls(); 56 // $this->plugin_URL = ; 57 // $this->wp_URL = ; 58 // $this->wp_FOLDER = ; 59 // $this->home_URL = ; 60 // $this->home_FOLDER = ; 61 } 62 } 63 43 64 $this->is_https = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']!=='off') || $_SERVER['SERVER_PORT']==443); 44 65 $this->httpsCurrent = $this->is_https ? 'https://' : 'http://'; … … 55 76 $this->homeUrlStripped = $this->stripUrlPrefixes($this->home_URL); 56 77 $this->is_localhost = (stripos($this->home_URL,'://127.0.0.1')!==false || stripos($this->home_URL,'://localhost')!==false ); 57 $this->is_settings_page = false; 58 $this->wpdb = $GLOBALS['wpdb']; 59 $this->options_tabs = []; 78 60 79 61 if ($this->old_version()){62 register_activation_hook( $this->plugin_FILE, function(){ exit( __("Sorry, your PHP version ". phpversion() ." is very old. We suggest changing your hosting's PHP version.") ); } );63 return;64 }65 66 // initial variables67 $this->my_plugin_vars();68 $this->network_managed = is_multisite() && $this->getNetworkedState();69 $this->opts = $this->refresh_options(); // Setup final variables70 $this->refresh_options_TimeGone();71 $this->logs_table_name = $this->get_prefix_CHOSEN() . $this->plugin_slug_u.'__errors_log'; // error logs table name72 $this->logs_table_maxnum= 100; // maximum rows in errors logs table73 $this->check_if_pro_plugin();74 $this->__construct_my(); // All other custom construction hooks75 $pgnm = property_exists($this,'customOptsPageUrl') ? $this->customOptsPageUrl : $this->slug;76 $this->settingsPHP_page = ( array_key_exists('menu_button_level', $this->static_settings) && $this->static_settings['menu_button_level']=="mainmenu" ) ? 'admin.php' : (is_network_admin() || $this->network_managed ? 'settings.php' : 'options-general.php');77 $this->plugin_page_url_current = ( is_network_admin() || $this->network_managed ? network_admin_url($this->settingsPHP_page) : admin_url($this->settingsPHP_page) ) .'?page='.$pgnm;78 $this->plugin_page_url_main = ( is_multisite() ? network_admin_url($this->settingsPHP_page) : admin_url($this->settingsPHP_page) ) .'?page='.$pgnm;79 $this->plugin_files = array_merge( (property_exists($this, 'plugin_files') ? $this->plugin_files : [] ), ['index.php'] );80 $this->translation_phrases= $this->get_phrases();81 $this->ip = $this->get_visitor_ip();82 $this->isMobile = false;83 $this->is_in_customizer = (stripos($this->currentURL, admin_url('customize.php')) !== false);84 $this->myplugin_class = 'myplugin postbox version_'. (!$this->static_settings['has_pro_version'] ? "free" : ($this->is_pro_legal ? "pro" : "not_pro") );85 $this->addon_namepart = 'puvox.software';86 80 87 $this->define_option_tabs(); 88 89 //activation & deactivation (empty hooks by default. all important things migrated into `refresh_options`) 90 register_activation_hook( $this->plugin_FILE, [$this, 'activate'] ); 91 register_deactivation_hook( $this->plugin_FILE, [$this, 'deactivate'] ); 92 93 //translation hook 94 add_action('init', [$this, 'load_textdomain'] ); 95 96 //==== my other default hooks ===// 97 $this->setupLinksAndMenus(); 98 99 //shortcodes 100 $this->shortcodes_initialize(); 101 102 // if buttons needed 103 $this->tinymce_funcs(); 104 105 // for backend ajax 106 add_action( 'wp_ajax_'.$this->plugin_slug_u.'_all', [$this, 'ajax_backend_call'] ); 107 108 add_action( 'admin_head', [$this,'admin_head_func']); 109 add_action( 'current_screen', function(){ $this->admin_scripts(null); } ); 110 111 //add uninstaller file 112 if(is_admin()) $this->add_default_uninstall(); //add_action( 'shutdown', [$this, 'my_shutdown_for_versioning']); 113 114 add_action('wp', [$this, 'flush_checkpoint'], 999); 115 116 // functions for PRO-ADDON upload 117 // add_filter( 'pre_move_uploaded_file', function( $null, $file, $new_file, $type ){ return $path; }, 10, 4); 118 $this->pro_file_part = 'puvox-software'; 119 if($this->static_settings['has_pro_version']) { 120 add_filter( 'upload_mimes', [$this,'upload_mimes_filter'], 1); 121 add_filter( 'wp_handle_upload', [$this,'wp_handle_upload_filter'], 10, 2); 122 } 81 #region ################ IF USED IN WP PLUGIN ################ 82 if ($this->isWP) 83 { 84 $this->is_settings_page = false; 85 $this->wpdb = $GLOBALS['wpdb']; 86 $this->options_tabs = []; 87 88 if ($this->old_version()){ 89 register_activation_hook( $this->plugin_FILE, function(){ exit( __("Sorry, your PHP version ". phpversion() ." is very old. We suggest changing your hosting's PHP version.") ); } ); 90 return; 91 } 92 93 // initial variables 94 $this->my_plugin_vars(); 95 $this->network_managed = is_multisite() && $this->getNetworkedState(); 96 $this->opts = $this->refresh_options(); // Setup final variables 97 $this->refresh_options_TimeGone(); 98 $this->logs_table_name = $this->get_prefix_CHOSEN() . $this->plugin_slug_u.'__errors_log'; // error logs table name 99 $this->logs_table_maxnum= 100; // maximum rows in errors logs table 100 $this->check_if_pro_plugin(); 101 $this->__construct_my(); // All other custom construction hooks 102 $pgnm = property_exists($this,'customOptsPageUrl') ? $this->customOptsPageUrl : $this->slug; 103 $this->settingsPHP_page = ( array_key_exists('menu_button_level', $this->static_settings) && $this->static_settings['menu_button_level']=="mainmenu" ) ? 'admin.php' : (is_network_admin() || $this->network_managed ? 'settings.php' : 'options-general.php'); 104 $this->plugin_page_url_current = ( is_network_admin() || $this->network_managed ? network_admin_url($this->settingsPHP_page) : admin_url($this->settingsPHP_page) ) .'?page='.$pgnm; 105 $this->plugin_page_url_main = ( is_multisite() ? network_admin_url($this->settingsPHP_page) : admin_url($this->settingsPHP_page) ) .'?page='.$pgnm; 106 $this->plugin_files = array_merge( (property_exists($this, 'plugin_files') ? $this->plugin_files : [] ), ['index.php'] ); 107 $this->translation_phrases= $this->get_phrases(); 108 $this->is_in_customizer = (stripos($this->currentURL, admin_url('customize.php')) !== false); 109 $this->myplugin_class = 'myplugin postbox version_'. (!$this->static_settings['has_pro_version'] ? "free" : ($this->is_pro_legal ? "pro" : "not_pro") ); 110 $this->addon_namepart = 'puvox.software'; 111 112 $this->define_option_tabs(); 113 114 //activation & deactivation (empty hooks by default. all important things migrated into `refresh_options`) 115 register_activation_hook( $this->plugin_FILE, [$this, 'activate'] ); 116 register_deactivation_hook( $this->plugin_FILE, [$this, 'deactivate'] ); 117 118 //translation hook 119 add_action('init', [$this, 'load_textdomain'] ); 120 121 //==== my other default hooks ===// 122 $this->setupLinksAndMenus(); 123 124 //shortcodes 125 $this->shortcodes_initialize(); 126 127 // if buttons needed 128 $this->tinymce_funcs(); 129 130 // for backend ajax 131 add_action( 'wp_ajax_'.$this->plugin_slug_u.'_all', [$this, 'ajax_backend_call'] ); 132 133 add_action( 'admin_head', [$this,'admin_head_func']); 134 add_action( 'current_screen', function(){ $this->admin_scripts(null); } ); 135 136 //add uninstaller file 137 if(is_admin()) $this->add_default_uninstall(); //add_action( 'shutdown', [$this, 'my_shutdown_for_versioning']); 138 139 add_action('wp', [$this, 'flush_checkpoint'], 999); 140 141 // functions for PRO-ADDON upload 142 // add_filter( 'pre_move_uploaded_file', function( $null, $file, $new_file, $type ){ return $path; }, 10, 4); 143 $this->pro_file_part = 'puvox-software'; 144 if($this->static_settings['has_pro_version']) { 145 add_filter( 'upload_mimes', [$this,'upload_mimes_filter'], 1); 146 add_filter( 'wp_handle_upload', [$this,'wp_handle_upload_filter'], 10, 2); 147 } 148 } 149 #endregion ############################################3 123 150 } 124 151 … … 432 459 //CHECK IF USER IS ADMIN 433 460 public function is_administrator() { if (function_exists('current_user_can') || require_once(ABSPATH.'wp-includes/pluggable.php')) return (current_user_can('install_plugins')); return false; } 461 public function is_editor() { if (function_exists('current_user_can') || require_once(ABSPATH.'wp-includes/pluggable.php')) return (current_user_can('edit_others_posts')); return false; } 434 462 435 463 public function phrase($key, $is_variable=false) { … … 525 553 526 554 555 public function convert_urls_in_text($text) { 556 return preg_replace('@([^\"\']https?://([-\w\.]+)+(:\d+)?(/([\w/_\.%-=#][^<]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text); 557 } 558 559 public function randomString($length = 11) { 560 return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1, $length); 561 } 562 563 564 565 public function PlainString(&$text1=false,&$text2=false,&$text3=false,&$text4=false,&$text5=false,&$text6=false,&$text7=false,&$text8=false){ 566 for($i=1; $i<=8; $i++){ if(${'text'.$i}) {${'text'.$i} = preg_replace('/\W/si','',${'text'.$i});} } 567 return $text1; 568 } 569 527 570 public function getDomain($url){ 528 571 return preg_replace('/http(s|):\/\/(www.|)(.*?)(\/.*|$)/i', '$3', $url); … … 538 581 } 539 582 583 public function remove_www($url) { 584 return str_replace( ['://www.'], '://', $url ); 585 } 586 587 public function remove_https_www($url){ 588 return str_replace( ['https://www.','http://www.','http://','https://'], '', $url ); 589 } 590 591 public function normalize_with_slashes($url, $add_trailing_slash=true){ 592 return rtrim( $this->OneSlash($url), '/') . ($add_trailing_slash ? '/' : '') ; 593 } 594 595 public function OneSlash($url){ 596 $prefix=''; 597 if(substr($url,0,2)=='//'){ 598 $prefix = '//'; 599 $url=substr($url,2); 600 } 601 return $prefix.preg_replace( '/([^:])\/\//', '$1/', $url); 602 } 603 540 604 public function stripUrlPrefixes($url){ 541 605 return preg_replace('/http(s|):\/\/(www.|)/i', '', $url); … … 575 639 } 576 640 577 public function convert_urls_in_text($text) {578 return preg_replace('@([^\"\']https?://([-\w\.]+)+(:\d+)?(/([\w/_\.%-=#][^<]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text);579 }580 581 public function randomString($length = 11) {582 return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1, $length);583 }584 585 public function OneSlash($url){586 $prefix='';587 if(substr($url,0,2)=='//'){588 $prefix = '//';589 $url=substr($url,2);590 }591 return $prefix.preg_replace( '/([^:])\/\//', '$1/', $url);592 }593 594 public function PlainString(&$text1=false,&$text2=false,&$text3=false,&$text4=false,&$text5=false,&$text6=false,&$text7=false,&$text8=false){595 for($i=1; $i<=8; $i++){ if(${'text'.$i}) {${'text'.$i} = preg_replace('/\W/si','',${'text'.$i});} }596 return $text1;597 }598 641 599 642 public function get_locale__SANITIZED(){ … … 732 775 733 776 777 778 734 779 public function cookieFuncs(){ 735 780 ?> … … 1042 1087 } 1043 1088 1089 public function fileUrl($file){ 1090 return $this->plugin_URL."/$file?vers_=".$this->filedate($this->plugin_DIR. "/$file"); 1091 } 1092 public function filedate($file){ 1093 return date("Y-M-D--H-i-s", filemtime($file) ); 1094 } 1044 1095 // ================ flash rules ================= // 1045 1096 … … 1706 1757 .myplugin ._save_button{ display:none; } 1707 1758 .myplugin .numeric_input{ width:50px; font-weight:bold;} 1708 1759 .myplugin .form-table td { vertical-align: top; } 1760 1709 1761 /* ---- jquery ui ( https://github.com/jquery/jquery-ui/tree/master/themes/base )----- */ 1710 1762 .ui-widget.ui-widget-content { border: 1px solid #c5c5c5; } … … 1991 2043 foreach( $this->plugin_files as $each) 1992 2044 { 1993 $cont .= file_get_contents( __DIR__.'/'.$this->slug.'/'.$each);2045 $cont .= file_get_contents($this->plugin_DIR.'/'.$each); 1994 2046 } 1995 2047 preg_match_all( '/\$this\-\>phrase\((.*?)\)/si', $cont, $matches ); -
breadcrumbs-shortcode/trunk/readme.txt
r2106337 r2147664 24 24 = Security & Efficiency = 25 25 > **Note! All plugins released by Puvox.Software are:** 26 > • Security-revised : checked and free from vulnerabilities.26 > • Security-revised to make it free from vulnerability. 27 27 > • No extra load/sloweness to site (even using tens of such plugins). 28 28 > • Plugins don't collect private data.
Note: See TracChangeset
for help on using the changeset viewer.