/** * * Function to create template options page * * @return null * **/ function dynamo_template_options() { // getting access to the template global object. global $dynamo_tpl; // check permissions if (!current_user_can('manage_options')) { wp_die(__('You don\'t have sufficient permissions to access this page!', DPTPLNAME)); } include_once dynamo_file('dynamo_framework/layouts/template.php'); }
if (get_post_format() != '') { ?> <div class="format dp-format-<?php echo get_post_format(); ?> "></div> <?php } ?> </div> <?php } ?> <?php include dynamo_file('layouts/content.post.featured.php'); dp_post_meta(); if (get_post_format() != 'link' && get_post_format() != 'quote' && get_post_format() != 'status' && $showtitle) { ?> <header> <h2> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('Permalink to %s', DPTPLNAME), the_title_attribute('echo=0')); ?> " rel="bookmark"> <?php the_title(); ?>
<?php // disable direct access to the file defined('DYNAMO_WP') or die('Access denied'); /** * * Main functions * * Functions used to creacte dashboard menus. * **/ // load file with Template Options page require_once dynamo_file('dynamo_framework/options.template.php'); // load file with Import/Export settings page require_once dynamo_file('dynamo_framework/options.importexport.php'); /** * * Function to add menu items in the admin panel * **/ if (!function_exists('dynamo_admin_menu')) { function dynamo_admin_menu() { // getting access to the template global object. global $dynamo_tpl; // set the default icon path $icon_path = dynamo_file_uri('images/back-end/small_logo.png'); // check if user set his own icon and then replace the default path if (get_option($dynamo_tpl->name . "_branding_admin_page_image") != '') { $icon_path = get_option($dynamo_tpl->name . "_branding_admin_page_image"); }
/** * * Function to load specific JSON file * * @param dir - the directory with JSON files * @param filename - name of the file to load - without ".json" extension * @param lang - if the directory supports multilanguage support * * @return JSON object from the loaded file * **/ public function get_json($dir, $filename, $lang = true) { // lang dir $lang = $lang ? $this->language . '/' : ''; if (defined('ICL_SITEPRESS_VERSION')) { $lang = apply_filters('dynamo-get-json', $dir, $lang); } if (is_dir(get_stylesheet_directory() . '/dynamo_framework/' . $dir . '/' . $lang)) { $path = dynamo_file('dynamo_framework/' . $dir . '/' . $lang . $filename . '.json'); } else { $path = dynamo_file('dynamo_framework/' . $dir . '/en_US/' . $filename . '.json'); } // check if the specified file exists if (file_exists($path)) { // decode data from the JSON file $json_data = json_decode(wp_remote_fopen($path)); // check for the older PHP versions if (function_exists('json_last_error')) { // get the errors switch (json_last_error()) { case JSON_ERROR_DEPTH: array_push($this->problems, 'JSON ERROR: Maximum stack depth exceeded in ' . $path); return array(); break; case JSON_ERROR_CTRL_CHAR: array_push($this->problems, 'JSON ERROR: Unexpected control character found in ' . $path); return array(); break; case JSON_ERROR_SYNTAX: array_push($this->problems, 'JSON ERROR: Syntax error, malformed JSON in ' . $path); return array(); break; case JSON_ERROR_NONE: // No errors return json_decode(file_get_contents($path)); break; } } else { return json_decode(file_get_contents($path)); } } else { // if the file doesn't exist - push the error array_push($this->problems, 'JSON ERROR: file ' . $path . ' doesn\'t exist'); return array(); } }
<?php // disable direct access to the file defined('DYNAMO_WP') or die('Access denied'); // access to the template object global $dynamo_tpl; // load the form parser include_once dynamo_file('dynamo_framework/form.parser.php'); // create a new instance of the form parser $parser = new DynamoWPFormParser($dynamo_tpl); // get the tabs list from the JSON file $tabs = $dynamo_tpl->get_json('options', 'tabs'); // iterators $tabsIterator = 0; $contentIterator = 0; // active tab $activeTab = 0; if (isset($_COOKIE[DPTPLNAME . '_active_tab']) && is_numeric($_COOKIE[DPTPLNAME . '_active_tab'])) { $activeTab = floor($_COOKIE[DPTPLNAME . '_active_tab']); } ?> <div class="dpWrap" id="dpMainWrap" data-theme="<?php echo DPTPLNAME; ?> "> <h1> <big><?php if (get_option($dynamo_tpl->name . "_branding_admin_page_template_name") != '') { echo get_option($dynamo_tpl->name . "_branding_admin_page_template_name"); } else {
/** * * Function used to load specific layout parts * * @return null * **/ function dp_load($part_name, $assets = null, $args = null) { $assets_output = ''; if ($assets !== null) { foreach ($assets as $key => $value) { if ($key == 'css') { $assets_output .= '<link rel="stylesheet" type="text/css" href="' . $value . '" />' . "\n"; } elseif ($key == 'js') { $assets_output .= '<script type="text/javascript" src="' . $value . '"></script>' . "\n"; } } } include dynamo_file('layouts/' . $part_name . '.php'); if ($part_name = 'header') { do_action('get_header', $part_name); } }
function dp_googlemap1($atts, $content = null) { extract(shortcode_atts(array('centertype' => 'address', 'address' => 'London', 'lat' => '51.507113', 'long' => '0', 'height' => '300', 'zoom' => '14', 'mapcontrol' => '', 'maptypecontrol' => '', 'pancontrol' => '', 'zoomcontrol' => '', 'streetviewcontrol' => '', 'mapstyle' => '', 'customtheme' => ''), $atts)); $js = $mapoutput = $options = $styles = ""; wp_register_script('google-map-api-js', 'http://maps.google.com/maps/api/js?sensor=false', array(), false); wp_enqueue_script('google-map-api-js'); wp_register_script('gmap3-js', get_template_directory_uri() . '/js/gmap3.min.js', array('jquery'), false); wp_enqueue_script('gmap3-js'); wp_register_script('richmarker-js', get_template_directory_uri() . '/js/richmarker.min.js', array('jquery'), false); wp_enqueue_script('richmarker-js'); $mapid = 'map-' . mt_rand(); if ($mapstyle != 'no' && $mapstyle != 'custom') { require_once dynamo_file('dynamo_framework/helpers/helpers.gmapstyles.php'); $styles = googlemapstyle($mapstyle); } if ($mapstyle == 'custom' && $customtheme != '') { $styles = 'styles: ' . rawurldecode(base64_decode(strip_tags($customtheme))) . ','; } $js = '<script type="text/javascript">'; $js .= 'jQuery(document).ready(function(){' . ''; $js .= 'jQuery("#' . $mapid . '").gmap3( { map:{'; if ($centertype == "address") { $js .= 'address:"' . $address . '",'; } $js .= 'options:{'; if ($centertype != "address") { $js .= 'center:[' . $lat . ', ' . $long . '],'; } $js .= ' zoom:' . $zoom . ','; if ($mapcontrol == 'N') { $js .= 'disableDefaultUI: true,'; } if (strtolower($maptypecontrol) == 'true') { $js .= 'mapTypeControl: false,'; } if (strtolower($pancontrol) == 'true') { $js .= 'panControl: false,'; } if (strtolower($zoomcontrol) == 'true') { $js .= 'zoomControl: false,'; } if (strtolower($streetviewcontrol) == 'true') { $js .= 'streetViewControl: false,'; } $js .= $styles; $js .= '} } } )'; $js .= '});'; $js .= '</script>'; $mapoutput = $js . '<div id="' . $mapid . '" class = "gmap" style="height:' . $height . 'px"></div>'; $toreplace = '[dp_googlemap_marker'; $replacement = '[dp_googlemap_marker parentid ="' . $mapid . '"'; $content = str_replace($toreplace, $replacement, $content); $mapoutput .= do_shortcode(strip_tags($content)); return $mapoutput; }
function dynamo_widget_rules() { global $dynamo_tpl; if (get_option($dynamo_tpl->name . '_widget_rules_state') == 'Y') { require_once dynamo_file('dynamo_framework/widget-rules.php'); } }
/** * * Function used to parse the JSON data * * @retunr HTML output * **/ private function output() { // prepare empty string for the output $prepared_data = ''; $standard_fields = array('Text', 'Select', 'RawText', 'Switcher', 'Textarea', 'Media', 'WidthHeight', 'Menu', 'TextBlock', 'Color', 'Background', 'Taxonomy', 'HTML', 'Slider', 'Save'); // parse groups foreach ($this->loaded_data as $group) { // $prepared_data .= '<fieldset><legend>' . $group->groupname . '</legend>'; $prepared_data .= '<p><small>' . $group->groupdesc . '</small></p>'; foreach ($group->fields as $field) { if (in_array($field->type, $standard_fields)) { $className = 'DPFormInput' . $field->type; $output = new $className($this->tpl, isset($field->name) ? $field->name : null, isset($field->label) ? $field->label : null, isset($field->tooltip) ? $field->tooltip : null, isset($field->default) ? $field->default : null, isset($field->class) ? $field->class : null, isset($field->format) ? $field->format : null, isset($field->required) ? $field->required : null, isset($field->visibility) ? $field->visibility : null, isset($field->other) ? $field->other : null); $prepared_data .= $output->output(); } else { // load field config $file_config = $this->tpl->get_json('form_elements/' . $field->type, 'config', false); // check if the file is correct if (is_array($file_config) && count($file_config) > 0 || is_object($file_config)) { // load these files only once time if (!class_exists($file_config->class)) { // load the main PHP class include_once dynamo_file('dynamo_framework/form_elements/') . $field->type . '/' . $file_config->php; } // create the object if (class_exists($file_config->class)) { $className = $file_config->class; $output = new $className($this->tpl, isset($field->name) ? $field->name : null, isset($field->label) ? $field->label : null, isset($field->tooltip) ? $field->tooltip : null, isset($field->default) ? $field->default : null, isset($field->class) ? $field->class : null, isset($field->format) ? $field->format : null, isset($field->required) ? $field->required : null, isset($field->visibility) ? $field->visibility : null, isset($field->other) ? $field->other : null); $prepared_data .= $output->output(); } } else { array_push($this->tpl->problems, 'JSON ERROR: config file for the element ' . $field->type . ' doesn\'t exist or is incorrect'); } } } $prepared_data .= '</fieldset>'; } // return the created output return $prepared_data; }