افزونه کپی کاری
افزونه کپی کاری : ابزاری منحصر بفرد و ایرانی جهت قرار دادن کدهای برنامه نویسی + باکس های سفارشی درون مقاله ,محصول ,برگه , نوشته (سازگار با ویرایشگر کلاسیک , گوتنبرگ و المنتور) تنها با یک شورتکد! هر نوع کد یا استایل باکس جذاب را به تصویر بکشید.
- قیمت : ۴۵۰/۰۰۰ تومان
ویژگیهای افزونه کپی کاری
-
✅ نمایش همزمان تاریخهای واقعی و فیک
-
✅ پشتیبانی کامل از ووکامرس فارسی
-
✅ طراحی ریسپانسیو و سازگار با موبایل
-
✅ انیمیشنهای جذاب و قابل تنظیم
-
✅ آیکونهای متنوع و زیبا
چرا این افزونه ضروری؟
-
افزایش اعتماد کاربران با نمایش تاریخهای بروزرسانی
-
بهبود سئو با بهروز نشان دادن محتوا
-
مدیریت حرفهای ظاهر تاریخها
-
صرفهجویی در زمان با اتوماسیون کامل
قابلیتهای اصلی
-
شورتکدهای متنوع: ۸ شورتکد مختلف برای نیازهای گوناگون
-
تنظیمات پیشرفته: کنترل کامل رنگ، فونت، آیکون و انیمیشن
-
مدیریت هوشمند: مخفی کردن خودکار در شرایط خاص
-
پشتیبانی از تاریخ شمسی: سازگار با افزونه پارسیدیت
برای چه سایتهایی مناسب؟
-
🛒 فروشگاههای اینترنتی
-
📝 وبلاگهای شخصی و شرکتی
-
🏢 سایتهای خبری
-
💼 همه سایتهای وردپرسی
نصب آسان – استفاده سریع
-
نصب-بروزرسانی از طریق پیشخوان
-
راهنمای فارسی کامل
-
پشتیبانی حرفهای
امنیت و بهینهسازی
-
توسعه بر اساس استانداردهای وردپرس
-
عدم تاثیر بر سرعت سایت
-
بهروزرسانی منظم و رایگان
-
سازگار با آخرین نسخه وردپرس
تجربه کاربری استثنایی
-
تنظیمات جداگانه برای بخشهای مختلف
-
قابلیت غیرفعال کردن در پستهای خاص
/** * Plugin Name: کپی کاری (نسخه رایگان) * Description: افزونهای ساده برای نمایش محتوا با دکمه کپی در وردپرس * Version: 0.0 * Author: مهندس براتی * Author URI: https://mrbarati.com * License: GPL v2 or later */ if (!defined('ABSPATH')) { exit; } define('CCB_VERSION', '0.0'); define('CCB_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('CCB_PLUGIN_URL', plugin_dir_url(__FILE__)); function ccb_register_settings() { $settings = array( 'ccb_shortcodes' => 'sanitize_text_field', ); foreach ($settings as $option => $callback) { register_setting('ccb_settings_group', $option, array('sanitize_callback' => $callback)); } } add_action('admin_init', 'ccb_register_settings'); function ccb_get_shortcode_link($shortcode_id) { $shortcode_id = sanitize_text_field($shortcode_id); $args = array( 's' => '[ccb_display id="' . $shortcode_id . '"]', 'post_type' => 'any', 'posts_per_page' => 1 ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $link = str_replace(home_url(), '', get_permalink()); wp_reset_postdata(); return rtrim($link, '/'); } } return 'استفاده نشده'; } function ccb_settings_page() { if (!current_user_can('manage_options')) { wp_die(esc_html__('شما دسترسی لازم برای مشاهده این صفحه را ندارید.', 'copy-kari')); } $shortcodes = get_option('ccb_shortcodes', array()); $max_shortcodes = 4; if (isset($_POST['save_shortcode']) && isset($_POST['ccb_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['ccb_nonce'])), 'ccb_save_shortcode')) { if (count($shortcodes) >= $max_shortcodes) { echo '<div class="updated"><p>حداکثر ۴ شورتکد مجاز است. برای ساخت بیشتر، نسخه پرو را تهیه کنید!</p></div>'; } else { $content = isset($_POST['ccb_custom_content']) ? wp_kses_post(wp_unslash($_POST['ccb_custom_content'])) : ''; $direction = isset($_POST['ccb_text_direction']) ? sanitize_text_field(wp_unslash($_POST['ccb_text_direction'])) : 'ltr'; $no_copy_download = isset($_POST['no_copy_download']) ? true : false; if (!empty($content)) { $shortcode_id = 'ck_' . wp_generate_password(2, false); $shortcodes[$shortcode_id] = array( 'content' => $content, 'created_at' => current_time('mysql'), 'no_copy_download' => $no_copy_download, 'direction' => $direction, ); update_option('ccb_shortcodes', $shortcodes); echo '<div class="updated"><p>شورتکد با موفقیت ساخته شد!</p></div>'; } } } if (isset($_POST['delete_shortcode']) && isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'ccb_delete_shortcode_' . sanitize_text_field(wp_unslash($_POST['delete_shortcode'])))) { $shortcode_id = sanitize_text_field(wp_unslash($_POST['delete_shortcode'])); if (isset($shortcodes[$shortcode_id])) { unset($shortcodes[$shortcode_id]); update_option('ccb_shortcodes', $shortcodes); echo '<div class="updated"><p>شورتکد حذف شد!</p></div>'; } } ?> <div class="wrap"> <div style="background: #fff; padding: 15px; border: 1px solid #ccc; border-radius: 5px; margin-bottom: 20px; text-align: center; font-size: 15px;"> افزونه شما نسخه رایگان هست با ساخت ۴ تا شورت کد برای تست - <a href="https://mrbarati.com" target="_blank">لینک خرید پرو</a> </div> <h1>تنظیمات افزونه کپی کاری (نسخه رایگان)</h1> <h2 class="nav-tab-wrapper"> <a href="#tab-1" class="nav-tab nav-tab-active">تنظیمات استایل</a> <a href="#tab-2" class="nav-tab">مدیریت شورتکد</a> <a href="#tab-3" class="nav-tab">راهنما</a> </h2> <div id="tab-1" class="tab-content"> <table class="form-table"> <tr><th>متن دکمه کپی:</th><td></td></tr> <tr><th>متن دکمه دانلود:</th><td></td></tr> <tr><th>تنظیمات دکمه کپی کد:</th><td></td></tr> <tr><th>تنظیمات دکمه دانلود:</th><td></td></tr> <tr><th>تنظیمات اندازه برای مانیتور:</th><td></td></tr> <tr><th>تنظیمات اندازه برای موبایل:</th><td></td></tr> <tr><th>موقعیت دکمه کپی کد:</th><td></td></tr> <tr><th>جهت دکمهها:</th><td></td></tr> <tr><th>تنظیمات رنگ محتوا:</th><td></td></tr> <tr><th>تنظیمات شماره خطوط:</th><td></td></tr> <tr><th>نوع فایل دانلود:</th><td></td></tr> <tr><th>تنظیمات گرد شدن گوشهها:</th><td></td></tr> <tr><th>عرض شورتکد:</th><td></td></tr> </table> <p>برای دسترسی به تنظیمات استایل، نسخه پرو را تهیه کنید.</p> </div> <div id="tab-2" class="tab-content" style="display:none;"> <form id="ccb-generate-form" method="post"> <?php wp_nonce_field('ccb_save_shortcode', 'ccb_nonce'); ?> <table class="form-table"> <tr> <th>محتوای متنی:</th> <td><textarea name="ccb_custom_content" rows="5" style="width:100%; direction:ltr; text-align:left;"></textarea></td> </tr> <tr> <th>جهتگیری متن:</th> <td> <div style="display: flex; flex-direction: column; gap: 10px;"> <label><input type="radio" name="ccb_text_direction" value="ltr" checked /> کد و حروف انگلیسی (چپچین)</label> <label><input type="radio" name="ccb_text_direction" value="rtl" /> حروف فارسی (راستچین)</label> </div> </td> </tr> </table> <p style="font-size:12px; color:#666;">قبل از وارد کردن متن، مطمئن شوید جهت متن کدام طرف باتوجه به گزینه انتخابی شما تنظیم شده است.</p> <button type="submit" name="save_shortcode" class="button button-primary">ساخت شورتکد</button> <button type="submit" name="no_copy_download" class="button" style="background:#9b1d20;color:#fff;border:none;">ساخت شورتکد بدون کپی+دانلود</button> </form> <h2>شورتکدهای ساختهشده</h2> <?php if (!empty($shortcodes)) : ?> <table class="widefat"> <thead> <tr> <th>#</th> <th>شورتکد</th> <th>تاریخ ایجاد</th> <th>لینک راهنما</th> <th>وضعیت کپی/دانلود</th> <th>عملیات</th> </tr> </thead> <tbody> <?php $counter = 1; foreach ($shortcodes as $shortcode_id => $data) : $content = $data['content']; $created_at = $data['created_at']; $no_copy_download = $data['no_copy_download']; $shortcode_text = '[ccb_display id="' . esc_html($shortcode_id) . '"]'; $guide_link = ccb_get_shortcode_link($shortcode_id); $is_used = ($guide_link !== 'استفاده نشده'); ?> <tr> <td><?php echo esc_html($counter++); ?></td> <td> <button type="button" class="ccb-shortcode-btn" data-shortcode="<?php echo esc_attr($shortcode_text); ?>"> <?php echo esc_html($shortcode_text); ?> </button> </td> <td><?php echo esc_html($created_at); ?></td> <td><span style="color:<?php echo $is_used ? 'green' : 'red'; ?>;"><?php echo esc_html($guide_link); ?></span></td> <td><?php echo $no_copy_download ? 'غیرفعال' : 'فعال'; ?></td> <td> <?php if (!$is_used) : ?> <form method="post" style="display:inline;"> <?php wp_nonce_field('ccb_delete_shortcode_' . $shortcode_id); ?> <input type="hidden" name="delete_shortcode" value="<?php echo esc_attr($shortcode_id); ?>"> <button type="submit" class="button" style="background:#dc3545;color:#fff;border:none;">🗑️</button> </form> <?php else: echo '-'; endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php else : ?> <p>شورتکدی وجود ندارد.</p> <?php endif; ?> </div> <div id="tab-3" class="tab-content" style="display:none;"> <h2>راهنما</h2> <p><strong>این افزونه توسط محمد براتی طراحی شده و برای افزودن دکمه کپی با تنظیمات دلخواه در وردپرس استفاده میشود.</strong></p> <p><strong>ویژگیها:</strong></p> <ul> <li><strong>ساخت شورتکد برای محتوای متنی</strong></li> <li><strong>تنظیم استایل دکمه و محتوا (در نسخه پرو)</strong></li> <li><strong>پشتیبانی از کدهای HTML مثل marquee</strong></li> <li><strong>دانلود کد بهصورت فایل (فقط در دسکتاپ)</strong></li> <li><strong>فاصله خطوط ثابت: ۲.۲ (دسکتاپ) و ۱.۹ (موبایل)</strong></li> <li><strong>تنظیم گرد شدن گوشههای دکمهها و شورتکد (در نسخه پرو)</strong></li> <li><strong>طراح و توسعهدهنده سایت، افزونه و SEO: <a href="https://mrbarati.com" target="_blank">مهندس براتی</a></strong></li> </ul> </div> <style> .nav-tab-wrapper { margin-bottom: 20px; } .tab-content { display: none; } .tab-content.active { display: block; } .ccb-notification { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #0073aa; color: white; padding: 10px 20px; border-radius: 5px; z-index: 9999; opacity: 0; transition: opacity 0.5s ease-in-out; pointer-events: none; } .ccb-notification.show { opacity: 1; } .ccb-shortcode-btn { background-color: #fff; border: 1px solid #ccc; color: #333; padding: 5px 10px; cursor: pointer; border-radius: 3px; } .ccb-shortcode-btn:hover { background-color: #f9f9f9; } </style> <script> document.addEventListener('DOMContentLoaded', function() { var tabs = document.querySelectorAll('.nav-tab'); var contents = document.querySelectorAll('.tab-content'); tabs.forEach(function(tab) { tab.addEventListener('click', function(e) { e.preventDefault(); tabs.forEach(function(t) { t.classList.remove('nav-tab-active'); }); contents.forEach(function(c) { c.style.display = 'none'; }); tab.classList.add('nav-tab-active'); document.querySelector(tab.getAttribute('href')).style.display = 'block'; }); }); document.querySelectorAll('.nav-tab')[0].click(); var textarea = document.querySelector('textarea[name="ccb_custom_content"]'); var directionRadios = document.querySelectorAll('input[name="ccb_text_direction"]'); function updateTextDirection() { if (directionRadios[0].checked) { textarea.style.direction = 'ltr'; textarea.style.textAlign = 'left'; } else if (directionRadios[1].checked) { textarea.style.direction = 'rtl'; textarea.style.textAlign = 'right'; } } updateTextDirection(); directionRadios.forEach(function(radio) { radio.addEventListener('change', updateTextDirection); }); document.querySelectorAll('.ccb-shortcode-btn').forEach(function(btn) { btn.addEventListener('click', function(e) { var shortcode = btn.getAttribute('data-shortcode'); copyToClipboard(shortcode, 'شورتکد کپی شد!'); }); }); function copyToClipboard(text, message) { if (navigator.clipboard) { navigator.clipboard.writeText(text).then(function() { showNotification(message); }).catch(function() { fallbackCopy(text, message); }); } else { fallbackCopy(text, message); } } function fallbackCopy(text, message) { var temp = document.createElement('textarea'); temp.value = text; document.body.appendChild(temp); temp.select(); document.execCommand('copy'); document.body.removeChild(temp); showNotification(message); } function showNotification(message) { var notification = document.querySelector('.ccb-notification'); if (!notification) { notification = document.createElement('div'); notification.className = 'ccb-notification'; document.body.appendChild(notification); } notification.textContent = message; notification.classList.add('show'); setTimeout(function() { notification.classList.remove('show'); setTimeout(function() { notification.remove(); }, 500); }, ۳۰۰۰); } <?php if (isset($_POST['save_shortcode']) && count($shortcodes) >= $max_shortcodes) : ?> showNotification('حداکثر ۴ شورتکد مجاز است. برای ساخت بیشتر، نسخه پرو را تهیه کنید!'); <?php endif; ?> }); </script> </div> <?php } add_action('admin_menu', function() { add_submenu_page( 'options-general.php', 'تنظیمات کپی کاری (رایگان)', 'کپی کاری', 'manage_options', 'ccb-settings', 'ccb_settings_page' ); }); function ccb_display_shortcode($atts) { $atts = shortcode_atts(array('id' => ''), $atts); $shortcode_id = sanitize_text_field($atts['id']); if (empty($shortcode_id)) return ''; $shortcodes = get_option('ccb_shortcodes', array()); if (!isset($shortcodes[$shortcode_id])) return ''; $data = $shortcodes[$shortcode_id]; $content = $data['content']; $no_copy_download = $data['no_copy_download']; $direction = $data['direction']; $allowed_html = array( 'marquee' => array( 'class' => array(), 'direction' => array(), 'scrollamount' => array(), 'loop' => array(), ), 'style' => array(), 'br' => array(), 'strong' => array(), 'em' => array(), 'span' => array('class' => array(), 'style' => array()), ); $container_direction = $direction === 'rtl' ? 'rtl' : 'ltr'; $container_text_align = $direction === 'rtl' ? 'right' : 'left'; ob_start(); ?> <div class="ccb-copy-container" style="background-color: #333332; color: #ffffff; padding: 20px; direction: <?php echo esc_attr($container_direction); ?>; text-align: <?php echo esc_attr($container_text_align); ?>; position: relative; font-family: inherit; border-radius: 0px; width: 100%; max-width: 100%; display: block; margin: 0 auto;"> <?php if (!$no_copy_download) : ?> <button class="ccb-copy-btn" style="position: absolute; top: 10px; right: 10px; border-radius: 0px; background: #0073aa; color: #ffffff; border: none; cursor: pointer; padding: 5px 10px; font-size: 14px;" data-content="<?php echo esc_attr($content); ?>">کپی</button> <button class="ccb-download-btn" style="position: absolute; top: 10px; right: 75px; border-radius: 0px; background: #28a745; color: #ffffff; border: none; cursor: pointer; padding: 5px 10px; font-size: 14px;" data-content="<?php echo esc_attr($content); ?>">دانلود</button> <?php endif; ?> <pre style="font-family: inherit; font-size: 14px; line-height: 2.2; margin: 8px 0; <?php echo $no_copy_download ? '' : 'padding-top: 25px;'; ?> direction: <?php echo esc_attr($container_direction); ?>; text-align: <?php echo esc_attr($container_text_align); ?>;"><?php echo wp_kses($content, $allowed_html); ?></pre> </div> <?php return ob_get_clean(); } add_shortcode('ccb_display', 'ccb_display_shortcode'); function ccb_add_copy_script() { ?> <style> .ccb-copy-container { position: relative; } pre { white-space: pre-wrap; word-wrap: break-word; } @media (max-width: 768px) { pre { line-height: 1.9; font-size: 12px; } .ccb-copy-btn { font-size: 12px; margin-top: 5px; margin-bottom: 5px; } .ccb-download-btn { display: none; } } .ccb-notification { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #0073aa; color: white; padding: 10px 20px; border-radius: 5px; z-index: 9999; opacity: 0; transition: opacity 0.5s ease-in-out; pointer-events: none; } .ccb-notification.show { opacity: 1; } </style> <script> document.addEventListener('DOMContentLoaded', function() { document.querySelectorAll('.ccb-copy-btn').forEach(function(btn) { btn.addEventListener('click', function(e) { e.preventDefault(); var content = btn.getAttribute('data-content'); copyToClipboard(content, 'کد کپی شد!'); btn.textContent = 'کپی شد!'; btn.style.backgroundColor = '#4CAF50'; btn.style.color = '#ffffff'; setTimeout(function() { btn.textContent = 'کپی'; btn.style.backgroundColor = '#0073aa'; btn.style.color = '#ffffff'; }, ۲۰۰۰); }); }); document.querySelectorAll('.ccb-download-btn').forEach(function(btn) { btn.addEventListener('click', function(e) { e.preventDefault(); var content = btn.getAttribute('data-content'); var blob = new Blob([content], { type: 'text/plain' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = 'code.txt'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showNotification('فایل دانلود شد!'); }); }); function copyToClipboard(text, message) { if (navigator.clipboard) { navigator.clipboard.writeText(text).then(function() { showNotification(message); }).catch(function() { fallbackCopy(text, message); }); } else { fallbackCopy(text, message); } } function fallbackCopy(text, message) { var temp = document.createElement('textarea'); temp.value = text; document.body.appendChild(temp); temp.select(); document.execCommand('copy'); document.body.removeChild(temp); showNotification(message); } function showNotification(message) { var notification = document.querySelector('.ccb-notification'); if (!notification) { notification = document.createElement('div'); notification.className = 'ccb-notification'; document.body.appendChild(notification); } notification.textContent = message; notification.classList.add('show'); setTimeout(function() { notification.classList.remove('show'); setTimeout(function() { notification.remove(); }, 500); }, ۳۰۰۰); } }); </script> <?php } add_action('wp_footer', 'ccb_add_copy_script'); function ccb_uninstall_cleanup() { delete_option('ccb_shortcodes'); } register_uninstall_hook(__FILE__, 'ccb_uninstall_cleanup');
2 پاسخ
واقعا راحت شدم بخاطر ساخت باکس دمحصول در مقالاتم! ممنون
موفق باشید🔥