/** * Handle the display of smart layers via CSS. * * @since 1.0.0 */ function handle_smart_layers() { $css = '.addthis-smartlayers{display:none;}.dp-addthis .addthis-smartlayers{display:block;}'; $rules = dp_addthis_get_rules('smart_layers'); if (!empty($rules)) { $contexts = dp_addthis_get_contexts(); $tools = dp_addthis_get_tools(array('is_smartlayer' => true)); foreach ($rules as $rule) { if (!in_array($rule['context'], $contexts)) { continue; } $tool = $rule['tool']; if (!empty($tools[$tool]['selector'])) { $css .= $tools[$tool]['selector'] . '{display:block;}'; } } } echo "\n<!-- Smart Layers CSS by (dp) AddThis START -->"; echo "\n" . '<style type="text/css">' . $css . '</style>'; echo "\n<!-- Smart Layers CSS by (dp) AddThis END -->\n"; }
function section_smart_layers() { ?> <div class="items-container"> <script type="text/html" class="tmpl-item"> <?php $this->render_smart_layer('cloneindex'); ?> </script> <table class="rule-table widefat striped"> <thead> <tr> <th><?php _e('Tool', 'dp-addthis'); ?> </th> <th><?php _e('Context', 'dp-addthis'); ?> </th> <th></th> </tr> </thead> <tbody> <?php $rules = dp_addthis_get_rules('smart_layers'); if (!empty($rules)) { foreach ($rules as $index => $rule) { $this->render_smart_layer($index, $rule); } } ?> </tbody> </table> <p><button type="button" class="add-item button-primary"><?php _e('Add Display Rule', 'dp-addthis'); ?> </button></p> </div> <?php }