Exemple #1
0
    function output_dynamic_style()
    {
        $store_type = PixCustomifyPlugin::get_plugin_option('values_store_mod', 'option');
        if ($store_type === 'option') {
            $output = get_option('live_css_edit');
        } elseif ($store_type === 'theme_mod') {
            $output = get_theme_mod('live_css_edit');
        }
        if (empty($output)) {
            return;
        }
        ?>
		<style id="customify_css_editor_output">
			<?php 
        echo $output;
        ?>
		</style>
		<?php 
    }
 function get_default_values()
 {
     $to_return = array();
     if (isset($this->default) && is_array($this->default)) {
         //Handle special logic for when the $value array is not an associative array
         if (!PixCustomifyPlugin::is_assoc($this->default)) {
             //Let's determine some type of font
             if (!isset($this->default[2]) || isset($this->default[2]) && 'google' == $this->default[2]) {
                 if (isset(self::$google_fonts[$this->default[0]])) {
                     $to_return = self::$google_fonts[$this->default[0]];
                     $to_return['font_family'] = $this->default[0];
                     $to_return['type'] = 'google';
                 }
             } else {
                 $to_return['type'] = $this->default[2];
             }
             //The first entry is the font-family
             if (isset($this->default[0])) {
                 $to_return['font_family'] = $this->default[0];
             }
             //In case we don't have an associative array
             //The second entry is the variants
             if (isset($this->default[1])) {
                 $to_return['selected_variants'] = $this->default[1];
             }
         } else {
             if (isset($this->default['font_family'])) {
                 $to_return['font_family'] = $this->default['font_family'];
             }
             if (isset($this->default['selected_variants'])) {
                 $to_return['selected_variants'] = $this->default['selected_variants'];
             }
         }
     }
     // rare case when there is a standard font we need to get the custom variants if there are some
     if (!isset($to_return['variants']) && isset($to_return['font_family']) && isset(self::$std_fonts[$to_return['font_family']]) && isset(self::$std_fonts[$to_return['font_family']]['variants'])) {
         $to_return['variants'] = self::$std_fonts[$to_return['font_family']]['variants'];
     }
     return $to_return;
 }
Exemple #3
0
    define('EXT', '.php');
}
require 'core/bootstrap' . EXT;
$config = (include 'plugin-config' . EXT);
// set textdomain
pixcustomify::settextdomain($config['textdomain']);
// Ensure Test Data
// ----------------
$defaults = (include 'plugin-defaults' . EXT);
$current_data = get_option($config['settings-key']);
if ($current_data === false) {
    add_option($config['settings-key'], $defaults);
} else {
    if (count(array_diff_key($defaults, $current_data)) != 0) {
        $plugindata = array_merge($defaults, $current_data);
        update_option($config['settings-key'], $plugindata);
    }
}
# else: data is available; do nothing
// Load Callbacks
// --------------
$basepath = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$callbackpath = $basepath . 'callbacks' . DIRECTORY_SEPARATOR;
pixcustomify::require_all($callbackpath);
require_once plugin_dir_path(__FILE__) . 'class-pixcustomify.php';
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
register_activation_hook(__FILE__, array('PixCustomifyPlugin', 'activate'));
//register_deactivation_hook( __FILE__, array( 'customifyPlugin', 'deactivate' ) );
global $pixcustomify_plugin;
$pixcustomify_plugin = PixCustomifyPlugin::get_instance();
Exemple #4
0
 static function option($option, $default = null)
 {
     return PixCustomifyPlugin::get_option($option, $default = null);
 }
Exemple #5
0
 protected function load_google_fonts()
 {
     $fonts_path = plugin_dir_path(__FILE__) . 'features/customizer/controls/resources/google.fonts.php';
     if (file_exists($fonts_path)) {
         self::$google_fonts = (require $fonts_path);
     }
     if (!empty(self::$google_fonts)) {
         return self::$google_fonts;
     }
     return false;
 }