Changeset 3487390
- Timestamp:
- 03/20/2026 06:15:11 PM (2 weeks ago)
- Location:
- indesign-random-quotes
- Files:
-
- 11 edited
-
assets/banner-1544x500-rtl.png (modified) (previous)
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-772x250-rtl.png (modified) (previous)
-
assets/banner-772x250.png (modified) (previous)
-
assets/icon-128x128.png (modified) (previous)
-
assets/icon-256x256.png (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
trunk/css/style.css (modified) (2 diffs)
-
trunk/idquotes.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indesign-random-quotes/trunk/css/style.css
r2440878 r3487390 1 /* Existing classic layout */ 1 2 .idquotes-warp { 2 3 border: 1px solid #cccccc; … … 12 13 content: '- '; 13 14 } 15 16 /* Modern layout */ 17 .idquotes-layout-modern { 18 background: #f9f9f9; 19 border-left: 5px solid #0073aa; 20 padding: 20px 30px; 21 margin: 20px 0; 22 font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 23 border-radius: 4px; 24 box-shadow: 0 2px 4px rgba(0,0,0,0.05); 25 } 26 .idquotes-modern-quote { 27 font-size: 1.2rem; 28 font-style: italic; 29 color: #333; 30 margin: 0 0 15px 0; 31 line-height: 1.6; 32 } 33 .idquotes-modern-author { 34 font-size: 1rem; 35 font-weight: bold; 36 color: #0073aa; 37 text-transform: uppercase; 38 letter-spacing: 1px; 39 } 40 .idquotes-modern-author::before { 41 content: '\2014 \0020'; 42 } 43 44 /* Minimal layout */ 45 .idquotes-layout-minimal { 46 text-align: center; 47 padding: 30px 15px; 48 margin: 20px 0; 49 } 50 .idquotes-minimal-quote { 51 display: block; 52 font-size: 1.5rem; 53 font-weight: 300; 54 color: #444; 55 margin-bottom: 10px; 56 font-style: italic; 57 } 58 .idquotes-minimal-author { 59 font-size: 0.9rem; 60 color: #777; 61 text-transform: uppercase; 62 letter-spacing: 1.5px; 63 } 64 65 /* Card layout */ 66 .idquotes-layout-card { 67 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 68 color: #fff; 69 padding: 30px; 70 border-radius: 12px; 71 text-align: center; 72 box-shadow: 0 10px 20px rgba(0,0,0,0.15); 73 margin: 20px 0; 74 } 75 .idquotes-card-content { 76 font-size: 1.4rem; 77 line-height: 1.5; 78 font-weight: 500; 79 margin-bottom: 20px; 80 } 81 .idquotes-card-author { 82 font-size: 1.1rem; 83 font-weight: 600; 84 opacity: 0.9; 85 } 86 87 /* Glassmorphism layout */ 88 .idquotes-layout-glass { 89 background: rgba(255, 255, 255, 0.2); 90 backdrop-filter: blur(10px); 91 -webkit-backdrop-filter: blur(10px); 92 border: 1px solid rgba(255, 255, 255, 0.3); 93 border-radius: 20px; 94 padding: 30px; 95 margin: 20px 0; 96 box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1); 97 } 98 .idquotes-glass-quote { 99 font-size: 1.3rem; 100 font-weight: 500; 101 color: #1e293b; 102 margin-bottom: 15px; 103 display: block; 104 } 105 .idquotes-glass-author { 106 font-size: 0.95rem; 107 color: #64748b; 108 font-weight: 600; 109 text-transform: uppercase; 110 letter-spacing: 0.5px; 111 } 112 113 /* Gradient Border layout */ 114 .idquotes-layout-gradient-border { 115 padding: 3px; 116 background: linear-gradient(to right, #f472b6, #8b5cf6); 117 border-radius: 12px; 118 display: block; 119 margin: 20px 0; 120 } 121 .idquotes-gradient-inner { 122 background: white; 123 padding: 25px; 124 border-radius: 10px; 125 } 126 .idquotes-gradient-quote { 127 font-size: 1.25rem; 128 color: #334155; 129 margin-bottom: 10px; 130 display: block; 131 line-height: 1.5; 132 } 133 .idquotes-gradient-author { 134 color: #8b5cf6; 135 font-weight: 700; 136 } 137 138 /* Dark Sleek layout */ 139 .idquotes-layout-dark-sleek { 140 background: #0f172a; 141 color: #f8fafc; 142 padding: 25px 35px; 143 border-radius: 16px; 144 border-left: 8px solid #38bdf8; 145 margin: 20px 0; 146 box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3); 147 } 148 .idquotes-dark-quote { 149 font-size: 1.35rem; 150 font-family: Georgia, serif; 151 font-style: italic; 152 margin-bottom: 15px; 153 display: block; 154 } 155 .idquotes-dark-author { 156 font-size: 1rem; 157 color: #38bdf8; 158 font-weight: 500; 159 text-align: right; 160 display: block; 161 } 162 163 /* Quote Bubble layout */ 164 .idquotes-layout-bubble { 165 background: #fff; 166 border: 2px solid #e2e8f0; 167 padding: 25px; 168 border-radius: 20px; 169 position: relative; 170 margin: 20px 0 40px 0; 171 } 172 .idquotes-layout-bubble::after { 173 content: ''; 174 position: absolute; 175 bottom: -15px; 176 left: 40px; 177 border-width: 15px 15px 0; 178 border-style: solid; 179 border-color: #e2e8f0 transparent; 180 } 181 .idquotes-layout-bubble::before { 182 content: ''; 183 position: absolute; 184 bottom: -10px; 185 left: 42px; 186 border-width: 13px 13px 0; 187 border-style: solid; 188 border-color: #fff transparent; 189 z-index: 1; 190 } 191 .idquotes-bubble-quote { 192 font-size: 1.25rem; 193 color: #1e293b; 194 margin-bottom: 5px; 195 display: block; 196 } 197 .idquotes-bubble-author { 198 font-size: 0.9rem; 199 color: #94a3b8; 200 text-align: right; 201 display: block; 202 } -
indesign-random-quotes/trunk/idquotes.php
r2440878 r3487390 3 3 Plugin Name: InDesign Random Quotes 4 4 Description: Random popular quotes use shortcode [id_popular_quotes] 5 Version: 1. 05 Version: 1.2 6 6 Author: InDesign Media 7 7 Author's URI: https://indesignmedia.net … … 11 11 define('IDQUOTES_URL', plugin_dir_url(__FILE__)); 12 12 13 // ENEQUESSTYLES13 // ENQUEUE STYLES 14 14 function idquotes_scripts() 15 15 { 16 wp_enqueue_style('idquotes-style', IDQUOTES_URL . ' /css/style.css');16 wp_enqueue_style('idquotes-style', IDQUOTES_URL . 'css/style.css', array(), '1.2'); 17 17 } 18 18 add_action('wp_enqueue_scripts', 'idquotes_scripts'); 19 19 20 function idquotes_ shortcode()20 function idquotes_admin_scripts($hook) 21 21 { 22 $quotes = array( 23 "When the people fear their government, there is tyranny; when the government fears the people, there is liberty.#Thomas Jefferson", 24 "The problem is never how to get new, innovative thoughts into your mind, but how to get old ones out.#Dee Hock", 25 "If you're not making mistakes, then you're not doing anything. I'm positive that a doer makes mistakes.#John Wooden", 26 "Vision without action is a daydream. Action without vision is a nightmare.#Japanese saying", 27 "Remember your biggest obstacle to success is the absence of execution.#Andrew Young", 28 "If you deliberately plan on being less than you are capable of being, then I warn you that you'll be unhappy for the rest of your life.#Abraham Maslow", 29 "If you don't quit, and don't cheat, and don't run home when trouble arrives, you can only win.#Shelley Long", 30 "Just because you can ... doesn't mean you should.#Anon", 31 "Anything unattempted is impossible.#Andrew Young", 32 "If you have always done it that way, it is probably wrong.#Charles Kettering", 33 "Faced with the choice between changing one's mind and proving that there is no need to do so, almost everybody gets busy on the proof.#John Kenneth Galbraith", 34 "If you are not working on your ideas each day, you're working on someone else's.#Marjorie Blanchard", 35 "If nothing changes ... nothing changes.#Justin Herald", 36 "The best car safety device is a rear-view mirror with a cop in it.#Dudley Moore", 37 "Anybody who wants the presidency so much that he'll spend two years organizing and campaigning for it is not to be trusted with the office.#David Broder", 38 "From the moment I picked up your book until I laid it down, I was convulsed with laughter. Some day I intend reading it.#Groucho Marx", 39 "This is not a novel to be tossed aside lightly. It should be thrown with great force.#Dorothy Parker", 40 "No one can make you feel inferior without your consent.#Eleanor Roosevelt", 41 "A vacuum is a hell of a lot better than some of the stuff that nature replaces it with.#Tennessee Williams", 42 "I don't necessarily agree with everything I say.#Marshall McLuhan", 43 "The first step to getting the things you want out of life is this: Decide what you want.#Ben Stein", 44 "To err is human, but to really foul things up requires a computer.#Anon", 45 "There will be only one of you for all time. Fearlessly be yourself.#Anon", 46 "Faith is believing what God said about you, not what you think about yourself.#Robb Thompson", 47 "Do your duty in all things. You cannot do more, you should never wish to do less.#General Robert E. Lee", 48 "I cannot trust a man to control others who cannot control himself.#General Robert E. Lee", 49 "Whiskey - I like it, I always did, and that is the reason I never use it.#General Robert E. Lee", 50 "My chief concern is to try to be an humble, earnest Christian.#General Robert E. Lee", 51 "Obedience to lawful authority is the foundation of manly character.#General Robert E. Lee", 52 "It is well that war is so terrible - lest we should grow too fond of it.#General Robert E. Lee", 53 "The education of a man is never completed until he dies.#General Robert E. Lee", 54 "You can have anything you want - if you want it badly enough. You can be anything you want to be, have anything you desire, accomplish anything you set out to accomplish - if you will hold to that desire with singleness of purpose.#General Robert E. Lee", 55 "Get correct views of life, and learn to see the world in its true light. It will enable you to live pleasantly, to do good, and, when summoned away, to leave without regret.#General Robert E. Lee", 56 "Never do a wrong thing to make a friend or keep one.#General Robert E. Lee", 57 "You cannot be a true man until you learn to obey.#General Robert E. Lee", 58 "My trust is in the mercy and wisdom of a kind Providence, who ordereth all things for our good.#General Robert E. Lee", 59 "And in the end it's not the years in your life that count. It's the life in your years.#Abraham Lincoln", 60 "Am I not destroying my enemies when I make friends of them?#Abraham Lincoln", 61 "Be sure you put your feet in the right place, then stand firm.#Abraham Lincoln", 62 "Better to remain silent and be thought a fool than to speak out and remove all doubt.#Abraham Lincoln", 63 "He has a right to criticize, who has a heart to help.#Abraham Lincoln", 64 "I have always found that mercy bears richer fruits than strict justice.#Abraham Lincoln", 65 "I never had a policy; I have just tried to do my very best each and every day.#Abraham Lincoln", 66 "I walk slowly, but I never walk backward.#Abraham Lincoln", 67 "If this is coffee, please bring me some tea; but if this is tea, please bring me some coffee.#Abraham Lincoln", 68 "If we could first know where we are, and whither we are tending, we could then better judge what to do, and how to do it.#Abraham Lincoln", 69 "If you look for the bad in people expecting to find it, you surely will.#Abraham Lincoln", 70 "Most folks are as happy as they make up their minds to be.#Abraham Lincoln", 71 "Nearly all men can stand adversity, but if you want to test a man's character, give him power.#Abraham Lincoln", 72 "No man has a good enough memory to be a successful liar.#Abraham Lincoln", 73 "No man is good enough to govern another man without that other's consent.#Abraham Lincoln", 74 "No matter how much cats fight, there always seem to be plenty of kittens.#Abraham Lincoln", 75 "Sir, my concern is not whether God is on our side; my greatest concern is to be on God's side, for God is always right.#Abraham Lincoln", 76 "Those who deny freedom to others deserve it not for themselves.#Abraham Lincoln", 77 "You can fool all the people some of the time, and some of the people all the time, but you cannot fool all the people all the time.#Abraham Lincoln", 78 "You cannot escape the responsibility of tomorrow by evading it today.#Abraham Lincoln", 79 "You cannot help men permanently by doing for them what they could and should do for themselves.#Abraham Lincoln", 80 "Captain, my religious belief teaches me to feel as safe in battle as in bed. God has fixed the time for my death. I do not concern myself about that, but to be always ready, no matter when it may overtake me.#General Stonewall Jackson", 81 "You may be whatever you resolve to be.#General Stonewall Jackson", 82 "Never take counsel of your fears.#General Stonewall Jackson", 83 "Duty is ours; consequences are God's.#General Stonewall Jackson", 84 "If it weren't for Philo T. Farnsworth, inventor of television, we'd still be eating frozen radio dinners.#Johnny Carson", 85 "You cannot multiply wealth by dividing it.#Adrian Rogers, 1931", 22 if (strpos($hook, 'idquotes-settings') !== false) { 23 wp_enqueue_style('idquotes-style', IDQUOTES_URL . 'css/style.css', array(), '1.2'); 24 } 25 } 26 add_action('admin_enqueue_scripts', 'idquotes_admin_scripts'); 27 28 function idquotes_shortcode($atts) 29 { 30 $atts = shortcode_atts( 31 array( 32 'layout' => 'classic', 33 ), 34 $atts, 35 'id_popular_quotes' 86 36 ); 37 38 $mode = get_option('idquotes_mode', 'manual'); 39 $custom_quotes = get_option('idquotes_list', ''); 40 41 if ($mode === 'universal' || empty(trim($custom_quotes))) { 42 $quotes = array( 43 "When the people fear their government, there is tyranny; when the government fears the people, there is liberty.#Thomas Jefferson", 44 "The problem is never how to get new, innovative thoughts into your mind, but how to get old ones out.#Dee Hock", 45 "If you're not making mistakes, then you're not doing anything. I'm positive that a doer makes mistakes.#John Wooden", 46 "Vision without action is a daydream. Action without vision is a nightmare.#Japanese saying", 47 "Remember your biggest obstacle to success is the absence of execution.#Andrew Young", 48 "If you deliberately plan on being less than you are capable of being, then I warn you that you'll be unhappy for the rest of your life.#Abraham Maslow", 49 "If you don't quit, and don't cheat, and don't run home when trouble arrives, you can only win.#Shelley Long", 50 "Just because you can ... doesn't mean you should.#Anon", 51 "Anything unattempted is impossible.#Andrew Young", 52 "If you have always done it that way, it is probably wrong.#Charles Kettering", 53 "Faced with the choice between changing one's mind and proving that there is no need to do so, almost everybody gets busy on the proof.#John Kenneth Galbraith", 54 "If you are not working on your ideas each day, you're working on someone else's.#Marjorie Blanchard", 55 "If nothing changes ... nothing changes.#Justin Herald", 56 "The best car safety device is a rear-view mirror with a cop in it.#Dudley Moore", 57 "Anybody who wants the presidency so much that he'll spend two years organizing and campaigning for it is not to be trusted with the office.#David Broder", 58 "From the moment I picked up your book until I laid it down, I was convulsed with laughter. Some day I intend reading it.#Groucho Marx", 59 "This is not a novel to be tossed aside lightly. It should be thrown with great force.#Dorothy Parker", 60 "No one can make you feel inferior without your consent.#Eleanor Roosevelt", 61 "A vacuum is a hell of a lot better than some of the stuff that nature replaces it with.#Tennessee Williams", 62 "I don't necessarily agree with everything I say.#Marshall McLuhan", 63 "The first step to getting the things you want out of life is this: Decide what you want.#Ben Stein", 64 "To err is human, but to really foul things up requires a computer.#Anon", 65 "There will be only one of you for all time. Fearlessly be yourself.#Anon", 66 "Faith is believing what God said about you, not what you think about yourself.#Robb Thompson", 67 "Do your duty in all things. You cannot do more, you should never wish to do less.#General Robert E. Lee", 68 "I cannot trust a man to control others who cannot control himself.#General Robert E. Lee", 69 "Whiskey - I like it, I always did, and that is the reason I never use it.#General Robert E. Lee", 70 "My chief concern is to try to be an humble, earnest Christian.#General Robert E. Lee", 71 "Obedience to lawful authority is the foundation of manly character.#General Robert E. Lee", 72 "It is well that war is so terrible - lest we should grow too fond of it.#General Robert E. Lee", 73 "The education of a man is never completed until he dies.#General Robert E. Lee", 74 "You can have anything you want - if you want it badly enough. You can be anything you want to be, have anything you desire, accomplish anything you set out to accomplish - if you will hold to that desire with singleness of purpose.#General Robert E. Lee", 75 "Get correct views of life, and learn to see the world in its true light. It will enable you to live pleasantly, to do good, and, when summoned away, to leave without regret.#General Robert E. Lee", 76 "Never do a wrong thing to make a friend or keep one.#General Robert E. Lee", 77 "You cannot be a true man until you learn to obey.#General Robert E. Lee", 78 "My trust is in the mercy and wisdom of a kind Providence, who ordereth all things for our good.#General Robert E. Lee", 79 "And in the end it's not the years in your life that count. It's the life in your years.#Abraham Lincoln", 80 "Am I not destroying my enemies when I make friends of them?#Abraham Lincoln", 81 "Be sure you put your feet in the right place, then stand firm.#Abraham Lincoln", 82 "Better to remain silent and be thought a fool than to speak out and remove all doubt.#Abraham Lincoln", 83 "He has a right to criticize, who has a heart to help.#Abraham Lincoln", 84 "I have always found that mercy bears richer fruits than strict justice.#Abraham Lincoln", 85 "I never had a policy; I have just tried to do my very best each and every day.#Abraham Lincoln", 86 "I walk slowly, but I never walk backward.#Abraham Lincoln", 87 "If this is coffee, please bring me some tea; but if this is tea, please bring me some coffee.#Abraham Lincoln", 88 "If we could first know where we are, and whither we are tending, we could then better judge what to do, and how to do it.#Abraham Lincoln", 89 "If you look for the bad in people expecting to find it, you surely will.#Abraham Lincoln", 90 "Most folks are as happy as they make up their minds to be.#Abraham Lincoln", 91 "Nearly all men can stand adversity, but if you want to test a man's character, give him power.#Abraham Lincoln", 92 "No man has a good enough memory to be a successful liar.#Abraham Lincoln", 93 "No man is good enough to govern another man without that other's consent.#Abraham Lincoln", 94 "No matter how much cats fight, there always seem to be plenty of kittens.#Abraham Lincoln", 95 "Sir, my concern is not whether God is on our side; my greatest concern is to be on God's side, for God is always right.#Abraham Lincoln", 96 "Those who deny freedom to others deserve it not for themselves.#Abraham Lincoln", 97 "You can fool all the people some of the time, and some of the people all the time, but you cannot fool all the people all the time.#Abraham Lincoln", 98 "You cannot escape the responsibility of tomorrow by evading it today.#Abraham Lincoln", 99 "You cannot help men permanently by doing for them what they could and should do for themselves.#Abraham Lincoln", 100 "Captain, my religious belief teaches me to feel as safe in battle as in bed. God has fixed the time for my death. I do not concern myself about that, but to be always ready, no matter when it may overtake me.#General Stonewall Jackson", 101 "You may be whatever you resolve to be.#General Stonewall Jackson", 102 "Never take counsel of your fears.#General Stonewall Jackson", 103 "Duty is ours; consequences are God's.#General Stonewall Jackson", 104 "If it weren't for Philo T. Farnsworth, inventor of television, we'd still be eating frozen radio dinners.#Johnny Carson", 105 "You cannot multiply wealth by dividing it.#Adrian Rogers, 1931" 106 ); 107 } else { 108 $quotes = array_filter(array_map('trim', explode("\n", $custom_quotes))); 109 $quotes = array_values($quotes); 110 } 111 112 if (empty($quotes)) { 113 return ''; 114 } 87 115 88 116 $picked = $quotes[rand(0, count($quotes) - 1)]; 89 117 $picked_parts = explode('#', $picked); 90 91 echo "<div class='idquotes-warp'>"; 92 echo '<div class="idquotes-quotes">' . $picked_parts[0] . '</div>'; 93 echo '<div class="idquotes-donner-name">' . $picked_parts[1] . '</div>'; 94 echo "</div>"; 118 119 $quote_text = isset($picked_parts[0]) ? trim($picked_parts[0]) : ''; 120 $quote_author = isset($picked_parts[1]) ? trim($picked_parts[1]) : 'Unknown'; 121 122 $output = ''; 123 124 switch ($atts['layout']) { 125 case 'modern': 126 $output .= '<div class="idquotes-layout-modern">'; 127 $output .= '<blockquote class="idquotes-modern-quote">' . esc_html($quote_text) . '</blockquote>'; 128 $output .= '<div class="idquotes-modern-author">' . esc_html($quote_author) . '</div>'; 129 $output .= '</div>'; 130 break; 131 132 case 'minimal': 133 $output .= '<div class="idquotes-layout-minimal">'; 134 $output .= '<span class="idquotes-minimal-quote">“' . esc_html($quote_text) . '”</span>'; 135 $output .= '<span class="idquotes-minimal-author">— ' . esc_html($quote_author) . '</span>'; 136 $output .= '</div>'; 137 break; 138 139 case 'card': 140 $output .= '<div class="idquotes-layout-card">'; 141 $output .= '<div class="idquotes-card-content">' . esc_html($quote_text) . '</div>'; 142 $output .= '<div class="idquotes-card-author">∼ ' . esc_html($quote_author) . '</div>'; 143 $output .= '</div>'; 144 break; 145 146 case 'glass': 147 $output .= '<div class="idquotes-layout-glass">'; 148 $output .= '<span class="idquotes-glass-quote">' . esc_html($quote_text) . '</span>'; 149 $output .= '<span class="idquotes-glass-author">' . esc_html($quote_author) . '</span>'; 150 $output .= '</div>'; 151 break; 152 153 case 'gradient-border': 154 $output .= '<div class="idquotes-layout-gradient-border">'; 155 $output .= '<div class="idquotes-gradient-inner">'; 156 $output .= '<span class="idquotes-gradient-quote">' . esc_html($quote_text) . '</span>'; 157 $output .= '<span class="idquotes-gradient-author">' . esc_html($quote_author) . '</span>'; 158 $output .= '</div></div>'; 159 break; 160 161 case 'dark-sleek': 162 $output .= '<div class="idquotes-layout-dark-sleek">'; 163 $output .= '<span class="idquotes-dark-quote">' . esc_html($quote_text) . '</span>'; 164 $output .= '<span class="idquotes-dark-author">' . esc_html($quote_author) . '</span>'; 165 $output .= '</div>'; 166 break; 167 168 case 'bubble': 169 $output .= '<div class="idquotes-layout-bubble">'; 170 $output .= '<span class="idquotes-bubble-quote">' . esc_html($quote_text) . '</span>'; 171 $output .= '<span class="idquotes-bubble-author">' . esc_html($quote_author) . '</span>'; 172 $output .= '</div>'; 173 break; 174 175 default: // classic 176 $output .= '<div class="idquotes-warp">'; 177 $output .= '<div class="idquotes-quotes">' . esc_html($quote_text) . '</div>'; 178 $output .= '<div class="idquotes-donner-name">' . esc_html($quote_author) . '</div>'; 179 $output .= '</div>'; 180 break; 181 } 182 183 return $output; 95 184 } 96 97 185 add_shortcode('id_popular_quotes', 'idquotes_shortcode'); 186 187 // --- ADMIN SETTINGS PAGE --- 188 function idquotes_add_admin_menu() { 189 add_menu_page( 190 'ID Quotes Settings', 191 'ID Quotes', 192 'manage_options', 193 'idquotes-settings', 194 'idquotes_settings_page', 195 'dashicons-format-quote', 196 30 197 ); 198 } 199 add_action('admin_menu', 'idquotes_add_admin_menu'); 200 201 function idquotes_settings_init() { 202 register_setting( 203 'idquotes_settings_group', 204 'idquotes_list', 205 array('sanitize_callback' => 'sanitize_textarea_field') 206 ); 207 register_setting( 208 'idquotes_settings_group', 209 'idquotes_mode', 210 array('sanitize_callback' => 'sanitize_text_field') 211 ); 212 } 213 add_action('admin_init', 'idquotes_settings_init'); 214 215 function idquotes_settings_page() { 216 ?> 217 <style> 218 /* Reset & Base */ 219 .idq-admin-container { 220 margin: 30px 20px 20px 0; 221 font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 222 color: #1e293b; 223 box-sizing: border-box; 224 } 225 .idq-admin-container * { 226 box-sizing: border-box; 227 } 228 229 /* Dashboard Layout */ 230 .idq-dashboard { 231 display: grid; 232 grid-template-columns: 1fr 420px; 233 gap: 30px; 234 max-width: 1400px; 235 } 236 237 @media (max-width: 1100px) { 238 .idq-dashboard { 239 grid-template-columns: 1fr; 240 } 241 } 242 243 /* Header */ 244 .idq-admin-container h1 { 245 font-size: 23px; 246 font-weight: 400; 247 margin: 0 0 5px 0; 248 color: #1d2327; 249 padding: 9px 0 4px 0; 250 line-height: 1.3; 251 } 252 253 .idq-admin-container .idq-header-p { 254 font-size: 13px; 255 margin: 0 0 20px 0; 256 color: #64748b; 257 } 258 259 /* Toggle Switch */ 260 .idq-mode-switch { 261 background: rgba(255, 255, 255, 0.15); 262 padding: 6px; 263 border-radius: 100px; 264 display: flex; 265 gap: 4px; 266 border: 1px solid rgba(255, 255, 255, 0.2); 267 position: relative; 268 z-index: 2; 269 } 270 271 .idq-mode-switch label { 272 padding: 10px 24px; 273 border-radius: 100px; 274 font-size: 15px; 275 font-weight: 600; 276 cursor: pointer; 277 transition: all 0.3s ease; 278 color: white; 279 } 280 281 .idq-mode-switch input { display: none; } 282 283 .idq-mode-switch input:checked + label { 284 background: white; 285 color: #8b5cf6; 286 box-shadow: 0 4px 12px rgba(0,0,0,0.1); 287 } 288 289 /* Glassmorphic Cards */ 290 .idq-card { 291 background: #ffffff; 292 border-radius: 20px; 293 padding: 35px; 294 box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 295 0 0 0 1px rgba(0,0,0,0.02); 296 transition: transform 0.3s ease, box-shadow 0.3s ease; 297 position: relative; 298 overflow: hidden; 299 margin-bottom: 30px; 300 } 301 302 .idq-card h2 { 303 font-size: 24px; 304 font-weight: 700; 305 margin: 0 0 20px 0; 306 color: #0f172a; 307 display: flex; 308 align-items: center; 309 gap: 12px; 310 } 311 312 .idq-card h2 svg { 313 width: 28px; 314 height: 28px; 315 color: #8b5cf6; 316 filter: drop-shadow(0 4px 6px rgba(139, 92, 246, 0.2)); 317 } 318 319 /* Quick Add Form */ 320 .idq-quick-add { 321 display: grid; 322 grid-template-columns: 1fr 200px 140px; 323 gap: 15px; 324 background: #f8fafc; 325 padding: 20px; 326 border-radius: 16px; 327 border: 1px solid #e2e8f0; 328 margin-bottom: 25px; 329 } 330 331 @media (max-width: 600px) { 332 .idq-quick-add { grid-template-columns: 1fr; } 333 } 334 335 .idq-input { 336 width: 100%; 337 border: 2px solid #e2e8f0; 338 border-radius: 12px; 339 padding: 12px 16px; 340 font-size: 15px; 341 outline: none; 342 transition: border-color 0.2s; 343 } 344 .idq-input:focus { border-color: #8b5cf6; } 345 346 .idq-add-btn { 347 background: #8b5cf6; 348 color: white; 349 border: none; 350 border-radius: 12px; 351 font-weight: 600; 352 cursor: pointer; 353 transition: transform 0.2s, background 0.2s; 354 } 355 .idq-add-btn:hover { background: #7c3aed; transform: translateY(-1px); } 356 357 /* Form Table & Textarea */ 358 .idq-textarea { 359 width: 100%; 360 border: 2px solid #e2e8f0; 361 border-radius: 16px; 362 padding: 20px; 363 font-size: 15px; 364 font-family: ui-monospace, monospace; 365 background-color: #f8fafc; 366 resize: vertical; 367 min-height: 200px; 368 transition: all 0.3s; 369 } 370 .idq-textarea:focus { border-color: #8b5cf6; background: white; } 371 372 /* Layout Previews */ 373 .idq-preview-grid { 374 display: flex; 375 flex-direction: column; 376 gap: 20px; 377 } 378 379 .idq-preview-header { 380 display: flex; 381 justify-content: space-between; 382 align-items: center; 383 margin-bottom: 10px; 384 border-bottom: 1px solid #f1f5f9; 385 padding-bottom: 8px; 386 } 387 388 .idq-preview-header strong { font-size: 16px; color: #1e293b; } 389 /* Copy Badge */ 390 .idq-copy-shortcode { 391 background: #f1f5f9; 392 padding: 4px 10px; 393 border-radius: 6px; 394 color: #ec4899; 395 font-family: monospace; 396 font-size: 13px; 397 cursor: pointer; 398 transition: all 0.2s ease; 399 border: 1px solid #e2e8f0; 400 position: relative; 401 } 402 403 .idq-copy-shortcode:hover { 404 background: #e2e8f0; 405 color: #db2777; 406 transform: translateY(-1px); 407 } 408 409 .idq-copy-shortcode:active { 410 transform: translateY(0); 411 } 412 413 .idq-copy-shortcode::after { 414 content: 'Click to copy'; 415 position: absolute; 416 bottom: 100%; 417 left: 50%; 418 transform: translateX(-50%); 419 background: #1e293b; 420 color: white; 421 padding: 4px 8px; 422 border-radius: 4px; 423 font-size: 11px; 424 white-space: nowrap; 425 opacity: 0; 426 visibility: hidden; 427 transition: all 0.2s ease; 428 margin-bottom: 5px; 429 } 430 431 .idq-copy-shortcode:hover::after { 432 opacity: 1; 433 visibility: visible; 434 } 435 436 .idq-copy-shortcode.copied::after { 437 content: 'Copied!'; 438 background: #10b981; 439 } 440 441 /* Integration Card Details */ 442 .idq-shortcode-preview { 443 background: #f1f5f9; 444 border-radius: 12px; 445 padding: 16px; 446 text-align: center; 447 border: 1px dashed #cbd5e1; 448 margin-bottom: 24px; 449 } 450 .idq-shortcode-preview code { font-size: 20px; color: #ec4899; font-weight: 700; } 451 452 /* Show/Hide Logic */ 453 #manual-entry-section { transition: opacity 0.3s ease; } 454 .is-hidden { display: none !important; } 455 456 /* Save Button */ 457 .idq-save-btn { 458 background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); 459 border: none; 460 color: white !important; 461 font-size: 17px; 462 font-weight: 600; 463 padding: 14px 32px; 464 border-radius: 12px; 465 cursor: pointer; 466 box-shadow: 0 10px 20px -5px rgba(109, 40, 217, 0.4); 467 display: inline-flex; 468 align-items: center; 469 gap: 10px; 470 text-decoration: none; 471 } 472 .idq-save-btn:hover { transform: translateY(-2px); box-shadow: 0 15px 25px -5px rgba(109, 40, 217, 0.5); } 473 </style> 474 475 <?php 476 $current_mode = get_option('idquotes_mode', 'manual'); 477 $custom_quotes = get_option('idquotes_list', ''); 478 479 // Get a sample quote for previews 480 $sample_quote = "Knowledge is power. Information is liberating."; 481 $sample_author = "Kofi Annan"; 482 483 if ($current_mode === 'universal' || empty(trim($custom_quotes))) { 484 // Use first universal quote 485 $sample_quote = "When the people fear their government, there is tyranny; when the government fears the people, there is liberty."; 486 $sample_author = "Thomas Jefferson"; 487 } else { 488 // Use first manual quote 489 $lines = explode("\n", $custom_quotes); 490 if (!empty($lines[0])) { 491 $parts = explode("#", $lines[0]); 492 $sample_quote = $parts[0]; 493 $sample_author = isset($parts[1]) ? $parts[1] : 'Unknown'; 494 } 495 } 496 ?> 497 498 <div class="wrap idq-admin-container"> 499 <form method="post" action="options.php"> 500 <?php settings_fields('idquotes_settings_group'); ?> 501 502 <div style="margin-bottom: 20px;"> 503 <h1>Quotes Studio</h1> 504 <p class="idq-header-p">Manage, customize, and preview your random quotes collections.</p> 505 </div> 506 507 <div class="idq-dashboard"> 508 <!-- Left Column: Form --> 509 <div id="manual-entry-section" class="idq-card"> 510 <div style="margin-bottom: 25px; border-bottom: 1px solid #f1f5f9; padding-bottom: 20px;"> 511 <div style="margin-bottom: 15px;"> 512 <div class="idq-mode-switch" style="background: #f1f5f9; border: 1px solid #e2e8f0; width: max-content;"> 513 <input type="radio" id="mode-universal" name="idquotes_mode" value="universal" <?php checked($current_mode, 'universal'); ?>> 514 <label for="mode-universal" style="color: #64748b;">Universal</label> 515 516 <input type="radio" id="mode-manual" name="idquotes_mode" value="manual" <?php checked($current_mode, 'manual'); ?>> 517 <label for="mode-manual" style="color: #64748b;">Manual</label> 518 </div> 519 </div> 520 521 <h2 style="margin: 0;"> 522 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg> 523 Quote Management 524 </h2> 525 </div> 526 527 <div id="manual-form-content" class="<?php echo $current_mode === 'universal' ? 'is-hidden' : ''; ?>"> 528 <p style="color: #64748b; margin-bottom: 25px;">Quickly add new quotes or manage your existing collection below.</p> 529 530 <!-- Quick Add --> 531 <div class="idq-quick-add"> 532 <input type="text" id="idq-new-text" class="idq-input" placeholder="Enter quote text..."> 533 <input type="text" id="idq-new-author" class="idq-input" placeholder="Author name"> 534 <button type="button" id="idq-add-action" class="idq-add-btn">Add Quote</button> 535 </div> 536 537 <textarea name="idquotes_list" id="idquotes_list" class="idq-textarea" placeholder="Quote#Author (one per line)"><?php echo esc_textarea(get_option('idquotes_list')); ?></textarea> 538 </div> 539 540 <!-- Universal Notice (Inside the card) --> 541 <div id="universal-notice-inline" class="<?php echo $current_mode === 'manual' ? 'is-hidden' : ''; ?>" style="text-align: center; padding: 20px 0;"> 542 <div style="background: #f8fafc; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px;"> 543 <svg style="width: 30px; height: 30px; color: #8b5cf6;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg> 544 </div> 545 <h3 style="margin-bottom: 10px; color: #1e293b;">Universal Mode Active</h3> 546 <p style="font-size: 15px; color: #64748b; margin-bottom: 0;">Using the hand-picked global collection. Your manual entries are safe but hidden.</p> 547 </div> 548 549 <div style="margin-top: 30px;"> 550 <button type="submit" class="idq-save-btn">Save Preferences</button> 551 </div> 552 </div> 553 554 <!-- Right Column: Previews --> 555 <div class="idq-card"> 556 <h2> 557 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"></path><circle cx="12" cy="12" r="3"></circle></svg> 558 Layout Previews 559 </h2> 560 561 <div class="idq-shortcode-preview" style="background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 15px; text-align: center; margin-bottom: 25px;"> 562 <span class="idq-copy-shortcode" style="font-size: 15px; padding: 8px 15px;">[id_popular_quotes]</span> 563 <p style="margin: 8px 0 0 0; font-size: 12px; color: #64748b;">Generic shortcode (uses default layout)</p> 564 </div> 565 566 <div class="idq-preview-grid"> 567 <div class="idq-preview-item"> 568 <div class="idq-preview-header"> 569 <strong>Classic</strong> 570 <span class="idq-copy-shortcode">[id_popular_quotes layout="classic"]</span> 571 </div> 572 <div class="idq-preview-box"> 573 <div class="idquotes-warp"> 574 <div class="idquotes-quotes"><?php echo esc_html($sample_quote); ?></div> 575 <div class="idquotes-donner-name"><?php echo esc_html($sample_author); ?></div> 576 </div> 577 </div> 578 </div> 579 580 <div class="idq-preview-item"> 581 <div class="idq-preview-header"> 582 <strong>Modern Blockquote</strong> 583 <span class="idq-copy-shortcode">[id_popular_quotes layout="modern"]</span> 584 </div> 585 <div class="idq-preview-box"> 586 <div class="idquotes-layout-modern"> 587 <blockquote class="idquotes-modern-quote"><?php echo esc_html($sample_quote); ?></blockquote> 588 <div class="idquotes-modern-author"><?php echo esc_html($sample_author); ?></div> 589 </div> 590 </div> 591 </div> 592 593 <div class="idq-preview-item"> 594 <div class="idq-preview-header"> 595 <strong>Minimalist</strong> 596 <span class="idq-copy-shortcode">[id_popular_quotes layout="minimal"]</span> 597 </div> 598 <div class="idq-preview-box"> 599 <div class="idquotes-layout-minimal"> 600 <span class="idquotes-minimal-quote">“<?php echo esc_html($sample_quote); ?>”</span> 601 <span class="idquotes-minimal-author">— <?php echo esc_html($sample_author); ?></span> 602 </div> 603 </div> 604 </div> 605 606 <div class="idq-preview-item"> 607 <div class="idq-preview-header"> 608 <strong>Vibrant Card</strong> 609 <span class="idq-copy-shortcode">[id_popular_quotes layout="card"]</span> 610 </div> 611 <div class="idq-preview-box"> 612 <div class="idquotes-layout-card"> 613 <div class="idquotes-card-content"><?php echo esc_html($sample_quote); ?></div> 614 <div class="idquotes-card-author">∼ <?php echo esc_html($sample_author); ?></div> 615 </div> 616 </div> 617 </div> 618 619 <div class="idq-preview-item"> 620 <div class="idq-preview-header"> 621 <strong>Glassmorphism</strong> 622 <span class="idq-copy-shortcode">[id_popular_quotes layout="glass"]</span> 623 </div> 624 <div class="idq-preview-box"> 625 <div class="idquotes-layout-glass"> 626 <span class="idquotes-glass-quote"><?php echo esc_html($sample_quote); ?></span> 627 <span class="idquotes-glass-author"><?php echo esc_html($sample_author); ?></span> 628 </div> 629 </div> 630 </div> 631 632 <div class="idq-preview-item"> 633 <div class="idq-preview-header"> 634 <strong>Gradient Border</strong> 635 <span class="idq-copy-shortcode">[id_popular_quotes layout="gradient-border"]</span> 636 </div> 637 <div class="idq-preview-box"> 638 <div class="idquotes-layout-gradient-border"> 639 <div class="idquotes-gradient-inner"> 640 <span class="idquotes-gradient-quote"><?php echo esc_html($sample_quote); ?></span> 641 <span class="idquotes-gradient-author"><?php echo esc_html($sample_author); ?></span> 642 </div> 643 </div> 644 </div> 645 </div> 646 647 <div class="idq-preview-item"> 648 <div class="idq-preview-header"> 649 <strong>Dark Sleek</strong> 650 <span class="idq-copy-shortcode">[id_popular_quotes layout="dark-sleek"]</span> 651 </div> 652 <div class="idq-preview-box"> 653 <div class="idquotes-layout-dark-sleek"> 654 <span class="idquotes-dark-quote"><?php echo esc_html($sample_quote); ?></span> 655 <span class="idquotes-dark-author"><?php echo esc_html($sample_author); ?></span> 656 </div> 657 </div> 658 </div> 659 660 <div class="idq-preview-item"> 661 <div class="idq-preview-header"> 662 <strong>Quote Bubble</strong> 663 <span class="idq-copy-shortcode">[id_popular_quotes layout="bubble"]</span> 664 </div> 665 <div class="idq-preview-box"> 666 <div class="idquotes-layout-bubble"> 667 <span class="idquotes-bubble-quote"><?php echo esc_html($sample_quote); ?></span> 668 <span class="idquotes-bubble-author"><?php echo esc_html($sample_author); ?></span> 669 </div> 670 </div> 671 </div> 672 </div> 673 </div> 674 </div> 675 </form> 676 </div> 677 678 <script> 679 document.addEventListener('DOMContentLoaded', function() { 680 const manualForm = document.getElementById('manual-form-content'); 681 const universalNotice = document.getElementById('universal-notice-inline'); 682 const radios = document.querySelectorAll('input[name="idquotes_mode"]'); 683 684 radios.forEach(radio => { 685 radio.addEventListener('change', function() { 686 if (this.value === 'universal') { 687 manualForm.classList.add('is-hidden'); 688 universalNotice.classList.remove('is-hidden'); 689 } else { 690 manualForm.classList.remove('is-hidden'); 691 universalNotice.classList.add('is-hidden'); 692 } 693 }); 694 }); 695 696 // Quick Add Logic 697 const addBtn = document.getElementById('idq-add-action'); 698 const textarea = document.getElementById('idquotes_list'); 699 const quoteInput = document.getElementById('idq-new-text'); 700 const authorInput = document.getElementById('idq-new-author'); 701 702 addBtn.addEventListener('click', function() { 703 const text = quoteInput.value.trim(); 704 const author = authorInput.value.trim() || 'Unknown'; 705 706 if (text) { 707 const newEntry = (textarea.value.trim() ? '\n' : '') + text + '#' + author; 708 textarea.value += newEntry; 709 quoteInput.value = ''; 710 authorInput.value = ''; 711 712 // Visual feedback 713 addBtn.textContent = 'Added!'; 714 setTimeout(() => addBtn.textContent = 'Add Quote', 1500); 715 } 716 }); 717 718 // Copy to Clipboard Logic 719 const copyBadges = document.querySelectorAll('.idq-copy-shortcode'); 720 copyBadges.forEach(badge => { 721 badge.addEventListener('click', function() { 722 const text = this.textContent; 723 navigator.clipboard.writeText(text).then(() => { 724 this.classList.add('copied'); 725 setTimeout(() => { 726 this.classList.remove('copied'); 727 }, 2000); 728 }); 729 }); 730 }); 731 }); 732 </script> 733 <?php 734 } -
indesign-random-quotes/trunk/readme.txt
r2440878 r3487390 2 2 Contributors: indesignmedia 3 3 Donate link: https://indesignmedia.net/ 4 Tags: random, quote 4 Tags: random, quote, quotes, random quotes, quote layout 5 5 Requires at least: 1.0 6 Tested up to: 5.6.06 Tested up to: 6.9.4 7 7 Requires PHP: 7.3 8 Stable tag: randomquote8 Stable tag: 1.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 11 12 A simple shortcode to display random quotes on your WordPress site. 13 12 A simple shortcode to display random quotes on your WordPress site, now with multiple layouts and a custom quotes manager! 14 13 15 14 == Description == 16 15 17 IMPORTANT UPDATE NOTE: For all users who are currently using this plugin, after updating you should view plugin description to get shortcode. 16 InDesign Random Quotes displays a random quote each time your site is loaded. 17 You can create and maintain the list of quotes directly from the new **ID Quotes** item in the main WordPress admin menu. If you don't add your own quotes, it defaults to a popular selection of quotes from around the globe. 18 18 19 c3 Random Quotes displays a random quote each time your site is loaded. 20 You create and maintain the list of quotes in a same plugin page. 21 Quotes are selected and most popular from around the globe. 22 It's easily installed and just use shortcode to display it randomly. 19 It's easily installed and you just use a shortcode to display it randomly anywhere on your site. 23 20 24 21 = Features: = 25 22 26 23 * Easy user install and display just by shortcode. 24 * **NEW:** Manage your own quotes natively from the dedicated **ID Quotes** menu in WordPress. 25 * **NEW:** Four built-in design layouts: Classic (default), Modern, Minimal, and Card. 27 26 28 27 == Installation == 29 28 30 Now requires PHP Version 7.3 29 Now requires PHP Version 7.3+ 31 30 32 = Installing the Widget=33 1. U nzip the widget archive.34 2. Upload the folder idquotes to the /wp-content/plugins directory.35 3. Activate the plugin through the 'Plugins' menu in WordPress.36 4. Add the shortcode [id_popular_quotes] to the content or in any widget to display it.31 = Installing the Plugin = 32 1. Upload the folder `idquotes` to the `/wp-content/plugins` directory. 33 2. Activate the plugin through the 'Plugins' menu in WordPress. 34 3. Manage your custom quotes from the new **ID Quotes** item in the main admin menu. 35 4. Add the shortcode `[id_popular_quotes]` to any post, page, or widget to display a quote. 37 36 37 = Layout Usage = 38 You can customize the look and feel using the `layout` attribute: 39 40 * **Classic (Default):** `[id_popular_quotes]` or `[id_popular_quotes layout="classic"]` 41 * **Modern Blockquote:** `[id_popular_quotes layout="modern"]` 42 * **Minimalist:** `[id_popular_quotes layout="minimal"]` 43 * **Gradient Card:** `[id_popular_quotes layout="card"]` 38 44 39 45 == Frequently Asked Questions == 40 46 41 = My template doesn't allow for widgets in the header. How can I add this? = 42 43 There are many good resources available online that discuss this very thing. Search for 'WordPress add a template widget area' to see several. Be warned this will require some code editing in your template files. If you're not comfortable with this consider hiring a web designer to do this. 47 = My template doesn't allow for widgets in the header. How can I add this? = 48 There are many good resources available online that discuss this very thing. Search for 'WordPress add a template widget area' to see several. Be warned this will require some code editing in your template files. If you're not comfortable with this consider hiring a web designer to do this. 44 49 45 50 == Screenshots == 46 51 47 52 1. Screenshot showing plugin directory 48 2. Screenshot showing shortcode 53 2. Screenshot showing shortcode usage with layouts 49 54 50 55 == Changelog == 51 56 57 = 1.2 = 58 * **Enhancement:** Moved the ID Quotes settings panel to a dedicated top-level main menu item for quicker access. 59 * **Security:** Added text sanitization callbacks for settings storage, adhering strictly to WordPress security standards. 60 * **Compatibility:** Tested and confirmed fully compatible with WordPress 6.9.4. 61 62 = 1.1 = 63 * **Feature:** Added a dedicated Admin Page (**ID Quotes** in the main menu) to easily manage and add custom quotes. 64 * **Feature:** Added new `layout` attributes to the shortcode to support multiple design styles: `classic`, `modern`, `minimal`, and `card`. 65 * **Fix/Improvement:** Updated shortcode to properly return output instead of echoing it, adhering to WordPress standards. 66 * **Backward Compatibility:** Ensured existing shortcode usage without layouts falls back to the exact classic design and works seamlessly. 67 52 68 = 1.0 = 53 Initial release54 69 * Initial release 70 55 71 == Upgrade Notice == 56 72 73 = 1.2 = 74 The ID Quotes settings have moved! You will now find "ID Quotes" as a top-level menu item in your WordPress dashboard sidebar instead of nested under Settings. 75 76 = 1.1 = 77 Huge update! You can now manage your own quotes from the dedicated ID Quotes admin menu, and choose from multiple fresh, modern layouts using shortcode attributes. Updating to 1.1 is fully backward compatible with your current pages. 78 57 79 = 1.0 = 58 80 This is initial release of plugin for show popular random quotes 59
Note: See TracChangeset
for help on using the changeset viewer.