Changeset 2612816
- Timestamp:
- 10/12/2021 06:38:48 AM (4 years ago)
- Location:
- ink-official/trunk
- Files:
-
- 3 edited
-
ink-content-block.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
src/init.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ink-official/trunk/ink-content-block.php
r2573677 r2612816 4 4 Plugin URL: https://inkforall.com 5 5 Description: INK Block plugin allows you to import .ink files to wordpress posts / pages. 6 Version: 3.0.16 Version: 4.0 7 7 */ 8 8 … … 16 16 */ 17 17 require_once plugin_dir_path( __FILE__ ) . 'src/init.php'; 18 require_once plugin_dir_path( __FILE__ ) . 'modules/post-sidebar/init.php'; 18 19 19 20 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'ink_action_links' ); … … 34 35 return $mimes; 35 36 } 36 //add_action('upload_mimes', 'upload_ink_mimes');37 add_action('upload_mimes', 'upload_ink_mimes'); 37 38 38 add_filter( 'wp_check_filetype_and_ext', 'wpse323750_multi_mimes', 99, 4 );39 //add_filter( 'wp_check_filetype_and_ext', 'wpse323750_multi_mimes', 99, 4 ); 39 40 40 41 function wpse323750_multi_mimes( $check, $file, $filename, $mimes ) { … … 65 66 66 67 67 register_activation_hook( __FILE__, 'ink_update_config' );68 //register_activation_hook( __FILE__, 'ink_update_config' ); 68 69 69 70 -
ink-official/trunk/readme.txt
r2573677 r2612816 124 124 = 3.0.1 = 125 125 126 -New ! You can now import and export .ink files with a click from the new INK sidebar. 127 128 = 3.0.1 = 129 126 130 -Fixed H3, H4, H5, H6 Gutenberg import issue. 127 131 -
ink-official/trunk/src/init.php
r2573677 r2612816 139 139 wp_register_script('ink_media_button', $pluginDirName.'js/ink_importer.js', array('jquery'), '1.6', true); 140 140 wp_enqueue_script('ink_media_button'); 141 $pluginUrl = array( 'inkUrl' => admin_url( 'admin-ajax.php'), 'pluginsUrl' => plugins_url() );141 $pluginUrl = array( 'inkUrl' => admin_url( 'admin-ajax.php'), 'pluginsUrl' => plugins_url(),'adminUrl' => admin_url() ); 142 142 wp_localize_script( 'ink_media_button', 'inkObj', $pluginUrl ); 143 143 … … 541 541 542 542 function ink_action() { 543 544 543 if (!isset($_POST['ink_file_url'])) { 545 544 return; 546 545 } else { 547 $fileUrlAS = esc_url_raw($_POST['ink_file_url']); 548 $fileUrl = esc_url_raw($_POST['ink_file_url']); 546 if($_POST['fileName']=='yes'){ 547 $wpdir = wp_upload_dir(); 548 $fileUrlAS =$wpdir['url'] . '/' .$_POST['ink_file_url']; 549 $fileUrl = $wpdir['url'] . '/' .$_POST['ink_file_url']; 550 $filepath = $wpdir['path'] . '/' .$_POST['ink_file_url']; 551 }else{ 552 553 $fileUrlAS = esc_url_raw($_POST['ink_file_url']); 554 $fileUrl = esc_url_raw($_POST['ink_file_url']); 555 } 549 556 } 550 557 551 558 try { 552 559 $data=array(); … … 556 563 $upload_dir = wp_upload_dir(); 557 564 558 565 /* 559 566 if( wp_mkdir_p( $upload_dir['path'] ) ) { 560 567 $fileUrl = $upload_dir['path'] . '/' . $filename; … … 562 569 $fileUrl = $upload_dir['basedir'] . '/' . $filename; 563 570 } 571 */ 572 $comFile=explode("uploads/",$fileUrlAS); 573 $afterUpload=$comFile[1]; 574 $comAs=explode("uploads/",$fileUrl); 575 $beforeUpload=$comAs[0]; 576 $ab=explode("/",$comFile[1]); 577 $rights=$ab[0].'/'.$ab[1]; 578 $wpM=$upload_dir['basedir'].'uploads/'.$rights; 579 $fileUrl=$upload_dir['basedir'].'/'.$rights.'/'.$filename; 580 564 581 $upldir = str_replace("/$filename","","$fileUrl"); 565 582 $tempdir = get_temp_dir(); … … 567 584 $zip = new ZipArchive; 568 585 if ($zip->open("$fileUrl") === TRUE) { 586 569 587 $zip->extractTo($tempdir.'/ink-'.$time.'/'); 570 588 $zip->close(); … … 612 630 $inkContent= file_get_contents($inkContentfile); 613 631 $ink_content = json_decode($inkContent, true); 614 615 616 632 $htmlContent="<p"; 617 633 $gtnContent=array(); … … 668 684 if(strpos($lastBlockValue,'ink_container')!== false){ 669 685 $gtnContent[]=$gtnBlockContent; 686 }elseif(strpos($lastBlockValue,'INK_IMG_')!== false){ 687 $gtnContent[]=$gtnBlockContent; 670 688 }else{ 671 689 $lastBlockValue=str_replace('</p>','',$lastBlockValue); … … 702 720 wp_delete_attachment($inkId,true); 703 721 unlink($tempdir.'/ink-'.$time); 704 705 706 722 723 if($_POST['fileName']=='yes'){ 724 unlink($filepath); 725 } 726 727 707 728 $data['title'] = $postTitle; 708 729 $data['content'] = $htmlContent; … … 1073 1094 $content_post = get_post($id); 1074 1095 $content = $content_post->post_content; 1096 $content_as = $content_post->post_content; 1075 1097 $content = preg_replace('/<!--(.|s)*?-->/', '', $content); 1076 1098 $content = preg_replace_callback( … … 1176 1198 } 1177 1199 $inkcontent .= $content; 1178 $filename = sanitize_title(get_the_title($id)); 1200 1201 $postTitle = get_the_title($id); 1202 1203 $ast=substr($postTitle,0,20); 1204 $cont=$ast; 1205 $lastoccur = strrpos($cont," "); 1206 $filename = substr($cont,0,$lastoccur); 1207 1208 $filename = sanitize_title($filename); 1209 1210 if(empty($filename) || $filename=='Untitled'){ 1211 $strtTitle=strpos($content_as,"<h1>"); 1212 $endTitle=strpos($content_as,"</h1>"); 1213 $postTitle=substr($content_as,$strtTitle+4,$endTitle-4); 1214 $postTitle=substr($postTitle,0,20); 1215 1216 $cont=$postTitle; 1217 $lastoccur = strrpos($cont," "); 1218 $filename = substr($cont,0,$lastoccur); 1219 1220 $filename = sanitize_title($filename); 1221 } 1222 if(empty($filename) || $filename=='Untitled'){ 1223 $strtTitle=strpos($content_as,"<h2>"); 1224 $endTitle=strpos($content_as,"</h2>"); 1225 $postTitle=substr($content_as,$strtTitle+4,$endTitle-4); 1226 $postTitle=substr($postTitle,0,20); 1227 $cont=$postTitle; 1228 $lastoccur = strrpos($cont," "); 1229 $filename = substr($cont,0,$lastoccur); 1230 $filename = sanitize_title($filename); 1231 } 1232 1179 1233 if( wp_mkdir_p( $upload_dir['path'] ) ) { 1180 1234 $file = $upload_dir['path'] . '/wp-' . $filename . '.ink';
Note: See TracChangeset
for help on using the changeset viewer.