Advertisement
Guest User

funtions.php

a guest
May 30th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.36 KB | None | 0 0
  1. <?php
  2.  
  3. defined('is_running') or die('Not an entry point...');
  4.  
  5.  
  6.  
  7. class Sample_Theme_Admin_Plugin {
  8.  
  9.     var $configFile;
  10.  
  11.     var $config = array();
  12.  
  13.  
  14.  
  15.     function Sample_Theme_Admin_Plugin() {
  16.  
  17.         $this->init();
  18.  
  19.         $cmd = common::GetCommand();
  20.  
  21.         if (common::LoggedIn()) {
  22.  
  23.             switch($cmd) {
  24.  
  25.                 case 'save_config':
  26.  
  27.             $this->checkSave();
  28.  
  29.                 break;
  30.  
  31.         }
  32.  
  33.     }
  34.  
  35.     $this->configForm();
  36.  
  37. }
  38.  
  39.  
  40.     function init() {
  41.  
  42.     global $addonPathData;
  43.  
  44.     $this->configFile = $addonPathData.'/index.php';
  45.  
  46.     $this->getData();
  47.  
  48.     }
  49.  
  50.  
  51.  
  52.     function getData() {
  53.  
  54.         global $langmessage;
  55.  
  56.         if (file_exists($this->configFile)) {
  57.  
  58.             require($this->configFile);
  59.  
  60.             $this->config = $myThemeConfig;
  61.  
  62.     }
  63.  
  64.     else    {
  65.  
  66.         $this->config = array(
  67.  
  68.         'img_1'=>'img1.jpg',
  69.  
  70.         'title_1'=>'<span class="ftitle"><span class="color2">We Have</span><span class="color1">Propositions</span><span>For Everybody</span></span><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit sed do eiusmod tempor.</p>
  71. <a href="#" class="button1">Read More</a>',
  72.  
  73.         'img_2'=>'img2.jpg',
  74.  
  75.         'title_2'=>'<span class="ftitle"><span class="color2">Fresh Ideas</span><span class="color1">For Growing</span><span>Your Business</span></span><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit sed do eiusmod tempor.</p><a href="#" class="button1">Read More</a>',
  76.  
  77.         'img_3'=>'img3.jpg',
  78.  
  79.         'title_3'=>'<span class="ftitle"><span class="color2">The Best</span><span class="color1">You Can Find</span><span>On The Web</span></span><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit sed do eiusmod tempor.</p><a href="#" class="button1">Read More</a>',
  80.  
  81.         'logo'=>'logo.png',
  82.        
  83.         'Facebook'=>'http://facebook.com/your_id',
  84.  
  85.         'Twitter'=>'http://twitter.com/your_id',
  86.  
  87.         'Picasa'=>'http://picasa.com/your_id',
  88.  
  89.         'YouTube'=>'http://youTube.com/your_id',
  90.        
  91.         'favicon'=>'http://link_to_favicon.com/folder_favicon,ico',
  92.  
  93.         'phone_no'=>'<span class="color1">+1 800</span> 123 45 67',
  94.  
  95.         'copyrights'=>'Superior.com &copy; 2012',
  96.  
  97.         'front_side_menu'=>'<h3>Publications</h3>
  98.                             <ul class="list2">
  99.                                 <li><a href="#">PR Management</a><br>
  100.                                 Dalesuad asorbi nunra vida- sea atcurs usecuctu.</li>
  101.                                 <li><a href="#">Global solutions</a><br>Naser maellus pore qus ese- dasese dusce.</li>
  102.                                 <li><a href="#">Progressive Research</a><br>Atcurs usuctu aecenas ttique  maellrase qus esedasese.</li>
  103.                                 <li><a href="#">New Technologies</a><br>Merts maellrase qus esedias dusceer lrurtasfeugiat.</li>
  104.                             </ul>',
  105.                            
  106.         'front_extra_menu_1'=>'<h2>Consulting</h2>
  107. <p>Superior.com is one of
  108. <a href="http://blog.templatemonster.com/free-website-templates/" target="_blank">
  109. free website templates</a>
  110. created by TemplateMonster.com. It is also XHTML & CSS valid.</p>',
  111.                            
  112.         'front_extra_menu_2'=>'<h2>Analysis</h2>
  113. <p>This website template has sev-eral pages:
  114. <a href="index.html">Home</a>,
  115. <a href="Company.html">Company</a>,
  116. <a href="Solutions.html">Solutions</a>,
  117. <a href="Services.html">Services</a>,
  118. <a href="Contacts.html">Contact Us</a>
  119. (contact form – doesn&#8217;t work).</p>',
  120.  
  121.         'front_extra_menu_3'=>'<h2>Strategy</h2>
  122. <p>This <a href="http://blog.templatemonster.com/2011/11/14/free-website-template-jquery-slider-business-project/" target="_blank">Superior Template</a> goes with two packages. PSD source files are available for the registered members.</p>',
  123.                            
  124.         'front_extra_menu_4'=>'<h2>Services</h2>
  125. <ul class="list1">
  126. <li><a href="#">Sed ut perspiciatis unde </a></li>
  127. <li><a href="#">Omnis iste natus errorsitvo</a></li>
  128. <li><a href="#">Uptatem acusantium domque </a></li>
  129. <li><a href="#">Laudantium totam rem</a></li>
  130. </ul>',
  131.  
  132.         'pages_side_menu'=>'<h2>Why Choose Us</h2>
  133.                         <div class="wrapper">
  134.                             <span class="dropcap_1">1</span>
  135.                             <p class="pad_bot1"><span class="color1">Quis auteure reprehenderit</span><br>
  136.                                     Dalesuad asorbi nunra vidasea atcurs usecuctu.</p>
  137.                         </div>
  138.                         <div class="wrapper">
  139.                             <span class="dropcap_1">2</span>
  140.                             <p class="pad_bot1"><span class="color1">Neque porro quisquam estorem</span><br>
  141.                                     Naser maellus pore qus esedase- se dusce.</p>
  142.                         </div>
  143.                         <div class="wrapper">
  144.                             <span class="dropcap_1">3</span>
  145.                             <p class="pad_bot1"><span class="color1">Nemo enim voluptatem</span><br>
  146.                                     Atcurs usuctu aecenas ttique  maellrase qus esedasese.</p>
  147.                         </div>
  148.                         <div class="wrapper">
  149.                             <span class="dropcap_1">4</span>
  150.                             <p class="pad_bot1"><span class="color1">Sed ut perspiciatis unde omnis</span><br>
  151.                                     Merts maellrase qus esedias dusceer lrurtasfeugiat.</p>
  152.                         </div>
  153.                     </div>
  154.                 </div>',
  155. //      'grayscale_enable'=>'enable'
  156.         );
  157.  
  158.  
  159.         if (!$this->saveConfig()) {
  160.  
  161.             message($langmessage['OOPS']);
  162.  
  163.         }
  164.  
  165.         else    {
  166.  
  167.             message($langmessage['SAVED']);
  168.  
  169.             }
  170.  
  171.             }
  172.  
  173.         }
  174.  
  175.    
  176.  
  177.     function checkSave()    {
  178.  
  179.         global $langmessage;
  180.         $this->config['slid_img']['img_1'] = ($_POST['img_1']);
  181.         $this->config['slid_img']['img_2'] = ($_POST['img_2']);
  182.         $this->config['slid_img']['img_3'] = ($_POST['img_3']);
  183.         $this->config['slid_img']['img_4'] = ($_POST['img_4']);
  184.         $this->config['slid_img']['img_5'] = ($_POST['img_5']);
  185.         $this->config['slid_img']['img_6'] = ($_POST['img_6']);
  186.         $this->config['slid_img']['img_7'] = ($_POST['img_7']);
  187.         $this->config['slid_img']['img_8'] = ($_POST['img_8']);
  188.         $this->config['slid_img']['img_9'] = ($_POST['img_9']);
  189.         $this->config['slid_img']['img_10'] = ($_POST['img_10']);
  190.         $this->config['slid_til']['title_1'] = ($_POST['title_1']);
  191.         $this->config['slid_til']['title_2'] = ($_POST['title_2']);
  192.         $this->config['slid_til']['title_3'] = ($_POST['title_3']);
  193.         $this->config['slid_til']['title_4'] = ($_POST['title_4']);
  194.         $this->config['slid_til']['title_5'] = ($_POST['title_5']);
  195.         $this->config['slid_til']['title_6'] = ($_POST['title_6']);
  196.         $this->config['slid_til']['title_7'] = ($_POST['title_7']);
  197.         $this->config['slid_til']['title_8'] = ($_POST['title_8']);
  198.         $this->config['slid_til']['title_9'] = ($_POST['title_9']);
  199.         $this->config['slid_til']['title_10'] = ($_POST['title_10']);
  200.        
  201.  
  202.         $this->config['copyrights'] = ($_POST['copyrights']);
  203.        
  204. /*          $fields = $_POST ['another_image'];
  205.         $values = $_POST ['another_title'];
  206.         foreach ( $values as $key => $value)
  207.         {
  208.             if ( $fields[$key]=='') continue;
  209.            $this->config[$key] = $fields;
  210.         }
  211.  
  212.  */
  213. /*     
  214.         $img ='img_';
  215.         for ($i=0, $keyCount = count($keys); $i < $keyCount; $i++) {
  216.         $this->config[$img[$i]] = ($_POST['another_image']); continue;
  217.         }
  218.         $len = count($_POST['another_image']);  
  219.          for ($i=0; $i < $len; $i++)  
  220.         $this->config[$len[$key]] = $key;
  221.  */
  222.    
  223. /*      for ($i=0, $keyCount = count($keys); $i < $keyCount; $i++) {
  224.          $combinedArray[$keys[$i]] = $values[$i];
  225.     }
  226.  */
  227. //      $this->config['another_image'] = ($_POST['another_image']); continue;
  228.  
  229. /*
  230.         $fields = $_POST ['another_image'];
  231.         $values = $_POST ['another_title'];
  232.             if ( $fields[$key]=='') continue;
  233.            $this->config[$fields[$key]] = $fields[$key].$i;
  234.  */
  235.  
  236. /*      $fields = $_POST ['another_image'];
  237.         $values = $_POST ['another_title'];
  238.         foreach ( $values as $key => $value)
  239.         {
  240.             if ( $fields[$key]=='' || $value == '') continue;
  241.            $this->config[$fields[$key]] = $value;
  242.         }
  243.  */
  244.  
  245.         /*if (isset($_POST['grayscale_enable'])) {
  246.  
  247.             $this->config['grayscale_enable'] = $_POST['grayscale_enable'];
  248.  
  249.         } else {
  250.  
  251.             $this->config['grayscale_enable'] = '';
  252.  
  253.         }*/
  254.  
  255.         if (!$this->saveConfig()) {
  256.  
  257.             message($langmessage['OOPS']);
  258.  
  259.         } else {
  260.  
  261.             message($langmessage['SAVED']);
  262.  
  263.         }
  264.  
  265.     }
  266.  
  267.  
  268.     function saveConfig() {
  269.  
  270.         return gpFiles::SaveArray($this->configFile, 'myThemeConfig', $this->config);
  271.  
  272.     }
  273.  
  274.  
  275.  
  276.     function configForm() {
  277.  
  278.         global $langmessage,$gpLayouts,$dataDir,$config, $page;
  279.  
  280.         if($page->theme_is_addon ){
  281.  
  282.             $Theme_path = '/data/_themes/';
  283.  
  284.         } else {
  285.  
  286.             $Theme_path = '/themes/';
  287.  
  288.         }  
  289.         $web_Path = common::GetDir();
  290.  
  291.         $this_theme_folder = $web_Path.$Theme_path.str_replace('&','&amp;',$page->theme_name);
  292.  
  293.  
  294.         $array =& $this->config;
  295.  
  296. ?>
  297. <h2 class="nocufon"><?php echo $config['title']; ?>&nbsp;Theme Configurations</h2>
  298. <form method="post" action="<?php echo common::getUrl('Admin_Sample_Theme_Admin_Plugin') ?>">
  299.  
  300. <div class="collapsible">
  301. <h4 class="head one"><a name="collapsible" href="#">Front Page Slider</a></h4>
  302. <div class="collapsearea">
  303. <table id="anotherfa" cellpadding="4" class="bordered configuration collapsible">
  304. <?php
  305. /*         $values = $_POST ['another_title'];
  306.         foreach ( $values as $key => $value)
  307.         {
  308.             if ( $fields[$key]=='' || $value == '') continue;
  309.            $this->config[$fields[$key]] = $value;
  310.         }
  311.  *//* $silder_image = new ArrayIterator($slim);
  312. $silder_title = new ArrayIterator($slit);
  313. // Use a MultipleIterator to iterate over our two arrays at the same time!
  314. $mit = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
  315. $mit->attachIterator($silder_image, 'image');
  316. $mit->attachIterator($silder_title, 'title');
  317. $fields = $_POST ['another_image'];
  318.  
  319.  *///if (!$slim) $slit = array();
  320.     // foreach ( $slim as $key => $slit )continue;
  321. //   $i = 0;
  322.                          //  {
  323.                             // if ( $key == 'facebook' || $key == 'twitter' || $key == 'in' ) continue;
  324.  
  325.  
  326. //foreach ($mit as $it)
  327. //echo $key. '-'. $slit;}
  328. $slid_img = array_filter($array['slid_img']);
  329. $slid_til = array_filter($array['slid_til']);
  330. $val_img = array_values($slid_img);
  331. $key_img = key($slid_img);
  332. $val_til = array_values($slid_til);
  333. $key_til = key($slid_til);
  334. $numtocount = count( $slid_img );
  335. //foreach ($slid_img as $key1 => $value1) {
  336.  // foreach ($slid_til as $key2 => $value2)
  337. //$aMerged = array_combine($fields, $values);
  338. //for ($i = 0; $i < 10; $i++) {
  339.  //   var_dump(key($slid_img));
  340. //    next($slid_img);
  341.    
  342. //  print_r($key_img);
  343.  
  344. //  echo array_values($array['slid_img']);
  345. //}
  346.  
  347. //$count = 0;
  348. /* foreach ($slid_img as $key=>$value) {
  349.     ++$count;
  350.     if ($count == 1) {
  351.         echo "<li>";
  352.         echo "<div>" . $value."</div>";    
  353.     } else {
  354.         echo "<div>" . $value."</div>";    
  355.         echo "</li>";
  356.         $count = 0;
  357.     }
  358. }
  359.  *////  if (!$meta) $meta = array();
  360. //      foreach ( $slid_img as $key => $value );
  361.                           // {
  362. //                           echo $key1 ."=". $value1;
  363.                              
  364.                              //if ( $slid_til = $valueeas ) continue; ?>
  365.  
  366.  <tbody id="copyf">
  367.     <tr>
  368.     <td style="white-space:nowrap">Slider Image <?php $key1;?></td>
  369.     <td><div><input type="text" value="<?php echo $key1;?>" size="40" name="<?php echo $value1;?>"></div>Maximum pixels for displayed images is width: 960px height: 453px.</td></tr>
  370.     <tr>
  371.     <td style="white-space:nowrap; border-top:none;">Slider Title <?php echo $key2;?></td><td><div><textarea rows="3" cols="50" name="<?php echo $key2;?>"><?php echo $value2;?></textarea></div></td></tr></tbody>
  372.  
  373.              <?php  //}}
  374. /* foreach ($aMerged as $key => $value)
  375. {
  376. echo $GLOBALS[$key] = strtoupper ($value);
  377. }
  378. //for ( $i = 0; $i < count($fields); $i++)
  379. echo var_export($aMerged);
  380.  */ //echo '<a href=" ' . $values[$i] . ' "> ' . $fields[$i] . '</a>';
  381. //foreach ($slid_img as $key => $value):  {?>
  382. <?php /*  <tbody id="copyf">
  383.     <tr>
  384.     <td style="white-space:nowrap">Slider Image <?php //echo $i++;?></td>
  385.     <td><div><input type="text" value="<?php echo $value;?>" size="40" name="<?php echo $value;?>"></div>Maximum pixels for displayed images is width: 960px height: 453px.</td></tr>
  386.     <tr>
  387.     <td style="white-space:nowrap; border-top:none;">Slider Title <?php echo $key;?>"</td><td><div><textarea rows="3" cols="50" name="<?php echo $key;?>"><?php echo $value;?></textarea></div></td></tr></tbody>
  388.  
  389.  */?>
  390.  
  391. <?php //} endforeach;?>
  392. </table>
  393.  <div id="addmorelink" style="margin-top:15px; margin-bottom:15px; ">
  394.  <a href='javascript:addField()'><img class="theme_fuse_add_meta" src=" <?php echo $this_theme_folder; ?>/color/images/add_icon.png"> Add more</a>  |  <a href='javascript:remField()'><img class="theme_fuse_add_meta" src=" <?php echo $this_theme_folder; ?>/color/images/remove_icon.png"> Remove</a>
  395.  </div>
  396. </div>
  397. </div>
  398.  
  399. <div>
  400.  
  401. <input type="hidden" value="save_config" name="cmd">
  402.  
  403. <input type="submit" class="gppost gpsubmit" value="<?php echo $langmessage['save'] ?>">
  404.  
  405. <input type="button" value="<?php echo $langmessage['cancel'] ?>" name=""  onclick="confirmation()" class="gpsubmit">
  406.  
  407. <a class="gpsubmit gppost" href="./" target="_blank">Preview</a>
  408.  
  409. </div>
  410. <!--<p class="admin_note"><b>See: </b><?php /*?><a title="Preferences" name="admin_box" href="/dstheme.bugs3.com/gp2/index.php/Admin_Preferences">Preferences</a><?php */?>
  411. <a href="<?php //echo $this_theme_folder;?>/help.php" onclick="centeredPopup(this.href,'myWindow','800','500','yes');return false">Help ?</a>
  412. </p>
  413. -->
  414. </form>
  415. <div class="donasimu" style="padding-top:10px;">
  416.     <a id="displayText" href="javascript:toggle();">Click Here to Donate</a>
  417.             <div id="toggleText" style="display: none;">
  418.  
  419.             <div class="donate" id="donate"><p>If you find this themes useful to you, please consider making a small dontations. Your contribution is needed for making this theme and pluggin better. If you are not able to donate, that is OK. Thanks for your kind support!<br />
  420.  
  421.             Currently i dont have a paypal account so you can donate via ekopratono@yahoo.com</p>
  422.  
  423.             <form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  424.  
  425.             <fieldset style="border: 2px solid #F8CDA1; background-color: #ffffee;">
  426.  
  427.             <input type="hidden" name="cmd" value="_donations">
  428.  
  429.             <input type="hidden" name="business" value="ekopratono@yahoo.com">
  430.  
  431.             <input type="hidden" name="lc" value="ID">
  432.  
  433.             <input type="hidden" name="item_name" value="David Saerang">
  434.  
  435.             <input type="hidden" name="item_number" value="Donation to keep David create gp|Easy Themes">
  436.  
  437.             <input type="hidden" name="currency_code" value="USD">
  438.  
  439.             <input type="hidden" name="return" value="http://dstheme.bugs3.com/">
  440.  
  441.             <label for="amount" style="font-family: Georgia; color: #000000; margin-right: 1em;"><strong>Amount:</strong></label>
  442.  
  443.             <input type="text" id="amount" style="margin: 0;" name="amount" size="5" value="3"><strong style="margin-left: 0.25em;"> USD</strong>
  444.  
  445.             <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest">
  446.  
  447.             <input type="image" style="float: right; margin: 0;" alt="Make payments with PayPal - it's fast, free and secure!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" ></fieldset></form>
  448.  
  449.               </div>
  450.  
  451.             </div>
  452. </div>
  453. <?php
  454. /* foreach ($array['slider'] as $a) {
  455.     $count_values[$a]++;
  456. }
  457.  *//* function countValuesRecursive($array, $count = 0) {
  458. global $myThemeConfig;
  459. //$array = $array['slider'];
  460.  
  461.     // Cycle through the array
  462.     foreach ($array['slider'] as $value) {
  463.        
  464.         // Check if the value is an array
  465.         if (is_array($value)) {
  466.            
  467.             // Cycle through deeper level
  468.             $count = countValuesRecursive($value, $count);
  469.             }
  470.         else {
  471.            
  472.             // Check if the value is TRUE
  473.             if ($value) {
  474.                 $count++;
  475.                 }
  476.             }
  477.         }
  478.    
  479.     // Return the count
  480.   return $count + 2;
  481. }
  482.  */?>
  483.     <script type="text/javascript">
  484.     window.onload=addField;
  485.     var i = "<?php echo $numtocount + 1; ?>";
  486.     function addField(){
  487.     var newContent = '<tbody id="copyf"><tr><td style="white-space:nowrap">Slider Image '+ i +'</td><td><div><input type="text" value="" size="40" name="img_'+ i +'"></div>Maximum pixels for displayed images is width: 960px height: 453px.</td></tr><tr><td style="white-space:nowrap">Slider Title '+ i +'</td><td><div><textarea rows="3" cols="50" name="title_'+ i +'"></textarea></div></td></tr></tbody>';
  488.     $("#anotherfa").append(newContent);
  489.      i++;
  490.      return false;
  491.     }
  492.  
  493.  function remField(){
  494.         if( i > 2 ) {
  495.            
  496.             $('tbody:last').remove();
  497.         i--;
  498.         }
  499.                 return false;
  500.     }
  501.     </script>
  502.     <script type="text/javascript">// <![CDATA[
  503.         function confirmation() {
  504.         var answer = confirm("Are you sure you want to close")
  505.         if (answer){
  506.             hidestuff();
  507.             } else {
  508.             }
  509.         }
  510.         function hidestuff(){
  511.         document.getElementById("admincontainer").style.visibility="hidden";
  512.         }
  513.        
  514.         function toggle() {
  515.  
  516.         var ele = document.getElementById("toggleText");
  517.  
  518.         var text = document.getElementById("displayText");
  519.  
  520.         if(ele.style.display == "block") {
  521.  
  522.         ele.style.display = "none";
  523.  
  524.         text.innerHTML = "Click Here to Donate";
  525.  
  526.         } else {
  527.  
  528.         ele.style.display = "block";
  529.  
  530.         text.innerHTML = "Not Now";
  531.  
  532.         }
  533.  
  534.         }
  535.  
  536.         var popupWindow = null;
  537.  
  538.         function centeredPopup(url,winName,w,h,scroll){
  539.  
  540.         LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  541.  
  542.         TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  543.  
  544.         settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  545.  
  546.         popupWindow = window.open(url,winName,settings)
  547.  
  548.     }
  549.  
  550.     // ]]></script>
  551.     <?php  }
  552.  
  553.     }
  554.  
  555. require_once ( 'theme_functions.php' );
  556.  
  557. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement