Пример #1
0
         wp_enqueue_script('thickbox');
         wp_register_script('PHP_Snippet_Widget', PHP_SNIPPETS_URL . '/js/widget.js', array('jquery'));
         wp_enqueue_script('PHP_Snippet_Widget');
     }
 }
 // TODO
 //load_plugin_textdomain( 'php_snippets', false, PHP_SNIPPETS_PATH.'/lang/' );
 global $shortcode_tags;
 $existing_shortcodes = array_keys($shortcode_tags);
 // Load up data
 $ps_data = get_option(Phpsnippets\Base::db_key, array());
 $defined_dirs = Phpsnippets\Base::get_value($ps_data, 'snippet_dirs', array());
 $ext = Phpsnippets\Base::get_value($ps_data, 'snippet_suffix', '.php');
 $include_built_in = Phpsnippets\Base::get_value($ps_data, 'show_builtin_snippets', true);
 // Set any placeholders we want to support in directory names
 Phpsnippets\Base::set_placeholder('ABSPATH', ABSPATH);
 // Get all snippets in all dirs
 $dirs = Phpsnippets\Base::get_dirs($defined_dirs, $include_built_in);
 PhpSnippets\Widget::setDirs($dirs);
 PhpSnippets\Widget::setExt($ext);
 // Loop thru each dir
 foreach ($dirs as $d => $d_exists) {
     $snippets = (array) Phpsnippets\Base::get_snippets($d, $ext);
     // Loop thru each file
     foreach ($snippets as $s) {
         Phpsnippets\Base::add_shortcode($s, $ext);
     }
 }
 // Register Ajax Calls
 Phpsnippets\Ajax::$controllers['dir_snippets'] = PHP_SNIPPETS_PATH . '/ajax-controllers/dir_snippets.php';
 Phpsnippets\Ajax::$controllers['get_snippet_shortcode'] = PHP_SNIPPETS_PATH . '/ajax-controllers/get_snippet_shortcode.php';