Advertisement
_Sascha_

tooltipsfunctions.php - quickfix

Apr 20th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.56 KB | None | 0 0
  1. <?php
  2.  
  3. function tooltipGlobalSettings()
  4. {
  5.     if (isset($_POST['onlyFirstKeywordsetting']))
  6.     {
  7.         if (isset($_POST['onlyFirstKeyword']))
  8.         {
  9.             update_option("onlyFirstKeyword",$_POST['onlyFirstKeyword']);
  10.         }
  11.         // version 3.4.9 tooltipsMessage("Changes saved."); //!!!
  12.         $tooltipsMessageString =  __( 'Changes saved.', 'wordpress-tooltips' );
  13.         tooltipsMessage($tooltipsMessageString);
  14.     }
  15.    
  16.    
  17.     $onlyFirstKeyword = get_option("onlyFirstKeyword");
  18.    
  19.     if (isset($_POST['enableTooltipsForImageSubmit']))
  20.     {
  21.         if (isset($_POST['enableTooltipsForImage']))
  22.         {
  23.             update_option("enableTooltipsForImage",$_POST['enableTooltipsForImage']);
  24.         }
  25.         // version 3.4.9
  26.         //tooltipsMessage("Changes saved."); //!!!
  27.         $tooltipsMessageString =  __( 'Changes saved.', 'wordpress-tooltips' );
  28.         tooltipsMessage($tooltipsMessageString);       
  29.     }
  30.  
  31.     $enableTooltipsForImage = get_option("enableTooltipsForImage");
  32.     // 2014-03 3.3.9
  33.     if (isset($_POST['enableTooltipsForExcerptSubmit']))
  34.     {
  35.         if (isset($_POST['enableTooltipsForExcerpt']))
  36.         {
  37.             update_option("enableTooltipsForExcerpt",$_POST['enableTooltipsForExcerpt']);
  38.         }
  39.         // version 3.4.9
  40.         //tooltipsMessage("Changes saved.");
  41.         $tooltipsMessageString =  __( 'Changes saved.', 'wordpress-tooltips' );
  42.         tooltipsMessage($tooltipsMessageString);       
  43.     }
  44.     $enableTooltipsForExcerpt = get_option("enableTooltipsForExcerpt");
  45.     if (empty($enableTooltipsForExcerpt)) $enableTooltipsForExcerpt = 'NO';
  46.  
  47.     // 2014-03 3.3.9
  48.     if (isset($_POST['enableTooltipsForTagSubmit']))
  49.     {
  50.         if (isset($_POST['enableTooltipsForTag']))
  51.         {
  52.             update_option("enableTooltipsForTags",$_POST['enableTooltipsForTag']);
  53.         }
  54.         // version 3.4.9
  55.         //tooltipsMessage("Changes saved."); //!!!
  56.         $tooltipsMessageString =  __( 'Changes saved.', 'wordpress-tooltips' );
  57.         tooltipsMessage($tooltipsMessageString);
  58.     }
  59.     $enableTooltipsForTag = get_option("enableTooltipsForTags");
  60.     if (empty($enableTooltipsForTag)) $enableTooltipsForTag = 'NO';
  61.    
  62. ?>
  63.  
  64. <div class="wrap">
  65. <div id="icon-options-general" class="icon32"><br></div>
  66. <?php
  67. // version 3.4.9
  68. //<h2>Tooltips Global Settings</h2>
  69. echo '<h2>' . __( 'Tooltips Global Settings', 'wordpress-tooltips' ) . '</h2>';
  70. ?>
  71. </div>
  72. <div style='clear:both'></div>     
  73.         <div class="wrap">
  74.             <div id="dashboard-widgets-wrap">
  75.                 <div id="dashboard-widgets" class="metabox-holder">
  76.                     <div id="post-body">
  77.                         <div id="dashboard-widgets-main-content">
  78.                             <div class="postbox-container" style="width:90%;">
  79.                                 <div class="postbox">
  80.                                     <h3 class='hndle'><span>
  81.                                         <?php
  82.                                         // version 3.4.9
  83.                                         // Tooltip Keyword Matching Mode
  84.                                         echo __( 'Tooltip Keyword Matching Mode', 'wordpress-tooltips' );
  85.                                          ?>
  86.                                     </span>
  87.                                     </h3>
  88.                                
  89.                                     <div class="inside" style='padding-left:5px;'>
  90.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  91.                                         <table id="toolstipstable" width="100%">
  92.  
  93.                                         <tr style="text-align:left;">
  94.                                        
  95.                                         <td width="25%"  style="text-align:left;">
  96.                                         <script type="text/javascript">
  97.                                         jQuery(document).ready(function () {
  98.                                           jQuery("span.question").hover(function () {
  99.                                             jQuery(this).append('<div class="tooltip"><p>The option --  "Add tooltips to all matching keyword in the same page" means if you have many matched words which have tooltip content, all these words will show related tooltip in the same page.</p><p>The option --  " Add tooltips to the first matching keyword in the same page" means if you have many matched words which have tooltip content, only the first matching word will show related tooltip in the same page.</p></div>');
  100.                                           }, function () {
  101.                                             jQuery("div.tooltip").remove();
  102.                                           });
  103.                                         });
  104.                                         </script>
  105.                                         <?php
  106.                                         // version 3.4.9
  107.                                         // Keyword Matching Mode: <span class="question">?</span>
  108.                                         echo __( 'Keyword Matching Mode:', 'wordpress-tooltips' ).' <span class="question">?</span>';
  109.                                         ?>
  110.                                         </td>
  111.                                         <td width="50%"  style="text-align:left;">
  112.                                         <select id="onlyFirstKeyword" name="onlyFirstKeyword" style="width:400px;">
  113.                                         <option id="firstKeywordSetting" value="all" <?php if ($onlyFirstKeyword == 'all') echo "selected";   ?>> Add tooltips to all matching keyword in the same page </option>
  114.                                         <option id="firstKeywordSetting" value="first" <?php if ($onlyFirstKeyword == 'first') echo "selected";   ?>> Add tooltips to the first matching keyword in the same page </option>
  115.                                         </select>
  116.                                         </td>
  117.                                         <td width="25%"  style="text-align:left;">
  118.                                         <?php
  119.                                         // version 3.4.9
  120.                                         // <input type="submit" id="onlyFirstKeywordsetting" name="onlyFirstKeywordsetting" value=" Update Now ">
  121.                                         ?>
  122.                                         <input type="submit" id="onlyFirstKeywordsetting" name="onlyFirstKeywordsetting" value="<?php  echo __( ' Update Now ', 'wordpress-tooltips' ); ?>">
  123.                                         </td>
  124.                                         </tr>
  125.  
  126.                                         </table>
  127.                                         </form>
  128.                                        
  129.                                     </div>
  130.                                 </div>
  131.                             </div>
  132.                         </div>
  133.                     </div>
  134.                 </div>
  135.             </div>
  136.         </div>
  137.         <div style="clear:both"></div>
  138.         <br />
  139.  
  140.        
  141. <div style='clear:both'></div>     
  142.         <div class="wrap">
  143.             <div id="dashboard-widgets-wrap">
  144.                 <div id="dashboard-widgets" class="metabox-holder">
  145.                     <div id="post-body">
  146.                         <div id="dashboard-widgets-main-content">
  147.                             <div class="postbox-container" style="width:90%;">
  148.                                 <div class="postbox">
  149.                                     <h3 class='hndle'><span>
  150.                                     <?php
  151.                                     // version 3.4.9
  152.                                     //  Enable/Disable Tooltips For Image Setting<i> <font color='Gray'> (tooltips shown when mouse hover the image)</font></i>
  153.                                     echo __( "Enable/Disable Tooltips For Image Setting", 'wordpress-tooltips' )."<i> <font color='Gray'> (".__('tooltips shown when mouse hover the image', 'wordpress-tooltips' ).')</font></i>';
  154.                                     ?>
  155.                                     </span>
  156.                                     </h3>
  157.                                
  158.                                     <div class="inside" style='padding-left:5px;'>
  159.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  160.                                         <table id="toolstipstable" width="100%">
  161.  
  162.                                         <tr style="text-align:left;">
  163.                                         <td width="25%"  style="text-align:left;">
  164.                                         <script type="text/javascript">
  165.                                         jQuery(document).ready(function () {
  166.                                           jQuery("span.questionimage").hover(function () {
  167.                                             jQuery(this).append('<div class="tooltip"><p>The option --  "I want to enable tooltips for image" means if you hover a image, the text in alt attribute will show as the tooltip content.</p><p>The option --  "    I want to disable tooltips for image " means if you hover a image, the tooltip box will not be shown.</p></div>');
  168.                                           }, function () {
  169.                                             jQuery("div.tooltip").remove();
  170.                                           });
  171.                                         });
  172.                                         </script>
  173.                                         <?php
  174.                                         // version 3.4.9
  175.                                         //Enable Image Tooltips: <span class="questionimage">?</span>
  176.                                         echo __( 'Enable Image Tooltips: ', 'wordpress-tooltips' ).'<span class="questionimage">?</span>';
  177.                                         ?>
  178.                                         </td>
  179.                                         <td width="50%"  style="text-align:left;">
  180.                                         <select id="enableTooltipsForImage" name="enableTooltipsForImage" style="width:400px;">
  181.                                         <option id="enableTooltipsForImageOption" value="YES" <?php if ($enableTooltipsForImage == 'YES') echo "selected";   ?>>  I want to enable tooltips for image </option>
  182.                                         <option id="enableTooltipsForImageOption" value="NO" <?php if ($enableTooltipsForImage == 'NO') echo "selected";   ?>>   I want to disable tooltips for image </option>
  183.                                         </select>
  184.                                         </td>
  185.                                         <td width="25%"  style="text-align:left;">
  186.                                         <?php
  187.                                         // version 3.4.9
  188.                                         //<input type="submit" id="enableTooltipsForImageSubmit" name="enableTooltipsForImageSubmit" value=" Update Now ">
  189.                                         ?>
  190.                                         <input type="submit" id="enableTooltipsForImageSubmit" name="enableTooltipsForImageSubmit" value="<?php echo __(' Update Now ', 'wordpress-tooltips'); ?>">
  191.                                         </td>
  192.                                         </tr>
  193.  
  194.                                         </table>
  195.                                         </form>
  196.                                        
  197.                                     </div>
  198.                                 </div>
  199.                             </div>
  200.                         </div>
  201.                     </div>
  202.                 </div>
  203.             </div>
  204.         </div>
  205.         <div style="clear:both"></div>
  206.         <br />
  207. <?php
  208. // 2014-03 3.3.9
  209. ?>
  210. <div style='clear:both'></div>     
  211.         <div class="wrap">
  212.             <div id="dashboard-widgets-wrap">
  213.                 <div id="dashboard-widgets" class="metabox-holder">
  214.                     <div id="post-body">
  215.                         <div id="dashboard-widgets-main-content">
  216.                             <div class="postbox-container" style="width:90%;">
  217.                                 <div class="postbox">
  218.                                     <h3 class='hndle'><span>
  219.                                     <?php
  220.                                     // version 3.4.9
  221.                                     //  Enable/Disable Tooltips For Post Excerpt<i> <font color='Gray'></font></i>
  222.                                     echo __( "Enable/Disable Tooltips For Post Excerpt", 'wordpress-tooltips' )."<i> <font color='Gray'></font></i>";
  223.                                     ?>
  224.                                     </span>
  225.                                     </h3>
  226.                                
  227.                                     <div class="inside" style='padding-left:5px;'>
  228.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  229.                                         <table id="toolstipstable" width="100%">
  230.  
  231.                                         <tr style="text-align:left;">
  232.                                         <td width="25%"  style="text-align:left;">
  233.                                         <script type="text/javascript">
  234.                                         jQuery(document).ready(function () {
  235.                                           jQuery("span.questionexcerpt").hover(function () {
  236.                                             jQuery(this).append('<div class="tooltip3"><p>The option --  "Enable Tooltips For Post Excerpt" means show tooltips in your post excerpt</p><p>The option --  "    Disable Tooltips For Post Excerpt " means do not show tooltips in your post excerpt</p><p>This option is helpful for some advance themes</p></div>');
  237.                                           }, function () {
  238.                                             jQuery("div.tooltip3").remove();
  239.                                           });
  240.                                         });
  241.                                         </script>                                      
  242.                                         <?php
  243.                                         // Tooltips For Excerpt: <span class="questionexcerpt">?</span>
  244.                                         echo __( 'Tooltips For Excerpt: ', 'wordpress-tooltips' ).'<span class="questionexcerpt">?</span>';
  245.                                         ?>
  246.                                         </td>
  247.                                         <td width="50%"  style="text-align:left;">
  248.                                         <select id="enableTooltipsForExcerpt" name="enableTooltipsForExcerpt" style="width:400px;">
  249.                                         <option id="enableTooltipsForExcerptOption" value="YES" <?php if ($enableTooltipsForExcerpt == 'YES') echo "selected";   ?>> Enable Tooltips For Post Excerpt </option>
  250.                                         <option id="enableTooltipsForExcerptOption" value="NO" <?php if ($enableTooltipsForExcerpt == 'NO') echo "selected";   ?>>   Disable Tooltips For Post Excerpt </option>
  251.                                         </select>
  252.                                         </td>
  253.                                         <td width="25%"  style="text-align:left;">
  254.                                         <?php
  255.                                         // version 3.4.9
  256.                                         // <input type="submit" id="enableTooltipsForExcerptSubmit" name="enableTooltipsForExcerptSubmit" value=" Update Now ">
  257.                                         ?>
  258.                                         <input type="submit" id="enableTooltipsForExcerptSubmit" name="enableTooltipsForExcerptSubmit" value="<?php echo __( ' Update Now ', 'wordpress-tooltips' ); ?>">
  259.                                         </td>
  260.                                         </tr>
  261.                                         </table>
  262.                                         </form>
  263.                                        
  264.                                     </div>
  265.                                 </div>
  266.                             </div>
  267.                         </div>
  268.                     </div>
  269.                 </div>
  270.             </div>
  271.         </div>
  272.         <div style="clear:both"></div>
  273.         <br />
  274.  
  275. <?php
  276. // 2014-03 3.4.1
  277. ?>
  278. <div style='clear:both'></div>     
  279.         <div class="wrap">
  280.             <div id="dashboard-widgets-wrap">
  281.                 <div id="dashboard-widgets" class="metabox-holder">
  282.                     <div id="post-body">
  283.                         <div id="dashboard-widgets-main-content">
  284.                             <div class="postbox-container" style="width:90%;">
  285.                                 <div class="postbox">
  286.                                     <h3 class='hndle'><span>
  287.                                     <?php
  288.                                     // version 3.4.9
  289.                                     //  Enable/Disable Tooltips For Post Tag<i> <font color='Gray'></font></i>
  290.                                     echo __( 'Enable/Disable Tooltips For Post Tag', 'wordpress-tooltips' )."<i> <font color='Gray'></font></i>";
  291.                                     ?>
  292.                                     </span>
  293.                                     </h3>
  294.                                     <div class="inside" style='padding-left:5px;'>
  295.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  296.                                         <table id="toolstipstable" width="100%">
  297.  
  298.                                         <tr style="text-align:left;">
  299.                                         <td width="25%"  style="text-align:left;">
  300.                                         <script type="text/javascript">
  301.                                         jQuery(document).ready(function () {
  302.                                           jQuery("span.questiontags").hover(function () {
  303.                                             jQuery(this).append('<div class="tooltip1"><p>The option --  "Enable Tooltips For Post Tag" means show tooltips on your post tags</p><p>The option --  "    Disable Tooltips For Post Tag " means do not show tooltips on your post tags</p></div>');
  304.                                           }, function () {
  305.                                             jQuery("div.tooltip1").remove();
  306.                                           });
  307.                                         });
  308.                                         </script>
  309.                                         <?php
  310.                                         // version 3.4.9
  311.                                         //Tooltips For Tag: <span class="questiontags">?</span>
  312.                                         echo __( 'Tooltips For Tag: ', 'wordpress-tooltips' ).'<span class="questiontags">?</span>';
  313.                                         ?>
  314.                                         </td>
  315.                                         <td width="50%"  style="text-align:left;">
  316.                                         <select id="enableTooltipsForTag" name="enableTooltipsForTag" style="width:400px;">
  317.                                         <option id="enableTooltipsForTagOption" value="YES" <?php if ($enableTooltipsForTag == 'YES') echo "selected";   ?>> Enable Tooltips For Post Tag </option>
  318.                                         <option id="enableTooltipsForTagOption" value="NO" <?php if ($enableTooltipsForTag == 'NO') echo "selected";   ?>>   Disable Tooltips For Post Tag </option>
  319.                                         </select>
  320.                                         </td>
  321.                                         <td width="25%"  style="text-align:left;">
  322.                                         <?php
  323.                                         // version 3.4.9
  324.                                         //<input type="submit" id="enableTooltipsForTagSubmit" name="enableTooltipsForTagSubmit" value=" Update Now ">
  325.                                         ?>
  326.                                         <input type="submit" id="enableTooltipsForTagSubmit" name="enableTooltipsForTagSubmit" value="<?php echo __( ' Update Now ', 'wordpress-tooltips' ); ?>">
  327.                                         </td>
  328.                                         </tr>
  329.  
  330.                                         </table>
  331.                                         </form>
  332.                                        
  333.                                     </div>
  334.                                 </div>
  335.                             </div>
  336.                         </div>
  337.                     </div>
  338.                 </div>
  339.             </div>
  340.         </div>
  341.         <div style="clear:both"></div>
  342.         <br />
  343. <?php
  344. }
  345.  
  346. function editTooltips()
  347. {
  348.        
  349.         global $wpdb;
  350.         $m_tooltipsArray = get_option('tooltipsarray');
  351.         $m_toolstipskeyword= '';
  352.         $m_toolstipscontent= '';
  353.         if (empty($m_tooltipsArray))
  354.         {
  355.             $m_tooltipsArray = array();
  356.         }
  357.        
  358.         if (isset($_POST['toolstipskeywordsubmitnew']))
  359.         {
  360.             if (isset($_POST['toolstipskeyword']))
  361.             {
  362.                 $m_toolstipskeyword = $wpdb->escape($_POST['toolstipskeyword']);
  363.             }
  364.  
  365.             if (isset($_POST['toolstipscontent']))
  366.             {
  367.                 $m_toolstipscontent = $wpdb->escape($_POST['toolstipscontent']);
  368.             }
  369.            
  370.             if ((!(empty($m_toolstipscontent))) && (!(empty($m_toolstipskeyword))))
  371.             {
  372.                 $m_added = false;
  373.                 if ((is_array($m_tooltipsArray)) && (count($m_tooltipsArray) > 0))
  374.                 {
  375.                     $i = 0;
  376.                     foreach ($m_tooltipsArray as $m_tooltipsSingle)
  377.                     {
  378.                         if ($m_tooltipsSingle['keyword'] == $m_toolstipskeyword)
  379.                         {
  380.                             $m_tooltipsSingle['content'] = $m_toolstipscontent;
  381.                             $m_tooltipsArray[$i]['content'] = $m_toolstipscontent;
  382.                             $m_added = true;
  383.                             break;
  384.                         }
  385.                         $i++;
  386.                     }
  387.                 }
  388.  
  389.                 if ($m_added  == false)
  390.                 {
  391.                     $m_tooltipsTempArray = array();
  392.                     $m_tooltipsTempArray['keyword'] = $m_toolstipskeyword;
  393.                     $m_tooltipsTempArray['content'] = $m_toolstipscontent;
  394.                     $m_tooltipsArray[] = $m_tooltipsTempArray;                 
  395.                 }
  396.                
  397.                 update_option('tooltipsarray',$m_tooltipsArray);
  398.             }
  399.             // version 3.4.9
  400.             // tooltipsMessage("Tooltips Added.");
  401.             $tooltipsMessageString =  __( 'Tooltips Added.', 'wordpress-tooltips' );
  402.             tooltipsMessage($tooltipsMessageString);
  403.         }
  404.        
  405.  
  406.  
  407.         if (isset($_POST['toolstipskeywordsubmitedit']))
  408.         {
  409.             if (isset($_POST['toolstipskeyword']))
  410.             {
  411.                 $m_toolstipskeyword = $wpdb->escape($_POST['toolstipskeyword']);
  412.             }
  413.  
  414.             if (isset($_POST['toolstipscontent']))
  415.             {
  416.                 $m_toolstipscontent = $wpdb->escape($_POST['toolstipscontent']);
  417.             }
  418.            
  419.             if ((!(empty($m_toolstipscontent))) && (!(empty($m_toolstipskeyword))))
  420.             {
  421.                 $m_added = false;
  422.                 $m_toolstipskeywordsubmithideen = $wpdb->escape($_POST['toolstipskeywordsubmithideen']);
  423.                 $m_tooltipsArray[$m_toolstipskeywordsubmithideen]['keyword'] = $m_toolstipskeyword;
  424.                 $m_tooltipsArray[$m_toolstipskeywordsubmithideen]['content'] = $m_toolstipscontent;  
  425.                 update_option('tooltipsarray',$m_tooltipsArray);
  426.             }
  427.             // version 3.4.9
  428.             //tooltipsMessage("Changes saved.");
  429.             $tooltipsMessageString =  __( 'Changes saved.', 'wordpress-tooltips' );
  430.             tooltipsMessage($tooltipsMessageString);           
  431.         }
  432.  
  433.         if (isset($_POST['toolstipskeywordsubmitdelete']))
  434.         {
  435.             $m_toolstipskeywordsubmithideen = $wpdb->escape($_POST['toolstipskeywordsubmithideen']);
  436.  
  437.             {
  438.                 array_splice($m_tooltipsArray,$m_toolstipskeywordsubmithideen,1);
  439.                 update_option('tooltipsarray',$m_tooltipsArray);
  440.             }
  441.             // version 3.4.9
  442.             //tooltipsMessage("Tooltips Deleted.");
  443.             $tooltipsMessageString =  __( 'Tooltips Deleted.', 'wordpress-tooltips' );
  444.             tooltipsMessage($tooltipsMessageString);
  445.  
  446.         }
  447.                
  448.         echo "<br />";
  449.         ?>
  450.  
  451. <div style='margin:10px 5px;'>
  452. <div style='float:left;margin-right:10px;'>
  453. <img src='<?php echo get_option('siteurl');  ?>/wp-content/plugins/wordpress-tooltips/images/new.png' style='width:30px;height:30px;'>
  454. </div>
  455. <div style='padding-top:5px; font-size:22px;'> <i></>Add/Edit Tooltips</i></div>
  456. </div>
  457. <div style='clear:both'></div>     
  458.         <div class="wrap">
  459.             <div id="dashboard-widgets-wrap">
  460.                 <div id="dashboard-widgets" class="metabox-holder">
  461.                     <div id="post-body">
  462.                         <div id="dashboard-widgets-main-content">
  463.                             <div class="postbox-container" style="width:90%;">
  464.                                 <div class="postbox">
  465.                                     <h3 class='hndle'><span>
  466.                                         Add New Tooltips
  467.                                     </span>
  468.                                     </h3>
  469.                                
  470.                                     <div class="inside" style='padding-left:5px;'>
  471.                                         <br />
  472.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  473.                                         <table id="toolstipstable" width="100%">
  474.  
  475.                                         <tr>
  476.                                         <td width="100%">
  477.                                         Please input your keyword/sentence of the tooltip:
  478.                                         <br />
  479.                                         <br />                                     
  480.                                         <input type="text" id="toolstipskeyword" name="toolstipskeyword" value=""  style="width:600px;">
  481.                                         <br />
  482.                                         <br />
  483.                                         <br />
  484.                                         <br />
  485.                                         Please input content/tips/image/video of the tooltip <i><font color="Gray">(HTML tag supported)</font></i>:
  486.                                         <br />
  487.                                         <br />
  488.                                         <textarea style="width:600px;" rows="2" cols="40" name='toolstipscontent'></textarea>
  489.                                        
  490.                                         </td>
  491.                                         </tr>
  492.  
  493.                                         </table>
  494.                                         <br />
  495.                                         <input type="submit" id="toolstipskeywordsubmitnew" name="toolstipskeywordsubmitnew" value="Add Now">
  496.                                         </form>
  497.                                        
  498.                                         <br />
  499.                                     </div>
  500.                                 </div>
  501.                             </div>
  502.                         </div>
  503.                     </div>
  504.                 </div>
  505.             </div>
  506.         </div>
  507.         <div style="clear:both"></div>
  508.         <br />
  509.        
  510. <!--  edit  -->
  511. <?php
  512.  
  513. $m_tooltipsArray = get_option('tooltipsarray');
  514.  
  515.     if ((is_array($m_tooltipsArray)) && (count($m_tooltipsArray)>0))
  516.     {      
  517. ?>
  518. <div style='margin:20px 5px;'>
  519.  
  520. <div style='clear:both'></div>     
  521.         <div class="wrap">
  522.             <div id="dashboard-widgets-wrap">
  523.                 <div id="dashboard-widgets" class="metabox-holder">
  524.                     <div id="post-body">
  525.                         <div id="dashboard-widgets-main-content">
  526.                             <div class="postbox-container" style="width:90%;">
  527.                                 <div class="postbox">
  528.                                     <h3 class='hndle'><span>
  529.                                         Edit Existed Tooltips
  530.                                     </span>
  531.                                     </h3>
  532.                                
  533.                                     <div class="inside" style='padding-left:5px;'>
  534.                                         <br />
  535.                                        
  536.                                         <table id="toolstipstable" width="100%">
  537.                                         <?php
  538.                                         $i = 0;
  539.                                         foreach ($m_tooltipsArray as $m_tooltipsNow)
  540.                                         {
  541.  
  542.                                         ?>
  543.                                         <form id="toolstipsform" name="toolstipsform" action="" method="POST">
  544.                                         <tr>
  545.                                         <td width="10%">
  546.                                         Keyword:
  547.                                         </td>
  548.                                         <td width="20%">
  549.                                         <input type="text" id="toolstipskeyword" name="toolstipskeyword" value="<?php echo stripslashes(stripslashes($m_tooltipsNow['keyword'])); ?>">
  550.                                         </td>
  551.                                         <td width="10%">
  552.                                         Content:
  553.                                         </td>
  554.                                         <td width="35%">
  555.                                         <textarea rows="2" cols="35" name='toolstipscontent'><?php echo stripslashes(stripslashes($m_tooltipsNow['content'])); ?></textarea>
  556.                                         </td>
  557.                                        
  558.                                         <td width="12%" style='align:right;text-align:right;padding-left:3px;'>
  559.                                             <input type="hidden" id="toolstipskeywordsubmithideen" name="toolstipskeywordsubmithideen" value="<?php echo $i; ?>">
  560.                                             <input type="submit" class="toolstipskeywordsubmitedit" name="toolstipskeywordsubmitedit" value="Update Now">                                      
  561.                                         </td>
  562.                                        
  563.                                         <td width="13%" style='align:right;text-align:right;'>
  564.                                             <input type="submit" class="toolstipskeywordsubmitdelete" name="toolstipskeywordsubmitdelete" value="Delete Now">                                      
  565.                                         </td>                                      
  566.                                         </tr>
  567.                                         </form>
  568.                                         <?php
  569.                                         $i++;
  570.                                         }
  571.  
  572.                                         ?>
  573.                                         </table>
  574.                                         <br />
  575.                                        
  576.                                        
  577.                                         <br />
  578.                                     </div>
  579.                                 </div>
  580.                             </div>
  581.                         </div>
  582.                     </div>
  583.                 </div>
  584.             </div>
  585.         </div>
  586.         <div style="clear:both"></div>
  587.         <br />     
  588.  
  589.         <?php
  590.         }              
  591. }
  592.    
  593.  
  594. //2014-08 3.4.7 add tooltips widget functionality
  595. function TooltipsWidgetInit()
  596. {  
  597.     wp_register_sidebar_widget('tooltips_sidebar','Tooltips', 'tooltipsSidebar');
  598.     wp_register_widget_control('tooltips_control','Tooltips', 'tooltipsControl', 300, 200);
  599. }
  600.  
  601. function tooltipsControl()
  602. {
  603.     global $wpdb,$table_prefix,$g_content;
  604.     $options = get_option('titleTooltipsControl');
  605.  
  606.     if (empty($options))
  607.     {
  608.         $m_title = '';
  609.     }
  610.     else
  611.     {
  612.         $m_title = $options;
  613.     }
  614.     echo $m_title;
  615.     if ($_POST['HiddenTooltipsControl'])
  616.     {
  617.         update_option('titleTooltipsControl',$wpdb->escape($_POST['HiddenTooltipsControl']));
  618.     }
  619.  
  620.     echo '<div style="width:250px">';
  621.     echo 'Input Title Here:';
  622.     echo '<br />';
  623.     echo '<input  type="text" id="HiddenTooltipsControl" name="HiddenTooltipsControl" value="'.$m_title.'" style="margin:5px 5px;width:200px" />';
  624.     echo '</div>';
  625. }
  626.  
  627.  
  628. function tooltipsSidebar($argssidebarsidebar = null)
  629. {
  630.     global $wpdb,$table_prefix,$g_content;
  631.     $before_widget = '';
  632.     $after_widget = '';
  633.     if (!empty($argssidebar))
  634.     {
  635.         extract($argssidebar);
  636.     }
  637.  
  638.     $options = get_option('titleTooltipsControl');
  639.  
  640.     if (empty($options))
  641.     {
  642.         $m_title = '';
  643.     }
  644.     else
  645.     {
  646.         $m_title = $options;
  647.     }
  648.    
  649.    
  650.     echo $before_widget;
  651.     echo '<div class="sidebarTooltips">';
  652.     if (!empty($m_title))
  653.     {
  654.         echo "<h1>" . $m_title . "</h1>";
  655.     }
  656.  
  657.     global $table_prefix,$wpdb,$post;
  658.  
  659.     $args = array( 'post_type' => 'tooltips', 'post_status' => 'public' );
  660.     $loop = new WP_Query( $args );
  661.     $return_content = '';
  662.     $return_content .= '<div class="tooltips_widget">';
  663.     while ( $loop->have_posts() ) : $loop->the_post();
  664.         $return_content .= '<div class="tooltips_list">'.get_the_title().'</div>';
  665.     endwhile;
  666.     $return_content = tooltipsInContent($return_content);
  667.     $return_content = showTooltipsInShorcode($return_content);
  668.  
  669.     $return_content .= '</div>';
  670.     echo "</div>";
  671.     echo $return_content;
  672. }
  673.  
  674. function tooltipsMessage($p_message)
  675. {
  676.  
  677.     echo "<div id='message' class='updated fade'>";
  678.  
  679.     echo $p_message;
  680.  
  681.     echo "</div>";
  682.  
  683. }
  684.    
  685. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement