@@ -164,6 +164,9 @@ class WidgetkitExPlugin{
164164
165165 private $ CMS ;
166166
167+ //true or false if installation path is correct
168+ private $ pathCorrect = false ;
169+
167170 //Use {wk} or uk prefix for CSS classes. Old Widgetkit uses uk prefix for UIkit, latest Widgetkits use {wk}
168171 private $ useWKPrefix ;
169172
@@ -201,20 +204,20 @@ public function __construct($appWK,$id=0){
201204 array_push ($ this ->debug_info ,'Host: ' .@php_uname ());
202205 $ ipath =$ this ->plugin_info ['path ' ];
203206 array_push ($ this ->debug_info ,'Widget installation path: ' .$ ipath );
204- $ pathCorrect =false ;
207+ $ this -> pathCorrect =false ;
205208 if ($ this ->isJoomla )
206- if (preg_match_all ('@.*\/administrator\/components\/com_widgetkit\/plugins\/widgets\/.+@ ' ,$ ipath ))
209+ if (preg_match_all ('@.*\/administrator\/components\/com_widgetkit\/plugins\/ ' .( $ this -> isWidget ? ' widgets ' : ' content ' ). ' \/.+@ ' ,$ ipath ))
207210 {
208211 array_push ($ this ->debug_info ,'Installation path is correct ' );
209- $ pathCorrect =true ;
212+ $ this -> pathCorrect =true ;
210213 }
211214 else
212215 array_push ($ this ->debug_error ,'Installation path is not correct, please fix it. Read more in the Wiki. ' );
213216 else
214- if (preg_match_all ('@.*\/wp-content\/plugins\/widgetkit\/plugins\/widgets\/.+@ ' ,$ ipath ))
217+ if (preg_match_all ('@.*\/wp-content\/plugins\/widgetkit\/plugins\/ ' .( $ this -> isWidget ? ' widgets ' : ' content ' ). ' \/.+@ ' ,$ ipath ))
215218 {
216219 array_push ($ this ->debug_info ,'Installation path is correct ' );
217- $ pathCorrect =true ;
220+ $ this -> pathCorrect =true ;
218221 }
219222 else
220223 array_push ($ this ->debug_warning ,'Installation path is not correct, please fix it. Read more in the Wiki. ' );
@@ -226,7 +229,7 @@ public function __construct($appWK,$id=0){
226229
227230 $ this ->useWKPrefix =false ;
228231 $ this ->UIkitVersion =null ;
229- if ($ pathCorrect ){
232+ if ($ this -> pathCorrect ){
230233 $ wkuikit = $ ipath .'/../../../vendor/assets/wkuikit ' ;
231234 if ( (file_exists ($ wkuikit )) && (is_dir ($ wkuikit )) ){
232235 $ this ->useWKPrefix =true ;
@@ -455,12 +458,9 @@ private function getWKPluginInfo($appWK){
455458
456459 $ needle =$ widgetkit_dir_name .DIRECTORY_SEPARATOR ."plugins " .DIRECTORY_SEPARATOR ."widgets " .DIRECTORY_SEPARATOR ;
457460 $ pos =strrpos (__DIR__ ,$ needle );
458- $ this ->isWidget =(boolean )$ pos ;
459461 if (!$ pos ){
460- $ this ->isWidget =false ;
461462 $ needle =$ widgetkit_dir_name .DIRECTORY_SEPARATOR ."plugins " .DIRECTORY_SEPARATOR ."content " .DIRECTORY_SEPARATOR ;
462463 $ pos =strrpos (__DIR__ ,$ needle );
463- $ this ->isContentProvider =(boolean )$ pos ;
464464 }
465465 if ($ pos ){
466466 $ info ['root ' ]=substr (__DIR__ ,0 ,$ pos );
@@ -504,6 +504,11 @@ private function getWKPluginInfo($appWK){
504504 if (preg_match_all ("@^\s*'plugin_website'\s*=>\s*'.*$@m " ,$ f ,$ matches )){
505505 $ info ['website ' ]=explode ("' " ,trim ($ matches [0 ][0 ]))[3 ];
506506 }
507+ if (preg_match_all ("@^\s*'name'\s*=>\s*'.*$@m " ,$ f ,$ matches )){
508+ $ raw_name =explode ("' " ,trim ($ matches [0 ][0 ]))[3 ];
509+ $ this ->isWidget = (substr ( $ raw_name , 0 , 7 ) === "widget/ " );
510+ $ this ->isContentProvider = (substr ( $ raw_name , 0 , 8 ) === "content/ " );
511+ }
507512 }
508513 $ url =$ appWK ['url ' ]->to ('widgetkit ' );
509514 if ($ url ){
@@ -557,12 +562,7 @@ public function printAboutInfo($appWK){
557562
558563 $ files =json_encode ($ item ->toArray ());
559564
560- $ installpath =true ;
561- if ($ this ->isJoomla )
562- $ installpath =preg_match_all ('@.*\/administrator\/components\/com_widgetkit\/plugins\/widgets\/.+@ ' ,$ this ->plugin_info ['path ' ]);
563- else
564- $ installpath =preg_match_all ('@.*\/wp-content\/plugins\/widgetkit\/plugins\/widgets\/.+@ ' ,$ this ->plugin_info ['path ' ]);
565- if ($ installpath )
565+ if ($ this ->pathCorrect )
566566 $ installpath ='<span class="uk-text-success" style="word-break:break-all"><i class="uk-icon uk-icon-check uk-margin-small-right"></i> ' .$ this ->plugin_info ['path ' ].'</span> ' ;
567567 else
568568 $ installpath ='<span class="uk-text-danger" style="word-break:break-all"><i class="uk-icon uk-icon-warning uk-margin-small-right"></i> ' .$ this ->plugin_info ['path ' ].'</span> ' ;
@@ -904,7 +904,7 @@ public function printDonationInfo($appWK){
904904 <div>
905905 <div class="uk-panel uk-panel-box uk-text-center uk-margin-bottom">
906906 <p class="uk-panel-title">{{ 'Euro' |trans}} <i class="uk-icon uk-icon-euro"></i></p>
907- <p>Payment methods:</p>
907+ <p>{{ ' Payment methods:' |trans}} </p>
908908 <ul style="list-style-type: none;">
909909 <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BJJF3E6DBRYHA" target="_blank"><i class="uk-icon uk-icon-credit-card"></i> {{ 'Bank card' |trans}}</a></li>
910910 <li><a href="https://www.paypal.me/valitov/0eur" target="_blank"><i class="uk-icon uk-icon-paypal"></i> {{ 'PayPal' |trans}}</a></li>
@@ -914,7 +914,7 @@ public function printDonationInfo($appWK){
914914 <div>
915915 <div class="uk-panel uk-panel-box uk-text-center uk-margin-bottom">
916916 <p class="uk-panel-title">{{ 'USD' |trans}} <i class="uk-icon uk-icon-usd"></i></p>
917- <p>Payment methods:</p>
917+ <p>{{ ' Payment methods:' |trans}} </p>
918918 <ul style="list-style-type: none;">
919919 <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B8VMNU7SEAU8J" target="_blank"><i class="uk-icon uk-icon-credit-card"></i> {{ 'Bank card' |trans}}</a></li>
920920 <li><a href="https://www.paypal.me/valitov/0usd" target="_blank"><i class="uk-icon uk-icon-paypal"></i> {{ 'PayPal' |trans}}</a></li>
0 commit comments