articlesss.com. Attention! If you deactivate the plugin its settings will be removed from the database.', 'article-directory'); return $string; } add_filter('pre_kses', 'artdir_plugin_description'); function artdir_default_options() { $def_options['exclude_cats'] = 0; $def_options['show_parent_count'] = 1; $def_options['show_child_count'] = 1; $def_options['hide_empty'] = 0; $def_options['desc_for_parent_title'] = 1; $def_options['desc_for_child_title'] = 1; $def_options['child_hierarchical'] = 1; $def_options['column_count'] = 3; $def_options['sort_by'] = 0; $def_options['sort_direction'] = 0; $def_options['no_child_alert'] = 1; $def_options['show_child'] = 1; $def_options['maximum_child'] = 0; $def_options['author_interface'] = 0; $def_options['author_panel_id'] = ''; $def_options['article_status'] = 0; $def_options['minimum_symbols'] = 700; $def_options['maximum_links'] = 3; $def_options['show_editor'] = 1; $def_options['default_editor'] = 'html'; $def_options['sel_only_one_cat'] = 1; $def_options['show_tags'] = 0; $def_options['allow_new_tags'] = 0; $def_options['publish_terms_text'] = ''; $def_options['kinderloss'] = 1; $def_options['show_article_code'] = 0; return $def_options; } function artdir_validate($input) { $def_options = artdir_default_options(); $input['exclude_cats'] = (preg_match("/^(\d+,)*\d+$/", $input['exclude_cats']) ? $input['exclude_cats'] : $def_options['exclude_cats']); $input['show_parent_count'] = ($input['show_parent_count'] == 1 ? 1 : 0); $input['show_child_count'] = ($input['show_child_count'] == 1 ? 1 : 0); $input['hide_empty'] = ($input['hide_empty'] == 1 ? 1 : 0); $input['desc_for_parent_title'] = ($input['desc_for_parent_title'] == 1 ? 1 : 0); $input['desc_for_child_title'] = ($input['desc_for_child_title'] == 1 ? 1 : 0); $input['child_hierarchical'] = ($input['child_hierarchical'] == 1 ? 1 : 0); $input['column_count'] = (is_numeric($input['column_count']) && $input['column_count'] > 0 ? $input['column_count'] : $def_options['column_count']); $input['sort_by'] = ($input['sort_by'] == 1 ? 1 : 0); $input['sort_direction'] = ($input['sort_direction'] == 1 ? 1 : 0); $input['no_child_alert'] = ($input['no_child_alert'] == 1 ? 1 : 0); $input['show_child'] = ($input['show_child'] == 1 ? 1 : 0); $input['maximum_child'] = (is_numeric($input['maximum_child']) && $input['maximum_child'] > 0 ? $input['maximum_child'] : $def_options['maximum_child']); $input['author_interface'] = ($input['author_interface'] == 1 ? 1 : 0); $input['author_panel_id'] = (!empty($input['author_panel_id']) && $input['author_panel_id'] > 0 && is_numeric($input['author_panel_id']) ? $input['author_panel_id'] : ''); $input['article_status'] = ($input['article_status'] == 1 ? 1 : 0); $input['minimum_symbols'] = (!empty($input['minimum_symbols']) && $input['minimum_symbols'] > 0 && is_numeric($input['minimum_symbols']) ? $input['minimum_symbols'] : $def_options['minimum_symbols']); $input['maximum_links'] = (!empty($input['maximum_links']) && $input['maximum_links'] >= 0 && is_numeric($input['maximum_links']) ? $input['maximum_links'] : $def_options['maximum_links']); $input['show_editor'] = ($input['show_editor'] == 1 ? 1 : 0); $input['default_editor'] = ($input['default_editor'] == 'tinymce' ? 'tinymce' : $def_options['default_editor']); $input['sel_only_one_cat'] = ($input['sel_only_one_cat'] == 1 ? 1 : 0); $input['show_tags'] = ($input['show_tags'] == 1 ? 1 : 0); $input['allow_new_tags'] = ($input['allow_new_tags'] == 1 ? 1 : 0); $input['publish_terms_text'] = (!empty($input['publish_terms_text']) ? $input['publish_terms_text'] : ''); $input['kinderloss'] = ($input['kinderloss'] == 1 ? 1 : 0); $input['show_article_code'] = ($input['show_article_code'] == 1 ? 1 : 0); if (isset($_POST['artdirReset'])) { $input = artdir_default_options(); } return $input; } function artdir_uninstall() { delete_option('article_directory'); } register_deactivation_hook( __FILE__, 'artdir_uninstall'); function article_directory($echo = TRUE) { $options = get_option('article_directory'); $exclude_cat = array($options['exclude_cats']); $show_parent_count = $options['show_parent_count']; $show_child_count = $options['show_child_count']; $hide_empty = $options['hide_empty']; $desc_for_parent_title = $options['desc_for_parent_title']; $desc_for_child_title = $options['desc_for_child_title']; $child_hierarchical = $options['child_hierarchical']; $column_count = $options['column_count']; $sort_by = $options['sort_by']; $sort_direction = $options['sort_direction']; $no_child_alert = $options['no_child_alert']; $show_child = $options['show_child']; $maximum_child = $options['maximum_child']; global $wpdb; $cal_tree = array(); if (!$column_count) $column_count = 1; global $rssfeeds; $feed = ''; if ($rssfeeds) { $feed = 'RSS'; $show_parent_count = 0; $show_child_count = 0; } if ($sort_by == 0) $order_by = $orderby = 'name'; elseif ($sort_by == 1) { $order_by = 'term_order'; $orderby = 'term_group'; } $parent_cats = $wpdb->get_results("SELECT * FROM " . $wpdb->term_taxonomy . " term_taxonomy LEFT JOIN " . $wpdb->terms . " terms ON terms.term_id = term_taxonomy.term_id WHERE term_taxonomy.taxonomy = 'category' AND term_taxonomy.parent = 0 " . ( count($exclude_cat) ? ' AND terms.term_id NOT IN (' . implode(',', $exclude_cat) . ') ' : '' ) . " ORDER BY terms." . $order_by); foreach ($parent_cats as $parent) { $summ = "SELECT SUM(count) FROM " . $wpdb->term_taxonomy . " WHERE taxonomy = 'category' AND parent = " . $parent->term_id; $child_summ = mysql_result(mysql_query($summ),0); //считаем кол-во статей в подрубрике 1-го уровня $catid = $wpdb->get_var("SELECT term_ID FROM " . $wpdb->term_taxonomy . " WHERE taxonomy = 'category' AND parent = " . $parent->term_id); //определяем ID подрубрики 1-го уровня $sub_child_summ = (int)$catid ? $wpdb->get_var("SELECT SUM(count) FROM " . $wpdb->term_taxonomy . " WHERE taxonomy = 'category' AND parent = " . $catid) : 0; //считаем кол-во статей в подрубрике 2-го уровня $cat_name = get_the_category_by_ID($parent->term_id); $descr = sprintf(__("View all posts filed under %s"), $cat_name); if ($desc_for_parent_title == 1) { if (empty($parent->description)) { $descr = $descr; } else { $descr = $parent->description; } } $child_summ += $parent->count; //прибавляем к сумме родительской рубрики сумму в подрубрике 1-го уровня $child_summ += $sub_child_summ; //прибавляем к сумме родительской рубрики сумму в подрубрике 2-го уровня if ($show_parent_count == 1) { $parent_count = ' (' . $child_summ . ')'; } else { $parent_count = ''; } $cal_tree[] = array( 'cat' => array( 'href' => get_category_link($parent->term_id), 'title' => $descr, 'name' => $cat_name, 'count' => $parent_count ), 'cats'=> wp_list_categories( ( count($exclude_cat) ? 'exclude=' . implode(',', $exclude_cat) : '' ) . '&orderby=' . $orderby . '&show_count=' . $show_child_count . '&hide_empty=' . $hide_empty . '&use_desc_for_title=' . $desc_for_child_title . '&child_of=' . $parent->term_id . '&title_li=&hierarchical=' . $child_hierarchical . '&echo=0&feed=' . $feed) ); } $_tree = array(); $count = count($cal_tree); if ($sort_direction) { $line_count = ceil( $count / $column_count ); $limit = $count - $line_count * $column_count % $count; for ($i = 0; $i < $count; $i++) { $index = floor($i / $line_count) + ($limit && $i > $limit ? 1 : 0); if (!isset($_tree[$index])) { $_tree[$index] = array(); } $_tree[$index][] = &$cal_tree[$i]; } } else { for ($i = 0; $i < $count; $i++) { $index = $i % $column_count; if (!isset($_tree[$index])) { $_tree[$index] = array(); } $_tree[$index][] = &$cal_tree[$i]; } } if (count($_tree)) { $write = '
'; for ($j = 0, $count = count($_tree); $j < $count; $j++) { // вывод столбца $write .= ' ' . "\r\n"; } $write .= '
' . "\r\n"; if ( $echo == true ) echo $write; else return $write; } } function artdir_options_page() { add_options_page('Article Directory', 'Article Directory', 8, __FILE__, 'artdir_options'); if (!get_option("article_directory")) { $options = artdir_default_options(); add_option("article_directory", $options) ; } } add_action('admin_menu', 'artdir_options_page'); function artdir_options() { $options = get_option('article_directory'); $error = false; if ( empty($options['author_panel_id']) && $options['author_interface'] == '0' ) { echo '

