| @@ -13,22 +13,22 @@ | ||
| 13 | 13 | $hook !='image-map-hotspot_page_imh-6310-wpmart-plugins' |
| 14 | 14 | ) { |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | - wp_enqueue_style('ima-google-font', 'https://fonts.googleapis.com/css?family=Amaranth'); | |
| 17 | + wp_enqueue_style('ima-google-font', plugins_url('assets/css/google-font.css', __FILE__)); | |
| 18 | 18 | wp_enqueue_style('imh-6310-style', plugins_url('assets/css/style.css', __FILE__)); |
| 19 | 19 | wp_enqueue_style('imh-6310-color-style', plugins_url('assets/css/jquery.minicolors.css', __FILE__)); |
| 20 | 20 | wp_enqueue_style('imh-6310-font-select-style', plugins_url('assets/css/fontselect.css', __FILE__)); |
| 21 | - wp_enqueue_style('imh-6310-font-awesome-5-0-13', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css'); | |
| 22 | - wp_enqueue_style('imh-6310-codemirror-style', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.0/codemirror.min.css'); | |
| 23 | - wp_enqueue_style('imh-6310-color-style', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.3.4/jquery.minicolors.min.css'); | |
| 24 | - wp_enqueue_style('imh-6310-jquery-ui-css', "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css"); | |
| 21 | + wp_enqueue_style('imh-font-awesome-new', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css'); | |
| 22 | + wp_enqueue_style('imh-font-awesome-old', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/v4-shims.min.css'); | |
| 23 | + wp_enqueue_style('imh-6310-codemirror-style', plugins_url('assets/css/codemirror.min.css', __FILE__)); | |
| 24 | + wp_enqueue_style('imh-6310-color-style', plugins_url('assets/css/jquery.minicolors.min.css', __FILE__)); | |
| 25 | + wp_enqueue_style('imh-6310-jquery-ui-css', plugins_url('assets/css/jquery-ui.min.css', __FILE__)); | |
| 25 | 26 | |
| 26 | - | |
| 27 | 27 | wp_enqueue_script('imh-6310-font-select-js', plugins_url('assets/js/fontselect.js', __FILE__), array('jquery')); |
| 28 | - wp_enqueue_script('imh-6310-jquery-ui-js', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', array('jquery')); | |
| 29 | - wp_enqueue_script('imh-6310-color-js', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.3.4/jquery.minicolors.min.js', array('jquery')); | |
| 30 | - wp_enqueue_script('imh-6310-codemirror-js', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.0/codemirror.min.js', array('jquery')); | |
| 28 | + wp_enqueue_script('imh-6310-jquery-ui-js', plugins_url('assets/js/jquery-ui.min.js', __FILE__), array('jquery')); | |
| 29 | + wp_enqueue_script('imh-6310-color-js', plugins_url('assets/js/jquery.minicolors.min.js', __FILE__), array('jquery')); | |
| 30 | + wp_enqueue_script('imh-6310-codemirror-js', plugins_url('assets/js/codemirror.min.js', __FILE__), array('jquery')); | |
| 31 | 31 | wp_enqueue_script('imh-6310-common', plugins_url('assets/js/imh-6310-common.js', __FILE__), array('jquery')); |
| 32 | 32 | wp_enqueue_script('imh-6310-json-js', plugins_url('assets/js/json-data.js', __FILE__), array('jquery')); |
| 33 | 33 | wp_enqueue_script('imh-6310-admin-js', plugins_url('assets/js/imh-6310-admin-script.js', __FILE__), array('jquery')); |
| 34 | 34 | wp_enqueue_script('imh-6310-modal-js', plugins_url('assets/js/imh-6310-admin-modal.js', __FILE__), array('jquery')); |
| @@ -1838,31 +1838,39 @@ | ||
| 1838 | 1838 | </p>"; |
| 1839 | 1839 | return; |
| 1840 | 1840 | } |
| 1841 | 1841 | global $wpdb; |
| 1842 | + | |
| 1843 | + $path = wp_upload_dir(); | |
| 1844 | + $name = '/' . $wpdb->prefix . 'image-map-hotspot-backup.txt'; | |
| 1845 | + $fileName = $path['path'] . $name; | |
| 1846 | + | |
| 1847 | + $table_name = $wpdb->prefix . 'imh_6310_style'; | |
| 1848 | + $data = $wpdb->get_results("SELECT * FROM $table_name", ARRAY_A); | |
| 1842 | 1849 | |
| 1843 | - $style_table = $wpdb->prefix . 'imh_6310_style'; | |
| 1850 | + if (!empty($data)) { | |
| 1851 | + $file_content = ''; | |
| 1844 | 1852 | |
| 1845 | - $path = wp_upload_dir(); | |
| 1846 | - $txtName = 'ima-item-' . time() . '.txt'; | |
| 1847 | - $file = $path['path'] . '/' . $txtName; | |
| 1848 | - $fp = fopen( $file, "w" ); | |
| 1849 | - $sqlData = "!@#$$#@!"; | |
| 1850 | - | |
| 1851 | - //style Table | |
| 1852 | - $data = $wpdb->get_results('SELECT * FROM ' . $style_table . ' ORDER BY id DESC', ARRAY_A); | |
| 1853 | - foreach ( $data as $selectedData ) { | |
| 1853 | + // SQL to drop and create the table | |
| 1854 | + $file_content .= "DROP TABLE IF EXISTS `$table_name`;\n"; | |
| 1855 | + $create_table_query = $wpdb->get_row("SHOW CREATE TABLE `$table_name`", ARRAY_N); | |
| 1856 | + $file_content .= $create_table_query[1] . ";\n\n"; | |
| 1854 | 1857 | |
| 1855 | - $sqlData .= | |
| 1856 | - "insert into {$style_table} set | |
| 1857 | - id='".esc_sql($selectedData['id'])."', | |
| 1858 | - name='".esc_sql($selectedData['name'])."', | |
| 1859 | - css='".esc_sql($selectedData['css'])."'!@#$$#@!"; | |
| 1858 | + // Insert data rows into the file | |
| 1859 | + foreach ($data as $row) { | |
| 1860 | + $values = array_map(function($value) use ($wpdb) { | |
| 1861 | + return isset($value) ? "'" . $wpdb->_real_escape($value) . "'" : "NULL"; | |
| 1862 | + }, $row); | |
| 1863 | + $file_content .= "INSERT INTO `$table_name` (" . implode(", ", array_keys($row)) . ") VALUES (" . implode(", ", $values) . ");\n"; | |
| 1864 | + } | |
| 1865 | + | |
| 1866 | + // Save the SQL statements to a file | |
| 1867 | + file_put_contents($fileName, $file_content); | |
| 1868 | + echo '<a href="'. $path['url'].$name .'" target="_blank" id="export-image-map-hotspot-plugin">Download</a>'; | |
| 1860 | 1869 | } |
| 1861 | - fwrite($fp, pack("CCC",0xef,0xbb,0xbf)); | |
| 1862 | - fwrite($fp, $sqlData); | |
| 1863 | - fclose($fp); | |
| 1864 | - echo '<a href="'.$path['url'].'/'.$txtName.'" target="_blank" id="export-image-map-hotspot-plugin">Download</a>'; | |
| 1870 | + else{ | |
| 1871 | + echo '<a href="#" id="export-image-map-hotspot-plugin">Download</a>'; | |
| 1872 | + } | |
| 1865 | 1873 | } |
| 1866 | 1874 | |
| 1867 | 1875 | function imh_6310_import_full_plugin($url) { |
| 1868 | 1876 | if( !ini_get('allow_url_fopen') ) { |
| @@ -1919,19 +1927,15 @@ | ||
| 1919 | 1927 | |
| 1920 | 1928 | $target = $js->openNewTab == '1' ? "target='_blank'" : ''; |
| 1921 | 1929 | $anchorStart = $js->customIconLinkType == '1' ? "<a href='".imh_6310_validate_url(esc_attr($js->linkURL))."' {$target}>" : ''; |
| 1922 | 1930 | $anchorEnd = $anchorStart ? '</a>' : ''; |
| 1923 | - $html .= " | |
| 1924 | - window.addEventListener('load', function(){ | |
| 1925 | - jQuery('body').append(` | |
| 1926 | - <div class='imh-6310-hover-content imh-6310-hover-content-{$ids}-{$counter}'> | |
| 1927 | - {$anchorStart} | |
| 1928 | - <div class='imh-6310-template-01-hover-content'>".esc_attr($js->linkText)."</div> | |
| 1929 | - {$anchorEnd} | |
| 1930 | - </div> | |
| 1931 | - `); | |
| 1932 | - }); | |
| 1933 | - "; | |
| 1931 | + echo " | |
| 1932 | + <div class='imh-6310-hover-content imh-6310-hover-content-{$ids}-{$counter}'> | |
| 1933 | + {$anchorStart} | |
| 1934 | + <div class='imh-6310-template-01-hover-content'>".esc_attr(str_replace("@@##!!@@", "'", $js->linkText))."</div> | |
| 1935 | + {$anchorEnd} | |
| 1936 | + </div> | |
| 1937 | + "; | |
| 1934 | 1938 | $customCSS .= " |
| 1935 | 1939 | .imh-6310-hover-content-{$ids}-{$counter} .imh-6310-template-01-hover-content{ |
| 1936 | 1940 | color: ".esc_attr($js->tempCommonFontColor)."; |
| 1937 | 1941 | font-size: ".esc_attr($js->tempCommonFontSize)."px; |