Ejemplo n.º 1
0
<?php

$plugin_opts = ylc_get_plugin_options();
?>

<div id="YLC"></div>
<script type="text/javascript">

    (function ($) {

        $(document).ready(function () {

            $( '#YLC' ).ylc(
                {
                    <?php 
ylc_print_plugin_options($plugin_opts);
?>
                },
                {
                    <?php 
apply_filters('ylc_js_premium', '');
?>
                }
            );

        });

    } (window.jQuery || window.Zepto));

</script>
Ejemplo n.º 2
0
 /**
  * Print plugin options
  *
  * @since   1.0.0
  * @param   $options
  * @param   $property
  * @return  array
  * @author  Alberto ruggiero
  */
 function ylc_print_plugin_options($options, $property = null)
 {
     $total_opts = count($options);
     if ($property) {
         echo $property . ": {\n\t\t\t\t";
     }
     $i = 1;
     foreach ($options as $option_key => $option_value) {
         $comma = $i < $total_opts ? ",\n\t\t\t" : "\n";
         if (!is_array($option_value) or !empty($option_value['_FUNC_'])) {
             // Print single line option
             if (is_array($option_value) and !empty($option_value['_FUNC_'])) {
                 // It is a callback / function?
                 $val = $option_value['_FUNC_'];
             } else {
                 $val = (is_int($option_value) or is_numeric($option_value)) ? $option_value : "'{$option_value}'";
                 // Sanitize value
             }
             echo $option_key . ': ' . $val . $comma;
             // Print option
         } else {
             // Print array option
             ylc_print_plugin_options($option_value, $option_key);
         }
         $i++;
     }
     if ($property) {
         echo "},\n\t\t\t";
     }
 }
Ejemplo n.º 3
0
 /**
  * Print plugin options
  *
  * @since   1.0.0
  *
  * @param   $options
  * @param   $property
  *
  * @return  array
  * @author  Alberto ruggiero
  */
 function ylc_print_plugin_options($options, $property = null)
 {
     $total_opts = count($options);
     if ($property) {
         echo $property . ": {\n\t\t\t\t";
     }
     $i = 1;
     foreach ($options as $option_key => $option_value) {
         $comma = $i < $total_opts ? ",\n\t\t\t" : "\n";
         if (!is_array($option_value)) {
             // Print single line option
             $val = is_int($option_value) || is_numeric($option_value) ? $option_value : "'{$option_value}'";
             // Sanitize value
             echo $option_key . ': ' . $val . $comma;
             // Print option
         } else {
             // Print array option
             ylc_print_plugin_options($option_value, $option_key);
         }
         $i++;
     }
     if ($property) {
         echo "},\n\t\t\t";
     }
 }