' . __('Attention', 'article-directory') . '! ' . __('The option "ID of author panel page" must be filled obligatory. Otherwise, the authors are unable to add articles.', 'article-directory') . '

'; } if ( empty($options['author_panel_id']) ) { $error = ' style="border: 1px solid #C00; background: #FFEBE8;"'; } ?>



(!) article_directory() function).', 'article-directory'); ?>
My Category Order plugin.', 'article-directory'); ?>
 
0 - all child categories will be displayed. If the number other than zero, level 3 child categories not shown.
Specify 99, if you not want to show subcategories of 3rd and above level.', 'article-directory'); ?>
 
1,3,7. 0 - all categories will be displayed.', 'article-directory'); ?>

name="article_directory[author_panel_id]" type="text" id="author_panel_id" value="" size="5" maxlength="6" /> Mandatory option. More about it read in the instructions for installing the plugin.', 'article-directory'); ?> How to find this ID.', 'article-directory'); ?>
<p>, <ul>, <strong>, <a>. Leave this field blank, if you don\'t want to show the terms.', 'article-directory'); ?>





© 2008- Dimox | Article Directory |

query_vars['cat'] . '\') AND post_type = \'post\' AND post_status = \'publish\'', $where); } return $where; } add_filter('posts_where', 'kinderloss_where'); } if ($options['author_interface'] == 0) { function artdir_restrict_admin_area() { if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin')) { if (!current_user_can('level_7')) { $options = get_option('article_directory'); require_once( ABSPATH . WPINC . '/pluggable.php'); if ( is_user_logged_in() ) { wp_redirect(get_permalink($options['author_panel_id'])); ?> <?php _e('WordPress › Error'); ?>

set it up.', 'article-directory') ?>

»

(function($) { $(function() { $("#getArticleCode").css({opacity: 0}).hide(); $("#getArticleSource").toggle( function() { $("#getArticleCode").animate({opacity: 1}, 300).show(); return false; }, function() { $("#getArticleCode").animate({opacity: 0}).hide(); return false; } ); $("#htmlVersion").text("

' . get_the_title() . '

" + "\r\n" + $("#artdirPost").html() + "

' . __('Source') . ': ' . get_permalink() . '

"); $("#textVersion").text("' . get_the_title() . '" + "\r\n\r\n" + $("#artdirPost").text() + "\r\n" + "' . __('Source') . ': ' . get_permalink() . '"); $("#getArticleCode textarea, #getArticleCode input").click(function() { $(this).select() }); }) })(jQuery)

'.__('Article Source', 'article-directory').'

'; if (is_single()) { return '
' . $text . '
' . $get_article_code; } else { return $text; } } add_filter('the_content', 'artdir_get_article_code'); if (is_single()) { add_action('wp_head', 'artdir_jquery', 8); } } function article_directory_author_panel() { include(ABSPATH . 'wp-content/plugins/article-directory/author-panel.php'); } function article_directory_authorization_form() { if (!current_user_can('level_0')) { ?>

|